Mercurial > emacs
comparison lisp/files.el @ 90299:9e490faa9f6b
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-17
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 85-96)
- Update from CVS
- Merge from erc--emacs--0
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 30-36)
- Merge from emacs--devo--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 17 Feb 2006 09:10:23 +0000 |
parents | d57ee9eab157 7d7207d65934 |
children | d1c5430c5bff |
comparison
equal
deleted
inserted
replaced
90298:15363e44d751 | 90299:9e490faa9f6b |
---|---|
2223 (if noninteractive | 2223 (if noninteractive |
2224 nil | 2224 nil |
2225 (let ((name (if buffer-file-name | 2225 (let ((name (if buffer-file-name |
2226 (file-name-nondirectory buffer-file-name) | 2226 (file-name-nondirectory buffer-file-name) |
2227 (concat "buffer " (buffer-name)))) | 2227 (concat "buffer " (buffer-name)))) |
2228 char) | 2228 prompt 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 (pop-to-buffer buf) | |
2232 (set (make-local-variable 'cursor-type) nil) | |
2233 (erase-buffer) | |
2231 (if unsafe-vars | 2234 (if unsafe-vars |
2232 (progn (princ "The local variables list in ") | 2235 (insert "The local variables list in " name |
2233 (princ name) | 2236 "\ncontains values that may not be safe (*)" |
2234 (princ "\ncontains values that may not be safe (*)") | 2237 (if risky-vars |
2235 (if risky-vars | 2238 ", and variables that are risky (**)." |
2236 (princ ", and variables that are risky (**).") | 2239 ".")) |
2237 (princ "."))) | |
2238 (if risky-vars | 2240 (if risky-vars |
2239 (progn (princ "The local variables list in ") | 2241 (insert "The local variables list in " name |
2240 (princ name) | 2242 "\ncontains variables that are risky (**).") |
2241 (princ "\ncontains variables that are risky (**).")) | 2243 (insert "A local variables list is specified in " name "."))) |
2242 (princ "A local variables list is specified in ") | 2244 (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 | |
2246 y -- to apply the local variables list. | 2245 y -- to apply the local variables list. |
2247 n -- to ignore the local variables list. | 2246 n -- to ignore the local variables list. |
2248 ! -- to apply the local variables list, and mark these values (*) as | 2247 ! -- to apply the local variables list, and mark these values (*) as |
2249 safe (in the future, they can be set automatically.)\n\n") | 2248 safe (in the future, they can be set automatically.)\n\n") |
2250 (dolist (elt vars) | 2249 (dolist (elt vars) |
2251 (cond ((member elt unsafe-vars) | 2250 (cond ((member elt unsafe-vars) |
2252 (princ " * ")) | 2251 (insert " * ")) |
2253 ((member elt risky-vars) | 2252 ((member elt risky-vars) |
2254 (princ " ** ")) | 2253 (insert " ** ")) |
2255 (t | 2254 (t |
2256 (princ " "))) | 2255 (insert " "))) |
2257 (princ (car elt)) | 2256 (princ (car elt) buf) |
2258 (princ " : ") | 2257 (insert " : ") |
2259 (princ (cdr elt)) | 2258 (princ (cdr elt) buf) |
2260 (princ "\n"))) | 2259 (insert "\n")) |
2261 (message "Please type y, n, or !: ") | 2260 (if (< (line-number-at-pos) (window-body-height)) |
2262 (let ((inhibit-quit t) | 2261 (setq prompt "Please type y, n, or !: ") |
2263 (cursor-in-echo-area t)) | 2262 (goto-char (point-min)) |
2264 (while (or (not (numberp (setq char (read-event)))) | 2263 (setq prompt "Please type y, n, or !, or C-v to scroll: ")) |
2265 (not (memq (downcase char) | 2264 (let ((inhibit-quit t) |
2266 '(?! ?y ?n ?\s ?\C-g)))) | 2265 (cursor-in-echo-area t) |
2267 (message "Please type y, n, or !: ")) | 2266 done) |
2268 (if (= char ?\C-g) | 2267 (while (not done) |
2269 (setq quit-flag nil))) | 2268 (message prompt) |
2270 (setq char (downcase char)) | 2269 (setq char (read-event)) |
2271 (when (and (= char ?!) unsafe-vars) | 2270 (if (numberp char) |
2272 (dolist (elt unsafe-vars) | 2271 (if (eq char ?\C-v) |
2273 (push elt safe-local-variable-values)) | 2272 (condition-case nil |
2274 (customize-save-variable | 2273 (scroll-up) |
2275 'safe-local-variable-values | 2274 (error (goto-char (point-min)))) |
2276 safe-local-variable-values)) | 2275 (setq done (memq (downcase char) |
2277 (or (= char ?!) | 2276 '(?! ?y ?n ?\s ?\C-g)))))) |
2278 (= char ?\s) | 2277 (if (= char ?\C-g) |
2279 (= char ?y)))))) | 2278 (setq quit-flag nil))) |
2279 (setq char (downcase char)) | |
2280 (when (and (= char ?!) unsafe-vars) | |
2281 (dolist (elt unsafe-vars) | |
2282 (add-to-list 'safe-local-variable-values elt)) | |
2283 (customize-save-variable | |
2284 'safe-local-variable-values | |
2285 safe-local-variable-values)) | |
2286 (kill-buffer buf) | |
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. |
2283 Ignore any specification for `mode:' and `coding:'; | 2293 Ignore any specification for `mode:' and `coding:'; |
2284 `set-auto-mode' should already have handled `mode:', | 2294 `set-auto-mode' should already have handled `mode:', |
2437 ;; We've read all the local variables. Now, return whether the | 2447 ;; We've read all the local variables. Now, return whether the |
2438 ;; mode is specified (if MODE-ONLY is non-nil), or set the | 2448 ;; mode is specified (if MODE-ONLY is non-nil), or set the |
2439 ;; variables (if MODE-ONLY is nil.) | 2449 ;; variables (if MODE-ONLY is nil.) |
2440 (if mode-only | 2450 (if mode-only |
2441 result | 2451 result |
2452 (dolist (ignored ignored-local-variables) | |
2453 (setq result (assq-delete-all ignored result))) | |
2454 (if (null enable-local-eval) | |
2455 (setq result (assq-delete-all 'eval result))) | |
2442 (when result | 2456 (when result |
2443 (setq result (nreverse result)) | 2457 (setq result (nreverse result)) |
2444 (dolist (ignored ignored-local-variables) | |
2445 (setq result (assq-delete-all ignored result))) | |
2446 (if (null enable-local-eval) | |
2447 (setq result (assq-delete-all 'eval result))) | |
2448 ;; Find those variables that we may want to save to | 2458 ;; Find those variables that we may want to save to |
2449 ;; `safe-local-variable-values'. | 2459 ;; `safe-local-variable-values'. |
2450 (let (risky-vars unsafe-vars) | 2460 (let (risky-vars unsafe-vars) |
2451 (dolist (elt result) | 2461 (dolist (elt result) |
2452 (let ((var (car elt)) | 2462 (let ((var (car elt)) |