# HG changeset patch # User Nick Roberts <nickrob@snap.net.nz> # Date 1167436658 0 # Node ID 3b49658358de82ca8cdf2d721b1c0b94f3e02a22 # Parent 8ad08e091b07f2358b03917096a9fbaaf7dd7ca9 (dired-sort-other): Move test for dired-mode... (dired-sort-set-modeline): ...to here. diff -r 8ad08e091b07 -r 3b49658358de lisp/dired.el --- a/lisp/dired.el Fri Dec 29 23:56:44 2006 +0000 +++ b/lisp/dired.el Fri Dec 29 23:57:38 2006 +0000 @@ -3098,15 +3098,18 @@ ;; 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 @@ 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