From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#63469: 29.0.90; project.el doesn't add menu-bar entries Date: Thu, 25 May 2023 09:29:49 +0300 Organization: LINKOV.NET Message-ID: <867csw53fm.fsf@mail.linkov.net> References: <83sfbvxkj3.fsf@gnu.org> <3d97111e-794d-eeef-73b0-ee3f6f5f15d5@gutov.dev> <83jzx6w2bg.fsf@gnu.org> <6a3eed52-3248-74f9-bcaf-bf12660ae0ed@gutov.dev> <83h6savsz4.fsf@gnu.org> <83mt21vfgl.fsf@gnu.org> <86mt211vk3.fsf@mail.linkov.net> <0ce4532f-03aa-6afe-bd8f-8ef1df6615de@gutov.dev> <86ilco7qbs.fsf@mail.linkov.net> <83r0rctxbc.fsf@gnu.org> <867ct4b4ds.fsf@mail.linkov.net> <835y8otbub.fsf@gnu.org> <86o7mccl5z.fsf@mail.linkov.net> <63854a1a-8178-d039-288c-34b1e67e5b06@gutov.dev> <86ttw3blc6.fsf@mail.linkov.net> <86sfbm6hp5.fsf@mail.linkov.net> <86jzwyw8j5.fsf@mail.linkov.net> <6a5c2251-52a8-e389-f2ab-08da775fab82@gutov.dev> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4882"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: sbaugh@janestreet.com, Eli Zaretskii , 63469@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 25 08:48:41 2023 Return-path: Envelope-to: geb-bug-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 1q24m8-0001AW-QK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 May 2023 08:48:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q24li-00048X-Ge; Thu, 25 May 2023 02:48:14 -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 1q24le-00047d-7b for bug-gnu-emacs@gnu.org; Thu, 25 May 2023 02:48:10 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q24lX-0000Wh-Jk for bug-gnu-emacs@gnu.org; Thu, 25 May 2023 02:48:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q24lW-0006Uq-GA for bug-gnu-emacs@gnu.org; Thu, 25 May 2023 02:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 May 2023 06:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63469 X-GNU-PR-Package: emacs Original-Received: via spool by 63469-submit@debbugs.gnu.org id=B63469.168499724324778 (code B ref 63469); Thu, 25 May 2023 06:48:02 +0000 Original-Received: (at 63469) by debbugs.gnu.org; 25 May 2023 06:47:23 +0000 Original-Received: from localhost ([127.0.0.1]:45746 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q24kt-0006RZ-1Y for submit@debbugs.gnu.org; Thu, 25 May 2023 02:47:23 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:53783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q24kq-0006RJ-Aa for 63469@debbugs.gnu.org; Thu, 25 May 2023 02:47:21 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 38A62E000C; Thu, 25 May 2023 06:47:11 +0000 (UTC) In-Reply-To: <6a5c2251-52a8-e389-f2ab-08da775fab82@gutov.dev> (Dmitry Gutov's message of "Thu, 25 May 2023 04:14:41 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262339 Archived-At: --=-=-= Content-Type: text/plain >> I see no way to set the same project name both for >> non-file and file buffers. > > Please try the patch below. It might have non-negligible effect on > performance though. Please try and report back. > > diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el > index 7c51778d5d4..1494665d565 100644 > --- a/lisp/progmodes/project.el > +++ b/lisp/progmodes/project.el > @@ -816,8 +816,8 @@ project-buffers > (push buf bufs))) > (nreverse bufs))) > > -(cl-defmethod project-name ((_project (head vc))) > - (or project-vc-name > +(cl-defmethod project-name ((project (head vc))) > + (or (project--value-in-dir 'project-vc-name (project-root project)) > (cl-call-next-method))) Thanks, I confirm this uses project-vc-name from dir-locals in non-file buffers. >> The standard solution is just to use e.g.: >> ;;;###autoload(put 'compilation-directory 'safe-local-variable 'stringp) > > Huh, so the attribute :safe only makes proper sense for preloaded packages > and autoloaded defcustom forms (which are discouraged anyway). > > Do you want to write a patch for all those vars in project.el? It will > probably make sense to push it to emacs-29. With this patch the problem is solved. I can push it to emacs-29. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=project-autoload-safe.patch diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 7c51778d5d4..8b5a1abf900 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -412,8 +412,8 @@ project-vc (defcustom project-vc-ignores nil "List of patterns to add to `project-ignores'." - :type '(repeat string) - :safe #'listp) + :type '(repeat string)) +;;;###autoload(put 'project-vc-ignores 'safe-local-variable #'listp) (defcustom project-vc-merge-submodules t "Non-nil to consider submodules part of the parent project. @@ -422,14 +422,14 @@ project-vc-merge-submodules you might have to restart Emacs to see the effect." :type 'boolean :version "28.1" - :package-version '(project . "0.2.0") - :safe #'booleanp) + :package-version '(project . "0.2.0")) +;;;###autoload(put 'project-vc-merge-submodules 'safe-local-variable #'booleanp) (defcustom project-vc-include-untracked t "When non-nil, the VC-aware project backend includes untracked files." :type 'boolean - :version "29.1" - :safe #'booleanp) + :version "29.1") +;;;###autoload(put 'project-vc-include-untracked 'safe-local-variable #'booleanp) (defcustom project-vc-name nil "When non-nil, the name of the current VC-aware project. @@ -439,8 +439,8 @@ project-vc-name :type '(choice (const :tag "Default to the base name" nil) (string :tag "Custom name")) :version "29.1" - :package-version '(project . "0.9.0") - :safe #'stringp) + :package-version '(project . "0.9.0")) +;;;###autoload(put 'project-vc-name 'safe-local-variable #'stringp) ;; Not using regexps because these wouldn't work in Git pathspecs, in ;; case we decide we need to be able to list nested projects. @@ -467,8 +467,8 @@ project-vc-extra-root-markers variables, such as `project-vc-ignores' or `project-vc-name'." :type '(repeat string) :version "29.1" - :package-version '(project . "0.9.0") - :safe (lambda (val) (and (listp val) (cl-every #'stringp val)))) + :package-version '(project . "0.9.0")) +;;;###autoload(put 'project-vc-extra-root-markers 'safe-local-variable (lambda (val) (and (listp val) (cl-every #'stringp val)))) ;; FIXME: Using the current approach, major modes are supposed to set ;; this variable to a buffer-local value. So we don't have access to @@ -1476,8 +1476,8 @@ project-kill-buffers-display-buffer-list :type 'boolean :version "29.1" :group 'project - :package-version '(project . "0.8.2") - :safe #'booleanp) + :package-version '(project . "0.8.2")) +;;;###autoload(put 'project-kill-buffers-display-buffer-list 'safe-local-variable #'booleanp) (defun project--buffer-check (buf conditions) "Check if buffer BUF matches any element of the list CONDITIONS. --=-=-=--