embark icon indicating copy to clipboard operation
embark copied to clipboard

Prefixes don't get passed to embark export commands

Open jdtsmith opened this issue 4 years ago • 4 comments

Prefixes to export don't seem to get passed on to the exported command. For example, I regularly use (with isearch/occur) M-s . M-5 M-s o to get 5 lines of context in an occur buffer. When exporting from consult-line etc. to an occur buffer, I had hoped a M-5 C-, E would accomplish the same thing, but the prefix arg info doesn't seem to make it through.

jdtsmith avatar Aug 08 '21 00:08 jdtsmith

Unfortunately, it's not just a matter of supplying the prefix argument to the export function: the functionality of that prefix needs to be implemented too. I do think it is a good idea to do this for the occur exporter.

Note that exporting from consult-line does not actually run occur. That couldn't work because occur does something different: it looks for matches of a regexp; consult-line, on the other hand, chooses lines that match according to the completion system. For example, in my configuration I use orderless and something like !ab cd matches lines containing cd but not containing ab; that's not so easy to do with a call to occur, and definitely calling occur with regexp !ab cd does something very different.

oantolin avatar Aug 08 '21 01:08 oantolin

(For the record you can match lines with cd but no ab with a call to occur, using this regexp:

\(?:\(?:\(\`\)\(?:[^a]\|\'\|a\(?:[^b]\|\'\)\)*\'\)\)\(?:cd\)\(?:\(?:\(\`\)\(?:[^a]\|\'\|a\(?:[^b]\|\'\)\)*\'\)\)

But you can probably see why I prefer consult-line + orderless.)

oantolin avatar Aug 08 '21 01:08 oantolin

Makes sense. Perhaps a more general scheme for adding "surrounding context lines on export" for every export that targets occur is warranted then. About the negative matching, I was surprised the work that orderless-without-literal has to do! For the want of negative lookahead assertions...

jdtsmith avatar Aug 08 '21 03:08 jdtsmith

It should be possible to add this to the exporter - take n lines before the consult-location marker and n lines after. It would be valuable to have this.

minad avatar Aug 08 '21 07:08 minad