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

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

Re: The definition of orig-fn.


From: Tassilo Horn
Subject: Re: The definition of orig-fn.
Date: Mon, 04 Oct 2021 20:14:38 +0200
User-agent: mu4e 1.7.0; emacs 29.0.50

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> I just borrowed the code snippet mentioned here [1] and insert them
> into my `~/.emacs.d/init.el' file, and not use the whole oremacs
> project as my configuration, as shown below:
>
> (defun ora--company-good-prefix-p (orig-fn prefix)
> (unless (and (stringp prefix) (string-match-p "\\`[0-9]+\\'" prefix))
> (funcall orig-fn prefix)))
> (ora-advice-add 'company--good-prefix-p :around #'ora--company-good-prefix-p)

Ok, so you've put the advice definition in your init file, and it seems
you have more "ora" stuff than what you've posted, i.e., you must also
have `ora-advice-add' somewhere if the above doesn't error.

>> When you do `C-h f company--good-prefix-p RET' it should mention that
>> there is an advice if there is one.
>
> I tried the above command, but only see the following result:
>
> company--good-prefix-p is a compiled function defined in company.el.
>
> Signature
> (company--good-prefix-p PREFIX)
>
> Documentation
> This function has :around advice: ora--company-good-prefix-p.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There it says that the function is :around-advised with
`ora--company-good-prefix-p'.

>> But I don't understand what you are trying to achieve.
>
> "Using digits to select company-mode candidates" without hitting the
> default modifier key, as noted here [2]. You can see the attachment to
> get a rough impression for the purpose of the code snippet discussed
> here.

Ok.  I somehow lost the contex.  In your first message you've asked what
`orig-fn' is and Emanuel and me told you.  But I can't follow your later
two replies, especially I'm not sure if you are still asking for
help. :-)

Bye,
Tassilo



reply via email to

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