diff options
author | JSDurand <mmemmew@gmail.com> | 2022-04-09 22:45:50 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-04-09 22:45:50 +0800 |
commit | d4c144f64b69e466a78ee2d195467d1efb35c57a (patch) | |
tree | 4d5f480853dfdd8eea0e6e54109ad25ff8ca8ad2 | |
parent | 894f5c008e715938db1dfadbfea9df1ef8ed50dc (diff) |
bookmark-conf: automatic grouping of Tramp bookmarks
* bookmark-conf.el ("ilist-automatic-group-durand"): Now this
automatic grouping function understands the syntax of Tramp buffers
(for ssh only, though) and will group Tramp bookmarks according to
the remote server name, like root@jsdurand.xyz, or
git@jsdurand.xyz.
I start to think that Tramp is the best invention since the slice of
bread now.
-rw-r--r-- | bookmark-conf.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bookmark-conf.el b/bookmark-conf.el index 7faa7c5..1b880f7 100644 --- a/bookmark-conf.el +++ b/bookmark-conf.el @@ -100,7 +100,8 @@ (save-match-data (let* ((handler (bookmark-get-handler element)) (handler-name (and handler (format "%S" handler))) - (location (bookmark-location element))) + (location (bookmark-location element)) + (capitalize-p t)) ;; replace repeating parts (cond ((and handler-name @@ -111,6 +112,14 @@ "^durand-" "" (replace-regexp-in-string "-bookmark$" "" (match-string 1 handler-name)))))) + ;; Tramp bookmarks + (cond + ((and (stringp location) + (not (string= location "")) + (string-match (rx bos "/ssh:" (group (1+ (not ":"))) ":" (1+ (not ":")) eos) location)) + (setq handler-name + (concat "Tramp - " (match-string 1 location))) + (setq capitalize-p nil))) ;; take case of file extensions (cond ((and (null handler-name) location @@ -120,7 +129,8 @@ (handler-name (cond ((<= (length handler-name) 3) (upcase handler-name)) - ((capitalize handler-name)))))))) + (capitalize-p (capitalize handler-name)) + (handler-name))))))) (setq blist-automatic-filter-groups #'ilist-automatic-group-durand) |