Skip to Content.
Sympa Menu

texmacs-users - Switching between different buffers

Subject: mailing-list for TeXmacs Users

List archive

Switching between different buffers


Chronological Thread 
  • From: Zoran Loncarevic <address@hidden>
  • To: address@hidden
  • Subject: Switching between different buffers
  • Date: Mon, 28 Mar 2022 03:31:56 +0200

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 my-init-texmacs.scm:

(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, 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; using
the Go menu to switch away from the buffer and then return
back makes things back to normal.

Strangely, that very same code

    (switch-to-buffer (second (buffer-menu-list 2)))

works fine when invoked from scheme session or inside

    (interactive go-to-buffer)

from the original TeXmacs definition of C-x b shortcut
(go-to-buffer essentially contains the code above).

What am I missing?

P.S. I use TeXmacs 2.1.1 on Ubuntu 20.04


  • Switching between different buffers, Zoran Loncarevic, 03/28/2022

Archive powered by MHonArc 2.6.24.

Top of Page