diff options
author | JSDurand <mmemmew@gmail.com> | 2022-09-03 16:04:43 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-09-03 16:04:43 +0800 |
commit | 52a52c0a55bcf48df492a42844b5245a2156a46a (patch) | |
tree | e932c41dfc81ccbc1ac0441bb90e7f4e02775397 | |
parent | 305adee7e32aae97d916434ad89d8f1af7e2cbc5 (diff) |
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.
-rw-r--r-- | bookmark-conf.el | 15 |
1 files changed, 14 insertions, 1 deletions
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 |