Fix uses of 'dired-omit-mode' (bug#71905)

* lisp/dired.el (dired-jump): Disable dired-omit-mode with -1.

* lisp/files.el (recover-session): Disable dired-omit-mode
explicitly afterwards instead of modifying dired-mode-hook
that fails when it contains a lambda.
This commit is contained in:
Juri Linkov 2024-07-07 09:52:01 +03:00
parent 8589fd9cae
commit 8911d53ce5
2 changed files with 7 additions and 9 deletions

View file

@ -5183,7 +5183,7 @@ Interactively with prefix argument, read FILE-NAME."
(dired-goto-file file))
;; Toggle omitting, if it is on, and try again.
(when (bound-and-true-p dired-omit-mode)
(dired-omit-mode)
(dired-omit-mode -1)
(dired-goto-file file)))))))))
;;;###autoload

View file

@ -7263,7 +7263,7 @@ auto-save file, if that is more recent than the visited file."
(after-find-file nil nil t))
(t (user-error "Recover-file canceled")))))
(defvar dired-mode-hook)
(declare-function dired-omit-mode "dired-x" (&optional arg))
(defun recover-session ()
"Recover auto save files from a previous Emacs session.
@ -7284,14 +7284,12 @@ Then you'll be asked about a number of files to recover."
(concat "\\`" (regexp-quote nd)))
t)
(error "No previous sessions to recover")))
(require 'dired)
(let ((ls-lisp-support-shell-wildcards t)
;; Ensure that we don't omit the session files as the user may
;; have (as suggested by the manual) `dired-omit-mode' in the
;; hook.
(dired-mode-hook (delete 'dired-omit-mode dired-mode-hook)))
(let ((ls-lisp-support-shell-wildcards t))
(dired (concat auto-save-list-file-prefix "*")
(concat (connection-local-value dired-listing-switches) " -t")))
(concat (connection-local-value dired-listing-switches) " -t"))
;; Toggle omitting, if it is on.
(when (bound-and-true-p dired-omit-mode)
(dired-omit-mode -1)))
(use-local-map (nconc (make-sparse-keymap) (current-local-map)))
(define-key (current-local-map) "\C-c\C-c" 'recover-session-finish)
(save-excursion