diff options
author | JSDurand <mmemmew@gmail.com> | 2022-04-10 13:08:50 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-04-10 13:08:50 +0800 |
commit | 9233c47071d4e65cd767572a9761dbe868e8f4f2 (patch) | |
tree | 3f2740b94b5546c56b336ef252984f6d4ce83ff2 | |
parent | deac1e938f092cc62058eda83d5722a2d3cf79b2 (diff) |
bookmark-conf: use `file-remote-p' to get host and user
* bookmark-conf.el ("ilist-automatic-group-durand"): Instead of using
a hand-made regular expression for determining the user and the host
of the remote file name, use the function `file-remote-p'. This is
quite necessary since the Tramp syntax might vary according to the
style used. It is best to use an official function.
-rw-r--r-- | bookmark-conf.el | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/bookmark-conf.el b/bookmark-conf.el index 32a102d..4e3aa5a 100644 --- a/bookmark-conf.el +++ b/bookmark-conf.el @@ -116,19 +116,20 @@ (cond ((and (stringp location) (not (string= location "")) - (string-match (rx bos "/ssh:" - (group (1+ (not ":"))) - (zero-or-more - (and "|" - (1+ (not ":")) - ":" - (1+ (not ":")))) - ":" - (1+ (not ":")) - eos) - location)) + (file-remote-p location)) (setq handler-name - (concat "Tramp - " (match-string 1 location))) + (concat "Tramp - " + (format + "%s%s" + (cond + ((file-remote-p location 'user) + (concat + (file-remote-p location 'user) + "@")) + ("")) + (cond + ((file-remote-p location 'host)) + (""))))) (setq capitalize-p nil))) ;; take case of file extensions (cond |