help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

el-search usage (doc, strings, pcase, etc.)


From: Garreau, Alexandre
Subject: el-search usage (doc, strings, pcase, etc.)
Date: Sat, 27 Oct 2018 16:48:12 +0200
User-agent: Gnus (5.13), GNU Emacs 25.1.1 (i686-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian

On 2018/10/17 at 17:42, Michael Heerdegen wrote:
> "Garreau, Alexandre" <galex-713@galex-713.eu> writes:
>>> Also, package `el-search.el' has similar possibilities (and many other
>>> good things).
>>
>> Wow it seems cool, I’ll try it out when I’ve got time if I remember to.
>> I’ve dreamt of it I think.
>
> If you happen to try it, I'm curious for your feedback, especially if
> you find bugs, something doesn't work as expected, the documentation
> isn't helpful enough, etc.

Other packages have an info file: maybe writing the doc in texinfo and
then exporting to org-mode (or the other way around: writing in org-mode
and exporting to texinfo), could be useful so to get an info
documentation accessible with C-h i.  I have the general habit of
searching with C-h i and docstrings only, but when a package is not
reified around an unique “main” command, usually its package name, so
its docstring can serves both as a mini reference and tutorial for
introducing the package (maybe it would be the case of el-search for
`el-search-pattern'? but then it would better be rather named
`el-search', and its docstring should be more detailed, otherwise it
requires guessing `el-search-pattern' is the main interface, or rather
using the manual for discovering so, which may cause great confusion to
the lazy user).  When a package doesn’t have this, for instance an
addition to a mode, or several modes, or a language feature (“gnorb”,
emms, eieio, etc.).

Btw I really liked what I did read at some point about if you search for
27, it will not match for text or comments (yet I barely need to search
for numbers usually): that makes it look pretty semantic (does it uses
`read', `eval' or something?).

In my memories it was confused, so I was going to try doing the
opposite: searching a string being or containing “was” (or “was:”) in
gnus’ source (/usr/share/emacs/25.1/lisp/gnus/), avoiding comments and
symbols, so to find the function removing exagerated “(was: old
subject)” in subject lines when replying.  But I found nothing relevant
being it, and many docstring contain it :/

I tried “(and (pred stringp) s (guard (string-match "\<was\>:" s)))”,
however that is long to type, so I found very very unfortunate el-search
doesn’t seem to maintain a prompt history (why so? it is easy, just a
symbol, so to put a list there).  However it probably call for a pcase
macro such as “(pcase-defmacro contain (match-string) `(and (pred
stringp) string (guard (string-match ,match-string string))))”, but the
problem is then it highlights the whole string, instead of the matched
part (while this should be easily usable since this macro actually
returns position of match (and match-end its end)), and
el-search-defpattern doesn’t seem to offer a way to do so (match for a
subpattern according its context, or maybe I’m not enough educated of
pcase complex mecanics).

As the search usage (keystrokes, etc.) seem to be quite different than
from isearch (it seems to highlight it specially but doesn’t rebind
special keystrokes (moving exit it (and scrolling commands such as SPC
or <backspace> do exit it too) and I don’t know how to go to next
occurence (maybe I should learn how to use occur so to know how to use
it?))), I’m a bit lost.  I’m used to be able not to bind keystrokes for
command I’m not yet a regular user of (otherwise I just bind the key and
forget it, so I end loosing keybindings for thing I’d actually need),
but it seems el-search enforces the opposite of that, since to continue
a search I *need* to repetedly run the command (which gives a lot of
“M-x <up> <return>”).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]