vfclists

joined 11 months ago
[–] vfclists@alien.top 1 points 10 months ago

CleverπŸ™‚, but doesn't generalize to other documents.

Is there a command to select a range of characters on a line and extend it as a column to the end of the buffer or narrowed region without scrolling down to mark the actual area?

[–] vfclists@alien.top 1 points 10 months ago (1 children)

The command is specific to the packages list.

It won't work with regular sniper.

[–] vfclists@alien.top 1 points 10 months ago

I didn't know that narrowing could also apply to columns, but narrowing to a rectangular selection means scrolling to the bottom of the listing, which is why I prefer to search in the first place.

 

When I do package-list-packages and I'm searching for a package, the search is not restricted to the package names, but searches the descriptions as well, and this requires scrolling down before starting the search.

Can the search be restricted to the column with the names?

 

Helm-mini enables acting on the file list by using Ctrl-Space to pick those required, though I don't know if that is the only action to be done on the selection.

Is that behaviour unique to helm's completing read implementation, or do other such functions exist?

I need to create an SQL command from a selection from a long list of databases and need something that can pick them individually with highlighting, so once I press Enter, the selection is passed to a function.

The default completing-read-multiple of typing a match and adding a comma is not suitable for this.

UPDATE

After some more searching I've come across this Embark discussion which may help me in what I need. I just need that kind of functionality in a completing-read command, basically something which lets me mark a list of items from a list and apply some arbitrary action to them.

[–] vfclists@alien.top 1 points 10 months ago

I'm trying it and get can't the action menu.

Is this in a new version of helm-projectile-ag?

[–] vfclists@alien.top 1 points 10 months ago

If you want a multithreading Emacs contribute to https://github.com/lem-project/lem. That will probably get you there faster than with Emacs.

Truth is it isn't Emacs that you want, but the features it has. Just replicate them in Lem.

[–] vfclists@alien.top 1 points 10 months ago (1 children)

Please use the four spaces indentation method of formatting code not the triple backtick.

It doesn't look right in the old reddit style format which is better for code.

where is /u/backtickbot when you need it?

 

I'm looking for a way to preview the results of a grep search within files as well as fold the output when there are multiple matches in the same file.

helm-projectile-ag is my current grepping tool but doesn't seem to offer such a facility, unless I haven't read the docs well enough.

My issues are:

  1. It can present a lot of hits in the same file it but lists each one separately. A good option would be to fold the output when there are multiple matches, then I can use the Tab keep to expand the fold and scan through the previews and even edit them right away.

  2. The search panel is modal. It doesn't create a result buffer which you can save and then return to later to continue to select files to edit. Once you lose focus it is gone. It doesn't even seem to retain the search term so you can use it later.

  3. It would be nice to have a window that shows the actual CLI command passed to the search utility. I see them once in a while but it would be good to show them up front or make them easily accessible.

Do any of the project grep tools or helm-projectile-ag itself offer such features?

 

By forward function declarations I mean what is needed when a function defined later in the file is called from a preceding one.

By circular I mean file A requires a function in file B which requires a function in file A. Something along those lines

PS. Apologies for inquiring about this again. I am sure I enquired sometime in the past and forgotten the actual question and the response to it.

 

I have this type of code in my init.el each loads the features in a directly and it turns out that because the file names contained the - character they were not being loaded, as the regex checks for only alphanumeric filenames which are not hidden.

(let ((default-directory (expand-file-name "wsi/lisp" user-emacs-directory)))
  (normal-top-level-add-to-load-path (directory-files default-directory nil "[^\\.][a-z0-9]*")))

By the way I copied this from someone's init.el and I've suffered from it for ages, an object lesson on how one should not copy init.el files and other Emacs lisp code without fully understanding the code in them.

I'm not sure but it looks like the regex will not even match file names with capitals in them.

I guess the question I want to ask is how to add arbitrary non-alphabetical characters to a regex matching alphanumeric characters, with the proviso that they are acceptable in file names..

 

Switch buffer in Doom and swiper-all display the selected files as you scroll through the matching files until you select or cancel one.

I use ivy-switch-buffer and its helm counterpart in my vanilla emacs configuration.

Is there some way to get these functions to the same as Doom or swiper-all?

[–] vfclists@alien.top 1 points 11 months ago

I made some progress, with read-from-minibuffer the function I need, however I want to terminate the script and suppress the error information at the end.

─○ cat text1.txt | emacs -batch --eval "(while t (princ (read-from-minibuffer \"\") (terpri)))"

Here is some text
Will it be tripled?

Here is some text
Will it be tripled?

Here is some text
Will it be tripled?
Debugger entered--Lisp error: (end-of-file "Error reading from stdin")
  read-from-minibuffer("")
  (princ (read-from-minibuffer "") (terpri))
  (while t (princ (read-from-minibuffer "") (terpri)))
  eval((while t (princ (read-from-minibuffer "") (terpri))) t)
  command-line-1(("--eval" "(while t (princ (read-from-minibuffer \"\") (terpri)..."))
  command-line()
  normal-top-level()
 

I want to write a script to process the contents of a text file line by line, and came across this example on Emacs wiki - https://www.emacswiki.org/emacs/BatchMode

emacs --batch --eval "(while t (print (eval (read))))"

So I adjusted it to emacs --batch --eval "(while t (print (read)))" and the prompt Lisp expression: is always displayed.

─○ emacs --batch --eval "(while t (print (read)))" 
Lisp expression: fdfdfds

fdfdfds
Lisp expression: dsfdsfdfds

Lisp expression: ^C%              

When I try a command like cat text1.txt | emacs --batch --eval "(while t (print (read)))" it barfs completely, so read is definitely not the function for this, unless I'm failing to pass some necessary options to it.

[–] vfclists@alien.top 1 points 11 months ago

This sounds exactly like what I'm looking for. I will check it out.

 

When you search for a string like \(a\)xxx\(b\)yy\(c\) is there some way to create a replacement string where each group can be replaced separately?

If that is not possible the only way I see round it will be to replace better off replacing the whole line with a string splicing the replacements where the groups are.

[–] vfclists@alien.top 1 points 11 months ago

Here is the solution for my .zsh_history example:

I first created a small function for the unix time string. More of the functionality in the replacement string can be included if preferred.

    (defun rgx-get-time-string (unixtimestr)
     (format-time-string "%Y-%m-%d %H:%M" (string-to-number unixtimestr))
      )

The search string: \(: \)\([0-9]\{10\}\)\(:0;\)

The replacement string: \,(concat (format "%6d " (line-number-at-pos)) (rgx-get-time-string (match-string 2)) " "))

(match-string 2) is an alternative for the back reference for the second string matched\2

[–] vfclists@alien.top 1 points 11 months ago

And how is this a meaningful answer to the question?

Is there some rule that questions asked here shouldn't be asked on stackexchange too?

 

I want to convert the timestamps in a .zsh_history file to their readable equivalents.

Is there some search and replace I can do in emacs that will replace the time with something like (format-time-string unixtime)?

: 1568128379:0;cp -a ~/.zshrc.pre-oh-my-zsh ~/.zshrc
: 1568128381:0;exit