From 1579f37824b59246609a5d8276ffc640a40b71dc Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Fri, 5 Nov 2010 08:20:33 +0100 Subject: [PATCH] More conversions to buffer display specifiers --- lisp/ChangeLog | 24 ++++++++++++++++++++++++ lisp/cus-edit.el | 50 +++++++++++++++++++++++++------------------------- lisp/ehelp.el | 3 +-- lisp/play/decipher.el | 12 ++++-------- lisp/vc/ediff-util.el | 3 +-- 5 files changed, 55 insertions(+), 37 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be489c74df7..cc6aa6d10ab 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -28,6 +28,30 @@ * buff-menu.el (Buffer-menu-switch-other-window) (Buffer-menu-2-window): Use buffer display specifiers. + * cus-edit.el (top-level): Remove autoloaded add-hook for + same-window-regexps. + (customize-group, customize-face): New optional argument + OTHER-WINDOW. Use buffer display specifiers. Call + custom-buffer-create with OTHER-WINDOW argument t. + (customize-group-other-window): Call customize-group with + OTHER-WINDOW argument t. + (customize-face-other-window): Call customize-face with + OTHER-WINDOW argument t. + (custom-buffer-create): New optional argument OTHER-WINDOW. + (custom-buffer-create-other-window): Call + pop-to-buffer-other-window. + (customize-browse): Call pop-to-buffer-same-window. + + * play/decipher.el (decipher-display-range): Use + pop-to-buffer-other-window. + (decipher-display-stats-buffer): Use + display-buffer-other-window. + + * vc/ediff-util.el (ediff-clone-buffer-for-region-comparison): + Use pop-to-buffer-other-window. + + * ehelp.el (with-electric-help): Use pop-to-buffer-other-window. + 2010-11-02 Martin Rudalics * window.el (display-buffer-names): Describe `not-this-window' and diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 61e6881139a..bcb70c6cc60 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -700,8 +700,6 @@ If `last', order groups after non-groups." (const :tag "none" nil)) :group 'custom-menu) -;;;###autoload (add-hook 'same-window-regexps (purecopy "\\`\\*Customiz.*\\*\\'")) - (defun custom-sort-items (items sort-alphabetically order-groups) "Return a sorted copy of ITEMS. ITEMS should be a `custom-group' property. @@ -1074,8 +1072,9 @@ then prompt for the MODE to customize." t))) ;;;###autoload -(defun customize-group (&optional group) - "Customize GROUP, which must be a customization group." +(defun customize-group (&optional group other-window) + "Customize GROUP, which must be a customization group. +OTHER-WINDOW non-nil means do this in another window." (interactive (list (customize-read-group))) (when (stringp group) (if (string-equal "" group) @@ -1084,21 +1083,21 @@ then prompt for the MODE to customize." (let ((name (format "*Customize Group: %s*" (custom-unlispify-tag-name group)))) (if (get-buffer name) - (pop-to-buffer name) + (if other-window + (pop-to-buffer-other-window name) + (pop-to-buffer-same-window name)) (custom-buffer-create (list (list group 'custom-group)) name (concat " for group " - (custom-unlispify-tag-name group)))))) + (custom-unlispify-tag-name group)) + other-window)))) ;;;###autoload (defun customize-group-other-window (&optional group) "Customize GROUP, which must be a customization group, in another window." (interactive (list (customize-read-group))) - (let ((pop-up-windows t) - (same-window-buffer-names nil) - (same-window-regexps nil)) - (customize-group group))) + (customize-group group t)) ;;;###autoload (defalias 'customize-variable 'customize-option) @@ -1279,8 +1278,10 @@ Emacs that is associated with version VERSION of PACKAGE." (< minor1 minor2))))) ;;;###autoload -(defun customize-face (&optional face) +(defun customize-face (&optional face other-window) "Customize FACE, which should be a face name or nil. +OTHER-WINDOW non-nil means do this in another window. + If FACE is nil, customize all faces. If FACE is actually a face-alias, customize the face it is aliased to. @@ -1296,7 +1297,7 @@ suggest to customize that face, if it's customizable." (custom-sort-items (mapcar (lambda (s) (list s 'custom-face)) face) t nil) - "*Customize Faces*") + "*Customize Faces*" other-window) ;; If FACE is actually an alias, customize the face it is aliased to. (if (get face 'face-alias) (setq face (get face 'face-alias))) @@ -1305,7 +1306,8 @@ suggest to customize that face, if it's customizable." (custom-buffer-create (list (list face 'custom-face)) (format "*Customize Face: %s*" - (custom-unlispify-tag-name face))))) + (custom-unlispify-tag-name face)) + nil other-window))) ;;;###autoload (defun customize-face-other-window (&optional face) @@ -1315,10 +1317,7 @@ If FACE is actually a face-alias, customize the face it is aliased to. Interactively, when point is on text which has a face specified, suggest to customize that face, if it's customizable." (interactive (list (read-face-name "Customize face" "all faces" t))) - (let ((pop-up-windows t) - (same-window-buffer-names nil) - (same-window-regexps nil)) - (customize-face face))) + (customize-face face t)) (defalias 'customize-customized 'customize-unsaved) @@ -1498,13 +1497,17 @@ not for everybody." buf)))) ;;;###autoload -(defun custom-buffer-create (options &optional name description) +(defun custom-buffer-create (options &optional name description other-window) "Create a buffer containing OPTIONS. Optional NAME is the name of the buffer. OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where SYMBOL is a customization option, and WIDGET is a widget for editing that option." - (pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*"))) + (if other-window + (pop-to-buffer-other-window + (custom-get-fresh-buffer (or name "*Customization*"))) + (pop-to-buffer-same-window + (custom-get-fresh-buffer (or name "*Customization*")))) (custom-buffer-create-internal options description)) ;;;###autoload @@ -1516,11 +1519,8 @@ OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where SYMBOL is a customization option, and WIDGET is a widget for editing that option." (unless name (setq name "*Customization*")) - (let ((pop-up-windows t) - (same-window-buffer-names nil) - (same-window-regexps nil)) - (pop-to-buffer (custom-get-fresh-buffer name)) - (custom-buffer-create-internal options description))) + (pop-to-buffer-other-window (custom-get-fresh-buffer name)) + (custom-buffer-create-internal options description)) (defcustom custom-reset-button-menu nil "If non-nil, only show a single reset button in customize buffers. @@ -1695,7 +1695,7 @@ Otherwise use brackets." (unless group (setq group 'emacs)) (let ((name "*Customize Browser*")) - (pop-to-buffer (custom-get-fresh-buffer name))) + (pop-to-buffer-same-window (custom-get-fresh-buffer name))) (Custom-mode) (widget-insert (format "\ %s buttons; type RET or click mouse-1 diff --git a/lisp/ehelp.el b/lisp/ehelp.el index 63ec3838d32..e1978fd995d 100644 --- a/lisp/ehelp.el +++ b/lisp/ehelp.el @@ -145,8 +145,7 @@ BUFFER is put back into its original major mode." (save-excursion (when one (goto-char (window-start (selected-window)))) - (let ((pop-up-windows t)) - (pop-to-buffer buffer)) + (pop-to-buffer-other-window buffer) (with-current-buffer buffer (when (and minheight (< (window-height) minheight)) (enlarge-window (- minheight (window-height)))) diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el index 34119a77a75..aec370d267c 100644 --- a/lisp/play/decipher.el +++ b/lisp/play/decipher.el @@ -711,10 +711,9 @@ START and END are positions in the statistics buffer. Makes the statistics buffer visible and sizes the window to just fit the displayed text, but leaves the current window selected." (let ((stats-buffer (decipher-stats-buffer)) - (current-window (selected-window)) - (pop-up-windows t)) + (current-window (selected-window))) (or (eq (current-buffer) stats-buffer) - (pop-to-buffer stats-buffer)) + (pop-to-buffer-other-window stats-buffer)) (goto-char start) (or (one-window-p t) (enlarge-window (- (1+ (count-lines start end)) (window-height)))) @@ -1001,12 +1000,9 @@ Creates the statistics buffer if it doesn't exist." (defun decipher-display-stats-buffer () "Make the statistics buffer visible, but do not select it." - (let ((stats-buffer (decipher-stats-buffer)) - (current-window (selected-window))) + (let ((stats-buffer (decipher-stats-buffer))) (or (eq (current-buffer) stats-buffer) - (progn - (pop-to-buffer stats-buffer) - (select-window current-window))))) + (display-buffer-other-window stats-buffer)))) (defun decipher-stats-buffer (&optional create) "Return the buffer used for decipher statistics. diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index b36599249a5..a211c773efd 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -3334,13 +3334,12 @@ Without an argument, it saves customized diff argument, if available ;; idea suggested by Hannu Koivisto (defun ediff-clone-buffer-for-region-comparison (buff region-name) (let ((cloned-buff (ediff-make-cloned-buffer buff region-name)) - (pop-up-windows t) wind other-wind msg-buf) (ediff-with-current-buffer cloned-buff (setq ediff-temp-indirect-buffer t)) - (pop-to-buffer cloned-buff) + (pop-to-buffer-other-window cloned-buff) (setq wind (ediff-get-visible-buffer-window cloned-buff)) (select-window wind) (delete-other-windows) -- 2.11.4.GIT