From 8d56bd0ceddf7792ec9a87705e6b33e4be7819aa Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sat, 12 Sep 2026 12:31:16 +0700 Subject: [PATCH] TAB folds a frame, which is what the header always said it did --- emacs/MANUAL.md | 2 +- emacs/flan-cnr.el | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/emacs/MANUAL.md b/emacs/MANUAL.md index 5e1cae0..1ac431c 100644 --- a/emacs/MANUAL.md +++ b/emacs/MANUAL.md @@ -362,7 +362,7 @@ answers; anything that needs to know what a form means asks. longer empty. It lists the stopped program's frames, innermost first, each with where it is and how many named slots it has. -`TAB` on a frame opens it and shows what its locals hold — name, type and +`TAB` on a frame opens it (or `f`, which folds from anywhere on the frame) and shows what its locals hold — name, type and value, rendered the same way the inspector renders anything else. They are fetched the first time a frame is opened and then kept, because a stopped program's locals cannot change underneath you and a round trip behind a key diff --git a/emacs/flan-cnr.el b/emacs/flan-cnr.el index 59b2eb2..67a6b57 100644 --- a/emacs/flan-cnr.el +++ b/emacs/flan-cnr.el @@ -383,11 +383,23 @@ list already says it." (get-text-property pos 'flan-cnr-frame) (get-text-property pos 'flan-cnr-inspect))) +(defun flan-cnr-tab () + "Fold this frame, or move to the next actionable line. + +TAB does two things because the buffer has two kinds of line and the section +header already promised the first one: on a frame, it opens or closes that +frame's locals; anywhere else, it moves. `f' still folds unconditionally, for +anyone who would rather TAB always moved." + (interactive) + (if (get-text-property (point) 'flan-cnr-frame) + (flan-cnr-toggle-frame) + (flan-cnr-next))) + (defvar flan-cnr-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "RET") #'flan-cnr-take) (define-key map [mouse-1] #'flan-cnr-take) - (define-key map (kbd "TAB") #'flan-cnr-next) + (define-key map (kbd "TAB") #'flan-cnr-tab) (define-key map [backtab] #'flan-cnr-previous) (define-key map "n" #'flan-cnr-next) (define-key map "p" #'flan-cnr-previous)