commit bb97552784af2e3cd89f0268b52ded0ae59e3895 (HEAD, refs/remotes/origin/master) Author: Tino Calancha Date: Tue May 15 09:03:02 2018 +0900 Run python test if the python executable is found * test/lisp/progmodes/python-tests.el (python-tests--bug31398): Skip test when executable python is no found. diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index dd1c45914e..1c4d22d72f 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -5355,6 +5355,7 @@ buffer with overlapping strings." ;; After call `run-python' the buffer running the python process is current. (ert-deftest python-tests--bug31398 () "Test for https://debbugs.gnu.org/31398 ." + (skip-unless (executable-find python-tests-shell-interpreter)) (let ((buffer (process-buffer (run-python nil nil 'show)))) (should (eq buffer (current-buffer))) (pop-to-buffer (other-buffer)) commit b015fb0ce37235480af8d80bce8c2f9b7e6258eb Author: Tino Calancha Date: Tue May 15 01:30:11 2018 +0900 run-python: Make the buffer running python current * lisp/progmodes/python.el (run-python, python-shell-make-comint): Make the buffer running the inferior python process the current buffer (Bug#31398). * test/lisp/progmodes/python-tests.el (python-tests--bug31398): Add test. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 32d645cfcc..a09ca2f2f2 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2842,10 +2842,12 @@ process buffer for a list of commands.)" (y-or-n-p "Make dedicated process? ") (= (prefix-numeric-value current-prefix-arg) 4)) (list (python-shell-calculate-command) nil t))) - (get-buffer-process - (python-shell-make-comint - (or cmd (python-shell-calculate-command)) - (python-shell-get-process-name dedicated) show))) + (let ((buffer + (python-shell-make-comint + (or cmd (python-shell-calculate-command)) + (python-shell-get-process-name dedicated) show))) + (pop-to-buffer buffer) + (get-buffer-process buffer))) (defun run-python-internal () "Run an inferior Internal Python process. diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 4955da02a2..dd1c45914e 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -5352,6 +5352,14 @@ buffer with overlapping strings." (python-nav-end-of-statement))) (should (eolp)))) +;; After call `run-python' the buffer running the python process is current. +(ert-deftest python-tests--bug31398 () + "Test for https://debbugs.gnu.org/31398 ." + (let ((buffer (process-buffer (run-python nil nil 'show)))) + (should (eq buffer (current-buffer))) + (pop-to-buffer (other-buffer)) + (run-python nil nil 'show) + (should (eq buffer (current-buffer))))) (provide 'python-tests) commit c2caf763cfe3bb85b4933ffac12695a7cb366cd4 Author: Basil L. Contovounesios Date: Tue May 15 01:23:35 2018 +0900 Minor refactoring in shell-command * lisp/simple.el (shell-command): Use call-process-shell-command, start-process-shell-command, and file-attribute-size. (bug#30280). diff --git a/lisp/simple.el b/lisp/simple.el index a0a6898e17..57e70a8d15 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3400,6 +3400,8 @@ a shell (with its need to quote arguments)." (setq command (concat command " &"))) (shell-command command output-buffer error-buffer)) +(declare-function comint-output-filter "comint" (process string)) + (defun shell-command (command &optional output-buffer error-buffer) "Execute string COMMAND in inferior shell; display output, if any. With prefix argument, insert the COMMAND's output at point. @@ -3477,12 +3479,11 @@ impose the use of a shell (with its need to quote arguments)." (not (or (bufferp output-buffer) (stringp output-buffer)))) ;; Output goes in current buffer. (let ((error-file - (if error-buffer - (make-temp-file - (expand-file-name "scor" - (or small-temporary-file-directory - temporary-file-directory))) - nil))) + (and error-buffer + (make-temp-file + (expand-file-name "scor" + (or small-temporary-file-directory + temporary-file-directory)))))) (barf-if-buffer-read-only) (push-mark nil t) ;; We do not use -f for csh; we will not support broken use of @@ -3490,24 +3491,22 @@ impose the use of a shell (with its need to quote arguments)." ;; "if ($?prompt) exit" before things which are not useful ;; non-interactively. Besides, if someone wants their other ;; aliases for shell commands then they can still have them. - (call-process shell-file-name nil - (if error-file - (list t error-file) - t) - nil shell-command-switch command) + (call-process-shell-command command nil (if error-file + (list t error-file) + t)) (when (and error-file (file-exists-p error-file)) - (if (< 0 (nth 7 (file-attributes error-file))) - (with-current-buffer (get-buffer-create error-buffer) - (let ((pos-from-end (- (point-max) (point)))) - (or (bobp) - (insert "\f\n")) - ;; Do no formatting while reading error file, - ;; because that can run a shell command, and we - ;; don't want that to cause an infinite recursion. - (format-insert-file error-file nil) - ;; Put point after the inserted errors. - (goto-char (- (point-max) pos-from-end))) - (display-buffer (current-buffer)))) + (when (< 0 (file-attribute-size (file-attributes error-file))) + (with-current-buffer (get-buffer-create error-buffer) + (let ((pos-from-end (- (point-max) (point)))) + (or (bobp) + (insert "\f\n")) + ;; Do no formatting while reading error file, + ;; because that can run a shell command, and we + ;; don't want that to cause an infinite recursion. + (format-insert-file error-file nil) + ;; Put point after the inserted errors. + (goto-char (- (point-max) pos-from-end))) + (display-buffer (current-buffer)))) (delete-file error-file)) ;; This is like exchange-point-and-mark, but doesn't ;; activate the mark. It is cleaner to avoid activation, @@ -3526,12 +3525,11 @@ impose the use of a shell (with its need to quote arguments)." (let* ((buffer (get-buffer-create (or output-buffer "*Async Shell Command*"))) (bname (buffer-name buffer)) - (directory default-directory) - proc) + (proc (get-buffer-process buffer)) + (directory default-directory)) ;; Remove the ampersand. (setq command (substring command 0 (match-beginning 0))) ;; Ask the user what to do with already running process. - (setq proc (get-buffer-process buffer)) (when proc (cond ((eq async-shell-command-buffer 'confirm-kill-process) @@ -3563,14 +3561,14 @@ impose the use of a shell (with its need to quote arguments)." (with-current-buffer buffer (shell-command--save-pos-or-erase) (setq default-directory directory) - (setq proc (start-process "Shell" buffer shell-file-name - shell-command-switch command)) + (setq proc + (start-process-shell-command "Shell" buffer command)) (setq mode-line-process '(":%s")) (require 'shell) (shell-mode) - (set-process-sentinel proc 'shell-command-sentinel) + (set-process-sentinel proc #'shell-command-sentinel) ;; Use the comint filter for proper handling of ;; carriage motion (see comint-inhibit-carriage-motion). - (set-process-filter proc 'comint-output-filter) + (set-process-filter proc #'comint-output-filter) (if async-shell-command-display-buffer ;; Display buffer immediately. (display-buffer buffer '(nil (allow-no-window . t))) commit 81fb3761ef491d55ba659594aed433f7f836f5b1 Author: Basil L. Contovounesios Date: Tue May 15 01:22:04 2018 +0900 Fix a broken test * lisp/simple.el (shell-command): Use call-process-shell-command, start-process-shell-command, and file-attribute-size. (bug#30280) diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 7a10df2058..678d9b9385 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -521,30 +521,51 @@ See Bug#21722." (do-auto-fill) (should (string-equal (buffer-string) "foo bar")))) + +;;; Shell command. + (ert-deftest simple-tests-async-shell-command-30280 () "Test for https://debbugs.gnu.org/30280 ." - :expected-result :failed (let* ((async-shell-command-buffer 'new-buffer) (async-shell-command-display-buffer nil) - (str "*Async Shell Command*") - (buffers-name - (cl-loop repeat 2 - collect (buffer-name - (generate-new-buffer str)))) + (base "name") + (first (buffer-name (generate-new-buffer base))) + (second (generate-new-buffer-name base)) + ;; `save-window-excursion' doesn't restore frame configurations. + (pop-up-frames nil) (inhibit-message t)) - (mapc #'kill-buffer buffers-name) - (async-shell-command - (format "%s -Q -batch -eval '(progn (sleep-for 3600) (message \"foo\"))'" - invocation-name)) - (async-shell-command - (format "%s -Q -batch -eval '(progn (sleep-for 1) (message \"bar\"))'" - invocation-name)) - (let ((buffers (mapcar #'get-buffer buffers-name)) - (processes (mapcar #'get-buffer-process buffers-name))) - (unwind-protect - (should (memq (cadr buffers) (mapcar #'window-buffer (window-list)))) - (mapc #'delete-process processes) - (mapc #'kill-buffer buffers))))) + ;; Let `shell-command' create the buffer as needed. + (kill-buffer first) + (unwind-protect + (save-window-excursion + ;; One command has no output, the other does. + ;; Removing the -eval argument also yields no output, but + ;; then both commands exit simultaneously when + ;; `accept-process-output' is called on the second command. + (dolist (form '("(sleep-for 8)" "(message \"\")")) + (async-shell-command (format "%s -Q -batch -eval '%s'" + invocation-name form) + first)) + ;; First command should neither have nor display output. + (let* ((buffer (get-buffer first)) + (process (get-buffer-process buffer))) + (should (buffer-live-p buffer)) + (should process) + (should (zerop (buffer-size buffer))) + (should (not (get-buffer-window buffer)))) + ;; Second command should both have and display output. + (let* ((buffer (get-buffer second)) + (process (get-buffer-process buffer))) + (should (buffer-live-p buffer)) + (should process) + (should (accept-process-output process 4 nil t)) + (should (> (buffer-size buffer) 0)) + (should (get-buffer-window buffer)))) + (dolist (name (list first second)) + (let* ((buffer (get-buffer name)) + (process (and buffer (get-buffer-process buffer)))) + (when process (delete-process process)) + (when buffer (kill-buffer buffer))))))) (provide 'simple-test) ;;; simple-test.el ends here commit 30bd61d67433c72641cb4d9a020b3c263aa6170f Author: Michael Albinus Date: Mon May 14 17:14:17 2018 +0200 * lisp/net/ange-ftp.el (ange-ftp-allow-child-lookup): Do not use obsolete ´dired-local-variables-file'. diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index c3650afa9a..cf9667ac62 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -2868,7 +2868,6 @@ NO-ERROR, if a listing for DIRECTORY cannot be obtained." ;; 2. The syntax of FILE and DIR make it impossible that FILE could be a valid ;; subdirectory. This is of course an OS dependent judgment. -(defvar dired-local-variables-file) (defmacro ange-ftp-allow-child-lookup (dir file) `(not (let* ((efile ,file) ; expand once. @@ -2877,10 +2876,6 @@ NO-ERROR, if a listing for DIRECTORY cannot be obtained." (host-type (ange-ftp-host-type (car parsed)))) (or - ;; Deal with dired - (and (boundp 'dired-local-variables-file) ; in the dired-x package - (stringp dired-local-variables-file) - (string-equal dired-local-variables-file efile)) ;; No dots in dir names in vms. (and (eq host-type 'vms) (string-match "\\." efile)) commit d15fa1b7d36a32e1dd9807eb5f0d1d8cd4f2e78d Author: Michael Albinus Date: Mon May 14 17:12:16 2018 +0200 Fix Bug#30663 * lisp/dired.el (dired-revert): Call `hack-dir-local-variables-non-file-buffer'. (Bug#30663) diff --git a/lisp/dired.el b/lisp/dired.el index 41b46d463a..1348df6934 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1443,7 +1443,8 @@ ARG and NOCONFIRM, passed from `revert-buffer', are ignored." (dolist (dir hidden-subdirs) (if (dired-goto-subdir dir) (dired-hide-subdir 1)))) - (unless modflag (restore-buffer-modified-p nil))) + (unless modflag (restore-buffer-modified-p nil)) + (hack-dir-local-variables-non-file-buffer)) ;; outside of the let scope ;;; Might as well not override the user if the user changed this. ;;; (setq buffer-read-only t) commit 63b506eb4c4194fc0910b77ea1c4211658b781e1 Author: Michael Albinus Date: Mon May 14 17:09:18 2018 +0200 Improve `dired-buffer-stale-p' for remote files * lisp/dired.el (dired-buffer-stale-p): Check for ´file-remote-p' only if `auto-revert-remote-files' is non-nil. diff --git a/lisp/dired.el b/lisp/dired.el index 1c283c5de3..41b46d463a 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -850,14 +850,18 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh." (not (eq (car attributes) t)) (equal (nth 5 attributes) modtime))))) +(defvar auto-revert-remote-files) + (defun dired-buffer-stale-p (&optional noconfirm) "Return non-nil if current Dired buffer needs updating. -If NOCONFIRM is non-nil, then this function always returns nil -for a remote directory. This feature is used by Auto Revert mode." +If NOCONFIRM is non-nil, then this function returns nil for a +remote directory, unless `auto-revert-remote-files' is non-nil. +This feature is used by Auto Revert mode." (let ((dirname (if (consp dired-directory) (car dired-directory) dired-directory))) (and (stringp dirname) - (not (when noconfirm (file-remote-p dirname))) + (not (when noconfirm (and (not auto-revert-remote-files) + (file-remote-p dirname)))) (file-readable-p dirname) ;; Do not auto-revert when the dired buffer can be currently ;; written by the user as in `wdired-mode'. commit 8fe07bbe310beea1c51b8f59c9fbac5fc466913b Author: Michael Albinus Date: Mon May 14 17:06:58 2018 +0200 ; Update etc/NEWS diff --git a/etc/NEWS b/etc/NEWS index 32fcdeff91..c7ffb17ad3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -493,25 +493,23 @@ comint-use-prompt-regexp-instead-of-fields, compilation-finish-function, count-text-lines, cperl-vc-header-alist, custom-face-save-command, cvs-display-full-path, cvs-fileinfo->full-path, delete-frame-hook, derived-mode-class, describe-char-after, describe-project, -desktop-basefilename, desktop-buffer-handlers, -desktop-buffer-misc-functions, desktop-buffer-modes-to-save, -desktop-enable, desktop-load-default, dired-omit-files-p, -disabled-command-hook, dungeon-mode-map, electric-nroff-mode, -electric-nroff-newline, electric-perl-terminator, focus-frame, -forward-text-line, generic-define-mswindows-modes, generic-define-unix-modes, -generic-font-lock-defaults, goto-address-at-mouse, +desktop-basefilename, desktop-buffer-handlers, desktop-buffer-misc-functions, +desktop-buffer-modes-to-save, desktop-enable, desktop-load-default, +dired-omit-files-p, disabled-command-hook, dungeon-mode-map, +electric-nroff-mode, electric-nroff-newline, electric-perl-terminator, +focus-frame, forward-text-line, generic-define-mswindows-modes, +generic-define-unix-modes, generic-font-lock-defaults, goto-address-at-mouse, highlight-changes-colours, ibuffer-elide-long-columns, ibuffer-hooks, ibuffer-mode-hooks, icalendar-convert-diary-to-ical, icalendar-extract-ical-from-buffer, imenu-always-use-completion-buffer-p, ipconfig-program, ipconfig-program-options, isearch-lazy-highlight-cleanup, -isearch-lazy-highlight-cleanup, isearch-lazy-highlight-initial-delay, -isearch-lazy-highlight-interval, isearch-lazy-highlight-max-at-a-time, -iswitchb-use-fonts, latin1-char-displayable-p, mouse-wheel-click-button, -mouse-wheel-down-button, mouse-wheel-up-button, new-frame, pascal-outline, -process-kill-without-query, recentf-menu-append-commands-p, -rmail-pop-password, rmail-pop-password-required, savehist-load, -set-default-font, spam-list-of-processors, -speedbar-add-ignored-path-regexp, speedbar-buffers-line-path, +isearch-lazy-highlight-initial-delay, isearch-lazy-highlight-interval, +isearch-lazy-highlight-max-at-a-time, iswitchb-use-fonts, +latin1-char-displayable-p, mouse-wheel-click-button, mouse-wheel-down-button, +mouse-wheel-up-button, new-frame, pascal-outline, process-kill-without-query, +recentf-menu-append-commands-p, rmail-pop-password, +rmail-pop-password-required, savehist-load, set-default-font, +spam-list-of-processors, speedbar-add-ignored-path-regexp, speedbar-buffers-line-path, speedbar-ignored-path-expressions, speedbar-ignored-path-regexp, speedbar-line-path, speedbar-path-line, timer-set-time-with-usecs, tooltip-gud-display, tooltip-gud-modes, @@ -519,7 +517,13 @@ tooltip-gud-toggle-dereference, unfocus-frame, unload-hook-features-list, update-autoloads-from-directories, vc-comment-ring, vc-comment-ring-index, vc-comment-search-forward, vc-comment-search-reverse, vc-comment-to-change-log, vc-diff-switches-list, vc-next-comment, vc-previous-comment, view-todo, -x-lost-selection-hooks, x-sent-selection-hooks +x-lost-selection-hooks, x-sent-selection-hooks. + +--- +** Further functions and variables obsolete since Emacs 24 have been removed: +default-directory-alist, dired-default-directory, +dired-default-directory-alist, dired-enable-local-variables, +dired-hack-local-variables, dired-local-variables-file, dired-omit-here-always. ** The function 'display-buffer-in-major-side-window' no longer exists. It has been renamed as internal function 'window--make-major-side-window', commit b01e6dd7b202fd9fbed8f1afa6cb6065ed85ff66 Author: Michael Albinus Date: Mon May 14 17:06:33 2018 +0200 Remove obsolete objects from dired-x.el * doc/misc/dired-x.texi (Local Variables): Remove node. * lisp/dired-x.el (dired-enable-local-variables) (default-directory-alist, dired-default-directory-alist) (dired-default-directory, dired-local-variables-file) (dired-hack-local-variables, dired-omit-here-always): Remove obsolete variables, constants and functions. diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi index a502667ab8..36179200f4 100644 --- a/doc/misc/dired-x.texi +++ b/doc/misc/dired-x.texi @@ -92,7 +92,6 @@ For @file{dired-x.el} as distributed with GNU Emacs @value{EMACSVER}. * Introduction:: * Installation:: * Omitting Files in Dired:: -* Local Variables:: * Shell Command Guessing:: * Virtual Dired:: * Advanced Mark Commands:: @@ -478,77 +477,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}. -@node Local Variables -@chapter Local Variables for Dired Directories - -@cindex Local Variables for Dired Directories -@vindex dired-local-variables-file -@vindex dired-enable-local-variables -@noindent -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 mechanisms, @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 - -@example -Local Variables: -dired-actual-switches: "-lat" -dired-omit-mode: t -End: -@end example - -@noindent -into a file called @file{.dired} in a directory then when that directory is -viewed it will be - -@enumerate -@item -sorted by date -@item -omitted automatically -@end enumerate - -@noindent -You can set @code{dired-local-variables-file} to @code{nil} to suppress this. -The value of @code{dired-enable-local-variables} controls if and how these -local variables are read. This variable exists so that it may override the -default value of @code{enable-local-variables}. - -@noindent -Please see the GNU Emacs Manual to learn more about local variables. -@xref{File Variables,Local Variables in Files,Local Variables in -Files,emacs,The GNU Emacs Manual}. - -@noindent -The following variables affect Dired Local Variables - -@table @code -@vindex dired-local-variables-file -@item dired-local-variables-file -Default: @code{".dired"} - -If non-@code{nil}, file name for local variables for Dired. If Dired finds a -file with that name in the current directory, it will temporarily insert it -into the Dired buffer and run @code{hack-local-variables}. - -@vindex dired-enable-local-variables -@item dired-enable-local-variables -Default: @code{t} - -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 @chapter Shell Command Guessing @cindex Guessing shell commands for files. diff --git a/lisp/dired-x.el b/lisp/dired-x.el index a1c2f4484c..4517dedeeb 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -192,21 +192,6 @@ toggle between those two." :type 'boolean :group 'dired-x) -(defcustom dired-enable-local-variables t - "Control use of local-variables lists in Dired. -This temporarily overrides the value of `enable-local-variables' when -listing a directory. See also `dired-local-variables-file'." - :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")) @@ -330,7 +315,6 @@ See also the functions: `dired-do-find-marked-files'" (interactive) ;; These must be done in each new dired buffer. - (dired-hack-local-variables) (dired-omit-startup)) @@ -785,34 +769,6 @@ Also useful for `auto-mode-alist' like this: ;; mechanism is provided for special handling of the working directory in ;; special major modes. -(define-obsolete-variable-alias 'default-directory-alist - 'dired-default-directory-alist "24.1") - -;; It's easier to add to this alist than redefine function -;; default-directory while keeping the old information. -(defconst dired-default-directory-alist - '((dired-mode . (if (fboundp 'dired-current-directory) - (dired-current-directory) - default-directory))) - "Alist of major modes and their opinion on `default-directory'. -Each element has the form (MAJOR . EXPRESSION). -The function `dired-default-directory' evaluates EXPRESSION to -determine a default directory.") - -(put 'dired-default-directory-alist 'risky-local-variable t) ; gets eval'd -(make-obsolete-variable 'dired-default-directory-alist - "this feature is due to be removed." "24.1") - -(defun dired-default-directory () - "Return the `dired-default-directory-alist' entry for the current major-mode. -If none, return `default-directory'." - ;; It looks like this was intended to be something of a "general" - ;; feature, but it only ever seems to have been used in - ;; dired-smart-shell-command, and doesn't seem worth keeping around. - (declare (obsolete nil "24.1")) - (or (eval (cdr (assq major-mode dired-default-directory-alist))) - default-directory)) - (defun dired-smart-shell-command (command &optional output-buffer error-buffer) "Like function `shell-command', but in the current Virtual Dired directory." (interactive @@ -829,85 +785,6 @@ If none, return `default-directory'." (shell-command command output-buffer error-buffer))) -;;; LOCAL VARIABLES FOR DIRED BUFFERS. - -;; 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' -;; -;; * 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. -;; -;; * If `dired-local-variables-file' satisfies the above, then temporarily -;; 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. - -(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 -buffer and `hack-local-variables' will be run. See Info node -`(emacs)File Variables' for more information on local variables. -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." - (declare (obsolete hack-dir-local-variables-non-file-buffer "24.1")) - (and (stringp dired-local-variables-file) - (file-exists-p dired-local-variables-file) - (let ((opoint (point-max)) - (inhibit-read-only t) - ;; In case user has `enable-local-variables' set to nil we - ;; override it locally with dired's variable. - (enable-local-variables dired-enable-local-variables)) - ;; Insert 'em. - (save-excursion - (goto-char opoint) - (insert "\^L\n") - (insert-file-contents dired-local-variables-file)) - ;; Hack 'em. - (unwind-protect - (let ((buffer-file-name dired-local-variables-file)) - (hack-local-variables)) - ;; Delete this stuff: `eobp' is used to find last subdir by dired.el. - (delete-region opoint (point-max))) - ;; Make sure that the mode line shows the proper information. - (dired-sort-set-mode-line)))) - -;; Does not seem worth a dedicated command. -;; See the more general features in files-x.el. -(defun dired-omit-here-always () - "Create `dir-locals-file' setting `dired-omit-mode' to t in `dired-mode'. -If in a Dired buffer, reverts it." - (declare (obsolete add-dir-local-variable "24.1")) - (interactive) - (if (file-exists-p dired-local-variables-file) - (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) - (add-dir-local-variable 'dired-mode 'subdirs nil) - (add-dir-local-variable 'dired-mode 'dired-omit-mode t) - ;; Run extra-hooks and revert directory. - (when (derived-mode-p 'dired-mode) - (hack-dir-local-variables-non-file-buffer) - (dired-extra-startup) - (dired-revert)))) - - ;;; GUESS SHELL COMMAND. ;; Brief Description: