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

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

[elpa] externals/denote f9cfde272e 2/4: Merge pull request #112 from mgm


From: ELPA Syncer
Subject: [elpa] externals/denote f9cfde272e 2/4: Merge pull request #112 from mgmarlow/feat/directory-name-exclusions
Date: Fri, 4 Nov 2022 13:57:32 -0400 (EDT)

branch: externals/denote
commit f9cfde272e8c38a27391f5d2c0c7a25806d67b45
Merge: e89833d453 39a20a7355
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #112 from mgmarlow/feat/directory-name-exclusions
    
    feat: Add denote-directory-exclusions
---
 denote.el | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index b96cfb18b8..b335c8fa61 100644
--- a/denote.el
+++ b/denote.el
@@ -379,6 +379,14 @@ current note."
 
 (make-obsolete 'denote-link-fontify-backlinks 'denote-backlinks-show-context 
"1.2.0")
 
+(defcustom denote-directory-exclusions nil
+  "Regular expression that excludes matching directories from 
denote-file-prompt.
+
+When nil (the default value) all directory names are allowed."
+  :group 'denote
+  :package-version '(denote . "1.2.0")
+  :type 'string)
+
 ;;;; Main variables
 
 ;; For character classes, evaluate: (info "(elisp) Char Classes")
@@ -548,6 +556,16 @@ and use one of the extensions implied by 
`denote-file-type'."
   'denote-file-has-identifier-p
   "1.0.0")
 
+(defun denote-file-directory-p (file)
+  "Return non-nil if FILE is a directory.
+You can exclude certain directories by customizing the
+`denote-directory-exclusions' regular expresion."
+  (and
+   (file-directory-p file)
+   (if denote-directory-exclusions
+       (not (string-match-p denote-directory-exclusions file))
+     t)))
+
 (defun denote-file-has-supported-extension-p (file)
   "Return non-nil if FILE has supported extension.
 Also account for the possibility of an added .gpg suffix.
@@ -684,7 +702,7 @@ With optional INITIAL-TEXT, use it to prepopulate the 
minibuffer."
   (read-file-name "Select note: " (denote-directory) nil nil initial-text
                   (lambda (f)
                     (or (denote-file-has-identifier-p f)
-                        (file-directory-p f)))))
+                        (denote-file-directory-p f)))))
 
 (define-obsolete-function-alias
   'denote--retrieve-read-file-prompt



reply via email to

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