I find myself switching between buffers constantly to double check activity in other buffers. Is it possible for windows to display different buffers after x amount of time? In other words can I get "billboard" like behaviour?
-
1Is there something special about which buffers you want to see? A particular name, names matching a particular regexp, certain major modes, certain buffers you wish to exclude such as uninteresting buffers with a leading space in the buffer name, buffers that begin and/or end with ansterisk, ....? A slide-show doesn't seem particularly useful in my opinion (and would likely be rather disruptive to your workflow, especially if nothing has happened in the other buffer(s), so you may wish to consider giving your design some more thought -- e.g., processes can have sentinels, filters, etc.– lawlistJun 27, 2017 at 23:05
-
@lawlist Thanks for your speedy reply. I plan to use a slide-show like system to view IRC channels. I may add different types of buffers in the future (mainly applications that ouput to stdout so I can monitor them)– Us3rnameJun 27, 2017 at 23:19
-
Here is a link to a blog about monitoring IRC activity in Emacs: jcubic.wordpress.com/2012/07/24/… In terms of monitoring all ongoing processes, it may be a little complicated if they do not have sentinels that can be easily tapped into ... so I'll leave the complicated stuff for another forum participant. :)– lawlistJun 27, 2017 at 23:25
-
2Just use a timer to switch buffers. Cycle through a list of the buffers you want.– DrewJun 28, 2017 at 0:47
1 Answer
I implemented Drews comment. (Improvements are welcome)
Here are 2 functions. One, which starts cycling buffers in current selected window my-cycle-buffers
. And one, which stops cycling my-cycle-buffers-kill
.
You can both bind to a hotkey if you want.
(defun my-cycle-buffers (seconds-delay)
(interactive "p")
(setq my-window (selected-window)
my-current-pos 0)
(defvar my-buffer-list '("*scratch*" "*Messages*" "*blubb*"))
(defun my-cycle-buffers-call ()
(with-selected-window my-window
(switch-to-buffer (nth my-current-pos my-buffer-list) t t)
(setq my-current-pos (mod (1+ my-current-pos) (length my-buffer-list)))))
(setq my-cycle-buffers-timer-obj (run-at-time "0 sec"
seconds-delay
'my-cycle-buffers-call)))
(defun my-cycle-buffers-kill ()
(interactive)
(cancel-timer my-cycle-buffers-timer-obj)
(message "cycling of buffers stopped"))
Usage:
- before start cycling, set variable
my-buffer-list
to a list of strings with buffer names you want to see. - select a window which should cycle through buffers by putting point in it.
- start function
my-cycle-buffers
with a prefix, to set time of how long a buffer should be shown.
(example:C-5 M-x my-cycle-buffers
switches every 5 seconds) - to stop the spook, do
M-x my-cycle-buffers-kill
-
Exactly what I am looking for! Many thanks to Drew for introducing me to timers.– Us3rnameJun 29, 2017 at 9:14