Remove some function declarations, no longer needed or correct
[bpt/emacs.git] / lisp / dired.el
index f03e0ac..e4f297e 100644 (file)
@@ -1,10 +1,10 @@
 ;;; dired.el --- directory-browsing commands -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992-1997, 2000-2013 Free Software
+;; Copyright (C) 1985-1986, 1992-1997, 2000-2014 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: files
 ;; Package: emacs
 
@@ -34,6 +34,9 @@
 
 ;;; Code:
 
+(declare-function dired-buffer-more-recently-used-p
+                 "dired-x" (buffer1 buffer2))
+
 ;;; Customizable variables
 
 (defgroup dired nil
@@ -87,8 +90,8 @@ will fail to parse some \"unusual\" file names, e.g. those with leading
 spaces.  You might want to install ls from GNU Coreutils, which does
 support this option.  Alternatively, you might want to use Emacs's
 own emulation of \"ls\", by using:
-  \(setq ls-lisp-use-insert-directory-program nil)
-  \(require 'ls-lisp)
+  (setq ls-lisp-use-insert-directory-program nil)
+  (require 'ls-lisp)
 This is used by default on MS Windows, which does not have an \"ls\" program.
 Note that `ls-lisp' does not support as many options as GNU ls, though.
 For more details, see Info node `(emacs)ls in Lisp'."
@@ -204,7 +207,7 @@ You can customize key bindings or load extensions with this."
   :type 'hook)
 
 (defcustom dired-before-readin-hook nil
-  "This hook is run before a dired buffer is read in (created or reverted)."
+  "This hook is run before a Dired buffer is read in (created or reverted)."
   :group 'dired
   :type 'hook)
 
@@ -217,6 +220,13 @@ with the buffer narrowed to the listing."
 ;; Note this can't simply be run inside function `dired-ls' as the hook
 ;; functions probably depend on the dired-subdir-alist to be OK.
 
+(defcustom dired-initial-position-hook nil
+  "This hook is used to position the point.
+It is run by the function `dired-initial-position'."
+  :group 'dired
+  :type 'hook
+  :version "24.4")
+
 (defcustom dired-dnd-protocol-alist
   '(("^file:///" . dired-dnd-handle-local-file)
     ("^file://"  . dired-dnd-handle-file)
@@ -224,20 +234,20 @@ with the buffer narrowed to the listing."
   "The functions to call when a drop in `dired-mode' is made.
 See `dnd-protocol-alist' for more information.  When nil, behave
 as in other buffers.  Changing this option is effective only for
-new dired buffers."
+new Dired buffers."
   :type '(choice (repeat (cons (regexp) (function)))
                 (const :tag "Behave as in other buffers" nil))
   :version "22.1"
   :group 'dired)
 
 (defcustom dired-hide-details-hide-symlink-targets t
-  "If non-nil, `dired-hide-details-mode' hides symbolic link targets."
+  "Non-nil means `dired-hide-details-mode' hides symbolic link targets."
   :type 'boolean
   :version "24.4"
   :group 'dired)
 
 (defcustom dired-hide-details-hide-information-lines t
-  "Non-nil means hide lines other than header and file/dir lines."
+  "Non-nil means `dired-hide-details-mode' hides all but header and file lines."
   :type 'boolean
   :version "24.4"
   :group 'dired)
@@ -272,18 +282,18 @@ action argument symbol is `window-height' and its value is nil." "24.3")
 
 ;;;###autoload
 (defvar dired-directory nil
-  "The directory name or wildcard spec that this dired directory lists.
-Local to each dired buffer.  May be a list, in which case the car is the
+  "The directory name or wildcard spec that this Dired directory lists.
+Local to each Dired buffer.  May be a list, in which case the car is the
 directory name and the cdr is the list of files to mention.
 The directory name must be absolute, but need not be fully expanded.")
 
 ;; Beware of "-l;reboot" etc.  See bug#3230.
 (defun dired-safe-switches-p (switches)
-  "Return non-nil if string SWITCHES does not look risky for dired."
+  "Return non-nil if string SWITCHES does not look risky for Dired."
   (or (not switches)
       (and (stringp switches)
            (< (length switches) 100)    ; arbitrary
-           (string-match "\\` *-[- [:alnum:]]+\\'" switches))))
+           (string-match-p "\\` *-[- [:alnum:]]+\\'" switches))))
 
 (defvar dired-actual-switches nil
   "The value of `dired-listing-switches' used to make this buffer's text.")
@@ -323,10 +333,9 @@ Each subdirectory has an element: (DIRNAME . STARTMARKER).
 The order of elements is the reverse of the order in the buffer.
 In simple cases, this list contains one element.")
 
-(defvar dired-switches-alist nil
+(defvar-local dired-switches-alist nil
   "Keeps track of which switches to use for inserted subdirectories.
 This is an alist of the form (SUBDIR . SWITCHES).")
-(make-variable-buffer-local 'dired-switches-alist)
 
 (defvaralias 'dired-move-to-filename-regexp
   'directory-listing-before-filename-regexp)
@@ -353,11 +362,11 @@ Subexpression 2 must end right before the \\n or \\r.")
 
 (defface dired-mark
   '((t (:inherit font-lock-constant-face)))
-  "Face used for dired marks."
+  "Face used for Dired marks."
   :group 'dired-faces
   :version "22.1")
 (defvar dired-mark-face 'dired-mark
-  "Face name used for dired marks.")
+  "Face name used for Dired marks.")
 
 (defface dired-marked
   '((t (:inherit warning)))
@@ -556,8 +565,8 @@ For any other non-nil value of ARG, use the current file.
 If optional third arg SHOW-PROGRESS evaluates to non-nil,
 redisplay the dired buffer after each file is processed.
 
-No guarantee is made about the position on the marked line.  BODY
-must ensure this itself if it depends on this.
+No guarantee is made about the position on the marked line.
+BODY must ensure this itself if it depends on this.
 
 Search starts at the beginning of the buffer, thus the car of the
 list corresponds to the line nearest to the buffer's bottom.
@@ -625,7 +634,8 @@ Optional second argument ARG, if non-nil, specifies files near
  point instead of marked files.  It usually comes from the prefix
  argument.
   If ARG is an integer, use the next ARG files.
-  Any other non-nil value means to use the current file instead.
+  If ARG is any other non-nil value, return the current file name.
+  If no files are marked, and ARG is nil, also return the current file name.
 Optional third argument FILTER, if non-nil, is a function to select
   some of the files--those for which (funcall FILTER FILENAME) is non-nil.
 
@@ -724,7 +734,9 @@ Don't use that together with FILTER."
 
 (defun dired-file-name-at-point ()
   "Try to get a file name at point in the current dired buffer.
-This hook is intended to be put in `file-name-at-point-functions'."
+This hook is intended to be put in `file-name-at-point-functions'.
+Note that it returns an abbreviated name that can't be used
+as an argument to `dired-goto-file'."
   (let ((filename (dired-get-filename nil t)))
     (when filename
       (if (file-directory-p filename)
@@ -746,7 +758,7 @@ You can flag files for deletion with \\[dired-flag-file-deletion] and then
 delete them by typing \\[dired-do-flagged-delete].
 Type \\[describe-mode] after entering Dired for more info.
 
-If DIRNAME is already in a dired buffer, that buffer is used without refresh."
+If DIRNAME is already in a Dired buffer, that buffer is used without refresh."
   ;; Cannot use (interactive "D") because of wildcards.
   (interactive (dired-read-dir-and-switches ""))
   (switch-to-buffer (dired-noselect dirname switches)))
@@ -767,7 +779,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
 
 ;;;###autoload
 (defun dired-noselect (dir-or-list &optional switches)
-  "Like `dired' but returns the dired buffer as value, does not select it."
+  "Like `dired' but returns the Dired buffer as value, does not select it."
   (or dir-or-list (setq dir-or-list default-directory))
   ;; This loses the distinction between "/foo/*/" and "/foo/*" that
   ;; some shells make:
@@ -805,9 +817,9 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
             (equal (nth 5 attributes) modtime)))))
 
 (defun dired-buffer-stale-p (&optional noconfirm)
-  "Return non-nil if current dired buffer needs updating.
+  "Return non-nil if current Dired buffer needs updating.
 If NOCONFIRM is non-nil, then this function always returns nil
-for a remote directory.  This feature is used by Auto Revert Mode."
+for a remote directory.  This feature is used by Auto Revert mode."
   (let ((dirname
         (if (consp dired-directory) (car dired-directory) dired-directory)))
     (and (stringp dirname)
@@ -819,8 +831,8 @@ for a remote directory.  This feature is used by Auto Revert Mode."
         (dired-directory-changed-p dirname))))
 
 (defcustom dired-auto-revert-buffer nil
-  "Automatically revert dired buffer on revisiting.
-If t, revisiting an existing dired buffer automatically reverts it.
+  "Automatically revert Dired buffer on revisiting.
+If t, revisiting an existing Dired buffer automatically reverts it.
 If its value is a function, call this function with the directory
 name as single argument and revert the buffer if it returns non-nil.
 Otherwise, a message offering to revert the changed dired buffer
@@ -829,8 +841,8 @@ Note that this is not the same as `auto-revert-mode' that
 periodically reverts at specified time intervals."
   :type '(choice
           (const :tag "Don't revert" nil)
-          (const :tag "Always revert visited dired buffer" t)
-          (const :tag "Revert changed dired buffer" dired-directory-changed-p)
+          (const :tag "Always revert visited Dired buffer" t)
+          (const :tag "Revert changed Dired buffer" dired-directory-changed-p)
           (function :tag "Predicate function"))
   :group 'dired
   :version "23.2")
@@ -903,7 +915,7 @@ periodically reverts at specified time intervals."
   ;; Enlarged by dired-advertise
   ;; Queried by function dired-buffers-for-dir. When this detects a
   ;; killed buffer, it is removed from this list.
-  "Alist of expanded directories and their associated dired buffers.")
+  "Alist of expanded directories and their associated Dired buffers.")
 
 (defvar dired-find-subdir)
 
@@ -951,7 +963,7 @@ periodically reverts at specified time intervals."
 ;; Read in a new dired buffer
 
 (defun dired-readin ()
-  "Read in a new dired buffer.
+  "Read in a new Dired buffer.
 Differs from `dired-insert-subdir' in that it accepts
 wildcards, erases the buffer, and builds the subdir-alist anew
 \(including making it buffer-local and clearing it first)."
@@ -974,9 +986,8 @@ wildcards, erases the buffer, and builds the subdir-alist anew
       (run-hooks 'dired-before-readin-hook)
       (if (consp buffer-undo-list)
          (setq buffer-undo-list nil))
-      (make-local-variable 'file-name-coding-system)
-      (setq file-name-coding-system
-           (or coding-system-for-read file-name-coding-system))
+      (setq-local file-name-coding-system
+                  (or coding-system-for-read file-name-coding-system))
       (let ((inhibit-read-only t)
            ;; Don't make undo entries for readin.
            (buffer-undo-list t))
@@ -986,7 +997,7 @@ wildcards, erases the buffer, and builds the subdir-alist anew
       (goto-char (point-min))
       ;; Must first make alist buffer local and set it to nil because
       ;; dired-build-subdir-alist will call dired-clear-alist first
-      (set (make-local-variable 'dired-subdir-alist) nil)
+      (setq-local dired-subdir-alist nil)
       (dired-build-subdir-alist)
       (let ((attributes (file-attributes dirname)))
        (if (eq (car attributes) t)
@@ -1085,7 +1096,7 @@ BEG..END is the line where the file info is located."
          ;; We're now just in front of a field, with a space behind us.
          (let* ((curcol (current-column))
                 ;; Nums are right-aligned.
-                (num-align (looking-at "[0-9]"))
+                (num-align (looking-at-p "[0-9]"))
                 ;; Let's look at the other line, in the same column: we
                 ;; should be either near the end of the previous field, or
                 ;; in the space between that field and the next.
@@ -1131,10 +1142,22 @@ BEG..END is the line where the file info is located."
 
 (defvar ls-lisp-use-insert-directory-program)
 
+(defun dired-check-switches (switches short &optional long)
+  "Return non-nil if the string SWITCHES matches LONG or SHORT format."
+  (let (case-fold-search)
+    (and (stringp switches)
+        (string-match-p (concat "\\(\\`\\| \\)-[[:alnum:]]*" short
+                                (if long (concat "\\|--" long "\\>") ""))
+                        switches))))
+
 (defun dired-switches-escape-p (switches)
   "Return non-nil if the string SWITCHES contains -b or --escape."
   ;; Do not match things like "--block-size" that happen to contain "b".
-  (string-match "\\(\\`\\| \\)-[[:alnum:]]*b\\|--escape\\>" switches))
+  (dired-check-switches switches "b" "escape"))
+
+(defun dired-switches-recursive-p (switches)
+  "Return non-nil if the string SWITCHES contains -R or --recursive."
+  (dired-check-switches switches "R" "recursive"))
 
 (defun dired-insert-directory (dir switches &optional file-list wildcard hdr)
   "Insert a directory listing of DIR, Dired style.
@@ -1212,7 +1235,7 @@ see `dired-use-ls-dired' for more details.")
     ;; Otherwise, indent them.
     (unless (save-excursion
              (goto-char opoint)
-             (looking-at "  "))
+             (looking-at-p "  "))
       (let ((indent-tabs-mode nil))
        (indent-rigidly opoint (point) 2)))
     ;; Insert text at the beginning to standardize things.
@@ -1237,32 +1260,33 @@ see `dired-use-ls-dired' for more details.")
   (save-excursion
     (goto-char beg)
     (while (< (point) end)
-      (condition-case nil
-         (if (not (dired-move-to-filename))
+      (ignore-errors
+       (if (not (dired-move-to-filename))
+           (unless (or (looking-at-p "^$")
+                       (looking-at-p dired-subdir-regexp))
              (put-text-property (line-beginning-position)
                                 (1+ (line-end-position))
-                                'invisible 'dired-hide-details-information)
-           (put-text-property (+ (line-beginning-position) 1) (1- (point))
-                              'invisible 'dired-hide-details-detail)
-           (add-text-properties
-            (point)
-            (progn
-              (dired-move-to-end-of-filename)
-              (point))
-            '(mouse-face
-              highlight
-              dired-filename t
-              help-echo "mouse-2: visit this file in other window"))
-           (when (< (+ (point) 4) (line-end-position))
-             (put-text-property (+ (point) 4) (line-end-position)
-                                'invisible 'dired-hide-details-link)))
-       (error nil))
+                                'invisible 'dired-hide-details-information))
+         (put-text-property (+ (line-beginning-position) 1) (1- (point))
+                            'invisible 'dired-hide-details-detail)
+         (add-text-properties
+          (point)
+          (progn
+            (dired-move-to-end-of-filename)
+            (point))
+          '(mouse-face
+            highlight
+            dired-filename t
+            help-echo "mouse-2: visit this file in other window"))
+         (when (< (+ (point) 4) (line-end-position))
+           (put-text-property (+ (point) 4) (line-end-position)
+                              'invisible 'dired-hide-details-link))))
       (forward-line 1))))
 \f
 ;; Reverting a dired buffer
 
 (defun dired-revert (&optional _arg _noconfirm)
-  "Reread the dired buffer.
+  "Reread the Dired buffer.
 Must also be called after `dired-actual-switches' have changed.
 Should not fail even on completely garbaged buffers.
 Preserves old cursor, marks/flags, hidden-p.
@@ -1313,7 +1337,7 @@ ARG and NOCONFIRM, passed from `revert-buffer', are ignored."
   "Return current positions in the buffer and all windows with this directory.
 The positions have the form (BUFFER-POSITION WINDOW-POSITIONS).
 
-BUFFER-POSITION is the point position in the current dired buffer.
+BUFFER-POSITION is the point position in the current Dired buffer.
 It has the form (BUFFER DIRED-FILENAME BUFFER-POINT).
 
 WINDOW-POSITIONS are current positions in all windows displaying
@@ -1390,17 +1414,15 @@ Each element of ALIST looks like (FILE . MARKERCHAR)."
 (defun dired-insert-old-subdirs (old-subdir-alist)
   "Try to insert all subdirs that were displayed before.
 Do so according to the former subdir alist OLD-SUBDIR-ALIST."
-  (or (string-match "R" dired-actual-switches)
+  (or (dired-switches-recursive-p dired-actual-switches)
       (let (elt dir)
        (while old-subdir-alist
          (setq elt (car old-subdir-alist)
                old-subdir-alist (cdr old-subdir-alist)
                dir (car elt))
-         (condition-case ()
-             (progn
-               (dired-uncache dir)
-               (dired-insert-subdir dir))
-           (error nil))))))
+         (ignore-errors
+           (dired-uncache dir)
+           (dired-insert-subdir dir))))))
 
 (defun dired-uncache (dir)
   "Remove directory DIR from any directory cache."
@@ -1629,7 +1651,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
                  :help "Incrementally search for string in file names only."))
     (define-key map [menu-bar immediate compare-directories]
       '(menu-item "Compare Directories..." dired-compare-directories
-                 :help "Mark files with different attributes in two dired buffers"))
+                 :help "Mark files with different attributes in two Dired buffers"))
     (define-key map [menu-bar immediate backup-diff]
       '(menu-item "Compare with Backup" dired-backup-diff
                  :help "Diff file at cursor with its latest backup"))
@@ -1653,7 +1675,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
                  :help "Create a directory"))
     (define-key map [menu-bar immediate wdired-mode]
       '(menu-item "Edit File Names" wdired-change-to-wdired-mode
-                 :help "Put a dired buffer in a mode in which filenames are editable"
+                 :help "Put a Dired buffer in a mode in which filenames are editable"
                  :keys "C-x C-q"
                  :filter (lambda (x) (if (eq major-mode 'dired-mode) x))))
 
@@ -1778,22 +1800,22 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
     (define-key map
       [menu-bar operate epa-dired-do-decrypt]
       '(menu-item "Decrypt..." epa-dired-do-decrypt
-                 :help "Decrypt file at cursor"))
+                 :help "Decrypt current or marked files"))
 
     (define-key map
       [menu-bar operate epa-dired-do-verify]
       '(menu-item "Verify" epa-dired-do-verify
-                 :help "Verify digital signature of file at cursor"))
+                 :help "Verify digital signature of current or marked files"))
 
     (define-key map
       [menu-bar operate epa-dired-do-sign]
       '(menu-item "Sign..." epa-dired-do-sign
-                 :help "Create digital signature of file at cursor"))
+                 :help "Create digital signature of current or marked files"))
 
     (define-key map
       [menu-bar operate epa-dired-do-encrypt]
       '(menu-item "Encrypt..." epa-dired-do-encrypt
-                 :help "Encrypt file at cursor"))
+                 :help "Encrypt current or marked files"))
 
     (define-key map [menu-bar operate dashes-3]
       '("--"))
@@ -1860,7 +1882,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
                  :help "Copy current file or all marked files"))
 
     map)
-  "Local keymap for `dired-mode' buffers.")
+  "Local keymap for Dired mode buffers.")
 \f
 ;; Dired mode is suitable only for specially formatted data.
 (put 'dired-mode 'mode-class 'special)
@@ -1871,7 +1893,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST."
   "\
 Mode for \"editing\" directory listings.
 In Dired, you are \"editing\" a list of the files in a directory and
-  \(optionally) its subdirectories, in the format of `ls -lR'.
+  (optionally) its subdirectories, in the format of `ls -lR'.
   Each directory is a page: use \\[backward-page] and \\[forward-page] to move pagewise.
 \"Editing\" means that you can run shell commands on files, visit,
   compress, load or byte-compile them, change their file attributes
@@ -1893,7 +1915,7 @@ Type \\[dired-unmark-backward] to back up one line and unmark or unflag.
 Type \\[dired-do-flagged-delete] to delete (eXecute) the files flagged `D'.
 Type \\[dired-find-file] to Find the current line's file
   (or dired it in another buffer, if it is a directory).
-Type \\[dired-find-file-other-window] to find file or dired directory in Other window.
+Type \\[dired-find-file-other-window] to find file or Dired directory in Other window.
 Type \\[dired-maybe-insert-subdir] to Insert a subdirectory in this buffer.
 Type \\[dired-do-rename] to Rename a file or move the marked files to another directory.
 Type \\[dired-do-copy] to Copy files.
@@ -1945,31 +1967,25 @@ Keybindings:
   ;; Ignore dired-hide-details-* value of invisible text property by default.
   (when (eq buffer-invisibility-spec t)
     (setq buffer-invisibility-spec (list t)))
-  (set (make-local-variable 'revert-buffer-function)
-       (function dired-revert))
-  (set (make-local-variable 'buffer-stale-function)
-       (function dired-buffer-stale-p))
-  (set (make-local-variable 'page-delimiter)
-       "\n\n")
-  (set (make-local-variable 'dired-directory)
-       (or dirname default-directory))
+  (setq-local revert-buffer-function (function dired-revert))
+  (setq-local buffer-stale-function (function dired-buffer-stale-p))
+  (setq-local page-delimiter "\n\n")
+  (setq-local dired-directory (or dirname default-directory))
   ;; list-buffers uses this to display the dir being edited in this buffer.
   (setq list-buffers-directory
        (expand-file-name (if (listp dired-directory)
                              (car dired-directory)
                            dired-directory)))
-  (set (make-local-variable 'dired-actual-switches)
-       (or switches dired-listing-switches))
-  (set (make-local-variable 'font-lock-defaults)
-       '(dired-font-lock-keywords t nil nil beginning-of-line))
-  (set (make-local-variable 'desktop-save-buffer)
-       'dired-desktop-buffer-misc-data)
+  (setq-local dired-actual-switches (or switches dired-listing-switches))
+  (setq-local font-lock-defaults
+              '(dired-font-lock-keywords t nil nil beginning-of-line))
+  (setq-local desktop-save-buffer 'dired-desktop-buffer-misc-data)
   (setq dired-switches-alist nil)
   (hack-dir-local-variables-non-file-buffer) ; before sorting
   (dired-sort-other dired-actual-switches t)
   (when (featurep 'dnd)
-    (set (make-local-variable 'dnd-protocol-alist)
-        (append dired-dnd-protocol-alist dnd-protocol-alist)))
+    (setq-local dnd-protocol-alist
+                (append dired-dnd-protocol-alist dnd-protocol-alist)))
   (add-hook 'file-name-at-point-functions 'dired-file-name-at-point nil t)
   (add-hook 'isearch-mode-hook 'dired-isearch-filenames-setup nil t)
   (run-mode-hooks 'dired-mode-hook))
@@ -1977,7 +1993,7 @@ Keybindings:
 ;; Idiosyncratic dired commands that don't deal with marks.
 
 (defun dired-summary ()
-  "Summarize basic Dired commands and show recent dired errors."
+  "Summarize basic Dired commands and show recent Dired errors."
   (interactive)
   (dired-why)
   ;>> this should check the key-bindings and use substitute-command-keys if non-standard
@@ -1985,14 +2001,14 @@ Keybindings:
    "d-elete, u-ndelete, x-punge, f-ind, o-ther window, R-ename, C-opy, h-elp"))
 
 (defun dired-undo ()
-  "Undo in a dired buffer.
+  "Undo in a Dired buffer.
 This doesn't recover lost files, it just undoes changes in the buffer itself.
 You can use it to recover marks, killed lines or subdirs."
   (interactive)
   (let ((inhibit-read-only t))
     (undo))
   (dired-build-subdir-alist)
-  (message "Change in dired buffer undone.
+  (message "Change in Dired buffer undone.
 Actual changes in files cannot be undone by Emacs."))
 
 (defun dired-toggle-read-only ()
@@ -2025,7 +2041,7 @@ Optional prefix ARG says how many lines to move; default is one line."
   (dired-next-line (- (or arg 1))))
 
 (defun dired-next-dirline (arg &optional opoint)
-  "Goto ARG'th next directory file line."
+  "Goto ARGth next directory file line."
   (interactive "p")
   (or opoint (setq opoint (point)))
   (if (if (> arg 0)
@@ -2037,14 +2053,16 @@ Optional prefix ARG says how many lines to move; default is one line."
     (error "No more subdirectories")))
 
 (defun dired-prev-dirline (arg)
-  "Goto ARG'th previous directory file line."
+  "Goto ARGth previous directory file line."
   (interactive "p")
   (dired-next-dirline (- arg)))
 
 (defun dired-up-directory (&optional other-window)
   "Run Dired on parent directory of current directory.
 Find the parent directory either in this buffer or another buffer.
-Creates a buffer if necessary."
+Creates a buffer if necessary.
+If OTHER-WINDOW (the optional prefix arg), display the parent
+directory in another window."
   (interactive "P")
   (let* ((dir (dired-current-directory))
         (up (file-name-directory (directory-file-name dir))))
@@ -2071,7 +2089,7 @@ Creates a buffer if necessary."
        file-name
       (if (file-symlink-p file-name)
          (error "File is a symlink to a nonexistent target")
-       (error "File no longer exists; type `g' to update dired buffer")))))
+       (error "File no longer exists; type `g' to update Dired buffer")))))
 
 ;; Force C-m keybinding rather than `f' or `e' in the mode doc:
 (define-obsolete-function-alias 'dired-advertised-find-file 'dired-find-file "23.2")
@@ -2084,7 +2102,7 @@ Creates a buffer if necessary."
     (find-file (dired-get-file-for-visit))))
 
 (defun dired-find-alternate-file ()
-  "In Dired, visit this file or directory instead of the dired buffer."
+  "In Dired, visit this file or directory instead of the Dired buffer."
   (interactive)
   (set-buffer-modified-p nil)
   (find-alternate-file (dired-get-file-for-visit)))
@@ -2132,7 +2150,8 @@ Otherwise, display it in another buffer."
 (defun dired-display-file ()
   "In Dired, display this file or directory in another window."
   (interactive)
-  (display-buffer (find-file-noselect (dired-get-file-for-visit))))
+  (display-buffer (find-file-noselect (dired-get-file-for-visit))
+                 t))
 \f
 ;;; Functions for extracting and manipulating file names in Dired buffers.
 
@@ -2266,10 +2285,13 @@ unchanged."
       (substring file (match-end 0))
     file))
 \f
-;;; Minor mode for hiding details
-;;;###autoload
 (define-minor-mode dired-hide-details-mode
-  "Hide details in `dired-mode'."
+  "Toggle visibility of detailed information in current Dired buffer.
+When this minor mode is enabled, details such as file ownership and
+permissions are hidden from view.
+
+See options: `dired-hide-details-hide-symlink-targets' and
+`dired-hide-details-hide-information-lines'."
   :group 'dired
   (unless (derived-mode-p 'dired-mode)
     (error "Not a Dired buffer"))
@@ -2339,9 +2361,8 @@ Return the position of the beginning of the filename, or nil if none found."
   ;; This is the UNIX version.
   (if (get-text-property (point) 'dired-filename)
       (goto-char (next-single-property-change (point) 'dired-filename))
-    (let (opoint file-type executable symlink hidden case-fold-search used-F eol)
-      ;; case-fold-search is nil now, so we can test for capital F:
-      (setq used-F (string-match "F" dired-actual-switches)
+    (let (opoint file-type executable symlink hidden used-F eol)
+      (setq used-F (dired-check-switches dired-actual-switches "F" "classify")
            opoint (point)
            eol (line-end-position)
            hidden (and selective-display
@@ -2401,7 +2422,7 @@ Return the position of the beginning of the filename, or nil if none found."
   "Copy names of marked (or next ARG) files into the kill ring.
 The names are separated by a space.
 With a zero prefix arg, use the absolute file name of each marked file.
-With \\[universal-argument], use the file name relative to the dired buffer's
+With \\[universal-argument], use the file name relative to the Dired buffer's
 `default-directory'.  (This still may contain slashes if in a subdirectory.)
 
 If on a subdir headerline, use absolute subdirname instead;
@@ -2452,9 +2473,9 @@ You can then feed the file name(s) to other commands with \\[yank]."
                   (if (stringp dired-directory)
                       (let ((wildcards (file-name-nondirectory
                                         dired-directory)))
-                        (or (= 0 (length wildcards))
-                            (string-match (dired-glob-regexp wildcards)
-                                          file)))
+                        (or (zerop (length wildcards))
+                            (string-match-p (dired-glob-regexp wildcards)
+                                             file)))
                     (member (expand-file-name file dir)
                             (cdr dired-directory))))
               (setq result (cons buf result)))))))
@@ -2481,7 +2502,7 @@ You can then feed the file name(s) to other commands with \\[yank]."
                       (if (= (aref pattern (1+ set-start)) ?^)
                           (+ 3 set-start)
                         (+ 2 set-start)))
-                     (set-end (string-match "]" pattern set-cont))
+                     (set-end (string-match-p "]" pattern set-cont))
                      (set (substring pattern set-start (1+ set-end))))
                 (setq regexp (concat regexp set))
                 (setq matched-in-pattern (1+ set-end))))
@@ -2521,7 +2542,7 @@ You can then feed the file name(s) to other commands with \\[yank]."
 (defun dired-in-this-tree (file dir)
   ;;"Is FILE part of the directory tree starting at DIR?"
   (let (case-fold-search)
-    (string-match (concat "^" (regexp-quote dir)) file)))
+    (string-match-p (concat "^" (regexp-quote dir)) file)))
 
 (defun dired-normalize-subdir (dir)
   ;; Prepend default-directory to DIR if relative file name.
@@ -2603,7 +2624,7 @@ instead of `dired-actual-switches'."
           (R-ftp-base-dir-regex
            ;; Used to expand subdirectory names correctly in recursive
            ;; ange-ftp listings.
-           (and (string-match "R" switches)
+           (and (dired-switches-recursive-p switches)
                 (string-match "\\`/.*:\\(/.*\\)" default-directory)
                 (concat "\\`" (match-string 1 default-directory)))))
       (goto-char (point-min))
@@ -2615,7 +2636,7 @@ instead of `dired-actual-switches'."
                  (goto-char (match-beginning 0))
                  (beginning-of-line)
                  (forward-char 2)
-                 (save-match-data (looking-at dired-re-perms)))
+                 (looking-at-p dired-re-perms))
          (save-excursion
            (goto-char (match-beginning 1))
            (setq new-dir-name
@@ -2673,9 +2694,9 @@ instead of `dired-actual-switches'."
   (dired-goto-next-file);; so there is a file to compare with
   (if (stringp dired-trivial-filenames)
       (while (and (not (eobp))
-                 (string-match dired-trivial-filenames
-                               (file-name-nondirectory
-                                (or (dired-get-filename nil t) ""))))
+                 (string-match-p dired-trivial-filenames
+                                  (file-name-nondirectory
+                                   (or (dired-get-filename nil t) ""))))
        (forward-line 1)
        (dired-move-to-filename))))
 
@@ -2685,7 +2706,7 @@ instead of `dired-actual-switches'."
       (forward-line 1))))
 
 (defun dired-goto-file (file)
-  "Go to line describing file FILE in this dired buffer."
+  "Go to line describing file FILE in this Dired buffer."
   ;; Return value of point on success, else nil.
   ;; FILE must be an absolute file name.
   ;; Loses if FILE contains control chars like "\007" for which ls
@@ -2734,7 +2755,7 @@ as returned by `dired-get-filename'.  LIMIT is the search limit."
     (setq str (replace-regexp-in-string "\^m" "\\^m"  file nil t))
     (setq str (replace-regexp-in-string "\\\\" "\\\\" str nil t))
     (and (dired-switches-escape-p dired-actual-switches)
-        (string-match "[ \t\n]" str)
+        (string-match-p "[ \t\n]" str)
         ;; FIXME: to fix this for embedded control characters etc, we
         ;; should escape everything that `ls -b' does.
         (setq str (replace-regexp-in-string " " "\\ "  str nil t)
@@ -2758,11 +2779,13 @@ as returned by `dired-get-filename'.  LIMIT is the search limit."
 ;; FIXME document whatever dired-x is doing.
 (defun dired-initial-position (dirname)
   "Where point should go in a new listing of DIRNAME.
-Point assumed at beginning of new subdir line."
+Point is assumed to be at the beginning of new subdir line.
+It runs the hook `dired-initial-position-hook'."
   (end-of-line)
   (and (featurep 'dired-x) dired-find-subdir
        (dired-goto-subdir dirname))
-  (if dired-trivial-filenames (dired-goto-next-nontrivial-file)))
+  (if dired-trivial-filenames (dired-goto-next-nontrivial-file))
+  (run-hooks 'dired-initial-position-hook))
 \f
 ;; These are hooks which make tree dired work.
 ;; They are in this file because other parts of dired need to call them.
@@ -2897,11 +2920,7 @@ non-empty directories is allowed."
   (let* ((files (mapcar (function car) l))
         (count (length l))
         (succ 0)
-        (trashing (and trash delete-by-moving-to-trash))
-        (progress-reporter
-         (make-progress-reporter
-          (if trashing "Trashing..." "Deleting...")
-          succ count)))
+        (trashing (and trash delete-by-moving-to-trash)))
     ;; canonicalize file list for pop up
     (setq files (nreverse (mapcar (function dired-make-relative) files)))
     (if (dired-mark-pop-up
@@ -2910,7 +2929,11 @@ non-empty directories is allowed."
                 (if trashing "Trash" "Delete")
                 (dired-mark-prompt arg files)))
        (save-excursion
-         (let (failures);; files better be in reverse order for this loop!
+         (let ((progress-reporter
+                (make-progress-reporter
+                 (if trashing "Trashing..." "Deleting...")
+                 succ count))
+               failures) ;; files better be in reverse order for this loop!
            (while l
              (goto-char (cdr (car l)))
              (let ((inhibit-read-only t))
@@ -2923,7 +2946,7 @@ non-empty directories is allowed."
                      (dired-fun-in-all-buffers
                       (file-name-directory fn) (file-name-nondirectory fn)
                       (function dired-delete-entry) fn))
-                 (error;; catch errors from failed deletions
+                 (error ;; catch errors from failed deletions
                   (dired-log "%s\n" err)
                   (setq failures (cons (car (car l)) failures)))))
              (setq l (cdr l)))
@@ -2980,7 +3003,7 @@ also offers to kill buffers visiting deleted files and directories."
            (kill-buffer buf)))
     (let ((buf-list (dired-buffers-for-dir (expand-file-name fn))))
       (and buf-list
-           (y-or-n-p (format "Kill dired buffer%s of %s, too? "
+           (y-or-n-p (format "Kill Dired buffer%s of %s, too? "
                              (dired-plural-s (length buf-list))
                              (file-name-nondirectory fn)))
            (dolist (buf buf-list)
@@ -3069,33 +3092,35 @@ FILES is the list of marked files.  It can also be (t FILENAME)
 in the case of one marked file, to distinguish that from using
 just the current file.
 
-FUNCTION should not manipulate files, just read input \(an
+FUNCTION should not manipulate files, just read input (an
 argument or confirmation)."
   (if (or (eq dired-no-confirm t)
          (memq op-symbol dired-no-confirm)
          ;; If FILES defaulted to the current line's file.
          (= (length files) 1))
       (apply function args)
-    (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*"))))
+    (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*")))
+         ;; Mark *Marked Files* window as softly-dedicated, to prevent
+         ;; other buffers e.g. *Completions* from reusing it (bug#17554).
+         (display-buffer-mark-dedicated 'soft))
       (with-current-buffer buffer
-       (let ((split-height-threshold 0))
-         (with-temp-buffer-window
-          buffer
-          (cons 'display-buffer-below-selected
-                '((window-height . fit-window-to-buffer)))
-          #'(lambda (window _value)
-              (with-selected-window window
-                (unwind-protect
-                    (apply function args)
-                  (when (window-live-p window)
-                    (quit-restore-window window 'kill)))))
-          ;; Handle (t FILE) just like (FILE), here.  That value is
-          ;; used (only in some cases), to mean just one file that was
-          ;; marked, rather than the current line file.
-          (dired-format-columns-of-files
-           (if (eq (car files) t) (cdr files) files))
-          (remove-text-properties (point-min) (point-max)
-                                  '(mouse-face nil help-echo nil))))))))
+       (with-current-buffer-window
+        buffer
+        (cons 'display-buffer-below-selected
+              '((window-height . fit-window-to-buffer)))
+        #'(lambda (window _value)
+            (with-selected-window window
+              (unwind-protect
+                  (apply function args)
+                (when (window-live-p window)
+                  (quit-restore-window window 'kill)))))
+        ;; Handle (t FILE) just like (FILE), here.  That value is
+        ;; used (only in some cases), to mean just one file that was
+        ;; marked, rather than the current line file.
+        (dired-format-columns-of-files
+         (if (eq (car files) t) (cdr files) files))
+        (remove-text-properties (point-min) (point-max)
+                                '(mouse-face nil help-echo nil)))))))
 
 (defun dired-format-columns-of-files (files)
   (let ((beg (point)))
@@ -3135,7 +3160,9 @@ argument or confirmation)."
   (save-excursion (not (dired-move-to-filename))))
 
 (defun dired-next-marked-file (arg &optional wrap opoint)
-  "Move to the next marked file, wrapping around the end of the buffer."
+  "Move to the next marked file.
+If WRAP is non-nil, wrap around to the beginning of the buffer if
+we reach the end."
   (interactive "p\np")
   (or opoint (setq opoint (point)));; return to where interactively started
   (if (if (> arg 0)
@@ -3152,7 +3179,9 @@ argument or confirmation)."
       (dired-next-marked-file arg nil opoint))))
 
 (defun dired-prev-marked-file (arg &optional wrap)
-  "Move to the previous marked file, wrapping around the end of the buffer."
+  "Move to the previous marked file.
+If WRAP is non-nil, wrap around to the end of the buffer if we
+reach the beginning of the buffer."
   (interactive "p\np")
   (dired-next-marked-file (- arg) wrap))
 
@@ -3174,7 +3203,7 @@ argument or confirmation)."
       ;; Skip subdir line and following garbage like the `total' line:
       (while (and (< (point) end) (dired-between-files))
        (forward-line 1))
-      (if (and (not (looking-at dired-re-dot))
+      (if (and (not (looking-at-p dired-re-dot))
               (dired-get-filename nil t))
          (progn
            (delete-char 1)
@@ -3255,7 +3284,7 @@ As always, hidden subdirs are not affected."
     (let ((inhibit-read-only t))
       (while (not (eobp))
         (or (dired-between-files)
-            (looking-at dired-re-dot)
+            (looking-at-p dired-re-dot)
             ;; use subst instead of insdel because it does not move
             ;; the gap and thus should be faster and because
             ;; other characters are left alone automatically
@@ -3272,6 +3301,7 @@ As always, hidden subdirs are not affected."
   "History list of regular expressions used in Dired commands.")
 
 (defun dired-read-regexp (prompt &optional default history)
+  "Read a regexp using `read-regexp'."
   (read-regexp prompt default (or history 'dired-regexp-history)))
 
 (defun dired-mark-files-regexp (regexp &optional marker-char)
@@ -3287,10 +3317,10 @@ object files--just `.o' will mark more than you might think."
         (if current-prefix-arg ?\040)))
   (let ((dired-marker-char (or marker-char dired-marker-char)))
     (dired-mark-if
-     (and (not (looking-at dired-re-dot))
+     (and (not (looking-at-p dired-re-dot))
          (not (eolp))                  ; empty line
          (let ((fn (dired-get-filename t t)))
-           (and fn (string-match regexp fn))))
+           (and fn (string-match-p regexp fn))))
      "matching file")))
 
 (defun dired-mark-files-containing-regexp (regexp &optional marker-char)
@@ -3303,7 +3333,7 @@ A prefix argument means to unmark them instead.
         (if current-prefix-arg ?\040)))
   (let ((dired-marker-char (or marker-char dired-marker-char)))
     (dired-mark-if
-     (and (not (looking-at dired-re-dot))
+     (and (not (looking-at-p dired-re-dot))
          (not (eolp))                  ; empty line
          (let ((fn (dired-get-filename nil t)))
            (when (and fn (file-readable-p fn)
@@ -3337,15 +3367,15 @@ The match is against the non-directory part of the filename.  Use `^'
 With prefix argument, unmark or unflag all those files."
   (interactive "P")
   (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
-    (dired-mark-if (looking-at dired-re-sym) "symbolic link")))
+    (dired-mark-if (looking-at-p dired-re-sym) "symbolic link")))
 
 (defun dired-mark-directories (unflag-p)
   "Mark all directory file lines except `.' and `..'.
 With prefix argument, unmark or unflag all those files."
   (interactive "P")
   (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
-    (dired-mark-if (and (looking-at dired-re-dir)
-                       (not (looking-at dired-re-dot)))
+    (dired-mark-if (and (looking-at-p dired-re-dir)
+                       (not (looking-at-p dired-re-dot)))
                   "directory file")))
 
 (defun dired-mark-executables (unflag-p)
@@ -3353,7 +3383,7 @@ With prefix argument, unmark or unflag all those files."
 With prefix argument, unmark or unflag all those files."
   (interactive "P")
   (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
-    (dired-mark-if (looking-at dired-re-exe) "executable file")))
+    (dired-mark-if (looking-at-p dired-re-exe) "executable file")))
 
 ;; dired-x.el has a dired-mark-sexp interactive command: mark
 ;; files for which PREDICATE returns non-nil.
@@ -3377,7 +3407,7 @@ A prefix argument says to unmark or unflag those files instead."
                                (progn
                                  (forward-char -1)
                                  (eq (preceding-char) ?#)))))
-         (not (looking-at dired-re-dir))
+         (not (looking-at-p dired-re-dir))
          (let ((fn (dired-get-filename t t)))
            (if fn (auto-save-file-name-p
                    (file-name-nondirectory fn)))))
@@ -3415,7 +3445,7 @@ With prefix argument, unmark or unflag these files."
                          (if (eq (preceding-char) ?*)
                              (forward-char -1))
                          (eq (preceding-char) ?~))
-         (not (looking-at dired-re-dir))
+         (not (looking-at-p dired-re-dir))
          (let ((fn (dired-get-filename t t)))
            (if fn (backup-file-name-p fn))))
      "backup file")))
@@ -3444,7 +3474,7 @@ OLD and NEW are both characters used to mark files."
                                    (match-end 0) old new)))))))
 
 (defun dired-unmark-all-marks ()
-  "Remove all marks from all files in the dired buffer."
+  "Remove all marks from all files in the Dired buffer."
   (interactive)
   (dired-unmark-all-files ?\r))
 
@@ -3551,12 +3581,12 @@ or nil if file names are not applicable."
 ;; So anything that does not contain these is sort "by name".
 
 (defvar dired-ls-sorting-switches "SXU"
-  "String of `ls' switches \(single letters\) except \"t\" that influence sorting.
+  "String of `ls' switches (single letters) except \"t\" that influence sorting.
 
 This indicates to Dired which option switches to watch out for because they
 will change the sorting order behavior of `ls'.
 
-To change the default sorting order \(e.g. add a `-v' option\), see the
+To change the default sorting order (e.g. add a `-v' option), see the
 variable `dired-listing-switches'.  To temporarily override the listing
 format, use `\\[universal-argument] \\[dired]'.")
 
@@ -3575,7 +3605,7 @@ format, use `\\[universal-argument] \\[dired]'.")
 
 (defvar dired-sort-inhibit nil
   "Non-nil means the Dired sort command is disabled.
-The idea is to set this buffer-locally in special dired buffers.")
+The idea is to set this buffer-locally in special Dired buffers.")
 
 (defun dired-sort-set-mode-line ()
   ;; Set mode line display according to dired-actual-switches.
@@ -3585,10 +3615,10 @@ The idea is to set this buffer-locally in special dired buffers.")
   (when (eq major-mode 'dired-mode)
     (setq mode-name
          (let (case-fold-search)
-           (cond ((string-match
+           (cond ((string-match-p
                    dired-sort-by-name-regexp dired-actual-switches)
                   "Dired by name")
-                 ((string-match
+                 ((string-match-p
                    dired-sort-by-date-regexp dired-actual-switches)
                   "Dired by date")
                  (t
@@ -3603,7 +3633,7 @@ The idea is to set this buffer-locally in special dired buffers.")
 With a prefix argument, edit the current listing switches instead."
   (interactive "P")
   (when dired-sort-inhibit
-    (error "Cannot sort this dired buffer"))
+    (error "Cannot sort this Dired buffer"))
   (if arg
       (dired-sort-other
        (read-string "ls switches (must contain -l): " dired-actual-switches))
@@ -3611,8 +3641,8 @@ With a prefix argument, edit the current listing switches instead."
 
 (defun dired-sort-toggle ()
   ;; Toggle between sort by date/name.  Reverts the buffer.
-  (let ((sorting-by-date (string-match dired-sort-by-date-regexp
-                                      dired-actual-switches))
+  (let ((sorting-by-date (string-match-p dired-sort-by-date-regexp
+                                         dired-actual-switches))
        ;; Regexp for finding (possibly embedded) -t switches.
        (switch-regexp "\\(\\`\\| \\)-\\([a-su-zA-Z]*\\)\\(t\\)\\([^ ]*\\)")
        case-fold-search)
@@ -3626,6 +3656,7 @@ With a prefix argument, edit the current listing switches instead."
        ;; Remove a switch of the form -XtY for some X and Y.
        (setq dired-actual-switches
              (replace-match "" t t dired-actual-switches 3))))
+
     ;; Now, if we weren't sorting by date before, add the -t switch.
     ;; Some simple-minded ls implementations (eg ftp servers) only
     ;; allow a single option string, so try not to add " -t" if possible.
@@ -3653,7 +3684,7 @@ With a prefix argument, edit the current listing switches instead."
     (concat result (substring string start))))
 
 (defun dired-sort-other (switches &optional no-revert)
-  "Specify new `ls' SWITCHES for current dired buffer.
+  "Specify new `ls' SWITCHES for current Dired buffer.
 Values matching `dired-sort-by-date-regexp' or `dired-sort-by-name-regexp'
 set the minor mode accordingly, others appear literally in the mode line.
 With optional second arg NO-REVERT, don't refresh the listing afterwards."
@@ -3662,9 +3693,8 @@ With optional second arg NO-REVERT, don't refresh the listing afterwards."
   (dired-sort-set-mode-line)
   (or no-revert (revert-buffer)))
 
-(defvar dired-subdir-alist-pre-R nil
+(defvar-local dired-subdir-alist-pre-R nil
   "Value of `dired-subdir-alist' before -R switch added.")
-(make-variable-buffer-local 'dired-subdir-alist-pre-R)
 
 (defun dired-sort-R-check (switches)
   "Additional processing of -R in ls option string SWITCHES.
@@ -3672,12 +3702,12 @@ Saves `dired-subdir-alist' when R is set and restores saved value
 minus any directories explicitly deleted when R is cleared.
 To be called first in body of `dired-sort-other', etc."
   (cond
-   ((and (string-match "R" switches)
-        (not (string-match "R" dired-actual-switches)))
+   ((and (dired-switches-recursive-p switches)
+        (not (dired-switches-recursive-p dired-actual-switches)))
     ;; Adding -R to ls switches -- save `dired-subdir-alist':
     (setq dired-subdir-alist-pre-R dired-subdir-alist))
-   ((and (string-match "R" dired-actual-switches)
-        (not (string-match "R" switches)))
+   ((and (dired-switches-recursive-p dired-actual-switches)
+        (not (dired-switches-recursive-p switches)))
     ;; Deleting -R from ls switches -- revert to pre-R subdirs
     ;; that are still present:
     (setq dired-subdir-alist
@@ -3745,7 +3775,7 @@ Any other value means to ask for each directory."
 (defvar dired-overwrite-confirmed)      ;Defined in dired-aux.
 
 (defun dired-dnd-handle-local-file (uri action)
-  "Copy, move or link a file to the dired directory.
+  "Copy, move or link a file to the Dired directory.
 URI is the file to handle, ACTION is one of copy, move, link or ask.
 Ask means pop up a menu for the user to select one of copy, move or link."
   (require 'dired-aux)
@@ -3792,7 +3822,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
               action))))))
 
 (defun dired-dnd-handle-file (uri action)
-  "Copy, move or link a file to the dired directory if it is a local file.
+  "Copy, move or link a file to the Dired directory if it is a local file.
 URI is the file to handle.  If the hostname in the URI isn't local, do nothing.
 ACTION is one of copy, move, link or ask.
 Ask means pop up a menu for the user to select one of copy, move or link."
@@ -3826,14 +3856,14 @@ Ask means pop up a menu for the user to select one of copy, move or link."
 (defun dired-restore-desktop-buffer (_file-name
                                      _buffer-name
                                      misc-data)
-  "Restore a dired buffer specified in a desktop file."
+  "Restore a Dired buffer specified in a desktop file."
   ;; First element of `misc-data' is the value of `dired-directory'.
   ;; This value is a directory name, optionally with shell wildcard or
   ;; a directory name followed by list of files.
   (let* ((dired-dir (car misc-data))
          (dir (if (consp dired-dir) (car dired-dir) dired-dir)))
     (if (file-directory-p (file-name-directory dir))
-        (progn
+        (with-demoted-errors "Desktop: Problem restoring directory: %S"
           (dired dired-dir)
           ;; The following elements of `misc-data' are the keys
           ;; from `dired-subdir-alist'.
@@ -3849,22 +3879,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
 \f
 ;;; Start of automatically extracted autoloads.
 \f
-;;;### (autoloads (dired-show-file-type dired-do-query-replace-regexp
-;;;;;;  dired-do-search dired-do-isearch-regexp dired-do-isearch
-;;;;;;  dired-isearch-filenames-regexp dired-isearch-filenames dired-isearch-filenames-setup
-;;;;;;  dired-hide-all dired-hide-subdir dired-tree-down dired-tree-up
-;;;;;;  dired-kill-subdir dired-mark-subdir-files dired-goto-subdir
-;;;;;;  dired-prev-subdir dired-insert-subdir dired-maybe-insert-subdir
-;;;;;;  dired-downcase dired-upcase dired-do-symlink-regexp dired-do-hardlink-regexp
-;;;;;;  dired-do-copy-regexp dired-do-rename-regexp dired-do-rename
-;;;;;;  dired-do-hardlink dired-do-symlink dired-do-copy dired-create-directory
-;;;;;;  dired-rename-file dired-copy-file dired-relist-file dired-remove-file
-;;;;;;  dired-add-file dired-do-redisplay dired-do-load dired-do-byte-compile
-;;;;;;  dired-do-compress dired-query dired-compress-file dired-do-kill-lines
-;;;;;;  dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
-;;;;;;  dired-clean-directory dired-do-print dired-do-touch dired-do-chown
-;;;;;;  dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
-;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "d6a694b6d13fa948465fde52a9ffb3ba")
+;;;### (autoloads nil "dired-aux" "dired-aux.el" "1a8e2a4a9117ab3a2586aa001358d3fb")
 ;;; Generated autoloads from dired-aux.el
 
 (autoload 'dired-diff "dired-aux" "\
@@ -4367,17 +4382,16 @@ instead.
 
 ;;;***
 \f
-;;;### (autoloads (dired-do-relsymlink dired-jump-other-window dired-jump)
-;;;;;;  "dired-x" "dired-x.el" "90ba5245f6f5df3bdbda6303c725ef45")
+;;;### (autoloads nil "dired-x" "dired-x.el" "291bc6e869bf72c900604c45d40f45ed")
 ;;; Generated autoloads from dired-x.el
 
 (autoload 'dired-jump "dired-x" "\
-Jump to dired buffer corresponding to current buffer.
-If in a file, dired the current directory and move to file's line.
+Jump to Dired buffer corresponding to current buffer.
+If in a file, Dired the current directory and move to file's line.
 If in Dired already, pop up a level and goto old directory's line.
-In case the proper dired file line cannot be found, refresh the dired
+In case the proper Dired file line cannot be found, refresh the dired
 buffer and try again.
-When OTHER-WINDOW is non-nil, jump to dired buffer in other window.
+When OTHER-WINDOW is non-nil, jump to Dired buffer in other window.
 Interactively with prefix argument, read FILE-NAME and
 move to its line in dired.