Prevent transient from exiting AND from acting upon the *transient* buffer #251
-
I'm using Emacs 30 and Transient (transient-define-prefix test-transient ()
"Transient test."
;; :transient-suffix 'transient--do-stay
;; :transient-non-suffix 'transient--do-warn
["Heading 1"
[("o" olivetti-mode
;; :transient t
:description (lambda () (if olivetti-mode
(propertize "ON" 'face '(bold success))
(propertize "OFF" 'face '(bold error)))))]]) The Transient defined in this example exits after Uncommenting How can I make the Transient stay after execution, and also act on the buffer (or window) it was called from? Uncommenting (I use "(or window)" because I've previously been able to change the buffer in a window and still have the transient work on it) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
How did you make that determination? I don't think the code you provided would be able to demonstrate that issue. (It might be affected by such an issue, but it would be hard to tell what is going on.) I don't have Here is some other code that would be able to demonstrate that issue, but, for me at least, it instead demonstrates that things work as expected. (defvar-local test-var t)
(transient-define-prefix test-transient ()
[("s" test-set-test-var :transient t :description
(lambda () (format "[stay] (from %s) %s" (current-buffer) test-var)))
("e" (lambda () (interactive) (test-set-test-var))
:transient nil :description
(lambda () (format "[exit] (from %s) %s" (current-buffer) test-var)))])
(defun test-set-test-var ()
(interactive)
(let ((v (random 100)))
(message "(in %s) %s => %s" (current-buffer) test-var v)
(setq test-var v))) |
Beta Was this translation helpful? Give feedback.
-
Calling I've tried https://github.com/positron-solutions/transient-showcase as well, and every example there also only uses You can try this instead: (transient-define-prefix test-transient ()
"Transient test."
:transient-suffix 'transient--do-stay
;; :transient-non-suffix 'transient--do-warn
["Heading 1"
[("o" olivetti-mode
;; :transient t
:description (lambda () (if olivetti-mode
(propertize "ON" 'face '(bold success))
(propertize "OFF" 'face '(bold error)))))
("l" display-line-numbers-mode
;; :transient t
:description "Toggle Line Numbers")
("v" visual-line-mode
:description "Visual Lines")
("m" mixed-pitch-mode
:description "Mixed Pitch")]]
["Major Modes"
[("0" "Clean Mode" clean-mode)]
[("1" "Fundamental Mode" fundamental-mode)
("2" "Emacs Lisp Mode" emacs-lisp-mode)]]) |
Beta Was this translation helpful? Give feedback.
Thank you for the example and the explanation!
(current-buffer)
was not*transient*
for me.I spent some time enabling and disabling things, and it turns out this wasn't an issue with Transient. It's instead an issue with
shackle-mode
(https://depp.brause.cc/shackle/), which I was using to enforce popup positions. I'm migrating from DOOM and wanted something easy, I guess I'll try to usedisplay-buffer-alist
instead.