From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: The definition of orig-fn. Date: Tue, 5 Oct 2021 10:12:00 +0800 Message-ID: References: <87czolhud6.fsf@gnu.org> <878rz9ht1m.fsf@gnu.org> <87sfxgfy19.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40889"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 05 04:13:39 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXZxb-000AQC-Eb for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 04:13:39 +0200 Original-Received: from localhost ([::1]:53712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXZxa-0004Oa-2j for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 04 Oct 2021 22:13:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXZwH-0003O3-Dk for help-gnu-emacs@gnu.org; Mon, 04 Oct 2021 22:12:17 -0400 Original-Received: from mail-vk1-xa29.google.com ([2607:f8b0:4864:20::a29]:43524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXZwF-0001LX-1R; Mon, 04 Oct 2021 22:12:17 -0400 Original-Received: by mail-vk1-xa29.google.com with SMTP id 14so128977vkq.10; Mon, 04 Oct 2021 19:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k8BNX/mwP2OiFew2LLVCAsIoJk0aJeWlSyya9L52qeE=; b=kedmTLIqYL6m+OOSmeESDhPTsso9TT0iz/cNkkRoRsC26dwaCRa7SinQrxJdJ6bYok o5J8/U3YmO46Wo5Wfq6A/JJYLTFUxAwNAd5MZ8Som5/Oher/U9OgfA/Ua9j98I9C3+vj avmmxFJyrNrPSXtvAkwwOVuUTUFI5vnAyR2XvUWfZ/vYiIAZ9woe2PglVCi7iDoWauGm XdM1q8bKYKVql54ipZ55VYy5FLd1mFqv51QiVBaKfVa7uY/2NPpJQy9ILD4v7kETwQBf 7IPbbWyI5HYamTenrMvVqTa64L2DKMxqxbp2t3h0NQImzuQYKxopBEqUaaEqc5BKFHtm WsAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k8BNX/mwP2OiFew2LLVCAsIoJk0aJeWlSyya9L52qeE=; b=dP5ygdKOazaCY9kH9rP/0tbOYi3VxgalouTzYZasYbZeTMZfTmUnKV/s6254szYtkB /PdAvP5QOzSXassSZexeVYaFR8cJRNuMemQBgHVZoppGy2Lpw0ZbF1ZIsfMqOf+nn0Gi amPpSSGCfpCrZZqykhGZ/LxidghgLzV9bmEy0jBhk9NSXSmuKBCdTu3uw1VJWt2OVCEG TgpRJ6FdFlKJ8pGJPolqxbPZ8FQ3WkfMPfyiBHKMAtiwlCINpwIXbtFkYkAm4rtCXh7t 8VshU0YJz2aYA1QwWWMy5HOZ6s+cCOqo9BTkuhVwaTCsVhUEq4zlmZzWnJGdee7RBe3H B4DA== X-Gm-Message-State: AOAM5313INzoxa8iXDWZP/bkhS2IwXZu6XNEQbxPsihz5NfRZzACZlVt K4bj1+jLda2Lw9qIgQ/QqOuaVbh9TCfDWPNcfaRGtAlVeB4mPK/2 X-Google-Smtp-Source: ABdhPJxR0kIyqC4x+aw5YVxDej7YKCac1y7LCeo8Ah3mYL7IMabO0meFhmsx54+QO4XFIusWXhiENHV/EGBwlcFi1XI= X-Received: by 2002:a1f:2408:: with SMTP id k8mr6457861vkk.11.1633399932461; Mon, 04 Oct 2021 19:12:12 -0700 (PDT) In-Reply-To: <87sfxgfy19.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::a29; envelope-from=hongyi.zhao@gmail.com; helo=mail-vk1-xa29.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133546 Archived-At: 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 file: ;https://github.com/abo-abo/oremacs/blob/d2b2cd8371b94f35a42000debef1c2b644cb9472/init.el#L28 (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]. [1] https://lists.gnu.org/archive/html/help-gnu-emacs/2021-09/msg00527.html HZ