summaryrefslogtreecommitdiff
path: root/lisp/custom.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-09-09 14:43:47 +0800
committerChong Yidong <cyd@gnu.org>2012-09-09 14:43:47 +0800
commit011474aa5af24faeceac60348315552313774b10 (patch)
tree3cc6fd2abea75f38677e2cfc3c0ee6eebb77300f /lisp/custom.el
parenta8b7cd8d8b81e8db907bbc17c1121e94624ca70c (diff)
downloademacs-011474aa5af24faeceac60348315552313774b10.tar.gz
Allow scrolling in y-or-n-p.
* lisp/replace.el (query-replace-map): Bind four new symbols for requesting window scrolling. * lisp/subr.el (y-or-n-p): Handle the window-scrolling bindings in query-replace-map. * lisp/custom.el (custom-theme-load-confirm): Use y-or-n-p. * lisp/window.el (scroll-other-window-down): Make the arg optional. * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Don't bind scrolling keys since they are now in query-replace-map. * doc/lispref/minibuf.texi (Yes-or-No Queries): Document recentering and scrolling in y-or-n-p. Remove gratuitous example. * doc/lispref/searching.texi (Search and Replace): Document window scrolling entries in query-replace-map. Fixes: debbugs:8948
Diffstat (limited to 'lisp/custom.el')
-rw-r--r--lisp/custom.el45
1 files changed, 13 insertions, 32 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index fb166dd35f7..3eb2895888d 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1223,38 +1223,19 @@ Return t if THEME was successfully loaded, nil otherwise."
"Query the user about loading a Custom theme that may not be safe.
The theme should be in the current buffer. If the user agrees,
query also about adding HASH to `custom-safe-themes'."
- (if noninteractive
- nil
- (let ((exit-chars '(?y ?n ?\s))
- window prompt char)
- (save-window-excursion
- (rename-buffer "*Custom Theme*" t)
- (emacs-lisp-mode)
- (setq window (display-buffer (current-buffer)))
- (setq prompt
- (format "Loading a theme can run Lisp code. Really load?%s"
- (if (and window
- (< (line-number-at-pos (point-max))
- (window-body-height)))
- " (y or n) "
- (push ?\C-v exit-chars)
- "\nType y or n, or C-v to scroll: ")))
- (goto-char (point-min))
- (while (null char)
- (setq char (read-char-choice prompt exit-chars))
- (when (eq char ?\C-v)
- (if window
- (with-selected-window window
- (condition-case nil
- (scroll-up)
- (error (goto-char (point-min))))))
- (setq char nil)))
- (when (memq char '(?\s ?y))
- ;; Offer to save to `custom-safe-themes'.
- (and (or custom-file user-init-file)
- (y-or-n-p "Treat this theme as safe in future sessions? ")
- (customize-push-and-save 'custom-safe-themes (list hash)))
- t)))))
+ (unless noninteractive
+ (save-window-excursion
+ (rename-buffer "*Custom Theme*" t)
+ (emacs-lisp-mode)
+ (setq window (pop-to-buffer (current-buffer)))
+ (goto-char (point-min))
+ (prog1 (when (y-or-n-p "Loading a theme can run Lisp code. Really load? ")
+ ;; Offer to save to `custom-safe-themes'.
+ (and (or custom-file user-init-file)
+ (y-or-n-p "Treat this theme as safe in future sessions? ")
+ (customize-push-and-save 'custom-safe-themes (list hash)))
+ t)
+ (quit-window)))))
(defun custom-theme-name-valid-p (name)
"Return t if NAME is a valid name for a Custom theme, nil otherwise.