emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0bb6b2dd1e 2/2: Move dired-info and dired-man from dired-x to dir


From: Stefan Kangas
Subject: master 0bb6b2dd1e 2/2: Move dired-info and dired-man from dired-x to dired
Date: Sat, 2 Jul 2022 10:43:56 -0400 (EDT)

branch: master
commit 0bb6b2dd1eee72788bed6d16bc6e4502e52b4e1c
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Move dired-info and dired-man from dired-x to dired
    
    * 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  | 12 +++++++++++
 doc/misc/dired-x.texi | 22 -------------------
 etc/NEWS              | 19 ++++++++++++++++
 lisp/dired-x.el       | 60 ++++++---------------------------------------------
 lisp/dired.el         | 27 +++++++++++++++++++++++
 5 files changed, 65 insertions(+), 75 deletions(-)

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 9e14e0f9a9..c7ef097bfb 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -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)
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi
index 754ccf4065..504060f41f 100644
--- a/doc/misc/dired-x.texi
+++ b/doc/misc/dired-x.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 773e0849c2..d5f3459630 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1028,6 +1028,25 @@ so automatically.
 
 * 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').
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index ed7f71e006..21de913287 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -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."
 
 ;;; 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")
 
 
 ;; As Barry Warsaw would say: "This might be useful..."
diff --git a/lisp/dired.el b/lisp/dired.el
index 55e150e9e0..dc7400d46e 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -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))
 
+
+;;; 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]