emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: edebug-pop-to-buffer fails for dedicated windows


From: martin rudalics
Subject: Re: edebug-pop-to-buffer fails for dedicated windows
Date: Thu, 12 Apr 2007 10:20:30 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

> edebug-pop-to-buffer changes the buffer in the "next window".
> However this results in an error, if that window is dedicated.

Please try the attached patch.
*** edebug.el.~3.96.~   Mon Apr  2 07:45:10 2007
--- edebug.el   Thu Apr 12 09:06:24 2007
***************
*** 364,389 ****

  (defun edebug-pop-to-buffer (buffer &optional window)
    ;; Like pop-to-buffer, but select window where BUFFER was last shown.
!   ;; Select WINDOW if it provided and it still exists.  Otherwise,
    ;; if buffer is currently shown in several windows, choose one.
    ;; Otherwise, find a new window, possibly splitting one.
!   (setq window (if (and (windowp window) (edebug-window-live-p window)
!                       (eq (window-buffer window) buffer))
!                  window
!                (if (eq (window-buffer (selected-window)) buffer)
!                    (selected-window)
!                  (edebug-get-buffer-window buffer))))
!   (if window
!       (select-window window)
!     (if (one-window-p)
!       (split-window))
!     ;;      (message "next window: %s" (next-window)) (sit-for 1)
!     (if (eq (get-buffer-window edebug-trace-buffer) (next-window))
!       ;; Don't select trace window
!       nil
!       (select-window (next-window))))
!   (set-window-buffer (selected-window) buffer)
!   (set-window-hscroll (selected-window) 0);; should this be??
    ;; Selecting the window does not set the buffer until command loop.
    ;;(set-buffer buffer)
    )
--- 364,394 ----

  (defun edebug-pop-to-buffer (buffer &optional window)
    ;; Like pop-to-buffer, but select window where BUFFER was last shown.
!   ;; Select WINDOW if it is provided and still exists.  Otherwise,
    ;; if buffer is currently shown in several windows, choose one.
    ;; Otherwise, find a new window, possibly splitting one.
!   (setq window
!       (cond
!        ((and (windowp window) (edebug-window-live-p window)
!              (eq (window-buffer window) buffer))
!         window)
!        ((eq (window-buffer (selected-window)) buffer)
!         (selected-window))
!        ((edebug-get-buffer-window buffer))
!        ((one-window-p 'nomini)
!         (split-window))
!        ((let ((trace-window (get-buffer-window edebug-trace-buffer)))
!           (catch 'found
!             (dolist (elt (window-list nil 'nomini))
!               (unless (or (eq elt (selected-window)) (eq elt trace-window)
!                           (window-dedicated-p elt))
!                 (throw 'found elt))))))
!        ;; All windows are dedicated or show `edebug-trace-buffer', split
!        ;; selected one.
!        (t (split-window))))
!   (select-window window)
!   (set-window-buffer window buffer)
!   (set-window-hscroll window 0);; should this be??
    ;; Selecting the window does not set the buffer until command loop.
    ;;(set-buffer buffer)
    )

reply via email to

[Prev in Thread] Current Thread [Next in Thread]