diff options
| author | Stephen Berman | 2026-04-11 11:01:05 +0200 |
|---|---|---|
| committer | Stephen Berman | 2026-04-11 11:01:05 +0200 |
| commit | 6a90e0ee324f6fd0efe8b0de2a82c8a8a09dd19d (patch) | |
| tree | 73f369ba0ca73c6f940f9536654e41e39ea98065 | |
| parent | 52e484742d9d95dd488f15dbe35962d342712137 (diff) | |
| download | emacs-6a90e0ee324f6fd0efe8b0de2a82c8a8a09dd19d.tar.gz emacs-6a90e0ee324f6fd0efe8b0de2a82c8a8a09dd19d.zip | |
Handle 'dired' called with -Al switches (bug#80711)
* lisp/dired.el (dired-internal-noselect): After reading in
directory, check whether there was an 'ls' error instead of
checking for file entries, since there may be none is the -Al
switches (or just -l) were used.
(dired--display-ls-error): Ensure the 'ls' error buffer is a live buffer.
* lisp/files.el (insert-directory-clean): Ensure deletion of
"//DIRED-OPTIONS//" line when using -Al switches (or just -l).
| -rw-r--r-- | lisp/dired.el | 18 | ||||
| -rw-r--r-- | lisp/files.el | 2 |
2 files changed, 8 insertions, 12 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 353190347db..2f66753f230 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1456,16 +1456,12 @@ The return value is the target column for the file names." | |||
| 1456 | (let ((failed t)) | 1456 | (let ((failed t)) |
| 1457 | (unwind-protect | 1457 | (unwind-protect |
| 1458 | (progn (dired-readin) | 1458 | (progn (dired-readin) |
| 1459 | ;; Check for file entries (they are listed below the | 1459 | (unless (and dired--ls-error-buffer |
| 1460 | ;; directory name and (if present) wildcard lines). | 1460 | (get-buffer "*ls error*")) |
| 1461 | (while (and (skip-syntax-forward "\s") | ||
| 1462 | (looking-at "\\(.+:$\\|wildcard\\)")) | ||
| 1463 | (forward-line)) | ||
| 1464 | (unless (eobp) | ||
| 1465 | (setq failed nil))) | 1461 | (setq failed nil))) |
| 1466 | ;; No file entries indicates an `ls' error, and `dired-readin' | 1462 | ;; If either `dired-readin' failed (e.g. if parent directories |
| 1467 | ;; can fail if parent directories are inaccessible. In either | 1463 | ;; are inaccessible) or `ls' errored, don't leave the Dired |
| 1468 | ;; case don't leave the Dired buffer around. | 1464 | ;; buffer around. |
| 1469 | (when failed | 1465 | (when failed |
| 1470 | (kill-buffer buffer) | 1466 | (kill-buffer buffer) |
| 1471 | (setq buffer nil)))) | 1467 | (setq buffer nil)))) |
| @@ -4112,8 +4108,8 @@ See `%s' for other alternatives and more information.")) | |||
| 4112 | (search-backward "Warning (dired)"))))) | 4108 | (search-backward "Warning (dired)"))))) |
| 4113 | 4109 | ||
| 4114 | (defun dired--display-ls-error () | 4110 | (defun dired--display-ls-error () |
| 4115 | "Pop up a buffer displaying the current `ls' error, if any." | 4111 | "Pop up the buffer displaying the current `ls' error, if any." |
| 4116 | (when dired--ls-error-buffer | 4112 | (when (buffer-live-p dired--ls-error-buffer) |
| 4117 | (let* ((errwin (display-buffer dired--ls-error-buffer))) | 4113 | (let* ((errwin (display-buffer dired--ls-error-buffer))) |
| 4118 | (fit-window-to-buffer errwin)) | 4114 | (fit-window-to-buffer errwin)) |
| 4119 | (setq dired--ls-error-buffer nil))) | 4115 | (setq dired--ls-error-buffer nil))) |
diff --git a/lisp/files.el b/lisp/files.el index e05a4b99497..15bcf3568a2 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -8340,7 +8340,7 @@ Valid wildcards are `*', `?', `[abc]' and `[a-z]'." | |||
| 8340 | ;; Take care of the case where the ls output contains a | 8340 | ;; Take care of the case where the ls output contains a |
| 8341 | ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line | 8341 | ;; "//DIRED-OPTIONS//"-line, but no "//DIRED//"-line |
| 8342 | ;; and we went one line too far back (see above). | 8342 | ;; and we went one line too far back (see above). |
| 8343 | (unless (bobp) (forward-line 1))) | 8343 | (forward-line 1)) |
| 8344 | (if (let ((case-fold-search nil)) (looking-at "//DIRED-OPTIONS//")) | 8344 | (if (let ((case-fold-search nil)) (looking-at "//DIRED-OPTIONS//")) |
| 8345 | (delete-region (point) (progn (forward-line 1) (point)))))) | 8345 | (delete-region (point) (progn (forward-line 1) (point)))))) |
| 8346 | 8346 | ||