mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-27 16:51:06 -07:00
* files.el (hack-local-variables-confirm): Allow scrolling if the
file variable list is too long.
This commit is contained in:
parent
9d8f542c7c
commit
42078bb225
2 changed files with 55 additions and 40 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2006-02-14 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* files.el (hack-local-variables-confirm): Allow scrolling if the
|
||||
file variable list is too long.
|
||||
|
||||
2006-02-15 Nick Roberts <nickrob@snap.net.nz>
|
||||
|
||||
* progmodes/gud.el (gdb): Improve doc string.
|
||||
|
|
|
|||
|
|
@ -2227,56 +2227,66 @@ Otherwise, return nil; point may be changed."
|
|||
(concat "buffer " (buffer-name))))
|
||||
char)
|
||||
(save-window-excursion
|
||||
(with-output-to-temp-buffer "*Local Variables*"
|
||||
(let ((buf (get-buffer-create "*Local Variables*"))
|
||||
(prompt))
|
||||
(pop-to-buffer buf)
|
||||
(set (make-local-variable 'cursor-type) nil)
|
||||
(erase-buffer)
|
||||
(if unsafe-vars
|
||||
(progn (princ "The local variables list in ")
|
||||
(princ name)
|
||||
(princ "\ncontains values that may not be safe (*)")
|
||||
(if risky-vars
|
||||
(princ ", and variables that are risky (**).")
|
||||
(princ ".")))
|
||||
(insert "The local variables list in " name
|
||||
"\ncontains values that may not be safe (*)"
|
||||
(if risky-vars
|
||||
", and variables that are risky (**)."
|
||||
"."))
|
||||
(if risky-vars
|
||||
(progn (princ "The local variables list in ")
|
||||
(princ name)
|
||||
(princ "\ncontains variables that are risky (**)."))
|
||||
(princ "A local variables list is specified in ")
|
||||
(princ name)
|
||||
(princ ".")))
|
||||
(princ "\n\nDo you want to apply it? You can type
|
||||
(insert "The local variables list in " name
|
||||
"\ncontains variables that are risky (**).")
|
||||
(insert "A local variables list is specified in " name ".")))
|
||||
(insert "\n\nDo you want to apply it? You can type
|
||||
y -- to apply the local variables list.
|
||||
n -- to ignore the local variables list.
|
||||
! -- to apply the local variables list, and mark these values (*) as
|
||||
safe (in the future, they can be set automatically.)\n\n")
|
||||
(dolist (elt vars)
|
||||
(cond ((member elt unsafe-vars)
|
||||
(princ " * "))
|
||||
(insert " * "))
|
||||
((member elt risky-vars)
|
||||
(princ " ** "))
|
||||
(insert " ** "))
|
||||
(t
|
||||
(princ " ")))
|
||||
(princ (car elt))
|
||||
(princ " : ")
|
||||
(princ (cdr elt))
|
||||
(princ "\n")))
|
||||
(message "Please type y, n, or !: ")
|
||||
(let ((inhibit-quit t)
|
||||
(cursor-in-echo-area t))
|
||||
(while (or (not (numberp (setq char (read-event))))
|
||||
(not (memq (downcase char)
|
||||
'(?! ?y ?n ?\s ?\C-g))))
|
||||
(message "Please type y, n, or !: "))
|
||||
(if (= char ?\C-g)
|
||||
(setq quit-flag nil)))
|
||||
(setq char (downcase char))
|
||||
(when (and (= char ?!) unsafe-vars)
|
||||
(dolist (elt unsafe-vars)
|
||||
(push elt safe-local-variable-values))
|
||||
(customize-save-variable
|
||||
'safe-local-variable-values
|
||||
safe-local-variable-values))
|
||||
(or (= char ?!)
|
||||
(= char ?\s)
|
||||
(= char ?y))))))
|
||||
(insert " ")))
|
||||
(princ (car elt) buf)
|
||||
(insert " : ")
|
||||
(princ (cdr elt) buf)
|
||||
(insert "\n"))
|
||||
(if (< (line-number-at-pos) (window-body-height))
|
||||
(setq prompt "Please type y, n, or !: ")
|
||||
(goto-char (point-min))
|
||||
(setq prompt "Please type y, n, or !, or C-v to scroll: "))
|
||||
(let ((inhibit-quit t)
|
||||
(cursor-in-echo-area t)
|
||||
done)
|
||||
(while (not done)
|
||||
(message prompt)
|
||||
(setq char (read-event))
|
||||
(if (numberp char)
|
||||
(if (eq char ?\C-v)
|
||||
(condition-case nil
|
||||
(scroll-up)
|
||||
(error (goto-char (point-min))))
|
||||
(setq done (memq (downcase char)
|
||||
'(?! ?y ?n ?\s ?\C-g))))))
|
||||
(if (= char ?\C-g)
|
||||
(setq quit-flag nil)))
|
||||
(setq char (downcase char))
|
||||
(when (and (= char ?!) unsafe-vars)
|
||||
(dolist (elt unsafe-vars)
|
||||
(add-to-list 'safe-local-variable-values elt))
|
||||
(customize-save-variable
|
||||
'safe-local-variable-values
|
||||
safe-local-variable-values))
|
||||
(or (= char ?!)
|
||||
(= char ?\s)
|
||||
(= char ?y)))))))
|
||||
|
||||
(defun hack-local-variables-prop-line (&optional mode-only)
|
||||
"Return local variables specified in the -*- line.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue