]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve dired-do-{info,man} error handling
authorStefan Kangas <stefan@marxist.se>
Sat, 2 Jul 2022 20:17:06 +0000 (22:17 +0200)
committerStefan Kangas <stefan@marxist.se>
Sun, 3 Jul 2022 09:43:58 +0000 (11:43 +0200)
* lisp/dired.el (dired-do-man, dired-do-info): Use
'dired-get-file-for-visit' to get better error handling.
Interactive mode tagging.

lisp/dired.el

index d7bf6316882d74213475d986ca26ce94dd406ce7..6fe0ba0be65af2e56e61a85c1ec0c81c637b9012 100644 (file)
@@ -4810,22 +4810,22 @@ Interactively with prefix argument, read FILE-NAME."
 (defvar manual-program) ; from man.el
 
 (defun dired-do-man ()
-  "Run `man' on this file."
-  (interactive)
+  "In Dired, run `man' on this file."
+  (interactive nil dired-mode)
   (require 'man)
   ;; FIXME: Move `dired-guess-shell-command' to dired.el to remove the
   ;;        need for requiring `dired-x'.
   (require 'dired-x)
-  (let* ((file (dired-get-filename))
+  (let* ((file (dired-get-file-for-visit))
          (manual-program (string-replace "*" "%s"
                                          (dired-guess-shell-command
                                           "Man command: " (list file)))))
     (Man-getpage-in-background file)))
 
 (defun dired-do-info ()
-  "Run `info' on this file."
-  (interactive)
-  (info (dired-get-filename)))
+  "In Dired, run `info' on this file."
+  (interactive nil dired-mode)
+  (info (dired-get-file-for-visit)))
 
 (provide 'dired)