From 52a52c0a55bcf48df492a42844b5245a2156a46a Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 3 Sep 2022 16:04:43 +0800 Subject: bookmark refine the automatic grouping * bookmark-conf.el: Refine the automatic grouping so that the file name extension "GPG" will not be picked as an automatic group name, and the last extension before GPG will be used instead. If there are no extensions before "GPG", no automatic grouping will be applied. I think this is more intuitive, as "GPG" only specifies that the file is encrytped, but does not say what the type of the file's true contents are. --- bookmark-conf.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bookmark-conf.el b/bookmark-conf.el index cd88eae..4745abf 100644 --- a/bookmark-conf.el +++ b/bookmark-conf.el @@ -139,7 +139,20 @@ (cond ((and (null handler-name) location (string-match "\\.\\([^.]+\\)\\'" location)) - (setq handler-name (match-string 1 location)))) + (setq handler-name (match-string 1 location)) + (let ((new-location location)) + (while (and handler-name + (durand-member + handler-name (list "gpg") #'string=)) + (setq new-location + (substring new-location nil (max 0 (1- (match-beginning 1))))) + (cond + ((string= location "~/.authinfo.gpg") + (message new-location))) + (cond + ((string-match "\\.\\([^.]+\\)\\'" new-location) + (setq handler-name (match-string 1 new-location))) + ((setq handler-name nil))))))) (cond (handler-name (cond -- cgit v1.2.3-18-g5258