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: command-execute: Wrong type argument: commandp, helm-command-prefix Date: Fri, 5 May 2023 12:18:18 +0800 Message-ID: References: <1ccf06f2-b311-0989-8351-f0e866044936@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20268"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Platon Pronko , help-gnu-emacs@gnu.org To: Ruijie Yu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 05 06:19:13 2023 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 1pumuX-00052y-8I for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 05 May 2023 06:19:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pumtu-0000m5-V7; Fri, 05 May 2023 00:18:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pumtt-0000lV-5r for help-gnu-emacs@gnu.org; Fri, 05 May 2023 00:18:33 -0400 Original-Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pumtr-00062k-Am for help-gnu-emacs@gnu.org; Fri, 05 May 2023 00:18:32 -0400 Original-Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-957dbae98b4so196670066b.1 for ; Thu, 04 May 2023 21:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683260310; x=1685852310; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tIlj84FRdkJPbrPVZhTBk1ibAb1A9YoRdHZUIVyzZxg=; b=YwCeetQP0L2ERQqaTsEw3DmRtZRe7JfiLgxibwIcQ91S4XWfx6PhIyT/XUnjGhl3g/ uF1ww6tcLWa0eTRA9hPl3JZ3A1heN2Tl7wVAGUidz6/+P/QOFBrIn6+ISLcIpb7MROcl LQ/SqYDEAXojG6UMMNuGXpOPehAwrZvhBYfCdJ6HY/tfx2TMlU0kCUFgTCiTAjJuYCRA GpxAE/aCgDytcn/2fXBa3OJKnzD58eIiumS0dqGKYnsU6uq0DWLjFPhD+aF67H8NobcJ KFapQRvmLBbUScIkjmc4GZeMaPqMIvpRWJf99LYZ6X83FK9kE1ZzjPajPyX3KOePvK+R Ty8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683260310; x=1685852310; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tIlj84FRdkJPbrPVZhTBk1ibAb1A9YoRdHZUIVyzZxg=; b=ccjpnP64WAni0QD/xtJDnwzbcfu9tDOopkkQcCpdz23eZGKbuvXTqVd2RaUt6jbti/ AoSAxt1SirSUnWIUKyZKeu1CyTpNw2+1x4RW9AqoYPJukWm5L3rYTB+gZpXGLKDNEbBm jG4YF9QeNB/kc5uyGJ+YnJqbXuWrZ0JyRB6D87wlQhtyAdfITCtgeDzeY0ud6m7CbrEN I9DNwRFgzEQZxVutZ5qiZBjPSi+/JSeKKkA52hBtLtoVqTFQBQf95fownwdFABGu46P2 OOGYtSg0uxzCSL4pIDfYnJmvRDBlsbjUTBL/lmdj+GE30lwhtYCZSTB0bQdufSgdXSP4 VW4w== X-Gm-Message-State: AC+VfDxGPfcP0KfnDau16GmGw6g9SxE10qC9ITDiVeQFfy0rAOS+cKYG xX0ZIAyaK3j8NP7yQN7K8FlTSLvaBis/Bv/oAqM= X-Google-Smtp-Source: ACHHUZ6oWGgjMxyEmO73nvFK11kUmjyhugwzbzvMZfpa/IdKYjOZVmWMI5LyWFqg1urG5HpG1OO/gogAG/cp7BHl09k= X-Received: by 2002:a17:907:d06:b0:94a:74b8:7a79 with SMTP id gn6-20020a1709070d0600b0094a74b87a79mr1020265ejc.59.1683260309519; Thu, 04 May 2023 21:18:29 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=hongyi.zhao@gmail.com; helo=mail-ej1-x635.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143514 Archived-At: On Fri, May 5, 2023 at 10:59=E2=80=AFAM Ruijie Yu wrote: > > > Platon Pronko writes: > > > On 2023-05-05 08:34, Hongyi Zhao wrote: > > >> :bind > >> (("" . helm-command-prefix) > >> :map helm-command-map > >> ("b" . helm-bibtex) > >> ("B" . helm-bibtex-with-local-bibliography) > >> ("n" . helm-bibtex-with-notes) > >> ("" . helm-resume)) > >> ``` > >> When I hit hey for the first time, the following error will be > >> triggered: > >> command-execute: Wrong type argument: commandp, helm-command-prefix > >> If I hit this key once more, the problem doesn't appear. I'm very > >> puzzled by this problem. Any tips will be appreciated. > >> See > >> https://github.com/tmalsburg/helm-bibtex/issues/429#issuecomment-15350= 10227 > >> for the related discussion. > >> Regards, > >> Zhao > > > :bind > > (("" . helm-command-prefix) > > :map helm-command-map > > ("b" . helm-bibtex) > > ("B" . helm-bibtex-with-local-bibliography) > > ("n" . helm-bibtex-with-notes) > > ("" . helm-resume)) > > When I macroexpand > > (use-package helm-bibtex :bind ("" . helm-command-prefix)) > > I get this: > > ```emacs-lisp > (progn > (unless > (fboundp 'helm-command-prefix) > (autoload #'helm-command-prefix "helm-bibtex" nil t)) > (bind-keys :package helm-bibtex > ("" . helm-command-prefix))) > ``` > > When I macroexpand > > (use-package helm-bibtex :bind-keymap ("" . helm-command-prefix)) > > I get this: > > ```emacs-lisp > (bind-key "" > #'(lambda nil > (interactive) > (use-package-autoload-keymap 'helm-command-prefix 'helm-bibtex nil)= )) > ``` > > Looking at the docstring of `bind-keys', it seems to me that the fact > that :bind happens to work sometimes is unintended, and we should prefer > :bind-keymap instead. Hongyi, try to move your keybind to > `helm-command-prefix' into a :bind-keymap section and see if that helps. > > FTR, I wasn't able to reproduce the error with :bind "" either. I > don't have "" key set, so I can't test that. Nice trick and it works. I've tried with several keys, such as, , , etc., to set helm-command-prefix, and they all works smoothly this way. The following is revised configuration according to the above advice: (use-package helm-bibtex :init (setq bibtex-completion-pdf-field "File" ;;https://github.com/tmalsburg/helm-bibtex#insert-latex-cite-commands bibtex-completion-cite-prompt-for-optional-arguments nil) :bind-keymap ("" . helm-command-prefix) :bind ( :map helm-command-map ("b" . helm-bibtex) ("B" . helm-bibtex-with-local-bibliography) ("n" . helm-bibtex-with-notes) ("" . helm-resume) ) :config (require 'helm-config) ;;https://github.com/tmalsburg/helm-bibtex#application-used-for-opening-p= dfs ;;https://github.com/tmalsburg/helm-bibtex/issues/386 (defun bibtex-completion-open-pdf-external (keys &optional fallback-actio= n) (let ((bibtex-completion-pdf-open-function (lambda (fpath) (start-process "evince" "*helm-bibtex-evince*" "/usr/bin/evince" fpath)))) (bibtex-completion-open-pdf keys fallback-action))) (helm-bibtex-helmify-action bibtex-completion-open-pdf-external helm-bibtex-open-pdf-external) (helm-add-action-to-source 'helm-bibtex '(("P" helm-bibtex-open-pdf-external "Open PDF file in external viewer (if present)"))) ;;https://github.com/tmalsburg/helm-bibtex#browser-used-for-opening-urls-= and-dois (setq bibtex-completion-browser-function (lambda (url _) (start-process "firefox" "*firefox*" "firefox" url))) ) > -- > Best, > > > RY Regards, Zhao > [Please note that this mail might go to spam due to some > misconfiguration in my mail server -- still investigating.]