Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
burtonator committed Oct 31, 2002
1 parent b729a78 commit 9a6f994
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 28 deletions.
22 changes: 16 additions & 6 deletions ecb-compilation.el
Expand Up @@ -50,6 +50,12 @@ window even if `compilation-buffer-p' says nil."
:group 'ecb-compilation
:type '(repeat (string :tag "Buffer name")))

(defcustom ecb-compilation-major-modes (list 'eshell-mode 'compilation-mode)
"*Additional major-mode that should be displayed in compilation window even if
`compilation-buffer-p' says nil."
:group 'ecb-compilation
:type '(repeat (symbol :tag "major-mode name")))

(defun ecb-compilation-get-buffers()
"Get all known compilation buffer names. See `ecb-compilation-buffer-p'."

Expand All @@ -73,15 +79,16 @@ window even if `compilation-buffer-p' says nil."

(defun ecb-compilation-buffer-p(buffer)
"Test if the given buffer is a compilation buffer. Note that in this case we
define 'compilation buffer' as a buffer that should ideally be displayed in
the `ecb-compile-window'. This means that in some situations this might not be
the result of a `compile-internal'. A good example would be the *Help* buffer
or the `ecb-eshell-buffer-name'.
define 'compilation buffer' as a buffer that should ideally be displayed in the
`ecb-compile-window'. This means that in some situations this might not be the
result of a `compile-internal'. A good example would be the *Help* buffer or the
`ecb-eshell-buffer-name'.
BUFFER can be the name of a buffer or a buffer-objekt.
This function returns true if the name of BUFFER is either contained in
`ecb-compilation-buffer-names' or if `compilation-buffer-p' returns true."
This function non-nil if the name of BUFFER is either contained in
`ecb-compilation-buffer-names', or its `major-mode' is in
`ecb-compilation-major-modes', or if `compilation-buffer-p' returns true."

(let ((buf (cond ((stringp buffer)
(get-buffer buffer))
Expand All @@ -91,6 +98,9 @@ This function returns true if the name of BUFFER is either contained in
nil))))
(if buf
(or (member (buffer-name buf) ecb-compilation-buffer-names)
(save-excursion
(set-buffer buffer)
(member major-mode ecb-compilation-major-modes))
(compilation-buffer-p buf)))))

(provide 'ecb-compilation)
Expand Down
40 changes: 20 additions & 20 deletions ecb-eshell.el
Expand Up @@ -108,25 +108,9 @@
;; - Right now ecb-eshell doesn't work with dired. Why? Try to setup a hook
;; and an ecb-eshell-dired-buffer-sync function that will take care of this.
;;
;; - BUG: when we exit the eshell, we enlarge the compilation buffer.... there
;; is not needed since the buffer is about to exit.
;;
;; - this might be fixed by using an eshell post command hook.
;;
;; - RFE: could we possibly find a way to avoid window enlargement if we launch
;; a background process like 'xterm &'. This would require determining what the
;; command is and then making sure it is acceptable.
;;
;; - BUG: when ecb-eshell-enlarge-when-selecting is nil we need to recenter. If
;; we don't we just end up with the point in the middle of the eshell.
;;
;; - BUG: enable just-in-time current-buffer-sync... only execute if the current
;; buffer's directlry is not equal to the ecb directory.

;;; - FIXME: is there a way to hook into when a window is resized so that we can
;;; recenter when this happens in the ecb-compile-window
;;; ... yes... window-size-change-functions

;;; Code:

(defgroup ecb-eshell nil
Expand Down Expand Up @@ -216,6 +200,14 @@ eshell is currently visible."
;;now update the buffer list to remove the eshell.
(modify-frame-parameters nil (list (cons 'buffer-list eshell-buffer-list))))))))

(defmacro ecb-eshell-save-buffer-history (&rest body)
"Protect the buffer-list so that the eshell buffer name is not places early in
the buffer list or at all if it currently doesn't exist."
`(unwind-protect
(let((eshell-buffer-list (frame-parameter nil 'buffer-list)))
,@body
(modify-frame-parameters nil (list (cons 'buffer-list eshell-buffer-list))))))

(defun ecb-eshell-recenter(&optional display-errors)
"Recenter the eshell window so that the prompt is at the end of the buffer."
(interactive
Expand Down Expand Up @@ -255,22 +247,30 @@ eshell is currently visible."
(when (ecb-compile-window-live-p 'display-msg)
(set-window-buffer ecb-compile-window ecb-eshell-buffer-name)
(select-window ecb-compile-window)

(if ecb-eshell-enlarge-when-selecting
(ecb-eshell-enlarge)
;;else just recenter
(ecb-eshell-recenter)))

;;we auto start the eshell here? I think so..
(ecb-eshell-activate)

(when ecb-eshell-enlarge-when-starting
(ecb-eshell-enlarge))))
(ecb-eshell-enlarge)))

;;sync to the current buffer
(ecb-eshell-current-buffer-sync))

(defun ecb-eshell-activate()
"Startup the eshell in the compile window."

(when (ecb-compile-window-live-p 'display-msg)
(select-window ecb-compile-window)
(eshell)))
(ecb-eshell-save-buffer-history
(save-excursion
(when (ecb-compile-window-live-p 'display-msg)
(select-window ecb-compile-window)
(eshell)
(set-window-buffer ecb-compile-window (get-buffer eshell-buffer-name))))))

(defun ecb-eshell-enlarge()
"Enlarge the eshell so more information is visible. This is usually done so
Expand Down
25 changes: 23 additions & 2 deletions ecb-multiframe.el
Expand Up @@ -162,9 +162,30 @@ frame. When complete return the new buffer name."
"Hook to run to initialize multiframe support"

;;disable ECB frame management for this frame
(ad-deactivate 'delete-frame))
(ad-deactivate 'delete-frame)

(add-hook 'ecb-activate-hook 'ecb-multiframe-activate-hook)
;;now make sure that the buffer being displayed in the edit window isn't a
;;compilation buffer. (NOTE: I actually think this should be a standard part
;;of the ECB)
(ecb-multiframe-edit-window-non-compilation-buffer))

(defun ecb-multiframe-edit-window-non-compilation-buffer()
"Go through the buffer list making the edit window a non compilation buffer."
(interactive)

(let((buffer-list (buffer-list))
(index 0))

(while (and (or (ecb-compilation-buffer-p (window-buffer ecb-edit-window))
(null (buffer-file-name (window-buffer ecb-edit-window))))
(< index (length buffer-list)))

(set-window-buffer ecb-edit-window (nth index buffer-list))

(setq index (1+ index)))))

;;this needs to happen last and it should be the last hook
(add-hook 'ecb-activate-hook 'ecb-multiframe-activate-hook t)

;;we need to modify frame parameters for new frames
(add-hook 'after-make-frame-functions 'ecb-multiframe-make-frame-hook)
Expand Down

0 comments on commit 9a6f994

Please sign in to comment.