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.
This commit is contained in:
parent
5582c6706a
commit
817b48a7bc
6 changed files with 101 additions and 80 deletions
|
@ -1,3 +1,11 @@
|
|||
2011-02-23 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* 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.
|
||||
|
||||
2011-02-21 Lars Ingebrigtsen <larsi@gnus.org>
|
||||
|
||||
* gnus.texi (Article Date): Clarify gnus-article-update-date-headers.
|
||||
|
|
|
@ -129,39 +129,24 @@ original @file{dired-x.el}).
|
|||
@section Features
|
||||
@cindex Features
|
||||
|
||||
Some features provided by Dired Extra
|
||||
Some features provided by Dired Extra:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Omitting uninteresting files from Dired listing.
|
||||
@itemize @bullet
|
||||
@xref{Omitting Files in Dired}.
|
||||
@end itemize
|
||||
Omitting uninteresting files from Dired listing
|
||||
(@pxref{Omitting Files in Dired}).
|
||||
@item
|
||||
Local variables for Dired directories.
|
||||
@itemize @bullet
|
||||
@xref{Local Variables}.
|
||||
@end itemize
|
||||
Guessing shell commands in Dired buffers
|
||||
(@pxref{Shell Command Guessing}).
|
||||
@item
|
||||
Guessing shell commands in Dired buffers.
|
||||
@itemize @bullet
|
||||
@xref{Shell Command Guessing}.
|
||||
@end itemize
|
||||
@item
|
||||
Running Dired command in non-Dired buffers.
|
||||
@itemize @bullet
|
||||
@xref{Virtual Dired}.
|
||||
@end itemize
|
||||
Running Dired command in non-Dired buffers
|
||||
(@pxref{Virtual Dired}).
|
||||
@item
|
||||
Finding a file mentioned in a buffer
|
||||
@itemize @bullet
|
||||
@xref{Find File At Point}.
|
||||
@end itemize
|
||||
(@pxref{Find File At Point}).
|
||||
@item
|
||||
Commands using file marking.
|
||||
@itemize @bullet
|
||||
@xref{Advanced Mark Commands}.
|
||||
@end itemize
|
||||
Commands using file marking
|
||||
(@pxref{Advanced Mark Commands}).
|
||||
@end enumerate
|
||||
|
||||
@noindent
|
||||
|
@ -351,27 +336,25 @@ inside your @code{dired-mode-hook} to have omitting initially turned on in
|
|||
@emph{every} Dired buffer (@pxref{Installation}). You can then use @kbd{M-o} to
|
||||
unomit in that buffer.
|
||||
|
||||
To enable omitting automatically only in certain directories one can use Dired
|
||||
Local Variables and put
|
||||
To enable omitting automatically only in certain directories you can add
|
||||
a directory local setting
|
||||
(@pxref{Directory Variables,,,emacs,The Gnu Emacs manual}) for Dired mode
|
||||
|
||||
@example
|
||||
Local Variables:
|
||||
dired-omit-mode: t
|
||||
End:
|
||||
((dired-mode . ((dired-omit-mode . t))))
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
into a file @file{.dired} (the default value of
|
||||
@code{dired-local-variables-file}) in that directory (@pxref{Local Variables}).
|
||||
to a @file{.dir-locals.el} file in that directory.
|
||||
|
||||
@table @code
|
||||
@findex dired-omit-here-always
|
||||
@item dired-omit-here-always
|
||||
|
||||
This is an interactive function that creates a local variables file exactly
|
||||
like the example above (if it does not already exist) in the file
|
||||
@code{dired-local-variables-file} in the current directory and then refreshes
|
||||
the directory listing (@pxref{Local Variables}).
|
||||
like the example above (if it does not already exist) in the
|
||||
@code{dir-locals-file} file in the current directory and then refreshes
|
||||
the directory listing.
|
||||
@end table
|
||||
|
||||
@vindex dired-omit-files
|
||||
|
@ -490,7 +473,6 @@ Loading @file{dired-x.el} will install Dired Omit by putting
|
|||
call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
|
||||
in your @code{dired-mode-hook}.
|
||||
|
||||
@c FIXME does the standard dir-locals mechanism obsolete this?
|
||||
@node Local Variables, Shell Command Guessing, Omitting Files in Dired, Top
|
||||
@chapter Local Variables for Dired Directories
|
||||
|
||||
|
@ -498,10 +480,15 @@ in your @code{dired-mode-hook}.
|
|||
@vindex dired-local-variables-file
|
||||
@vindex dired-enable-local-variables
|
||||
@noindent
|
||||
When Dired visits a directory, it looks for a file whose name is the value of
|
||||
variable @code{dired-local-variables-file} (default: @file{.dired}). If such
|
||||
a file is found, Dired will temporarily insert it into the Dired buffer and
|
||||
run @code{hack-local-variables}.
|
||||
This Dired-X feature is obsolete as of Emacs 24.1. The standard Emacs
|
||||
directory local variables mechanism (@pxref{Directory
|
||||
Variables,,,emacs,The Gnu Emacs manual}) replaces it. For an example of
|
||||
the new mechanims, @pxref{Omitting Variables}.
|
||||
|
||||
When Dired visits a directory, it looks for a file whose name is the
|
||||
value of variable @code{dired-local-variables-file} (default: @file{.dired}).
|
||||
If such a file is found, Dired will temporarily insert it into the Dired
|
||||
buffer and run @code{hack-local-variables}.
|
||||
|
||||
@noindent
|
||||
For example, if the user puts
|
||||
|
@ -551,12 +538,10 @@ into the Dired buffer and run @code{hack-local-variables}.
|
|||
@item dired-enable-local-variables
|
||||
Default: @code{t}
|
||||
|
||||
Controls the use of local-variables lists in Dired. The value can be @code{t},
|
||||
@code{nil}, or something else. A value of @code{t} means local-variables
|
||||
lists are obeyed in the @code{dired-local-variables-file}; @code{nil} means
|
||||
they are ignored; anything else means query. This variable temporarily
|
||||
overrides the value of @code{enable-local-variables} when the Dired Local
|
||||
Variables are hacked.
|
||||
Controls the use of local-variables lists in Dired. This variable
|
||||
temporarily overrides the value of @code{enable-local-variables} when
|
||||
the Dired Local Variables are hacked. It takes the same values as that
|
||||
variable. A value of @code{nil} means to ignore any Dired Local Variables.
|
||||
@end table
|
||||
|
||||
@node Shell Command Guessing, Virtual Dired, Local Variables, Top
|
||||
|
|
12
etc/NEWS
12
etc/NEWS
|
@ -347,6 +347,12 @@ Just set shell-dir-cookie-re to an appropriate regexp.
|
|||
** browse-url has gotten a new variable that is used for mailto: URLs,
|
||||
`browse-url-mailto-function', which defaults to `browse-url-mail'.
|
||||
|
||||
** Directory local variables can apply to file-less buffers, in certain modes
|
||||
(eg dired, vc-dir, log-edit). For example, adding
|
||||
"(diff-mode . ((mode . whitespace)))" to your .dir-locals.el file,
|
||||
will turn on `whitespace-mode' for *vc-diff* buffers. Modes should
|
||||
call `hack-dir-local-variables-non-file-buffer' to support this.
|
||||
|
||||
** ERC changes
|
||||
|
||||
*** New vars `erc-autojoin-timing' and `erc-autojoin-delay'.
|
||||
|
@ -412,9 +418,9 @@ choose a color via list-colors-display.
|
|||
*** dired-jump and dired-jump-other-window called with a prefix argument
|
||||
read a file name from the minibuffer instead of using buffer-file-name.
|
||||
|
||||
** Directory local variables can apply to file-less buffers.
|
||||
For example, adding "(diff-mode . ((mode . whitespace)))" to your
|
||||
.dir-locals.el file, will turn on `whitespace-mode' for *vc-diff* buffers.
|
||||
+++
|
||||
*** The `dired local variables' feature provided by Dired-x is obsolete.
|
||||
The standard directory local variables feature replaces it.
|
||||
|
||||
** SQL Mode enhancements.
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
2011-02-23 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* dired.el (dired-mode): Call hack-dir-local-variables-non-file-buffer.
|
||||
* dired-x.el (dired-omit-mode): Safe if boolean.
|
||||
(dired-enable-local-variables): Fix doc and custom type.
|
||||
(dired-enable-local-variables, dired-local-variables-file)
|
||||
(dired-hack-local-variables): Make obsolete.
|
||||
(dired-omit-here-always): Use dir-locals.el instead.
|
||||
|
||||
* files.el (safe-local-eval-forms): Add the write-file-hooks version.
|
||||
|
||||
2011-02-22 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1860,6 +1860,7 @@ Keybindings:
|
|||
(set (make-local-variable 'desktop-save-buffer)
|
||||
'dired-desktop-buffer-misc-data)
|
||||
(setq dired-switches-alist nil)
|
||||
(hack-dir-local-variables-non-file-buffer) ; before sorting
|
||||
(dired-sort-other dired-actual-switches t)
|
||||
(when (featurep 'dnd)
|
||||
(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.
|
|||
;;;***
|
||||
|
||||
;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
|
||||
;;;;;; "86d436093caa9ae80f7b73915c6a4b4c")
|
||||
;;;;;; "515e1dbc42acebd9a0175c4209b6673c")
|
||||
;;; Generated autoloads from dired-x.el
|
||||
|
||||
(autoload 'dired-jump "dired-x" "\
|
||||
|
|
Loading…
Add table
Reference in a new issue