aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2006-02-15 01:21:31 +0000
committerChong Yidong2006-02-15 01:21:31 +0000
commit42078bb225a979a791d8b33528ae1c96e4bd19cf (patch)
tree990ea22f5da9e41c987d82bbba2b211c7e189a78
parent9d8f542c7c8a4b27eda9090bc036ce562da111fc (diff)
downloademacs-42078bb225a979a791d8b33528ae1c96e4bd19cf.tar.gz
emacs-42078bb225a979a791d8b33528ae1c96e4bd19cf.zip
* files.el (hack-local-variables-confirm): Allow scrolling if the
file variable list is too long.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el90
2 files changed, 55 insertions, 40 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8f325d6ae6d..d691f30b035 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12006-02-14 Chong Yidong <cyd@stupidchicken.com>
2
3 * files.el (hack-local-variables-confirm): Allow scrolling if the
4 file variable list is too long.
5
12006-02-15 Nick Roberts <nickrob@snap.net.nz> 62006-02-15 Nick Roberts <nickrob@snap.net.nz>
2 7
3 * progmodes/gud.el (gdb): Improve doc string. 8 * progmodes/gud.el (gdb): Improve doc string.
diff --git a/lisp/files.el b/lisp/files.el
index 9aab6209db4..7b0c5e591c1 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2227,56 +2227,66 @@ Otherwise, return nil; point may be changed."
2227 (concat "buffer " (buffer-name)))) 2227 (concat "buffer " (buffer-name))))
2228 char) 2228 char)
2229 (save-window-excursion 2229 (save-window-excursion
2230 (with-output-to-temp-buffer "*Local Variables*" 2230 (let ((buf (get-buffer-create "*Local Variables*"))
2231 (prompt))
2232 (pop-to-buffer buf)
2233 (set (make-local-variable 'cursor-type) nil)
2234 (erase-buffer)
2231 (if unsafe-vars 2235 (if unsafe-vars
2232 (progn (princ "The local variables list in ") 2236 (insert "The local variables list in " name
2233 (princ name) 2237 "\ncontains values that may not be safe (*)"
2234 (princ "\ncontains values that may not be safe (*)") 2238 (if risky-vars
2235 (if risky-vars 2239 ", and variables that are risky (**)."
2236 (princ ", and variables that are risky (**).") 2240 "."))
2237 (princ ".")))
2238 (if risky-vars 2241 (if risky-vars
2239 (progn (princ "The local variables list in ") 2242 (insert "The local variables list in " name
2240 (princ name) 2243 "\ncontains variables that are risky (**).")
2241 (princ "\ncontains variables that are risky (**).")) 2244 (insert "A local variables list is specified in " name ".")))
2242 (princ "A local variables list is specified in ") 2245 (insert "\n\nDo you want to apply it? You can type
2243 (princ name)
2244 (princ ".")))
2245 (princ "\n\nDo you want to apply it? You can type
2246y -- to apply the local variables list. 2246y -- to apply the local variables list.
2247n -- to ignore the local variables list. 2247n -- to ignore the local variables list.
2248! -- to apply the local variables list, and mark these values (*) as 2248! -- to apply the local variables list, and mark these values (*) as
2249 safe (in the future, they can be set automatically.)\n\n") 2249 safe (in the future, they can be set automatically.)\n\n")
2250 (dolist (elt vars) 2250 (dolist (elt vars)
2251 (cond ((member elt unsafe-vars) 2251 (cond ((member elt unsafe-vars)
2252 (princ " * ")) 2252 (insert " * "))
2253 ((member elt risky-vars) 2253 ((member elt risky-vars)
2254 (princ " ** ")) 2254 (insert " ** "))
2255 (t 2255 (t
2256 (princ " "))) 2256 (insert " ")))
2257 (princ (car elt)) 2257 (princ (car elt) buf)
2258 (princ " : ") 2258 (insert " : ")
2259 (princ (cdr elt)) 2259 (princ (cdr elt) buf)
2260 (princ "\n"))) 2260 (insert "\n"))
2261 (message "Please type y, n, or !: ") 2261 (if (< (line-number-at-pos) (window-body-height))
2262 (let ((inhibit-quit t) 2262 (setq prompt "Please type y, n, or !: ")
2263 (cursor-in-echo-area t)) 2263 (goto-char (point-min))
2264 (while (or (not (numberp (setq char (read-event)))) 2264 (setq prompt "Please type y, n, or !, or C-v to scroll: "))
2265 (not (memq (downcase char) 2265 (let ((inhibit-quit t)
2266 '(?! ?y ?n ?\s ?\C-g)))) 2266 (cursor-in-echo-area t)
2267 (message "Please type y, n, or !: ")) 2267 done)
2268 (if (= char ?\C-g) 2268 (while (not done)
2269 (setq quit-flag nil))) 2269 (message prompt)
2270 (setq char (downcase char)) 2270 (setq char (read-event))
2271 (when (and (= char ?!) unsafe-vars) 2271 (if (numberp char)
2272 (dolist (elt unsafe-vars) 2272 (if (eq char ?\C-v)
2273 (push elt safe-local-variable-values)) 2273 (condition-case nil
2274 (customize-save-variable 2274 (scroll-up)
2275 'safe-local-variable-values 2275 (error (goto-char (point-min))))
2276 safe-local-variable-values)) 2276 (setq done (memq (downcase char)
2277 (or (= char ?!) 2277 '(?! ?y ?n ?\s ?\C-g))))))
2278 (= char ?\s) 2278 (if (= char ?\C-g)
2279 (= char ?y)))))) 2279 (setq quit-flag nil)))
2280 (setq char (downcase char))
2281 (when (and (= char ?!) unsafe-vars)
2282 (dolist (elt unsafe-vars)
2283 (add-to-list 'safe-local-variable-values elt))
2284 (customize-save-variable
2285 'safe-local-variable-values
2286 safe-local-variable-values))
2287 (or (= char ?!)
2288 (= char ?\s)
2289 (= char ?y)))))))
2280 2290
2281(defun hack-local-variables-prop-line (&optional mode-only) 2291(defun hack-local-variables-prop-line (&optional mode-only)
2282 "Return local variables specified in the -*- line. 2292 "Return local variables specified in the -*- line.