branch: externals/detached
commit d58f815d91683031f749d48c66f902dcaf654185
Author: Niklas Eklund <[email protected]>
Commit: Niklas Eklund <[email protected]>
Add more display buffer customization options
---
detached-list.el | 16 +++++++++++++---
detached.el | 12 ++++++++++--
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/detached-list.el b/detached-list.el
index 9404ac6d7a..6929037ee6 100644
--- a/detached-list.el
+++ b/detached-list.el
@@ -47,12 +47,20 @@
(:face symbol))))
:group 'detached)
-(defcustom detached-list-display-buffer-action '(display-buffer-same-window
- (inhibit-same-window . nil))
+(defcustom detached-list-display-buffer-action
+ '(display-buffer-same-window
+ (inhibit-same-window . nil))
"The action used to display the detached list buffer."
:group 'detached
:type 'sexp)
+(defcustom detached-list-open-session-display-buffer-action
+ '(display-buffer-same-window
+ (inhibit-same-window . nil))
+ "The action used to display a detached session."
+ :group 'detached
+ :type 'sexp)
+
(defcustom detached-list-filters nil
"An alist of custom filters that can be applied.
@@ -187,7 +195,9 @@ Optionally SUPPRESS-OUTPUT."
(defun detached-list-open-session ()
"View session."
(interactive)
- (let ((session (tabulated-list-get-id)))
+ (let ((session (tabulated-list-get-id))
+ (detached-open-session-display-buffer-action
+ detached-list-open-session-display-buffer-action))
(when (> (length (window-list)) 1)
(delete-window (get-buffer-window)))
(detached-open-session session)))
diff --git a/detached.el b/detached.el
index 8e5ac5a7ad..7e2024e922 100644
--- a/detached.el
+++ b/detached.el
@@ -191,6 +191,12 @@ If set to a non nil value the latest entry to
:type 'float
:group 'detached)
+(defcustom detached-open-session-display-buffer-action
+ '(display-buffer-pop-up-window)
+ "The action used to display a detached session."
+ :group 'detached
+ :type 'sexp)
+
;;;;; Public
(defvar detached-enabled nil)
@@ -427,7 +433,8 @@ The session is compiled by opening its output and enabling
(font-lock-mode)
(read-only-mode)
(goto-char (point-max)))
- (pop-to-buffer buffer-name)))))
+ (select-window
+ (display-buffer buffer-name
detached-open-session-display-buffer-action))))))
;;;###autoload
(defun detached-rerun-session (session &optional suppress-output)
@@ -534,7 +541,8 @@ Optionally DELETE the session if prefix-argument is
provided."
(detached-log-mode))
(setq detached--buffer-session session)
(goto-char (point-max)))
- (pop-to-buffer buffer-name))
+ (select-window
+ (display-buffer buffer-name
detached-open-session-display-buffer-action)))
(message "Detached can't find file: %s" file-path)))))
;;;###autoload