]> git.eshelyaron.com Git - emacs.git/commitdiff
Move dired-info and dired-man from dired-x to dired
authorStefan Kangas <stefan@marxist.se>
Sat, 2 Jul 2022 13:41:43 +0000 (15:41 +0200)
committerStefan Kangas <stefan@marxist.se>
Sat, 2 Jul 2022 14:43:29 +0000 (16:43 +0200)
* lisp/dired-x.el (dired-bind-man, dired-bind-info): Change into
defvars and make obsolete.
(dired-extra-startup): Doc fix.
(dired-info, dired-man): Move from here...
* lisp/dired.el (dired-do-info, dired-do-man): ...to here and
rename.  (Bug#21981)

* lisp/dired.el (dired-mode-map): Bind 'I' and 'N' to 'dired-do-info'
and 'dired-do-man'.

* doc/misc/dired-x.texi (Miscellaneous Commands): Remove documentation
of 'dired-info' and 'dired-man'.
* doc/emacs/dired.texi (Dired Enter): Document 'dired-do-info' and
'dired-do-man'.
* etc/NEWS: Announce the above changes.

doc/emacs/dired.texi
doc/misc/dired-x.texi
etc/NEWS
lisp/dired-x.el
lisp/dired.el

index 9e14e0f9a9992b8e228732ff3df9214ed185e508..c7ef097bfb3d9a5e297d37dda53b363e68104740 100644 (file)
@@ -963,6 +963,18 @@ Byte compile the specified Emacs Lisp files
 (@code{dired-do-byte-compile}).  @xref{Byte Compilation,, Byte
 Compilation, elisp, The Emacs Lisp Reference Manual}.
 
+@findex dired-do-info
+@kindex I @r{(Dired)}
+@cindex running info on files (in Dired)
+@item I
+Run Info on this file (assumed to be a file in Info format).
+
+@findex dired-do-man
+@kindex N @r{(Dired)}
+@cindex running man on files (in Dired)
+@item N
+Run man on this file (assumed to be a file in @code{nroff} format).
+
 @kindex A @r{(Dired)}
 @findex dired-do-find-regexp
 @cindex search multiple files (in Dired)
index 754ccf4065cc995e8f651cd13b9156d72a54c433..504060f41fc5781c4af181c9294a225d1fd44239 100644 (file)
@@ -921,28 +921,6 @@ to @kbd{V}.  Otherwise, @code{dired-bind-rmail} will be bound.
 Bound to @kbd{V} if @code{dired-bind-vm} is @code{nil}.  Run Rmail on this
 file (assumed to be mail folder in Rmail format).
 
-@item dired-info
-@kindex I
-@cindex running info.
-@findex dired-info
-Bound to @kbd{I}.  Run Info on this file (assumed to be a file in Info
-format).
-
-@vindex dired-bind-info
-If the variable @code{dired-bind-info} is @code{nil}, @code{dired-info} will
-not be bound to @kbd{I}.
-
-@item dired-man
-@cindex running man.
-@kindex N
-@findex dired-man
-Bound to @kbd{N}.  Run man on this file (assumed to be a file in @code{nroff}
-format).
-
-@vindex dired-bind-man
-If the variable @code{dired-bind-man} is @code{nil}, @code{dired-man} will not
-be bound to @kbd{N}.
-
 @item dired-do-relsymlink
 @cindex relative symbolic links.
 @kindex Y
index 773e0849c2e4f23f9857ead8324a47c23b0b08c7..d5f3459630035dcdb23bf8981ce115e221b71761 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1028,6 +1028,25 @@ so automatically.
 \f
 * Changes in Specialized Modes and Packages in Emacs 29.1
 
+** Dired
+
+*** 'dired-info' and 'dired-man' moved from dired-x to dired.
+The 'dired-info' and 'dired-man' commands have been moved from the
+'dired-x' package to 'dired'.  They have also been renamed to
+'dired-do-info' and 'dired-do-man'; the old command names are obsolete
+aliases.
+
+They keys 'I' ('dired-do-info') and 'N' ('dired-do-man') are now bound
+in Dired mode by default.  The user options 'dired-bind-man' and
+'dired-bind-info' no longer have any effect and are obsolete.
+
+To get the old behavior back and unbind these keys in Dired mode, add
+the following to your Init file:
+
+(with-eval-after-load 'dired
+  (keymap-set dired-mode-map "N" nil)
+  (keymap-set dired-mode-map "I" nil))
+
 ** Elisp
 
 *** New command 'elisp-eval-buffer' (bound to 'C-c C-e').
index ed7f71e00694fcef5c6510d44db2affb9cba93c8..21de91328706c12bf974b941545339a6d0efee1c 100644 (file)
@@ -1,7 +1,6 @@
 ;;; dired-x.el --- extra Dired functionality  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 1997, 2001-2022 Free Software Foundation,
-;; Inc.
+;; Copyright (C) 1993-2022 Free Software Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
 ;;     Lawrence R. Dodd <dodd@roebling.poly.edu>
@@ -68,29 +67,11 @@ mbox format, and so cannot be distinguished in this way."
 (defvar dired-bind-jump t)
 (make-obsolete-variable 'dired-bind-jump "not used." "28.1")
 
-(defcustom dired-bind-man t
-  "Non-nil means bind `dired-man' to \"N\" in Dired, otherwise do not.
-Setting this variable directly after dired-x is loaded has no effect -
-use \\[customize]."
-  :type 'boolean
-  :set (lambda (sym val)
-         (if (set sym val)
-             (define-key dired-mode-map "N" 'dired-man)
-           (if (eq 'dired-man (lookup-key dired-mode-map "N"))
-               (define-key dired-mode-map "N" nil))))
-  :group 'dired-keys)
+(defvar dired-bind-man t)
+(make-obsolete-variable 'dired-bind-man "not used." "29.1")
 
-(defcustom dired-bind-info t
-  "Non-nil means bind `dired-info' to \"I\" in Dired, otherwise do not.
-Setting this variable directly after dired-x is loaded has no effect -
-use \\[customize]."
-  :type 'boolean
-  :set (lambda (sym val)
-         (if (set sym val)
-             (define-key dired-mode-map "I" 'dired-info)
-           (if (eq 'dired-info (lookup-key dired-mode-map "I"))
-               (define-key dired-mode-map "I" nil))))
-  :group 'dired-keys)
+(defvar dired-bind-info t)
+(make-obsolete-variable 'dired-bind-info "not used." "29.1")
 
 (defcustom dired-vm-read-only-folders nil
   "If non-nil, \\[dired-vm] will visit all folders read-only.
@@ -328,8 +309,6 @@ files"]
   "Automatically put on `dired-mode-hook' to get extra Dired features:
 \\<dired-mode-map>
   \\[dired-do-run-mail]\t-- run mail on folder (see `dired-bind-vm')
-  \\[dired-info]\t-- run info on file
-  \\[dired-man]\t-- run man on file
   \\[dired-do-find-marked-files]\t-- visit all marked files simultaneously
   \\[dired-omit-mode]\t-- toggle omitting of files
   \\[dired-mark-sexp]\t-- mark by Lisp expression
@@ -338,10 +317,8 @@ To see the options you can set, use \\[customize-group] RET dired-x RET.
 See also the functions:
   `dired-flag-extension'
   `dired-virtual'
-  `dired-man'
   `dired-vm'
   `dired-rmail'
-  `dired-info'
   `dired-do-find-marked-files'"
   (interactive)
   ;; These must be done in each new dired buffer.
@@ -1238,31 +1215,6 @@ NOSELECT the files are merely found but not selected."
 \f
 ;;; Miscellaneous commands
 
-;; Run man on files.
-
-(declare-function Man-getpage-in-background "man" (topic))
-
-(defvar manual-program) ; from man.el
-
-(defun dired-man ()
-  "Run `man' on this file."
-  ;; Used also to say: "Display old buffer if buffer name matches filename."
-  ;; but I have no idea what that means.
-  (interactive)
-  (require 'man)
-  (let* ((file (dired-get-filename))
-         (manual-program (string-replace "*" "%s"
-                          (dired-guess-shell-command
-                           "Man command: " (list file)))))
-    (Man-getpage-in-background file)))
-
-;; Run Info on files.
-
-(defun dired-info ()
-  "Run `info' on this file."
-  (interactive)
-  (info (dired-get-filename)))
-
 ;; Run mail on mail folders.
 
 (declare-function vm-visit-folder "ext:vm" (folder &optional read-only))
@@ -1596,6 +1548,8 @@ If `current-prefix-arg' is non-nil, uses name at point as guess."
 ;;; Epilog
 
 (define-obsolete-function-alias 'dired-x-submit-report 'report-emacs-bug "24.1")
+(define-obsolete-function-alias 'dired-man #'dired-do-man "29.1")
+(define-obsolete-function-alias 'dired-info #'dired-do-info "29.1")
 
 \f
 ;; As Barry Warsaw would say: "This might be useful..."
index 55e150e9e04e3d22c398c6cbf8d461395990a460..dc7400d46e0ef0dfbb5b9ecc06e23380ba29cac3 100644 (file)
@@ -2079,8 +2079,10 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
   "D"       #'dired-do-delete
   "G"       #'dired-do-chgrp
   "H"       #'dired-do-hardlink
+  "I"       #'dired-do-info
   "L"       #'dired-do-load
   "M"       #'dired-do-chmod
+  "N"       #'dired-do-man
   "O"       #'dired-do-chown
   "P"       #'dired-do-print
   "Q"       #'dired-do-find-regexp-and-replace
@@ -4795,6 +4797,31 @@ Interactively with prefix argument, read FILE-NAME."
              (read-file-name "Jump to Dired file: "))))
   (dired-jump t file-name))
 
+\f
+;;; Miscellaneous commands
+
+(declare-function Man-getpage-in-background "man" (topic))
+(declare-function dired-guess-shell-command "dired-x" (prompt files))
+(defvar manual-program) ; from man.el
+
+(defun dired-do-man ()
+  "Run `man' on this file."
+  (interactive)
+  (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))
+         (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)))
+
 (provide 'dired)
 
 (run-hooks 'dired-load-hook)           ; for your customizations