zsh-users
 help / color / mirror / code / Atom feed
* Searching zshall man page in emacs
@ 2019-10-19 22:36 Perry Smith
  0 siblings, 0 replies; only message in thread
From: Perry Smith @ 2019-10-19 22:36 UTC (permalink / raw)
  To: zsh-users

On Catalina, M-x man zshall returns a buffer but it has been narrowed
to the first zsh page.  So, C-x n w needs to be done so you can search
all of the text.

On Catalina, the descriptions such as compadd or what does %D do or
what does -a do in a conditional are all indented seven spaces.

So, to help speed up finding these items, I wrote some emacs code.
Its damn awkward to navigate but it uses the standard ways of doing
things.

(defun zsh-manpage-search-regexp (string &optional lax)
  "Returns a string to search for entries in the zshall man page"
  (format "\n[A-Z ]*\n \\{7\\}%s%s" string (if lax "" "\\_>")))

(isearch-define-mode-toggle zsh-manpage "z" zsh-manpage-search-regexp "\
Searching zshall man page for where a concept is described")

I'm using emacs 27 (a nightly build) but I believe all this will work
in emacs 26 as well.

The least painful method of using is to first do man of zshall as
usual.  widen the region.  I would also turn case folding off.  Then
start your search with the usual C-s.  It seems least painful to type
out the whole word but your mileage may vary.

Then shift into "zsh-manpage" mode by typing M-s z and then another
C-s will bring you to the first hit.  There are usually only one or
two hits.  You are still in isearch mode so all the twelve billion
special bindings in that mode are still in effect.  This is basically
just like dropping into "word mode" or "symbol mode" -- think of it as
"search zshall man page mode" :-)  And there is nothing restricting
this to just the zshall man page but I have no idea if the pattern
will work in other man pages.

A trailing \_> is added to force a word boundary so if you are looking
for "function" you don't find "functions".  This can be "relaxed" (to
use their term) by typing M-s SPC although that UI seems a bit hostile
to me...  With the distribution I'm running, it looks like you need to
start back over with the search to get that to work.

So now I can find where _approximate is described with only about ten
seconds of finger gymnastics.

Enjoy
pedz


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-19 22:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-19 22:36 Searching zshall man page in emacs Perry Smith

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).