Skip to content

Instantly share code, notes, and snippets.

@astahlman
Created July 4, 2018 22:40
Show Gist options
  • Save astahlman/45f11f8e84d63df41addd53cdab6b0ef to your computer and use it in GitHub Desktop.
Save astahlman/45f11f8e84d63df41addd53cdab6b0ef to your computer and use it in GitHub Desktop.
Allow magit-popup menus to be redefined for iterative development.
(defmacro magit-redefine-popup (name doc &rest args)
"Define a popup command named NAME.
See magit-define-popup for a description of the parameters.
Unlike with magit-define-popup, changes to the popup definition
*will* be reflected upon re-evaluating this form. This is
convenient for iterative, interactive development of a
magit-popup menu."
(let* ((-name (symbol-name name))
(popup-name (progn
(string-match "\\([^ ]+\\)-popup" -name)
(match-string 1 -name))))
`(progn
(makunbound (intern ,(concat popup-name "-arguments")))
(makunbound (intern ,-name))
(fmakunbound (intern ,-name))
(magit-define-popup ,name ,doc ,@args))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment