]> code.delx.au - gnu-emacs/blobdiff - lisp/dired.el
Merge from emacs--devo--0
[gnu-emacs] / lisp / dired.el
index 09f4dc8425af5266a0f06c1f4615f3f39f19d69f..7734a9bd69fb568aa9dbe02cae00512661ec9121 100644 (file)
@@ -1,7 +1,7 @@
 ;;; dired.el --- directory-browsing commands
 
 ;; Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995, 1996, 1997, 2000,
-;;   2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;;   2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
 ;; Maintainer: FSF
@@ -56,7 +56,7 @@ may contain even `F', `b', `i' and `s'.  See also the variable
 `dired-ls-F-marks-symlinks' concerning the `F' switch.
 On systems such as MS-DOS and MS-Windows, which use `ls' emulation in Lisp,
 some of the `ls' switches are not supported; see the doc string of
-`insert-directory' on `ls-lisp.el' for more details."
+`insert-directory' in `ls-lisp.el' for more details."
   :type 'string
   :group 'dired)
 
@@ -3098,15 +3098,18 @@ The idea is to set this buffer-locally in special dired buffers.")
   ;; Modeline display of "by name" or "by date" guarantees the user a
   ;; match with the corresponding regexps.  Non-matching switches are
   ;; shown literally.
-  (setq mode-name
-       (let (case-fold-search)
-         (cond ((string-match dired-sort-by-name-regexp dired-actual-switches)
-                "Dired by name")
-               ((string-match dired-sort-by-date-regexp dired-actual-switches)
-                "Dired by date")
-               (t
-                (concat "Dired " dired-actual-switches)))))
-  (force-mode-line-update))
+  (when (eq major-mode 'dired-mode)
+    (setq mode-name
+         (let (case-fold-search)
+           (cond ((string-match 
+                   dired-sort-by-name-regexp dired-actual-switches)
+                  "Dired by name")
+                 ((string-match
+                   dired-sort-by-date-regexp dired-actual-switches)
+                  "Dired by date")
+                 (t
+                  (concat "Dired " dired-actual-switches)))))
+    (force-mode-line-update)))
 
 (defun dired-sort-toggle-or-edit (&optional arg)
   "Toggle between sort by date/name and refresh the dired buffer.
@@ -3162,7 +3165,7 @@ set the minor mode accordingly, others appear literally in the mode line.
 With optional second arg NO-REVERT, don't refresh the listing afterwards."
   (dired-sort-R-check switches)
   (setq dired-actual-switches switches)
-  (if (eq major-mode 'dired-mode) (dired-sort-set-modeline))
+  (dired-sort-set-modeline)
   (or no-revert (revert-buffer)))
 
 (defvar dired-subdir-alist-pre-R nil