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

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

Re: `M-.' can't skip to the corresponding DEFUN from within the Apropos


From: Hongyi Zhao
Subject: Re: `M-.' can't skip to the corresponding DEFUN from within the Apropos buffer.
Date: Tue, 6 Jul 2021 08:09:20 +0800

On Tue, Jul 6, 2021 at 8:02 AM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> On Tue, Jul 6, 2021 at 5:27 AM Daniel Martín <mardani29@yahoo.es> wrote:
> >
> > Hongyi Zhao <hongyi.zhao@gmail.com> writes:
> >
> > >>
> > >> - Create a buffer-local binding for xref-backend-functions in Apropos
> > >>   buffers where you prepend elisp--xref-backend to the list.
> > >>
> > >
> > > I've read some relevant document [1], but still can't figure out how
> > > to set this feature in my initialization file.
> > >
> > > [1] 
> > > https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Buffer_002dLocal.html
> > >
> >
> > You could add something like
> >
> > (add-hook 'apropos-mode-hook
> >           (lambda ()
> >             (add-hook 'xref-backend-functions
> >                       #'elisp--xref-backend nil t)))
> >
>
> The built-in help document says:
>
> ```
> (add-hook HOOK FUNCTION &optional DEPTH LOCAL)
>
> [...]
> The place where the function is added depends on the DEPTH
> parameter.  DEPTH defaults to 0.  By convention, it should be
> a number between -100 and 100 where 100 means that the function
> should be at the very end of the list, whereas -100 means that
> the function should always come first.
> Since nothing is "always" true, don’t use 100 nor -100.
> When two functions have the same depth, the new one gets added after the
> old one if depth is strictly positive and before otherwise.
>
> For backward compatibility reasons, a symbol other than nil is
> interpreted as a DEPTH of 90.
> ```
>
> Here, you set DEPTH to nil. I'm not sure if your usage is equivalent
> to the following?
>
>   (add-hook 'apropos-mode-hook
>            (lambda ()
>              (add-hook 'xref-backend-functions
>                        #'elisp--xref-backend 0 t)))
>

Based on my tries, passing nil or 0 as the third argument is
equivalent. Thank you again.

HY
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China



reply via email to

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