diff options
| author | Simen Heggestøyl | 2020-05-29 16:58:09 +0200 |
|---|---|---|
| committer | Simen Heggestøyl | 2020-06-02 19:12:19 +0200 |
| commit | e7065459d96498163e737c0c8e45e5dc2412f181 (patch) | |
| tree | acb51cb154dceff85294333aeec0eb0fa4aeeef7 /lisp | |
| parent | 7ddfbb98d25cd939b808d71ec9693e316bc956b2 (diff) | |
| download | emacs-e7065459d96498163e737c0c8e45e5dc2412f181.tar.gz emacs-e7065459d96498163e737c0c8e45e5dc2412f181.zip | |
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.
Diffstat (limited to 'lisp')
| -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'." | |||
| 743 | (defvar project--list 'unset | 743 | (defvar project--list 'unset |
| 744 | "List of known project directories.") | 744 | "List of known project directories.") |
| 745 | 745 | ||
| 746 | (defun project--ensure-file-exists (filename) | ||
| 747 | "Create an empty file FILENAME if it doesn't exist." | ||
| 748 | (unless (file-exists-p filename) | ||
| 749 | (with-temp-buffer | ||
| 750 | (write-file filename)))) | ||
| 751 | |||
| 752 | (defun project--read-project-list () | 746 | (defun project--read-project-list () |
| 753 | "Initialize `project--list' from the project list file." | 747 | "Initialize `project--list' from the project list file." |
| 754 | (let ((filename (locate-user-emacs-file "project-list"))) | 748 | (let ((filename (locate-user-emacs-file "project-list"))) |
| 755 | (project--ensure-file-exists filename) | 749 | (setq project--list |
| 756 | (with-temp-buffer | 750 | (when (file-exists-p filename) |
| 757 | (insert-file-contents filename) | 751 | (with-temp-buffer |
| 758 | (let ((dirs (split-string (buffer-string) "\n" t)) | 752 | (insert-file-contents filename) |
| 759 | (project-list '())) | 753 | (let ((dirs (split-string (buffer-string) "\n" t)) |
| 760 | (dolist (dir dirs) | 754 | (project-list '())) |
| 761 | (cl-pushnew (file-name-as-directory dir) | 755 | (dolist (dir dirs) |
| 762 | project-list | 756 | (cl-pushnew (file-name-as-directory dir) |
| 763 | :test #'equal)) | 757 | project-list |
| 764 | (setq project--list (reverse project-list)))))) | 758 | :test #'equal)) |
| 759 | (reverse project-list))))))) | ||
| 765 | 760 | ||
| 766 | (defun project--ensure-read-project-list () | 761 | (defun project--ensure-read-project-list () |
| 767 | "Initialize `project--list' if it hasn't already been." | 762 | "Initialize `project--list' if it hasn't already been." |