0

I wondered why the jch's with-undo-collapse macro (or something like that) isn't an emacs built-in yet.

Is it safe enough? Is there a built-in alternative?

I mean something that can be applied like in the jcs's example of usage:

(defun test-no-collapse ()
  (interactive)
  (insert "toto")
  (undo-boundary)
  (insert "titi"))

(defun test-collapse ()
  (interactive)
  (with-undo-collapse
    (insert "toto")
    (undo-boundary)
    (insert "titi")))
  • 2
    M-x report-emacs-bug as a feature request. Things don't get built-in if no one asks for them. – phils Mar 1 at 6:16
  • @phils Thank you. I'll do it soon. – Gabriele Nicolardi Mar 1 at 6:50
2

There is undo-amalgamate-change-group nowadays. Used for instance in the function viper-adjust-undo in the file lisp/emulators/viper-cmd.el:

(defun test-collapse ()
  (let ((cg (prepare-change-group)))
    (insert "toto")
    (undo-boundary)
    (insert "titi")
    (undo-amalgamate-change-group cg)))
  • Could you please post a concrete example of usage of this function using the abovetest-collapse code? I have some difficulty understanding the undo-amalgamate-change-group usage. – Gabriele Nicolardi Mar 1 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.