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

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

[elpa] externals/denote fb534987ce 2/2: Add variable to extend "illegal"


From: ELPA Syncer
Subject: [elpa] externals/denote fb534987ce 2/2: Add variable to extend "illegal" punctuation
Date: Wed, 20 Jul 2022 00:57:29 -0400 (EDT)

branch: externals/denote
commit fb534987cef774a6e8b1584630bf019556db3d8f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add variable to extend "illegal" punctuation
    
    This is to allow users to omit non-ascii characters from file names.
    
    Thanks to pRot0ta1p for the feedback in issue 57 over at the GitHub
    mirror: <https://github.com/protesilaos/denote/issues/57>.
    
    Example based on the input of pRot0ta1p:
    
        (setq denote-punctuation-excluded-extra-regexp
              "[『』〖〗{}「」【】〔〕[]()《》〈〉«»!#¥%…&"'*,。;:、?—]*")
---
 denote.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/denote.el b/denote.el
index 391dacc155..8a17fbe8a7 100644
--- a/denote.el
+++ b/denote.el
@@ -327,6 +327,13 @@ are described in the doc string of `format-time-string'."
   "Punctionation that is removed from file names.
 We consider those characters illigal for our purposes.")
 
+(defvar denote-punctuation-excluded-extra-regexp nil
+  "Additional punctuation that is removed from file names.
+This variable is for advanced users who need to extend the
+`denote--punctuation-regexp'.  Once we have a better
+understanding of what we should be omitting, we will update
+things accordingly.")
+
 (defvar denote-last-path nil "Store last path.")
 (defvar denote-last-title nil "Store last title.")
 (defvar denote-last-keywords nil "Store last keywords.")
@@ -353,7 +360,9 @@ We consider those characters illigal for our purposes.")
 
 (defun denote--slug-no-punct (str)
   "Convert STR to a file name slug."
-  (replace-regexp-in-string denote--punctuation-regexp "" str))
+  (replace-regexp-in-string
+   (concat denote--punctuation-regexp denote-punctuation-excluded-extra-regexp)
+   "" str))
 
 (defun denote--slug-hyphenate (str)
   "Replace spaces with hyphens in STR.



reply via email to

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