aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-09-09 13:50:43 +0800
committerChong Yidong2012-09-09 13:50:43 +0800
commita8b7cd8d8b81e8db907bbc17c1121e94624ca70c (patch)
tree0879c9ae1ee3c0246a69e5aebc0d2a418174a71f
parentc3268831411fd68ce4f6f84ecda5eda2814a59a8 (diff)
downloademacs-a8b7cd8d8b81e8db907bbc17c1121e94624ca70c.tar.gz
emacs-a8b7cd8d8b81e8db907bbc17c1121e94624ca70c.zip
Use quit-window for quitting the *Local Variables* buffer.
* lisp/files.el (hack-local-variables-confirm): Use quit-window to kill the *Local Variables* buffer.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el72
2 files changed, 44 insertions, 33 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 29fa06c10e5..d7f730556ac 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-09-09 Chong Yidong <cyd@gnu.org>
2
3 * files.el (hack-local-variables-confirm): Use quit-window to kill
4 the *Local Variables* buffer.
5
12012-09-08 Dmitry Gutov <dgutov@yandex.ru> 62012-09-08 Dmitry Gutov <dgutov@yandex.ru>
2 7
3 * progmodes/ruby-mode.el (ruby-toggle-block): Guess the current block, 8 * progmodes/ruby-mode.el (ruby-toggle-block): Guess the current block,
diff --git a/lisp/files.el b/lisp/files.el
index fb4549f0399..4acdb542089 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2951,20 +2951,16 @@ UNSAFE-VARS is the list of those that aren't marked as safe or risky.
2951RISKY-VARS is the list of those that are marked as risky. 2951RISKY-VARS is the list of those that are marked as risky.
2952If these settings come from directory-local variables, then 2952If these settings come from directory-local variables, then
2953DIR-NAME is the name of the associated directory. Otherwise it is nil." 2953DIR-NAME is the name of the associated directory. Otherwise it is nil."
2954 (if noninteractive 2954 (unless noninteractive
2955 nil 2955 (let ((name (cond (dir-name)
2956 (save-window-excursion 2956 (buffer-file-name
2957 (let* ((name (or dir-name 2957 (file-name-nondirectory buffer-file-name))
2958 (if buffer-file-name 2958 ((concat "buffer " (buffer-name)))))
2959 (file-name-nondirectory buffer-file-name) 2959 (offer-save (and (eq enable-local-variables t)
2960 (concat "buffer " (buffer-name))))) 2960 unsafe-vars))
2961 (offer-save (and (eq enable-local-variables t) 2961 (buf (get-buffer-create "*Local Variables*")))
2962 unsafe-vars)) 2962 ;; Set up the contents of the *Local Variables* buffer.
2963 (exit-chars 2963 (with-current-buffer buf
2964 (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g)))
2965 (buf (pop-to-buffer "*Local Variables*"))
2966 prompt char)
2967 (set (make-local-variable 'cursor-type) nil)
2968 (erase-buffer) 2964 (erase-buffer)
2969 (cond 2965 (cond
2970 (unsafe-vars 2966 (unsafe-vars
@@ -2999,25 +2995,35 @@ n -- to ignore the local variables list.")
2999 (let ((print-escape-newlines t)) 2995 (let ((print-escape-newlines t))
3000 (prin1 (cdr elt) buf)) 2996 (prin1 (cdr elt) buf))
3001 (insert "\n")) 2997 (insert "\n"))
3002 (setq prompt 2998 (set (make-local-variable 'cursor-type) nil)
3003 (format "Please type %s%s: " 2999 (set-buffer-modified-p nil)
3004 (if offer-save "y, n, or !" "y or n") 3000 (goto-char (point-min)))
3005 (if (< (line-number-at-pos) (window-body-height)) 3001
3006 "" 3002 ;; Display the buffer and read a choice.
3007 (push ?\C-v exit-chars) 3003 (save-window-excursion
3008 ", or C-v to scroll"))) 3004 (pop-to-buffer buf)
3009 (goto-char (point-min)) 3005 (let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v))
3010 (while (null char) 3006 (prompt (format "Please type %s%s: "
3011 (setq char (read-char-choice prompt exit-chars t)) 3007 (if offer-save "y, n, or !" "y or n")
3012 (when (eq char ?\C-v) 3008 (if (< (line-number-at-pos (point-max))
3013 (condition-case nil 3009 (window-body-height))
3014 (scroll-up) 3010 ""
3015 (error (goto-char (point-min)))) 3011 (push ?\C-v exit-chars)
3016 (setq char nil))) 3012 ", or C-v to scroll")))
3017 (kill-buffer buf) 3013 char)
3018 (when (and offer-save (= char ?!) unsafe-vars) 3014 (if offer-save (push ?! exit-chars))
3019 (customize-push-and-save 'safe-local-variable-values unsafe-vars)) 3015 (while (null char)
3020 (memq char '(?! ?\s ?y)))))) 3016 (setq char (read-char-choice prompt exit-chars t))
3017 (when (eq char ?\C-v)
3018 (condition-case nil
3019 (scroll-up)
3020 (error (goto-char (point-min))
3021 (recenter 1)))
3022 (setq char nil)))
3023 (when (and offer-save (= char ?!) unsafe-vars)
3024 (customize-push-and-save 'safe-local-variable-values unsafe-vars))
3025 (prog1 (memq char '(?! ?\s ?y))
3026 (quit-window t)))))))
3021 3027
3022(defun hack-local-variables-prop-line (&optional mode-only) 3028(defun hack-local-variables-prop-line (&optional mode-only)
3023 "Return local variables specified in the -*- line. 3029 "Return local variables specified in the -*- line.