emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/denote 1aeee8410f 07/14: Remove check for writable-and-


From: ELPA Syncer
Subject: [elpa] externals/denote 1aeee8410f 07/14: Remove check for writable-and-supported-p in denote--edit-front-matter-p
Date: Mon, 15 Aug 2022 23:57:30 -0400 (EDT)

branch: externals/denote
commit 1aeee8410f36567db9d20a53dfa7d0b7bb008969
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Remove check for writable-and-supported-p in denote--edit-front-matter-p
    
    - Move the check in denote-rename-file and denote-dired-rename-marked-files
---
 denote.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/denote.el b/denote.el
index 8d6dbd4a2d..ff3ec71138 100644
--- a/denote.el
+++ b/denote.el
@@ -1343,10 +1343,9 @@ Use FILE-TYPE to look for the front matter lines. This is
 relevant for operations that insert or rewrite the front matter
 in a Denote note.
 
-For the purposes of this test, FILE is a Denote note when it (i)
-is a regular file and (ii) is writable."
-  (and (denote--writable-and-supported-p file)
-       (not (denote--file-empty-p file))
+For the purposes of this test, FILE is a Denote note when it
+contains a title line, a keywords line or both."
+  (and (not (denote--file-empty-p file))
        (denote--regexp-in-file-p (denote--title-key-regexp file-type) file)
        (denote--regexp-in-file-p (denote--keywords-key-regexp file-type) 
file)))
 
@@ -1500,9 +1499,10 @@ files)."
     (when (denote--rename-file-prompt file new-name)
       (denote--rename-file file new-name)
       (denote-update-dired-buffers)
-      (if (denote--edit-front-matter-p new-name file-type)
-          (denote--rewrite-front-matter new-name title keywords file-type)
-        (denote--add-front-matter new-name title keywords id file-type)))))
+      (when (denote--writable-and-supported-p new-name)
+        (if (denote--edit-front-matter-p new-name file-type)
+            (denote--rewrite-front-matter new-name title keywords file-type)
+          (denote--add-front-matter new-name title keywords id file-type))))))
 
 (define-obsolete-function-alias
   'denote-dired-rename-file-and-add-front-matter
@@ -1561,9 +1561,10 @@ The operation does the following:
                  (new-name (denote--format-file
                             dir id keywords (denote--sluggify title) 
extension)))
             (denote--rename-file file new-name)
-            (if (denote--edit-front-matter-p new-name file-type)
-                (denote--rewrite-keywords new-name keywords file-type)
-              (denote--add-front-matter new-name title keywords id 
file-type))))
+            (when (denote--writable-and-supported-p new-name)
+              (if (denote--edit-front-matter-p new-name file-type)
+                  (denote--rewrite-keywords new-name keywords file-type)
+                (denote--add-front-matter new-name title keywords id 
file-type)))))
         (revert-buffer))
     (user-error "No marked files; aborting")))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]