emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103393: Obsolete dired-x's directory


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103393: Obsolete dired-x's directory local variables in favor of standard ones.
Date: Tue, 22 Feb 2011 19:44:13 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103393
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2011-02-22 19:44:13 -0800
message:
  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.
modified:
  doc/misc/ChangeLog
  doc/misc/dired-x.texi
  etc/NEWS
  lisp/ChangeLog
  lisp/dired-x.el
  lisp/dired.el
=== modified file 'doc/misc/ChangeLog'
--- a/doc/misc/ChangeLog        2011-02-22 13:31:15 +0000
+++ b/doc/misc/ChangeLog        2011-02-23 03:44:13 +0000
@@ -1,3 +1,11 @@
+2011-02-23  Glenn Morris  <address@hidden>
+
+       * 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  <address@hidden>
 
        * gnus.texi (Article Date): Clarify gnus-article-update-date-headers.

=== modified file 'doc/misc/dired-x.texi'
--- a/doc/misc/dired-x.texi     2011-02-19 20:36:54 +0000
+++ b/doc/misc/dired-x.texi     2011-02-23 03:44:13 +0000
@@ -129,39 +129,24 @@
 @section Features
 @cindex Features
 
-Some features provided by Dired Extra
+Some features provided by Dired Extra:
 
 @enumerate
 @item
-Omitting uninteresting files from Dired listing.
address@hidden @bullet
address@hidden Files in Dired}.
address@hidden itemize
address@hidden
-Local variables for Dired directories.
address@hidden @bullet
address@hidden Variables}.
address@hidden itemize
address@hidden
-Guessing shell commands in Dired buffers.
address@hidden @bullet
address@hidden Command Guessing}.
address@hidden itemize
address@hidden
-Running Dired command in non-Dired buffers.
address@hidden @bullet
address@hidden Dired}.
address@hidden itemize
+Omitting uninteresting files from Dired listing
+(@pxref{Omitting Files in Dired}).
address@hidden
+Guessing shell commands in Dired buffers
+(@pxref{Shell Command Guessing}).
address@hidden
+Running Dired command in non-Dired buffers
+(@pxref{Virtual Dired}).
 @item
 Finding a file mentioned in a buffer
address@hidden @bullet
address@hidden File At Point}.
address@hidden itemize
+(@pxref{Find File At Point}).
 @item
-Commands using file marking.
address@hidden @bullet
address@hidden Mark Commands}.
address@hidden itemize
+Commands using file marking
+(@pxref{Advanced Mark Commands}).
 @end enumerate
 
 @noindent
@@ -351,27 +336,25 @@
 @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
address@hidden) 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
address@hidden 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
address@hidden file in the current directory and then refreshes
+the directory listing.
 @end table
 
 @vindex dired-omit-files
@@ -490,7 +473,6 @@
 call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
 in your @code{dired-mode-hook}.
 
address@hidden 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 @@
 @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 @@
 @item dired-enable-local-variables
 Default: @code{t}
 
-Controls the use of local-variables lists in Dired.  The value can be @code{t},
address@hidden, 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

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2011-02-16 19:41:31 +0000
+++ b/etc/NEWS  2011-02-23 03:44:13 +0000
@@ -347,6 +347,12 @@
 ** 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 @@
 *** 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.
 

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-02-23 03:24:23 +0000
+++ b/lisp/ChangeLog    2011-02-23 03:44:13 +0000
@@ -1,5 +1,12 @@
 2011-02-23  Glenn Morris  <address@hidden>
 
+       * 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  <address@hidden>

=== modified file 'lisp/dired-x.el'
--- a/lisp/dired-x.el   2011-02-19 20:44:34 +0000
+++ b/lisp/dired-x.el   2011-02-23 03:44:13 +0000
@@ -145,6 +145,8 @@
       (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 @@
 
 (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 @@
 
 ;;; 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 @@
   :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 @@
          ;; 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.

=== modified file 'lisp/dired.el'
--- a/lisp/dired.el     2011-02-20 11:59:44 +0000
+++ b/lisp/dired.el     2011-02-23 03:44:13 +0000
@@ -1860,6 +1860,7 @@
   (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 @@
 ;;;***
 
 ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el"
-;;;;;;  "86d436093caa9ae80f7b73915c6a4b4c")
+;;;;;;  "515e1dbc42acebd9a0175c4209b6673c")
 ;;; Generated autoloads from dired-x.el
 
 (autoload 'dired-jump "dired-x" "\


reply via email to

[Prev in Thread] Current Thread [Next in Thread]