]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt Electric-pop-up-window to new buffer display specifiers.
authorMartin Rudalics <rudalics@gmx.at>
Thu, 13 Jan 2011 16:53:20 +0000 (17:53 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Thu, 13 Jan 2011 16:53:20 +0000 (17:53 +0100)
lisp/ChangeLog
lisp/electric.el

index 6e24dc95f639204f4ecf6f774e1467773885757a..a04696dc4f36ccae8c2b06962557a66a23eb140c 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-13  Martin Rudalics  <rudalics@gmx.at>
+
+       * electric.el (Electric-pop-up-window): Adapt to new buffer
+       display specifiers.
+
 2011-01-12  Martin Rudalics  <rudalics@gmx.at>
 
        * dired.el (dired-display-file, dired-why): Use
index 0e2a515911ec81868803aa9c7078dd4c0c3e0521..13af2cd54c370ccb37e1f6662dac33d15f255361 100644 (file)
 
 (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.