[Top][All Lists]

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

Re: The definition of orig-fn.

From: Hongyi Zhao
Subject: Re: The definition of orig-fn.
Date: Tue, 5 Oct 2021 10:12:00 +0800

On Tue, Oct 5, 2021 at 2:24 AM Tassilo Horn <> wrote:
> Hongyi Zhao <> 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.

Yes, I've also borrowed the following code snippet below and put them
immediately above the code snippet which I've posted here in my init

  (defun ora-advice-add (&rest args)
  (when (fboundp 'advice-add)
    (apply #'advice-add args)))

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

Basically, I'm asking or trying to figure out the following questions:

1. Whether can I delete out the advice function used in the code
snippet by abo-abo, without affecting the actual function it produces:
Insert the company candidates with digits, unless the number is
potentially part of the candidate; In that case, insert the number.

2. Extend the digits to a more wide range with digits letters, so that
I can select and insert more candidates, as we've discussed here [1].



reply via email to

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