Skip to content

Commit

Permalink
support ignore function
Browse files Browse the repository at this point in the history
this makes it easier for users to ignore vast swaths of commands

Signed-off-by: Psionik K <[email protected]>
  • Loading branch information
psionic-k committed Nov 17, 2023
1 parent 43321a1 commit 9509148
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions keypression.el
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ See `set-face-attribute' help for details."
:group 'keypression)

(defcustom keypression-ignored-commands '(self-insert-command)
"List of commands to ignore."
:type '(repeat symbol))
"Function or list that rejects commands.
If list, members will be ignored. When a function is provided, function will be
called with single COMMAND argument, a symbol. If the function returns non-nil,
the command is ignored."
:type '(options (repeat symbol)
function))

;;; Global variables

Expand Down Expand Up @@ -424,7 +428,10 @@ See `set-face-attribute' help for details."
(defun keypression--pre-command ()
(unless (or (memq (event-basic-type last-command-event)
keypression-ignore-mouse-events)
(memq this-command keypression-ignored-commands))
(if (functionp keypression-ignored-commands)
(funcall keypression-ignored-commands this-command)
;; assume list if not callable.
(memq this-command keypression-ignored-commands)))
(keypression--push-string (keypression--keys-to-string (this-command-keys)))))

(cl-defun keypression--create-frame (buffer-or-name
Expand Down

0 comments on commit 9509148

Please sign in to comment.