diff options
author | Simen Heggestøyl <simenheg@gmail.com> | 2020-05-29 16:58:09 +0200 |
---|---|---|
committer | Simen Heggestøyl <simenheg@gmail.com> | 2020-06-02 19:12:19 +0200 |
commit | e7065459d96498163e737c0c8e45e5dc2412f181 (patch) | |
tree | acb51cb154dceff85294333aeec0eb0fa4aeeef7 | |
parent | 7ddfbb98d25cd939b808d71ec9693e316bc956b2 (diff) | |
download | emacs-e7065459d96498163e737c0c8e45e5dc2412f181.tar.gz |
Remove 'project--ensure-file-exists'
* lisp/progmodes/project.el (project--ensure-file-exists): Remove.
(project--read-project-list): Set 'project--list' to nil when the
project list file doesn't exist.
-rw-r--r-- | lisp/progmodes/project.el | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 12149806891..314918901ea 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -743,25 +743,20 @@ Arguments the same as in `compile'." (defvar project--list 'unset "List of known project directories.") -(defun project--ensure-file-exists (filename) - "Create an empty file FILENAME if it doesn't exist." - (unless (file-exists-p filename) - (with-temp-buffer - (write-file filename)))) - (defun project--read-project-list () "Initialize `project--list' from the project list file." (let ((filename (locate-user-emacs-file "project-list"))) - (project--ensure-file-exists filename) - (with-temp-buffer - (insert-file-contents filename) - (let ((dirs (split-string (buffer-string) "\n" t)) - (project-list '())) - (dolist (dir dirs) - (cl-pushnew (file-name-as-directory dir) - project-list - :test #'equal)) - (setq project--list (reverse project-list)))))) + (setq project--list + (when (file-exists-p filename) + (with-temp-buffer + (insert-file-contents filename) + (let ((dirs (split-string (buffer-string) "\n" t)) + (project-list '())) + (dolist (dir dirs) + (cl-pushnew (file-name-as-directory dir) + project-list + :test #'equal)) + (reverse project-list))))))) (defun project--ensure-read-project-list () "Initialize `project--list' if it hasn't already been." |