GNU bug report logs -
#63469
29.0.90; project.el doesn't add menu-bar entries
Previous Next
Reported by: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Fri, 12 May 2023 17:49:02 UTC
Severity: normal
Found in version 29.0.90
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
>> 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.
[project-autoload-safe.patch (text/x-diff, inline)]
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.
This bug report was last modified 2 years and 43 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.