diff options
| -rw-r--r-- | lib/doc/jao-org-notes.el | 34 | 
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/doc/jao-org-notes.el b/lib/doc/jao-org-notes.el index 24698b9..9fdca8a 100644 --- a/lib/doc/jao-org-notes.el +++ b/lib/doc/jao-org-notes.el @@ -89,27 +89,28 @@  (defvar jao-org-notes--tags nil)  (defvar jao-org-notes-tags-cache-file "~/.emacs.d/cache/tags.eld") -(defun jao-org-notes--update-tags () -  (message "Updating tags cache...") -  (setq jao-org-notes--tags -        (org-global-tags-completion-table -         (directory-files-recursively jao-org-notes-dir ".*\\.org"))) +(defun jao-org-notes--save-tags ()    (with-current-buffer (find-file-noselect jao-org-notes-tags-cache-file)      (delete-region (point-min) (point-max))      (print jao-org-notes--tags (current-buffer)) -    (save-buffer))) +    (let ((message-log-max nil) +          (inhibit-message t)) +      (save-buffer)))) -(defun jao-org-notes-read-tags-cache (&optional refresh) -  (interactive "P") -  (when refresh (jao-org-notes--update-tags)) -  (or jao-org-notes--tags -      (let ((b (find-file-noselect jao-org-notes-tags-cache-file))) -        (with-current-buffer b (goto-char (point-min))) -        (setq jao-org-notes--tags (read b))))) +(defun jao-org-notes--read-tags-cache () +  (let ((b (find-file-noselect jao-org-notes-tags-cache-file))) +    (with-current-buffer b (goto-char (point-min))) +    (setq jao-org-notes--tags (read b))))  (defun jao-org-notes--read-tags () -  (unless jao-org-notes--tags (jao-org-notes-read-tags-cache)) -  (completing-read-multiple "Tags: " jao-org-notes--tags)) +  (unless jao-org-notes--tags (jao-org-notes--read-tags-cache)) +  (let* ((tags (completing-read-multiple "Tags: " jao-org-notes--tags)) +         (new-tags (seq-difference tags jao-org-notes--tags))) +    (when new-tags +      (setq jao-org--notes-tags +            (sort (append new-tags jao-org-notes--tags) #'string<)) +      (jao-org-notes--save-tags)) +    tags))  (defun jao-org-notes--insert-tags ()    (insert "#+filetags: " (mapconcat #'identity (jao-org-notes--read-tags) " ") "\n")) @@ -137,8 +138,7 @@    (interactive)    (when (jao-org-notes--insert-title)      (jao-org-notes--insert-date) -    (jao-org-notes--insert-tags) -    (jao-org-notes--update-tags)) +    (jao-org-notes--insert-tags))    (save-buffer)    (buffer-file-name))  | 
