Commit e9407052 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(dired-get-filename): Err for . and .. in usual case.

(dired-get-file-for-visit): Specify no-error to dired-get-filename,
and check for real errors here.
(dired-unmark-all-files): Specify no-error to dired-get-filename.
parent 638df3f7
2003-06-04 Richard M. Stallman <rms@gnu.org>
* dired.el (dired-get-filename): Err for . and .. in usual case.
(dired-get-file-for-visit): Specify no-error to dired-get-filename,
and check for real errors here.
(dired-unmark-all-files): Specify no-error to dired-get-filename.
* buff-menu.el (list-buffers-noselect): Use window-inside-edges
to compute the number of offset spaces.
(list-buffers-noselect): Use Buffer-menu-buffer+size to
indent the dashes properly. Put some in fixed-pitch.
2003-06-04 Lars Hansen <larsh@math.ku.dk> 2003-06-04 Lars Hansen <larsh@math.ku.dk>
   
* desktop.el (desktop-create-buffer): Undo last change. * desktop.el (desktop-create-buffer): Undo last change.
......
...@@ -1350,7 +1350,12 @@ Creates a buffer if necessary." ...@@ -1350,7 +1350,12 @@ Creates a buffer if necessary."
(defun dired-get-file-for-visit () (defun dired-get-file-for-visit ()
"Get the current line's file name, with an error if file does not exist." "Get the current line's file name, with an error if file does not exist."
(interactive) (interactive)
(let ((file-name (file-name-sans-versions (dired-get-filename) t))) ;; We pass t for second arg so that we don't get error for `.' and `..'.
(let ((raw (dired-get-filename nil t))
file-name)
(if (null raw)
(error "No file on this line"))
(setq file-name (file-name-sans-versions raw t))
(if (file-exists-p file-name) (if (file-exists-p file-name)
file-name file-name
(if (file-symlink-p file-name) (if (file-symlink-p file-name)
...@@ -1482,6 +1487,11 @@ Optional arg NO-ERROR-IF-NOT-FILEP means return nil if no filename on ...@@ -1482,6 +1487,11 @@ Optional arg NO-ERROR-IF-NOT-FILEP means return nil if no filename on
(cond (cond
((null file) ((null file)
nil) nil)
((and (not no-error-if-not-filep)
(save-excursion
(beginning-of-line)
(looking-at dired-re-dir)))
(error "Cannot operate on `.' or `..'"))
((eq localp 'verbatim) ((eq localp 'verbatim)
file) file)
((and (eq localp 'no-dir) already-absolute) ((and (eq localp 'no-dir) already-absolute)
...@@ -2658,8 +2668,10 @@ Type SPC or `y' to unmark one file, DEL or `n' to skip to next, ...@@ -2658,8 +2668,10 @@ Type SPC or `y' to unmark one file, DEL or `n' to skip to next,
(re-search-forward dired-re-mark nil t) (re-search-forward dired-re-mark nil t)
(search-forward string nil t)) (search-forward string nil t))
(if (or (not arg) (if (or (not arg)
(dired-query 'query "Unmark file `%s'? " (let ((file (dired-get-filename t t)))
(dired-get-filename t))) (and file
(dired-query 'query "Unmark file `%s'? "
file))))
(progn (subst-char-in-region (1- (point)) (point) (progn (subst-char-in-region (1- (point)) (point)
(preceding-char) ?\ ) (preceding-char) ?\ )
(setq count (1+ count))))) (setq count (1+ count)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment