From e58e2318087b7baa7c968a6d589b05e04284e26a Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 7 Jul 2024 09:52:01 +0300 Subject: [PATCH] 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. (cherry picked from commit 8911d53ce5d8c67327704b7bf55ada14024766d0) --- lisp/dired.el | 2 +- lisp/files.el | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index 8781ff52fbe..6225ee3a7b0 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -5171,7 +5171,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 diff --git a/lisp/files.el b/lisp/files.el index 74a9c62c667..ab2b0223d1d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7310,7 +7310,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. @@ -7331,14 +7331,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 -- 2.39.2