I would like to have a keyboard shortcut to cycle between two most recently used buffers. After looking around
$TEXMACS_PATH/progs/texmacs/menus/file-menu.scm I added the following to
(define (switch-to-recent-buffer) (if (< 1 (length (buffer-menu-list 2))) (switch-to-buffer (second (buffer-menu-list 2))))) (delayed (:idle 1000) (kbd-map (:profile emacs) ("emacs:prefix b" (switch-to-recent-buffer))))
But while Go menu nicely switches between buffers, showing the buffer just as I left it with the cursor visible, my shortcut, in contrast, after switching always shows beginning of document with cursor retaining it’s original position but way off screen. Sometimes, it’s as if the view was simply scrolled off away from the cursor position and I can continue working just fine, but sometimes what happens is that scroll bar would indicate document is just one screen and a half long (no matter it’s actual size) and TeXmacs would simply refuse to scroll the view past this limit; to get things back to normal I have to switch away from the buffer and then return using the Go menu.
Strangely, that very same code
(switch-to-buffer (second (buffer-menu-list 2)))
works fine when invoked from scheme session or the original TeXmacs
C-x b keyboard shortcut (defined as
(interactive go-to-buffer) which also in the end switches buffers using
Is this a bug, or am I missing something?
P.S. I use TeXmacs 2.1.1 on Ubuntu 20.04