Function: activate-change-group

activate-change-group is a byte-compiled function defined in subr.el.gz.

Signature

(activate-change-group HANDLE)

Documentation

Activate a change group made with prepare-change-group (which see).

View in manual

Probably introduced at or before Emacs version 22.1.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun activate-change-group (handle)
  "Activate a change group made with `prepare-change-group' (which see)."
  (dolist (elt handle)
    (with-current-buffer (car elt)
      (if (eq buffer-undo-list t)
	  (setq buffer-undo-list nil)
	;; Add a boundary to make sure the upcoming changes won't be
	;; merged/combined with any previous changes (bug#33341).
	;; We're not supposed to introduce a real (visible)
        ;; `undo-boundary', tho, so we have to push something else
        ;; that acts like a boundary w.r.t preventing merges while
	;; being harmless.
        ;; We use for that an "empty insertion", but in order to be harmless,
        ;; it has to be at a harmless position.  Currently only
        ;; insertions are ever merged/combined, so we use such a "boundary"
        ;; only when the last change was an insertion and we use the position
        ;; of the last insertion.
        (when (numberp (car-safe (car buffer-undo-list)))
          (push (cons (caar buffer-undo-list) (caar buffer-undo-list))
                buffer-undo-list))))))