branch: externals/denote commit 0b69904020edaf0a812b0ce48365c9dade410191 Merge: d3a537d065 b745cae875 Author: Peter Prevos <pe...@prevos.net> Commit: GitHub <nore...@github.com>
Merge branch 'protesilaos:main' into main --- denote-dired.el | 28 +++++++--------------------- denote-retrieve.el | 3 --- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/denote-dired.el b/denote-dired.el index 8ece6de42b..d990169ee4 100644 --- a/denote-dired.el +++ b/denote-dired.el @@ -282,25 +282,6 @@ replace what isn't there." ;; Heuristic to check if this is one of our notes (string= (expand-file-name default-directory) (denote-directory))))) -;; FIXME 2022-07-25: We should make the underlying regular expressions -;; that `denote-retrieve--value-title' targets more refined, so that we -;; capture eveyrhing at once. -(defun denote-dired--rewrite-title (file old new) - "Rewrite OLD front matter of title to NEW value in FILE." - (save-excursion - (goto-char (point-min)) - (re-search-forward denote-retrieve--title-front-matter-key-regexp nil t 1) - (search-forward old nil t 1) - (replace-match (concat "\\1" new) t))) - -(defun denote-dired--rewrite-keywords (file old new) - "Rewrite OLD front matter of keywords to NEW value in FILE." - (save-excursion - (goto-char (point-min)) - (re-search-forward denote-retrieve--keywords-front-matter-key-regexp nil t 1) - (search-forward old nil t 1) - (replace-match (concat "\\1" new) t))) - (defun denote-dired--rewrite-front-matter (file title keywords) "Rewrite front matter of note after `denote-dired-rename-file'. The FILE, TITLE, and KEYWORDS are passed from the renaming @@ -321,8 +302,13 @@ appropriate." (propertize new-title 'face 'success) (propertize old-keywords 'face 'error) (propertize new-keywords 'face 'success))) - (denote-dired--rewrite-title file old-title new-title) - (denote-dired--rewrite-keywords file old-keywords new-keywords)))))) + (save-excursion + (goto-char (point-min)) + (search-forward old-title nil t 1) + (replace-match (concat "\\1" new-title) t) + (goto-char (point-min)) + (search-forward old-keywords nil t 1) + (replace-match (concat "\\1" new-keywords) t))))))) (defun denote-dired--add-front-matter (file title keywords id) "Add front matter to the beginning of FILE. diff --git a/denote-retrieve.el b/denote-retrieve.el index 0e6ef21f86..fd21df0453 100644 --- a/denote-retrieve.el +++ b/denote-retrieve.el @@ -33,9 +33,6 @@ (require 'denote) (require 'xref) -;; FIXME 2022-07-25: We must review these. When we need to move in the -;; buffer, we should capture both the key and its value at once. Check -;; `denote-dired--rewrite-front-matter'. (defconst denote-retrieve--title-front-matter-key-regexp "^\\(?:#\\+\\)?\\(?:title\\)\\s-*[:=]" "Regular expression for title key.")