aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2020-06-03 00:27:29 +0300
committerDmitry Gutov2020-06-03 00:27:29 +0300
commit8b71bfb891d4cc871e62dd63b28d834db4090577 (patch)
tree87185398e5b76ea08e3c89ae4c0d133ef8d6aa35
parentacba19e24768112b13820c4e9e12eff4abc5d3b4 (diff)
downloademacs-8b71bfb891d4cc871e62dd63b28d834db4090577.tar.gz
emacs-8b71bfb891d4cc871e62dd63b28d834db4090577.zip
project-list-file: New user option
* lisp/progmodes/project.el (project): New custom group. (project-vc): Use it as parent. (project-vc-merge-submodules): Tag with Emacs version. (project-read-file-name-function): Assign to the 'project' group. (project-list-file): New user option (bug#41600). (project--write-project-list, project--read-project-list): Use it.
-rw-r--r--lisp/progmodes/project.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 0051a84ff84..1c4dc7e7617 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -93,6 +93,10 @@
93(require 'cl-generic) 93(require 'cl-generic)
94(eval-when-compile (require 'subr-x)) 94(eval-when-compile (require 'subr-x))
95 95
96(defgroup project nil
97 "Operations on the current project."
98 :group 'tools)
99
96(defvar project-find-functions (list #'project-try-vc) 100(defvar project-find-functions (list #'project-try-vc)
97 "Special hook to find the project containing a given directory. 101 "Special hook to find the project containing a given directory.
98Each functions on this hook is called in turn with one 102Each functions on this hook is called in turn with one
@@ -236,7 +240,7 @@ to find the list of ignores for each directory."
236(defgroup project-vc nil 240(defgroup project-vc nil
237 "Project implementation based on the VC package." 241 "Project implementation based on the VC package."
238 :version "25.1" 242 :version "25.1"
239 :group 'tools) 243 :group 'project)
240 244
241(defcustom project-vc-ignores nil 245(defcustom project-vc-ignores nil
242 "List of patterns to include in `project-ignores'." 246 "List of patterns to include in `project-ignores'."
@@ -249,6 +253,7 @@ to find the list of ignores for each directory."
249After changing this variable (using Customize or .dir-locals.el) 253After changing this variable (using Customize or .dir-locals.el)
250you might have to restart Emacs to see the effect." 254you might have to restart Emacs to see the effect."
251 :type 'boolean 255 :type 'boolean
256 :version "28.1"
252 :package-version '(project . "0.2.0") 257 :package-version '(project . "0.2.0")
253 :safe 'booleanp) 258 :safe 'booleanp)
254 259
@@ -601,6 +606,7 @@ For the arguments list, see `project--read-file-cpd-relative'."
601 (const :tag "Read with completion from absolute names" 606 (const :tag "Read with completion from absolute names"
602 project--read-file-absolute) 607 project--read-file-absolute)
603 (function :tag "Custom function" nil)) 608 (function :tag "Custom function" nil))
609 :group 'project
604 :version "27.1") 610 :version "27.1")
605 611
606(defun project--read-file-cpd-relative (prompt 612(defun project--read-file-cpd-relative (prompt
@@ -740,12 +746,17 @@ Arguments the same as in `compile'."
740 746
741;;; Project list 747;;; Project list
742 748
749(defcustom project-list-file (locate-user-emacs-file "project-list")
750 "File to save the list of known projects."
751 :type 'string
752 :group 'project)
753
743(defvar project--list 'unset 754(defvar project--list 'unset
744 "List of known project directories.") 755 "List of known project directories.")
745 756
746(defun project--read-project-list () 757(defun project--read-project-list ()
747 "Initialize `project--list' from the project list file." 758 "Initialize `project--list' from the project list file."
748 (let ((filename (locate-user-emacs-file "project-list"))) 759 (let ((filename project-list-file))
749 (setq project--list 760 (setq project--list
750 (when (file-exists-p filename) 761 (when (file-exists-p filename)
751 (with-temp-buffer 762 (with-temp-buffer
@@ -765,7 +776,7 @@ Arguments the same as in `compile'."
765 776
766(defun project--write-project-list () 777(defun project--write-project-list ()
767 "Persist `project--list' to the project list file." 778 "Persist `project--list' to the project list file."
768 (let ((filename (locate-user-emacs-file "project-list"))) 779 (let ((filename project-list-file))
769 (with-temp-buffer 780 (with-temp-buffer
770 (insert (string-join project--list "\n")) 781 (insert (string-join project--list "\n"))
771 (write-region nil nil filename nil 'silent)))) 782 (write-region nil nil filename nil 'silent))))