summaryrefslogtreecommitdiff
path: root/lisp/dired-x.el
diff options
context:
space:
mode:
authorDave Love <fx@gnu.org>2003-01-27 11:36:08 +0000
committerDave Love <fx@gnu.org>2003-01-27 11:36:08 +0000
commitdb7196773894e69fc8701ca1ee9e716001862873 (patch)
treec5e22210571d4db5bd7478c1e0412fb5e7d02f2b /lisp/dired-x.el
parentf759a1ab649d24c5c83de7d0e760297eb1f38460 (diff)
downloademacs-db7196773894e69fc8701ca1ee9e716001862873.tar.gz
(dired-filename-at-point): Fix last change and tidy up.
Diffstat (limited to 'lisp/dired-x.el')
-rw-r--r--lisp/dired-x.el16
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 256064a3d6f..0cc9c43b2fe 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -1561,16 +1561,13 @@ to test if that file exists. Use minibuffer after snatching filename."
;;; Internal functions.
-;; Fixme: This should probably be replaced with `thing-at-point', but
-;; that needs checking for compatibility. -- fx
+;; Fixme: This should probably use `thing-at-point'. -- fx
(defun dired-filename-at-point ()
"Get the filename closest to point, but do not change position.
Has a preference for looking backward when not directly on a symbol. Not
perfect - point must be in middle of or end of filename."
(let ((filename-chars "-.[:alnum:]_/:$+@")
- (bol (save-excursion (beginning-of-line) (point)))
- (eol (save-excursion (end-of-line) (point)))
start end filename prefix)
(save-excursion
@@ -1585,16 +1582,19 @@ perfect - point must be in middle of or end of filename."
(if (string-match (concat "[" filename-chars "]")
(char-to-string (following-char)))
(progn
- (skip-chars-backward filename-chars)
+ (if (re-search-backward (concat "[^" filename-chars "]") nil t)
+ (forward-char)
+ (goto-char (point-min)))
(setq start (point))
(setq prefix
- (and (string-match "^\\w+@"
- (buffer-substring start eol))
+ (and (string-match
+ "^\\w+@"
+ (buffer-substring start (line-beginning-position)))
"/"))
(goto-char start)
(if (string-match "[/~]" (char-to-string (preceding-char)))
(setq start (1- start)))
- (skip-chars-forward filename-chars))
+ (re-search-forward (concat "\\=[" filename-chars "]*") nil t))
(error "No file found around point!"))