Function: context-menu-undo

context-menu-undo is a byte-compiled function defined in mouse.el.gz.

Signature

(context-menu-undo MENU CLICK)

Documentation

Populate MENU with undo commands.

Source Code

;; Defined in /usr/src/emacs/lisp/mouse.el.gz
(defun context-menu-undo (menu _click)
  "Populate MENU with undo commands."
  (define-key-after menu [separator-undo] menu-bar-separator)
  (when (and (not buffer-read-only)
             (not (eq t buffer-undo-list))
             (if (eq last-command 'undo)
                 (listp pending-undo-list)
               (consp buffer-undo-list)))
    (define-key-after menu [undo]
      `(menu-item ,(if (region-active-p) "Undo in Region" "Undo") undo
                  :help "Undo last edits")))
  (when (and (not buffer-read-only)
             (undo--last-change-was-undo-p buffer-undo-list))
    (define-key-after menu [undo-redo]
      `(menu-item (if undo-in-region "Redo in Region" "Redo") undo-redo
                  :help "Redo last undone edits")))
  menu)