]> git.eshelyaron.com Git - emacs.git/commitdiff
* files.el (hack-local-variables-confirm): Allow scrolling if the
authorChong Yidong <cyd@stupidchicken.com>
Wed, 15 Feb 2006 01:21:31 +0000 (01:21 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Wed, 15 Feb 2006 01:21:31 +0000 (01:21 +0000)
file variable list is too long.

lisp/ChangeLog
lisp/files.el

index 8f325d6ae6d1859246dcc642286d71e2b83ee1a1..d691f30b0351025a3363b7422b5cd5919fa4d3b0 100644 (file)
@@ -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.
index 9aab6209db4b45ebee4af20b55f9ace0749d96ba..7b0c5e591c1bda8b81d028f7ff3ac68693ac89e3 100644 (file)
@@ -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.