diff options
| -rw-r--r-- | lisp/dired-aux.el | 13 | ||||
| -rw-r--r-- | lisp/dired.el | 18 |
2 files changed, 18 insertions, 13 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 3b66c68598f..ad154f9dea1 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -478,12 +478,13 @@ and use this command with a prefix argument (the value does not matter)." | |||
| 478 | ;; Return the name of the compressed or uncompressed file. | 478 | ;; Return the name of the compressed or uncompressed file. |
| 479 | ;; Rerurn nil if no change in files. | 479 | ;; Rerurn nil if no change in files. |
| 480 | (let (handler (handlers file-name-handler-alist)) | 480 | (let (handler (handlers file-name-handler-alist)) |
| 481 | (while (and (consp handlers) (null handler)) | 481 | (save-match-data |
| 482 | (if (and (consp (car handlers)) | 482 | (while (and (consp handlers) (null handler)) |
| 483 | (stringp (car (car handlers))) | 483 | (if (and (consp (car handlers)) |
| 484 | (string-match (car (car handlers)) file)) | 484 | (stringp (car (car handlers))) |
| 485 | (setq handler (cdr (car handlers)))) | 485 | (string-match (car (car handlers)) file)) |
| 486 | (setq handlers (cdr handlers))) | 486 | (setq handler (cdr (car handlers)))) |
| 487 | (setq handlers (cdr handlers)))) | ||
| 487 | (cond (handler | 488 | (cond (handler |
| 488 | (funcall handler 'dired-compress-file file)) | 489 | (funcall handler 'dired-compress-file file)) |
| 489 | ((file-symlink-p file) | 490 | ((file-symlink-p file) |
diff --git a/lisp/dired.el b/lisp/dired.el index 02a4d53d681..55cb1f058df 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -187,7 +187,8 @@ Local to each dired buffer.") | |||
| 187 | (defvar dired-subdir-alist nil | 187 | (defvar dired-subdir-alist nil |
| 188 | "Association list of subdirectories and their buffer positions. | 188 | "Association list of subdirectories and their buffer positions. |
| 189 | Each subdirectory has an element: (DIRNAME . STARTMARKER). | 189 | Each subdirectory has an element: (DIRNAME . STARTMARKER). |
| 190 | The order of elements is the reverse of the order in the buffer.") | 190 | The order of elements is the reverse of the order in the buffer. |
| 191 | In simple cases, this list contains one element.") | ||
| 191 | 192 | ||
| 192 | (defvar dired-subdir-regexp "^. \\([^ \n\r]+\\)\\(:\\)[\n\r]" | 193 | (defvar dired-subdir-regexp "^. \\([^ \n\r]+\\)\\(:\\)[\n\r]" |
| 193 | "Regexp matching a maybe hidden subdirectory line in `ls -lR' output. | 194 | "Regexp matching a maybe hidden subdirectory line in `ls -lR' output. |
| @@ -851,7 +852,8 @@ Creates a buffer if necessary." | |||
| 851 | (let* ((dir (dired-current-directory)) | 852 | (let* ((dir (dired-current-directory)) |
| 852 | (up (file-name-directory (directory-file-name dir)))) | 853 | (up (file-name-directory (directory-file-name dir)))) |
| 853 | (or (dired-goto-file (directory-file-name dir)) | 854 | (or (dired-goto-file (directory-file-name dir)) |
| 854 | (and dired-subdir-alist | 855 | ;; Only try dired-goto-subdir if buffer has more than one dir. |
| 856 | (and (cdr dired-subdir-alist) | ||
| 855 | (dired-goto-subdir up)) | 857 | (dired-goto-subdir up)) |
| 856 | (progn | 858 | (progn |
| 857 | (dired up) | 859 | (dired up) |
| @@ -868,7 +870,8 @@ When file is a directory, show it in this buffer if it is inserted; | |||
| 868 | otherwise, display it in another buffer." | 870 | otherwise, display it in another buffer." |
| 869 | (interactive) | 871 | (interactive) |
| 870 | (if (file-directory-p (dired-get-filename)) | 872 | (if (file-directory-p (dired-get-filename)) |
| 871 | (or (and dired-subdir-alist (dired-goto-subdir (dired-get-filename))) | 873 | (or (and (cdr dired-subdir-alist) |
| 874 | (dired-goto-subdir (dired-get-filename))) | ||
| 872 | (dired (dired-get-filename))) | 875 | (dired (dired-get-filename))) |
| 873 | (view-file (dired-get-filename)))) | 876 | (view-file (dired-get-filename)))) |
| 874 | 877 | ||
| @@ -1225,7 +1228,7 @@ Returns the new value of the alist." | |||
| 1225 | ;; without really calling it if we don't have any subdirs. | 1228 | ;; without really calling it if we don't have any subdirs. |
| 1226 | (if (if (string= dir default-directory) | 1229 | (if (if (string= dir default-directory) |
| 1227 | (goto-char (point-min)) | 1230 | (goto-char (point-min)) |
| 1228 | (and dired-subdir-alist | 1231 | (and (cdr dired-subdir-alist) |
| 1229 | (dired-goto-subdir dir))) | 1232 | (dired-goto-subdir dir))) |
| 1230 | (let ((base (file-name-nondirectory file)) | 1233 | (let ((base (file-name-nondirectory file)) |
| 1231 | (boundary (dired-subdir-max))) | 1234 | (boundary (dired-subdir-max))) |
| @@ -1286,7 +1289,7 @@ Optional argument means return a file name relative to `default-directory'." | |||
| 1286 | 1289 | ||
| 1287 | (defun dired-subdir-max () | 1290 | (defun dired-subdir-max () |
| 1288 | (save-excursion | 1291 | (save-excursion |
| 1289 | (if (or (null dired-subdir-alist) (not (dired-next-subdir 1 t t))) | 1292 | (if (or (null (cdr dired-subdir-alist)) (not (dired-next-subdir 1 t t))) |
| 1290 | (point-max) | 1293 | (point-max) |
| 1291 | (point)))) | 1294 | (point)))) |
| 1292 | 1295 | ||
| @@ -1373,7 +1376,8 @@ Optional argument means return a file name relative to `default-directory'." | |||
| 1373 | ;; This is a separate function for the sake of dired-x.el. | 1376 | ;; This is a separate function for the sake of dired-x.el. |
| 1374 | (defun dired-clean-up-after-deletion (fn) | 1377 | (defun dired-clean-up-after-deletion (fn) |
| 1375 | ;; Clean up after a deleted file or directory FN. | 1378 | ;; Clean up after a deleted file or directory FN. |
| 1376 | (save-excursion (and (dired-goto-subdir fn) | 1379 | (save-excursion (and (cdr dired-subdir-alist) |
| 1380 | (dired-goto-subdir fn) | ||
| 1377 | (dired-kill-subdir)))) | 1381 | (dired-kill-subdir)))) |
| 1378 | 1382 | ||
| 1379 | ;; Confirmation | 1383 | ;; Confirmation |
| @@ -1576,7 +1580,7 @@ Use \\[dired-unmark-all-files] to remove all marks | |||
| 1576 | and \\[dired-unmark] on a subdir to remove the marks in | 1580 | and \\[dired-unmark] on a subdir to remove the marks in |
| 1577 | this subdir." | 1581 | this subdir." |
| 1578 | (interactive "P") | 1582 | (interactive "P") |
| 1579 | (if (and dired-subdir-alist (dired-get-subdir)) | 1583 | (if (and (cdr dired-subdir-alist) (dired-get-subdir)) |
| 1580 | (save-excursion (dired-mark-subdir-files)) | 1584 | (save-excursion (dired-mark-subdir-files)) |
| 1581 | (let (buffer-read-only) | 1585 | (let (buffer-read-only) |
| 1582 | (dired-repeat-over-lines | 1586 | (dired-repeat-over-lines |