unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* el-search usage (doc, strings, pcase, etc.)
@ 2018-10-27 14:48 Garreau, Alexandre
  2018-10-27 15:43 ` Michael Heerdegen
  2018-10-27 15:55 ` Michael Heerdegen
  0 siblings, 2 replies; 12+ messages in thread
From: Garreau, Alexandre @ 2018-10-27 14:48 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

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>”).



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-10-28 23:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-27 14:48 el-search usage (doc, strings, pcase, etc.) Garreau, Alexandre
2018-10-27 15:43 ` Michael Heerdegen
2018-10-27 16:37   ` Garreau, Alexandre
2018-10-27 20:19     ` Michael Heerdegen
2018-10-27 22:30       ` Garreau, Alexandre
2018-10-28  0:01         ` Michael Heerdegen
2018-10-28  1:11           ` Michael Heerdegen
2018-10-28  1:55           ` Garreau, Alexandre
2018-10-28 22:26             ` Michael Heerdegen
2018-10-28 22:59               ` Garreau, Alexandre
2018-10-28 23:39                 ` Michael Heerdegen
2018-10-27 15:55 ` Michael Heerdegen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).