summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/files.el18
-rw-r--r--lisp/progmodes/etags.el2
2 files changed, 12 insertions, 8 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 6e68c137f77..7a0a56448a9 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -327,10 +327,18 @@ otherwise a string <2> or <3> or ... is appended to get an unused name."
Choose the buffer's name using generate-new-buffer-name."
(get-buffer-create (generate-new-buffer-name name)))
+(defconst automount-dir-prefix "^/tmp_mnt/"
+ "Regexp to match the automounter prefix in a directory name.")
+
(defun abbreviate-file-name (filename)
"Return a version of FILENAME shortened using directory-abbrev-alist.
This also substitutes \"~\" for the user's home directory.
See \\[describe-variable] directory-abbrev-alist RET for more information."
+ ;; Get rid of the prefixes added by the automounter.
+ (if (and (string-match automount-dir-prefix filename)
+ (file-exists-p (file-name-directory
+ (substring filename (1- (match-end 0))))))
+ (setq filename (substring filename (1- (match-end 0)))))
(let ((tail directory-abbrev-alist))
(while tail
(if (string-match (car (car tail)) filename)
@@ -347,13 +355,9 @@ See \\[describe-variable] directory-abbrev-alist RET for more information."
If a buffer exists visiting FILENAME, return that one, but
verify that the file has not changed since visited or saved.
The buffer is not selected, just returned to the caller."
- (setq filename (expand-file-name filename))
- ;; Get rid of the prefixes added by the automounter.
- (if (and (string-match "^/tmp_mnt/" filename)
- (file-exists-p (file-name-directory
- (substring filename (1- (match-end 0))))))
- (setq filename (substring filename (1- (match-end 0)))))
- (setq filename (abbreviate-file-name filename))
+ (setq filename
+ (abbreviate-file-name
+ (expand-file-name filename)))
(if (file-directory-p filename)
(if find-file-run-dired
(dired-noselect filename)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 2c171190093..01af927e301 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -164,7 +164,7 @@ file the tag was in."
default-directory)
t)
current-prefix-arg))
- (setq file (expand-file-name file))
+ (setq file (abbreviate-file-name (expand-file-name file)))
(if (file-directory-p file)
(setq file (expand-file-name "TAGS" file)))
(if local