summaryrefslogtreecommitdiff
path: root/lisp/dired-x.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2011-02-22 19:44:13 -0800
committerGlenn Morris <rgm@gnu.org>2011-02-22 19:44:13 -0800
commit817b48a7bccb820203ae424aa14c559259a4f355 (patch)
tree62ab20c2bee40ed1e67bea7f5c6ac1aa5ad34a64 /lisp/dired-x.el
parent5582c6706a68bca9cc9a1215f257cc3fbe573c9a (diff)
downloademacs-817b48a7bccb820203ae424aa14c559259a4f355.tar.gz
Obsolete dired-x's directory local variables in favor of standard ones.
* lisp/dired.el (dired-mode): Call hack-dir-local-variables-non-file-buffer. * lisp/dired-x.el (dired-omit-mode): Safe if boolean. (dired-enable-local-variables): Fix doc and custom type. Mark risky. (dired-enable-local-variables, dired-local-variables-file) (dired-hack-local-variables): Make obsolete. (dired-omit-here-always): Use dir-locals.el instead. * doc/misc/dired-x.texi (Features): Don't advertise obsolete local variables. Simplify layout. (Omitting Variables): Update local variables example. (Local Variables): Say this is obsolete. Fix description of dired-enable-local-variables possible values. * etc/NEWS: Relocate the existing entry about directory local variables in file-les buffers, and make it clearer. Mention above dired changes.
Diffstat (limited to 'lisp/dired-x.el')
-rw-r--r--lisp/dired-x.el74
1 files changed, 44 insertions, 30 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 8b1dbb1ef83..dcf8906976b 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -145,6 +145,8 @@ See Info node `(dired-x) Omitting Variables' for more information."
(let ((dired-omit-size-limit nil)) (dired-omit-expunge))
(revert-buffer)))
+(put 'dired-omit-mode 'safe-local-variable 'booleanp)
+
;; For backward compatibility
(define-obsolete-variable-alias 'dired-omit-files-p 'dired-omit-mode "22.1")
@@ -185,15 +187,19 @@ If nil, there is no maximum size."
(defcustom dired-enable-local-variables t
"Control use of local-variables lists in Dired.
-The value can be t, nil or something else.
-A value of t means local-variables lists are obeyed;
-nil means they are ignored; anything else means query.
-
This temporarily overrides the value of `enable-local-variables' when
listing a directory. See also `dired-local-variables-file'."
- :type 'boolean
+ :risky t
+ :type '(choice (const :tag "Query Unsafe" t)
+ (const :tag "Safe Only" :safe)
+ (const :tag "Do all" :all)
+ (const :tag "Ignore" nil)
+ (other :tag "Query" other))
:group 'dired-x)
+(make-obsolete-variable 'dired-enable-local-variables
+ "use a standard `dir-locals-file' instead." "24.1")
+
(defcustom dired-guess-shell-gnutar
(catch 'found
(dolist (exe '("tar" "gtar"))
@@ -723,26 +729,25 @@ Knows about the special cases in variable `dired-default-directory-alist'."
;;; LOCAL VARIABLES FOR DIRED BUFFERS.
-;; Brief Description:
-;;;
+;; Brief Description (This feature is obsolete as of Emacs 24.1)
+;;
;; * `dired-extra-startup' is part of the `dired-mode-hook'.
-;;;
+;;
;; * `dired-extra-startup' calls `dired-hack-local-variables'
-;;;
+;;
;; * `dired-hack-local-variables' checks the value of
-;;; `dired-local-variables-file'
-;;;
+;; `dired-local-variables-file'
+;;
;; * Check if `dired-local-variables-file' is a non-nil string and is a
-;;; filename found in the directory of the Dired Buffer being created.
-;;;
+;; filename found in the directory of the Dired Buffer being created.
+;;
;; * If `dired-local-variables-file' satisfies the above, then temporarily
-;;; include it in the Dired Buffer at the bottom.
-;;;
+;; include it in the Dired Buffer at the bottom.
+;;
;; * Set `enable-local-variables' temporarily to the user variable
-;;; `dired-enable-local-variables' and run `hack-local-variables' on the
-;;; Dired Buffer.
+;; `dired-enable-local-variables' and run `hack-local-variables' on the
+;; Dired Buffer.
-;; FIXME do standard dir-locals obsolete this?
(defcustom dired-local-variables-file (convert-standard-filename ".dired")
"Filename, as string, containing local dired buffer variables to be hacked.
If this file found in current directory, then it will be inserted into dired
@@ -752,6 +757,8 @@ See also `dired-enable-local-variables'."
:type 'file
:group 'dired)
+(make-obsolete-variable 'dired-local-variables-file 'dir-locals-file "24.1")
+
(defun dired-hack-local-variables ()
"Evaluate local variables in `dired-local-variables-file' for dired buffer."
(and (stringp dired-local-variables-file)
@@ -774,22 +781,29 @@ See also `dired-enable-local-variables'."
;; Delete this stuff: `eobp' is used to find last subdir by dired.el.
(delete-region opoint (point-max)))))
+(make-obsolete 'dired-hack-local-variables
+ 'hack-dir-local-variables-non-file-buffer "24.1")
+
+;; Not sure this is worth having a dedicated command for...
(defun dired-omit-here-always ()
- "Create `dired-local-variables-file' for omitting and reverts directory.
-Sets `dired-omit-mode' to t in a local variables file that is readable by
-dired."
+ "Create `dir-locals-file' setting `dired-omit-mode' to t in `dired-mode'.
+If in a Dired buffer, reverts it."
(interactive)
(if (file-exists-p dired-local-variables-file)
- (message "File `./%s' already exists." dired-local-variables-file)
- ;; Create `dired-local-variables-file'.
- (with-current-buffer (get-buffer-create " *dot-dired*")
- (erase-buffer)
- (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n")
- (write-file dired-local-variables-file)
- (kill-buffer))
+ (error "Old-style dired-local-variables-file `./%s' found;
+replace it with a dir-locals-file `./%s'"
+ dired-local-variables-file
+ dir-locals-file))
+ (if (file-exists-p dir-locals-file)
+ (message "File `./%s' already exists." dir-locals-file)
+ (with-temp-buffer
+ (insert "((dired-mode . ((dired-omit-mode . t))))\n")
+ (write-file dir-locals-file))
;; Run extra-hooks and revert directory.
- (dired-extra-startup)
- (dired-revert)))
+ (when (derived-mode-p 'dired-mode)
+ (hack-dir-local-variables-non-file-buffer)
+ (dired-extra-startup)
+ (dired-revert))))
;;; GUESS SHELL COMMAND.