summaryrefslogtreecommitdiff
path: root/emacs/.config/emacs-kj/lisp/kj-lib.el
blob: 117584b423bce563e1ce916f6542be0133532a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;;; -*- lexical-binding: t; -*-

(defmacro define-repeating-key (keymap key cmd &optional desc)
  "DEF may be a cons cell (DESCRIPTION . FUNC) or a command."
  `(let ((def
          ,(if desc
               `'(,desc ,cmd)
             `',cmd)))
     (define-key ,keymap ,key def)
     (put ',cmd 'repeat-map ',keymap)))

(provide 'kj-lib)

(macroexpand '(define-repeating-key map "." mc/mark-next-like-this ))
(define-repeating-map)

(macroexpand '(define-repeating-key map "." mc/mark-next-like-this "→ this"))