Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


allow commands to filter arguments from popup #1243

merged 2 commits into from

1 participant

Jonas Bernoulli
Jonas Bernoulli

Also see #1220.

Jonas Bernoulli tarsius merged commit 78d4f56 into from
Jonas Bernoulli tarsius deleted the branch
Jonas Bernoulli tarsius added this to the 2.1.0 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 0 deletions.
  1. +15 −0 magit-popup.el
15 magit-popup.el
@@ -277,6 +277,21 @@ that without users being aware of it could lead to tears.
(defvar magit-current-popup nil)
(defvar magit-current-popup-args nil)
+(defun magit-current-popup-args (&rest filter)
+ (let ((-compare-fn (lambda (a b) (magit-popup-arg-match b a))))
+ (-filter (if (eq (car filter) :not)
+ (lambda (arg) (not (-contains? (cdr filter) arg)))
+ (when (eq (car filter) :only)
+ (pop filter))
+ (lambda (arg) (-contains? filter arg)))
+ magit-current-popup-args)))
+(defun magit-popup-arg-match (pattern string)
+ (if (or (string-match-p "=$" pattern)
+ (string-match-p "^-[A-Z]$" pattern))
+ (string-match (format "^%s\\(.*\\)$" pattern) string)
+ (string-equal string pattern)))
(cl-defstruct magit-popup-event key dsc arg fun use val)
(defun magit-popup-event-keydsc (ev)
Something went wrong with that request. Please try again.