diff options
author | Amin Bandali <bandali@gnu.org> | 2020-04-14 00:23:56 -0400 |
---|---|---|
committer | Amin Bandali <bandali@gnu.org> | 2020-04-14 00:23:56 -0400 |
commit | 13301d4266d26882f9fe7efe3046accd315d7c55 (patch) | |
tree | b5aa49a90f9531ade3fe5161bc168f25a85aa064 | |
parent | 38f7538d8f62ee287e8271d048f1230d840c11a0 (diff) | |
download | emacs-13301d4266d26882f9fe7efe3046accd315d7c55.tar.gz |
New function erc-track-switch-buffer-other-window
* lisp/erc/erc-track.el (erc-track-switch-buffer): Factor out the
implementation from here ...
(erc-track--switch-buffer): ... to here.
(erc-track-switch-buffer-other-window): New function, like
`erc-track-switch-buffer', but uses `switch-to-buffer-other-window'
instead, to open the buffer in another window.
-rw-r--r-- | etc/NEWS | 5 | ||||
-rw-r--r-- | lisp/erc/erc-track.el | 32 |
2 files changed, 28 insertions, 9 deletions
@@ -1652,6 +1652,11 @@ which better handles surrounding pair of parentheses. which is like 'erc-switch-to-buffer', but opens the buffer in another window. +--- +*** New function 'erc-track-switch-buffer-other-window' +which is like 'erc-track-switch-buffer', but opens the buffer in +another window. + ** EUDC --- diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index db8ccbb4a79..41d8fc1a98f 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -921,11 +921,7 @@ is relative to `erc-track-switch-direction'." (setq offset 0))) (car (nth offset erc-modified-channels-alist)))) -(defun erc-track-switch-buffer (arg) - "Switch to the next active ERC buffer, or if there are no active buffers, -switch back to the last non-ERC buffer visited. Next is defined by -`erc-track-switch-direction', a negative argument will reverse this." - (interactive "p") +(defun erc-track--switch-buffer (fun arg) (if (not erc-track-mode) (message (concat "Enable the ERC track module if you want to use the" " tracking minor mode")) @@ -934,12 +930,30 @@ switch back to the last non-ERC buffer visited. Next is defined by (unless (eq major-mode 'erc-mode) (setq erc-track-last-non-erc-buffer (current-buffer))) ;; and jump to the next active channel - (switch-to-buffer (erc-track-get-active-buffer arg))) + (funcall fun (erc-track-get-active-buffer arg))) ;; if no active channels, switch back to what we were doing before ((and erc-track-last-non-erc-buffer - erc-track-switch-from-erc - (buffer-live-p erc-track-last-non-erc-buffer)) - (switch-to-buffer erc-track-last-non-erc-buffer))))) + erc-track-switch-from-erc + (buffer-live-p erc-track-last-non-erc-buffer)) + (funcall fun erc-track-last-non-erc-buffer))))) + +(defun erc-track-switch-buffer (arg) + "Switch to the next active ERC buffer. +If there are no active ERC buffers, switch back to the last +non-ERC buffer visited. The order of buffers is defined by +`erc-track-switch-direction', and a negative argument will +reverse it." + (interactive "p") + (erc-track--switch-buffer 'switch-to-buffer arg)) + +(defun erc-track-switch-buffer-other-window (arg) + "Switch to the next active ERC buffer in another window. +If there are no active ERC buffers, switch back to the last +non-ERC buffer visited. The order of buffers is defined by +`erc-track-switch-direction', and a negative argument will +reverse it." + (interactive "p") + (erc-track--switch-buffer 'switch-to-buffer-other-window arg)) (provide 'erc-track) |