diff options
| author | Chong Yidong | 2006-03-10 23:22:30 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-03-10 23:22:30 +0000 |
| commit | af467e285ed142761527612f2c40fd6dfd02d345 (patch) | |
| tree | 6c6005536099fc6279e37422f2ec70aed7d98003 | |
| parent | 7c565097d15d61cef15fe7474da44a2bc9e87725 (diff) | |
| download | emacs-af467e285ed142761527612f2c40fd6dfd02d345.tar.gz emacs-af467e285ed142761527612f2c40fd6dfd02d345.zip | |
* files.el (hack-local-variables-confirm): Don't prompt for ! if
enable-local-variables is set to always query, or there is no
savable variable.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/files.el | 33 |
2 files changed, 27 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7892a9b6d22..96aae2ec1c4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2006-03-10 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * files.el (hack-local-variables-confirm): Don't prompt for ! if | ||
| 4 | enable-local-variables is set to always query, or there is no | ||
| 5 | savable variable. | ||
| 6 | |||
| 1 | 2006-03-10 Bill Wohler <wohler@newt.com> | 7 | 2006-03-10 Bill Wohler <wohler@newt.com> |
| 2 | 8 | ||
| 3 | * image.el (image-load-path-for-library): Merge at least three | 9 | * image.el (image-load-path-for-library): Merge at least three |
diff --git a/lisp/files.el b/lisp/files.el index fc6267fd002..91a434dd33f 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2349,6 +2349,7 @@ asking you for confirmation." | |||
| 2349 | (let ((name (if buffer-file-name | 2349 | (let ((name (if buffer-file-name |
| 2350 | (file-name-nondirectory buffer-file-name) | 2350 | (file-name-nondirectory buffer-file-name) |
| 2351 | (concat "buffer " (buffer-name)))) | 2351 | (concat "buffer " (buffer-name)))) |
| 2352 | (offer-save (and (eq enable-local-variables t) unsafe-vars)) | ||
| 2352 | prompt char) | 2353 | prompt char) |
| 2353 | (save-window-excursion | 2354 | (save-window-excursion |
| 2354 | (let ((buf (get-buffer-create "*Local Variables*"))) | 2355 | (let ((buf (get-buffer-create "*Local Variables*"))) |
| @@ -2367,9 +2368,12 @@ asking you for confirmation." | |||
| 2367 | (insert "A local variables list is specified in " name "."))) | 2368 | (insert "A local variables list is specified in " name "."))) |
| 2368 | (insert "\n\nDo you want to apply it? You can type | 2369 | (insert "\n\nDo you want to apply it? You can type |
| 2369 | y -- to apply the local variables list. | 2370 | y -- to apply the local variables list. |
| 2370 | n -- to ignore the local variables list. | 2371 | n -- to ignore the local variables list.") |
| 2372 | (if offer-save | ||
| 2373 | (insert " | ||
| 2371 | ! -- to apply the local variables list, and mark these values (*) as | 2374 | ! -- to apply the local variables list, and mark these values (*) as |
| 2372 | safe (in the future, they can be set automatically.)\n\n") | 2375 | safe (in the future, they can be set automatically.)\n\n") |
| 2376 | (insert "\n\n")) | ||
| 2373 | (dolist (elt vars) | 2377 | (dolist (elt vars) |
| 2374 | (cond ((member elt unsafe-vars) | 2378 | (cond ((member elt unsafe-vars) |
| 2375 | (insert " * ")) | 2379 | (insert " * ")) |
| @@ -2381,12 +2385,17 @@ n -- to ignore the local variables list. | |||
| 2381 | (insert " : ") | 2385 | (insert " : ") |
| 2382 | (princ (cdr elt) buf) | 2386 | (princ (cdr elt) buf) |
| 2383 | (insert "\n")) | 2387 | (insert "\n")) |
| 2384 | (if (< (line-number-at-pos) (window-body-height)) | 2388 | (setq prompt |
| 2385 | (setq prompt "Please type y, n, or !: ") | 2389 | (format "Please type %s%s: " |
| 2386 | (goto-char (point-min)) | 2390 | (if offer-save "y, n, or !" "y or n") |
| 2387 | (setq prompt "Please type y, n, or !, or C-v to scroll: ")) | 2391 | (if (< (line-number-at-pos) (window-body-height)) |
| 2392 | "" | ||
| 2393 | ", or C-v to scroll"))) | ||
| 2394 | (goto-char (point-min)) | ||
| 2388 | (let ((inhibit-quit t) | 2395 | (let ((inhibit-quit t) |
| 2389 | (cursor-in-echo-area t) | 2396 | (cursor-in-echo-area t) |
| 2397 | (exit-chars | ||
| 2398 | (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g))) | ||
| 2390 | done) | 2399 | done) |
| 2391 | (while (not done) | 2400 | (while (not done) |
| 2392 | (message prompt) | 2401 | (message prompt) |
| @@ -2396,21 +2405,21 @@ n -- to ignore the local variables list. | |||
| 2396 | (condition-case nil | 2405 | (condition-case nil |
| 2397 | (scroll-up) | 2406 | (scroll-up) |
| 2398 | (error (goto-char (point-min)))) | 2407 | (error (goto-char (point-min)))) |
| 2399 | (setq done (memq (downcase char) | 2408 | (setq done (memq (downcase char) exit-chars))))) |
| 2400 | '(?! ?y ?n ?\s ?\C-g)))))) | ||
| 2401 | (if (= char ?\C-g) | 2409 | (if (= char ?\C-g) |
| 2402 | (setq quit-flag nil))) | 2410 | (setq quit-flag nil))) |
| 2403 | (setq char (downcase char)) | 2411 | (setq char (downcase char)) |
| 2404 | (when (and (= char ?!) unsafe-vars) | 2412 | (when (and offer-save (= char ?!) unsafe-vars) |
| 2405 | (dolist (elt unsafe-vars) | 2413 | (dolist (elt unsafe-vars) |
| 2406 | (add-to-list 'safe-local-variable-values elt)) | 2414 | (add-to-list 'safe-local-variable-values elt)) |
| 2407 | ;; When this is called from desktop-restore-file-buffer, | 2415 | ;; When this is called from desktop-restore-file-buffer, |
| 2408 | ;; coding-system-for-read may be non-nil. Reset it before | 2416 | ;; coding-system-for-read may be non-nil. Reset it before |
| 2409 | ;; writing to .emacs. | 2417 | ;; writing to .emacs. |
| 2410 | (let ((coding-system-for-read nil)) | 2418 | (if (or custom-file user-init-file) |
| 2411 | (customize-save-variable | 2419 | (let ((coding-system-for-read nil)) |
| 2412 | 'safe-local-variable-values | 2420 | (customize-save-variable |
| 2413 | safe-local-variable-values))) | 2421 | 'safe-local-variable-values |
| 2422 | safe-local-variable-values)))) | ||
| 2414 | (kill-buffer buf) | 2423 | (kill-buffer buf) |
| 2415 | (or (= char ?!) | 2424 | (or (= char ?!) |
| 2416 | (= char ?\s) | 2425 | (= char ?\s) |