mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-24 10:38:38 +00:00
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.
This commit is contained in:
parent
38f7538d8f
commit
13301d4266
5
etc/NEWS
5
etc/NEWS
@ -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
|
||||
|
||||
---
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user