comparison lisp/dired.el @ 48491:5d690a3537aa

(dired-sort-inhibit): New variable. (dired-sort-toggle-or-edit): Err if dired-sort-inhibit non-nil.
author Richard M. Stallman <rms@gnu.org>
date Thu, 21 Nov 2002 17:31:51 +0000
parents 29357f0b7ba5
children bcc54fecfcee
comparison
equal deleted inserted replaced
48490:3531509372aa 48491:5d690a3537aa
2721 2721
2722 (defvar dired-sort-by-name-regexp 2722 (defvar dired-sort-by-name-regexp
2723 (concat "^-[^t" dired-ls-sorting-switches "]+$") 2723 (concat "^-[^t" dired-ls-sorting-switches "]+$")
2724 "Regexp recognized by dired to set `by name' mode.") 2724 "Regexp recognized by dired to set `by name' mode.")
2725 2725
2726 (defvar dired-sort-inhibit nil
2727 "Non-nil means the Dired sort command is disabled.
2728 The idea is to set this buffer-locally in special Dired buffers.")
2729
2726 (defun dired-sort-set-modeline () 2730 (defun dired-sort-set-modeline ()
2727 ;; Set modeline display according to dired-actual-switches. 2731 ;; Set modeline display according to dired-actual-switches.
2728 ;; Modeline display of "by name" or "by date" guarantees the user a 2732 ;; Modeline display of "by name" or "by date" guarantees the user a
2729 ;; match with the corresponding regexps. Non-matching switches are 2733 ;; match with the corresponding regexps. Non-matching switches are
2730 ;; shown literally. 2734 ;; shown literally.
2740 2744
2741 (defun dired-sort-toggle-or-edit (&optional arg) 2745 (defun dired-sort-toggle-or-edit (&optional arg)
2742 "Toggle between sort by date/name and refresh the dired buffer. 2746 "Toggle between sort by date/name and refresh the dired buffer.
2743 With a prefix argument you can edit the current listing switches instead." 2747 With a prefix argument you can edit the current listing switches instead."
2744 (interactive "P") 2748 (interactive "P")
2749 (when dired-sort-inhibit
2750 (error "Cannot sort this Dired buffer"))
2745 (if arg 2751 (if arg
2746 (dired-sort-other 2752 (dired-sort-other
2747 (read-string "ls switches (must contain -l): " dired-actual-switches)) 2753 (read-string "ls switches (must contain -l): " dired-actual-switches))
2748 (dired-sort-toggle))) 2754 (dired-sort-toggle)))
2749 2755