diff options
| author | Simen Heggestøyl | 2020-06-02 19:20:14 +0200 |
|---|---|---|
| committer | Simen Heggestøyl | 2020-06-02 19:27:55 +0200 |
| commit | 9afcf2bd39ceb2988ed516efa0a474137fb30f74 (patch) | |
| tree | 3956ad12964ed5c0a2dd472dd7886f020873c87a | |
| parent | e7065459d96498163e737c0c8e45e5dc2412f181 (diff) | |
| download | emacs-9afcf2bd39ceb2988ed516efa0a474137fb30f74.tar.gz emacs-9afcf2bd39ceb2988ed516efa0a474137fb30f74.zip | |
Write project list to file only when changed
* lisp/progmodes/project.el (project--add-to-project-list-front):
Write the project list to file only when it has changed.
| -rw-r--r-- | lisp/progmodes/project.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 314918901ea..0051a84ff84 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -771,14 +771,15 @@ Arguments the same as in `compile'." | |||
| 771 | (write-region nil nil filename nil 'silent)))) | 771 | (write-region nil nil filename nil 'silent)))) |
| 772 | 772 | ||
| 773 | (defun project--add-to-project-list-front (pr) | 773 | (defun project--add-to-project-list-front (pr) |
| 774 | "Add project PR to the front of the project list and save it. | 774 | "Add project PR to the front of the project list. |
| 775 | Return PR." | 775 | Save the result to disk if the project list was changed." |
| 776 | (project--ensure-read-project-list) | 776 | (project--ensure-read-project-list) |
| 777 | (let ((dir (project-root pr))) | 777 | (let* ((dir (project-root pr)) |
| 778 | (do-write (not (equal (car project--list) dir)))) | ||
| 778 | (setq project--list (delete dir project--list)) | 779 | (setq project--list (delete dir project--list)) |
| 779 | (push dir project--list)) | 780 | (push dir project--list) |
| 780 | (project--write-project-list) | 781 | (when do-write |
| 781 | pr) | 782 | (project--write-project-list)))) |
| 782 | 783 | ||
| 783 | (defun project--remove-from-project-list (pr-dir) | 784 | (defun project--remove-from-project-list (pr-dir) |
| 784 | "Remove directory PR-DIR from the project list. | 785 | "Remove directory PR-DIR from the project list. |