From 3df36c2fffc3eaed6be64a06e4be104abd949f57 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Thu, 13 Jan 2011 17:53:20 +0100 Subject: [PATCH] Adapt Electric-pop-up-window to new buffer display specifiers. --- lisp/ChangeLog | 5 +++++ lisp/electric.el | 35 +++++++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6e24dc95f63..a04696dc4f3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-01-13 Martin Rudalics + + * electric.el (Electric-pop-up-window): Adapt to new buffer + display specifiers. + 2011-01-12 Martin Rudalics * dired.el (dired-display-file, dired-why): Use diff --git a/lisp/electric.el b/lisp/electric.el index 0e2a515911e..13af2cd54c3 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -151,24 +151,23 @@ (defun Electric-pop-up-window (buffer &optional max-height) (let* ((win (or (get-buffer-window buffer) (selected-window))) - (buf (get-buffer buffer)) - (one-window (one-window-p t))) - (if (not buf) - (error "Buffer %s does not exist" buffer) - (cond ((and (eq (window-buffer win) buf)) - (select-window win)) - (one-window - (pop-to-buffer - ;; Try to do what the comment above says. - buffer '(same-frame (new-window (selected . below)))) - (setq win (selected-window))) - (t - (switch-to-buffer buf))) - ;; Don't shrink the window, but expand it if necessary. - (goto-char (point-min)) - (unless (= (point-max) (window-end win t)) - (fit-window-to-buffer win max-height)) - win))) + (buf (get-buffer buffer))) + (cond + ((not buf) + (error "Buffer %s does not exist" buffer)) + ((eq (window-buffer win) buf) + (select-window win)) + ((eq win (frame-root-window)) + ;; Try to do what the comment above says. + (pop-to-buffer buffer '((pop-up-window (selected . below))))) + (t + (pop-to-buffer-same-window buf))) + + ;; Don't shrink the window, but expand it if necessary. + (goto-char (point-min)) + (unless (= (point-max) (window-end nil t)) + (fit-window-to-buffer nil max-height)) + (selected-window))) ;;; Electric keys. -- 2.39.5