aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2011-02-22 19:44:13 -0800
committerGlenn Morris2011-02-22 19:44:13 -0800
commit817b48a7bccb820203ae424aa14c559259a4f355 (patch)
tree62ab20c2bee40ed1e67bea7f5c6ac1aa5ad34a64
parent5582c6706a68bca9cc9a1215f257cc3fbe573c9a (diff)
downloademacs-817b48a7bccb820203ae424aa14c559259a4f355.tar.gz
emacs-817b48a7bccb820203ae424aa14c559259a4f355.zip
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.
-rw-r--r--doc/misc/ChangeLog8
-rw-r--r--doc/misc/dired-x.texi77
-rw-r--r--etc/NEWS12
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/dired-x.el74
-rw-r--r--lisp/dired.el3
6 files changed, 101 insertions, 80 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 217702b7c0f..67197450a5b 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,11 @@
12011-02-23 Glenn Morris <rgm@gnu.org>
2
3 * dired-x.texi (Features): Don't advertise obsolete local variables.
4 Simplify layout.
5 (Omitting Variables): Update local variables example.
6 (Local Variables): Say this is obsolete. Fix description of
7 dired-enable-local-variables possible values.
8
12011-02-21 Lars Ingebrigtsen <larsi@gnus.org> 92011-02-21 Lars Ingebrigtsen <larsi@gnus.org>
2 10
3 * gnus.texi (Article Date): Clarify gnus-article-update-date-headers. 11 * gnus.texi (Article Date): Clarify gnus-article-update-date-headers.
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi
index 003046d5a7c..f7c73237249 100644
--- a/doc/misc/dired-x.texi
+++ b/doc/misc/dired-x.texi
@@ -129,39 +129,24 @@ original @file{dired-x.el}).
129@section Features 129@section Features
130@cindex Features 130@cindex Features
131 131
132Some features provided by Dired Extra 132Some features provided by Dired Extra:
133 133
134@enumerate 134@enumerate
135@item 135@item
136Omitting uninteresting files from Dired listing. 136Omitting uninteresting files from Dired listing
137@itemize @bullet 137(@pxref{Omitting Files in Dired}).
138@xref{Omitting Files in Dired}.
139@end itemize
140@item 138@item
141Local variables for Dired directories. 139Guessing shell commands in Dired buffers
142@itemize @bullet 140(@pxref{Shell Command Guessing}).
143@xref{Local Variables}.
144@end itemize
145@item 141@item
146Guessing shell commands in Dired buffers. 142Running Dired command in non-Dired buffers
147@itemize @bullet 143(@pxref{Virtual Dired}).
148@xref{Shell Command Guessing}.
149@end itemize
150@item
151Running Dired command in non-Dired buffers.
152@itemize @bullet
153@xref{Virtual Dired}.
154@end itemize
155@item 144@item
156Finding a file mentioned in a buffer 145Finding a file mentioned in a buffer
157@itemize @bullet 146(@pxref{Find File At Point}).
158@xref{Find File At Point}.
159@end itemize
160@item 147@item
161Commands using file marking. 148Commands using file marking
162@itemize @bullet 149(@pxref{Advanced Mark Commands}).
163@xref{Advanced Mark Commands}.
164@end itemize
165@end enumerate 150@end enumerate
166 151
167@noindent 152@noindent
@@ -351,27 +336,25 @@ inside your @code{dired-mode-hook} to have omitting initially turned on in
351@emph{every} Dired buffer (@pxref{Installation}). You can then use @kbd{M-o} to 336@emph{every} Dired buffer (@pxref{Installation}). You can then use @kbd{M-o} to
352unomit in that buffer. 337unomit in that buffer.
353 338
354To enable omitting automatically only in certain directories one can use Dired 339To enable omitting automatically only in certain directories you can add
355Local Variables and put 340a directory local setting
341(@pxref{Directory Variables,,,emacs,The Gnu Emacs manual}) for Dired mode
356 342
357@example 343@example
358Local Variables: 344((dired-mode . ((dired-omit-mode . t))))
359dired-omit-mode: t
360End:
361@end example 345@end example
362 346
363@noindent 347@noindent
364into a file @file{.dired} (the default value of 348to a @file{.dir-locals.el} file in that directory.
365@code{dired-local-variables-file}) in that directory (@pxref{Local Variables}).
366 349
367@table @code 350@table @code
368@findex dired-omit-here-always 351@findex dired-omit-here-always
369@item dired-omit-here-always 352@item dired-omit-here-always
370 353
371This is an interactive function that creates a local variables file exactly 354This is an interactive function that creates a local variables file exactly
372like the example above (if it does not already exist) in the file 355like the example above (if it does not already exist) in the
373@code{dired-local-variables-file} in the current directory and then refreshes 356@code{dir-locals-file} file in the current directory and then refreshes
374the directory listing (@pxref{Local Variables}). 357the directory listing.
375@end table 358@end table
376 359
377@vindex dired-omit-files 360@vindex dired-omit-files
@@ -490,7 +473,6 @@ Loading @file{dired-x.el} will install Dired Omit by putting
490call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup} 473call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
491in your @code{dired-mode-hook}. 474in your @code{dired-mode-hook}.
492 475
493@c FIXME does the standard dir-locals mechanism obsolete this?
494@node Local Variables, Shell Command Guessing, Omitting Files in Dired, Top 476@node Local Variables, Shell Command Guessing, Omitting Files in Dired, Top
495@chapter Local Variables for Dired Directories 477@chapter Local Variables for Dired Directories
496 478
@@ -498,10 +480,15 @@ in your @code{dired-mode-hook}.
498@vindex dired-local-variables-file 480@vindex dired-local-variables-file
499@vindex dired-enable-local-variables 481@vindex dired-enable-local-variables
500@noindent 482@noindent
501When Dired visits a directory, it looks for a file whose name is the value of 483This Dired-X feature is obsolete as of Emacs 24.1. The standard Emacs
502variable @code{dired-local-variables-file} (default: @file{.dired}). If such 484directory local variables mechanism (@pxref{Directory
503a file is found, Dired will temporarily insert it into the Dired buffer and 485Variables,,,emacs,The Gnu Emacs manual}) replaces it. For an example of
504run @code{hack-local-variables}. 486the new mechanims, @pxref{Omitting Variables}.
487
488When Dired visits a directory, it looks for a file whose name is the
489value of variable @code{dired-local-variables-file} (default: @file{.dired}).
490If such a file is found, Dired will temporarily insert it into the Dired
491buffer and run @code{hack-local-variables}.
505 492
506@noindent 493@noindent
507For example, if the user puts 494For example, if the user puts
@@ -551,12 +538,10 @@ into the Dired buffer and run @code{hack-local-variables}.
551@item dired-enable-local-variables 538@item dired-enable-local-variables
552Default: @code{t} 539Default: @code{t}
553 540
554Controls the use of local-variables lists in Dired. The value can be @code{t}, 541Controls the use of local-variables lists in Dired. This variable
555@code{nil}, or something else. A value of @code{t} means local-variables 542temporarily overrides the value of @code{enable-local-variables} when
556lists are obeyed in the @code{dired-local-variables-file}; @code{nil} means 543the Dired Local Variables are hacked. It takes the same values as that
557they are ignored; anything else means query. This variable temporarily 544variable. A value of @code{nil} means to ignore any Dired Local Variables.
558overrides the value of @code{enable-local-variables} when the Dired Local
559Variables are hacked.
560@end table 545@end table
561 546
562@node Shell Command Guessing, Virtual Dired, Local Variables, Top 547@node Shell Command Guessing, Virtual Dired, Local Variables, Top
diff --git a/etc/NEWS b/etc/NEWS
index 96cc97ac795..9119fa3b8e1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -347,6 +347,12 @@ Just set shell-dir-cookie-re to an appropriate regexp.
347** browse-url has gotten a new variable that is used for mailto: URLs, 347** browse-url has gotten a new variable that is used for mailto: URLs,
348 `browse-url-mailto-function', which defaults to `browse-url-mail'. 348 `browse-url-mailto-function', which defaults to `browse-url-mail'.
349 349
350** Directory local variables can apply to file-less buffers, in certain modes
351(eg dired, vc-dir, log-edit). For example, adding
352"(diff-mode . ((mode . whitespace)))" to your .dir-locals.el file,
353will turn on `whitespace-mode' for *vc-diff* buffers. Modes should
354call `hack-dir-local-variables-non-file-buffer' to support this.
355
350** ERC changes 356** ERC changes
351 357
352*** New vars `erc-autojoin-timing' and `erc-autojoin-delay'. 358*** New vars `erc-autojoin-timing' and `erc-autojoin-delay'.
@@ -412,9 +418,9 @@ choose a color via list-colors-display.
412*** dired-jump and dired-jump-other-window called with a prefix argument 418*** dired-jump and dired-jump-other-window called with a prefix argument
413read a file name from the minibuffer instead of using buffer-file-name. 419read a file name from the minibuffer instead of using buffer-file-name.
414 420
415** Directory local variables can apply to file-less buffers. 421+++
416For example, adding "(diff-mode . ((mode . whitespace)))" to your 422*** The `dired local variables' feature provided by Dired-x is obsolete.
417.dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* buffers. 423The standard directory local variables feature replaces it.
418 424
419** SQL Mode enhancements. 425** SQL Mode enhancements.
420 426
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5102204b571..14ef035445a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
12011-02-23 Glenn Morris <rgm@gnu.org> 12011-02-23 Glenn Morris <rgm@gnu.org>
2 2
3 * dired.el (dired-mode): Call hack-dir-local-variables-non-file-buffer.
4 * dired-x.el (dired-omit-mode): Safe if boolean.
5 (dired-enable-local-variables): Fix doc and custom type.
6 (dired-enable-local-variables, dired-local-variables-file)
7 (dired-hack-local-variables): Make obsolete.
8 (dired-omit-here-always): Use dir-locals.el instead.
9
3 * files.el (safe-local-eval-forms): Add the write-file-hooks version. 10 * files.el (safe-local-eval-forms): Add the write-file-hooks version.
4 11
52011-02-22 Stefan Monnier <monnier@iro.umontreal.ca> 122011-02-22 Stefan Monnier <monnier@iro.umontreal.ca>
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."
145 (let ((dired-omit-size-limit nil)) (dired-omit-expunge)) 145 (let ((dired-omit-size-limit nil)) (dired-omit-expunge))
146 (revert-buffer))) 146 (revert-buffer)))
147 147
148(put 'dired-omit-mode 'safe-local-variable 'booleanp)
149
148;; For backward compatibility 150;; For backward compatibility
149(define-obsolete-variable-alias 'dired-omit-files-p 'dired-omit-mode "22.1") 151(define-obsolete-variable-alias 'dired-omit-files-p 'dired-omit-mode "22.1")
150 152
@@ -185,15 +187,19 @@ If nil, there is no maximum size."
185 187
186(defcustom dired-enable-local-variables t 188(defcustom dired-enable-local-variables t
187 "Control use of local-variables lists in Dired. 189 "Control use of local-variables lists in Dired.
188The value can be t, nil or something else.
189A value of t means local-variables lists are obeyed;
190nil means they are ignored; anything else means query.
191
192This temporarily overrides the value of `enable-local-variables' when 190This temporarily overrides the value of `enable-local-variables' when
193listing a directory. See also `dired-local-variables-file'." 191listing a directory. See also `dired-local-variables-file'."
194 :type 'boolean 192 :risky t
193 :type '(choice (const :tag "Query Unsafe" t)
194 (const :tag "Safe Only" :safe)
195 (const :tag "Do all" :all)
196 (const :tag "Ignore" nil)
197 (other :tag "Query" other))
195 :group 'dired-x) 198 :group 'dired-x)
196 199
200(make-obsolete-variable 'dired-enable-local-variables
201 "use a standard `dir-locals-file' instead." "24.1")
202
197(defcustom dired-guess-shell-gnutar 203(defcustom dired-guess-shell-gnutar
198 (catch 'found 204 (catch 'found
199 (dolist (exe '("tar" "gtar")) 205 (dolist (exe '("tar" "gtar"))
@@ -723,26 +729,25 @@ Knows about the special cases in variable `dired-default-directory-alist'."
723 729
724;;; LOCAL VARIABLES FOR DIRED BUFFERS. 730;;; LOCAL VARIABLES FOR DIRED BUFFERS.
725 731
726;; Brief Description: 732;; Brief Description (This feature is obsolete as of Emacs 24.1)
727;;; 733;;
728;; * `dired-extra-startup' is part of the `dired-mode-hook'. 734;; * `dired-extra-startup' is part of the `dired-mode-hook'.
729;;; 735;;
730;; * `dired-extra-startup' calls `dired-hack-local-variables' 736;; * `dired-extra-startup' calls `dired-hack-local-variables'
731;;; 737;;
732;; * `dired-hack-local-variables' checks the value of 738;; * `dired-hack-local-variables' checks the value of
733;;; `dired-local-variables-file' 739;; `dired-local-variables-file'
734;;; 740;;
735;; * Check if `dired-local-variables-file' is a non-nil string and is a 741;; * Check if `dired-local-variables-file' is a non-nil string and is a
736;;; filename found in the directory of the Dired Buffer being created. 742;; filename found in the directory of the Dired Buffer being created.
737;;; 743;;
738;; * If `dired-local-variables-file' satisfies the above, then temporarily 744;; * If `dired-local-variables-file' satisfies the above, then temporarily
739;;; include it in the Dired Buffer at the bottom. 745;; include it in the Dired Buffer at the bottom.
740;;; 746;;
741;; * Set `enable-local-variables' temporarily to the user variable 747;; * Set `enable-local-variables' temporarily to the user variable
742;;; `dired-enable-local-variables' and run `hack-local-variables' on the 748;; `dired-enable-local-variables' and run `hack-local-variables' on the
743;;; Dired Buffer. 749;; Dired Buffer.
744 750
745;; FIXME do standard dir-locals obsolete this?
746(defcustom dired-local-variables-file (convert-standard-filename ".dired") 751(defcustom dired-local-variables-file (convert-standard-filename ".dired")
747 "Filename, as string, containing local dired buffer variables to be hacked. 752 "Filename, as string, containing local dired buffer variables to be hacked.
748If this file found in current directory, then it will be inserted into dired 753If this file found in current directory, then it will be inserted into dired
@@ -752,6 +757,8 @@ See also `dired-enable-local-variables'."
752 :type 'file 757 :type 'file
753 :group 'dired) 758 :group 'dired)
754 759
760(make-obsolete-variable 'dired-local-variables-file 'dir-locals-file "24.1")
761
755(defun dired-hack-local-variables () 762(defun dired-hack-local-variables ()
756 "Evaluate local variables in `dired-local-variables-file' for dired buffer." 763 "Evaluate local variables in `dired-local-variables-file' for dired buffer."
757 (and (stringp dired-local-variables-file) 764 (and (stringp dired-local-variables-file)
@@ -774,22 +781,29 @@ See also `dired-enable-local-variables'."
774 ;; Delete this stuff: `eobp' is used to find last subdir by dired.el. 781 ;; Delete this stuff: `eobp' is used to find last subdir by dired.el.
775 (delete-region opoint (point-max))))) 782 (delete-region opoint (point-max)))))
776 783
784(make-obsolete 'dired-hack-local-variables
785 'hack-dir-local-variables-non-file-buffer "24.1")
786
787;; Not sure this is worth having a dedicated command for...
777(defun dired-omit-here-always () 788(defun dired-omit-here-always ()
778 "Create `dired-local-variables-file' for omitting and reverts directory. 789 "Create `dir-locals-file' setting `dired-omit-mode' to t in `dired-mode'.
779Sets `dired-omit-mode' to t in a local variables file that is readable by 790If in a Dired buffer, reverts it."
780dired."
781 (interactive) 791 (interactive)
782 (if (file-exists-p dired-local-variables-file) 792 (if (file-exists-p dired-local-variables-file)
783 (message "File `./%s' already exists." dired-local-variables-file) 793 (error "Old-style dired-local-variables-file `./%s' found;
784 ;; Create `dired-local-variables-file'. 794replace it with a dir-locals-file `./%s'"
785 (with-current-buffer (get-buffer-create " *dot-dired*") 795 dired-local-variables-file
786 (erase-buffer) 796 dir-locals-file))
787 (insert "Local Variables:\ndired-omit-mode: t\nEnd:\n") 797 (if (file-exists-p dir-locals-file)
788 (write-file dired-local-variables-file) 798 (message "File `./%s' already exists." dir-locals-file)
789 (kill-buffer)) 799 (with-temp-buffer
800 (insert "((dired-mode . ((dired-omit-mode . t))))\n")
801 (write-file dir-locals-file))
790 ;; Run extra-hooks and revert directory. 802 ;; Run extra-hooks and revert directory.
791 (dired-extra-startup) 803 (when (derived-mode-p 'dired-mode)
792 (dired-revert))) 804 (hack-dir-local-variables-non-file-buffer)
805 (dired-extra-startup)
806 (dired-revert))))
793 807
794 808
795;;; GUESS SHELL COMMAND. 809;;; GUESS SHELL COMMAND.
diff --git a/lisp/dired.el b/lisp/dired.el
index 910d59f2cce..3f31ba58139 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1860,6 +1860,7 @@ Keybindings:
1860 (set (make-local-variable 'desktop-save-buffer) 1860 (set (make-local-variable 'desktop-save-buffer)
1861 'dired-desktop-buffer-misc-data) 1861 'dired-desktop-buffer-misc-data)
1862 (setq dired-switches-alist nil) 1862 (setq dired-switches-alist nil)
1863 (hack-dir-local-variables-non-file-buffer) ; before sorting
1863 (dired-sort-other dired-actual-switches t) 1864 (dired-sort-other dired-actual-switches t)
1864 (when (featurep 'dnd) 1865 (when (featurep 'dnd)
1865 (set (make-local-variable 'dnd-protocol-alist) 1866 (set (make-local-variable 'dnd-protocol-alist)
@@ -4072,7 +4073,7 @@ true then the type of the file linked to by FILE is printed instead.
4072;;;*** 4073;;;***
4073 4074
4074;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el" 4075;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
4075;;;;;; "86d436093caa9ae80f7b73915c6a4b4c") 4076;;;;;; "515e1dbc42acebd9a0175c4209b6673c")
4076;;; Generated autoloads from dired-x.el 4077;;; Generated autoloads from dired-x.el
4077 4078
4078(autoload 'dired-jump "dired-x" "\ 4079(autoload 'dired-jump "dired-x" "\