* Problem with search-forward in *Help* buffers
@ 2022-11-26 4:08 Eduardo Ochs
2022-11-26 5:03 ` Emanuel Berg
0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Ochs @ 2022-11-26 4:08 UTC (permalink / raw)
To: help-gnu-emacs
Hi list,
consider these two defuns, and the four tests after them:
;; This is a simplified version of:
;; (find-efunction 'ee-goto-position)
;; http://angg.twu.net/eev-current/eev-blinks.el.html#ee-goto-position
(defun ee-goto-position-mini (&optional str &rest strs)
(when str
(goto-char (point-min))
(search-forward str)
(dolist (s strs)
(search-forward s))))
;; This is a simplified version of:
;; (find-efunction 'find-dbsw-call)
;; http://angg.twu.net/eev-current/eev-blinks.el.html#find-dbsw
(defun find-dbsw-call-mini (sexp &rest pos-spec-list)
(let ((display-buffer-overriding-action '(display-buffer-same-window)))
(eval sexp))
(apply 'ee-goto-position-mini pos-spec-list))
(find-dbsw-call-mini '(customize-group 'editing) "Parent")
(find-dbsw-call-mini '(describe-function 'next-line) "line-move-visual")
(find-dbsw-call-mini '(list-input-methods) "TeX")
(find-dbsw-call-mini '(describe-input-method 'TeX) "\\bullet")
The first call to `find-dbsw-call-mini' works as I expected: it runs
(customize-group 'editing)
and searches for the first occurrence of the string "Parent" in it.
But in the other ones the search doesn't work - after the
(find-dbsw-call-mini ...) is run the point is elsewhere. What is
happening here? And do you have any suggestions of how to fix that?
Thanks in advance!
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problem with search-forward in *Help* buffers
2022-11-26 4:08 Problem with search-forward in *Help* buffers Eduardo Ochs
@ 2022-11-26 5:03 ` Emanuel Berg
0 siblings, 0 replies; 2+ messages in thread
From: Emanuel Berg @ 2022-11-26 5:03 UTC (permalink / raw)
To: help-gnu-emacs
Eduardo Ochs wrote:
> ;; This is a simplified version of:
> ;; (find-efunction 'ee-goto-position)
> ;; http://angg.twu.net/eev-current/eev-blinks.el.html#ee-goto-position
> (defun ee-goto-position-mini (&optional str &rest strs)
> (when str
> (goto-char (point-min))
> (search-forward str)
> (dolist (s strs)
> (search-forward s))))
You can simplify even further with just (&rest strs) since
that is optional in its own way with nil/the empty list ...
> ;; This is a simplified version of:
> ;; (find-efunction 'find-dbsw-call)
> ;; http://angg.twu.net/eev-current/eev-blinks.el.html#find-dbsw
> (defun find-dbsw-call-mini (sexp &rest pos-spec-list)
> (let ((display-buffer-overriding-action '(display-buffer-same-window)))
> (eval sexp))
> (apply 'ee-goto-position-mini pos-spec-list))
Why `apply'?
> and searches for the first occurrence of the string "Parent"
> in it. But in the other ones the search doesn't work - after
> the (find-dbsw-call-mini ...) is run the point is elsewhere.
> What is happening here? And do you have any suggestions of
> how to fix that?
You must do something like
(progn
(describe-function #'next-line)
(with-current-buffer (help-buffer)
(search-forward "line-move-visual") ))
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-26 5:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-26 4:08 Problem with search-forward in *Help* buffers Eduardo Ochs
2022-11-26 5:03 ` Emanuel Berg
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.