mirror of
https://codeberg.org/scip/viking-mode.git
synced 2025-12-17 12:31:02 +01:00
added some commentary to viking-last-key-repeats, besser is das
This commit is contained in:
@@ -207,16 +207,15 @@ should be a point-moving function."
|
|||||||
(defun viking-last-key-repeats ()
|
(defun viking-last-key-repeats ()
|
||||||
"Returns how many times the last key has been pressed as integer."
|
"Returns how many times the last key has been pressed as integer."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((keys (reverse (append (recent-keys) nil)))
|
(let* ((keys (reverse (append (recent-keys) nil))) ;; list of last keys pressed, last @0
|
||||||
(len (length keys))
|
(pressed (car keys)) ;; the very last key pressed, i.e. the one bound to this defun
|
||||||
(first (car keys))
|
(times 0)) ;; how many times that key have been pressed
|
||||||
(times 0))
|
|
||||||
(progn
|
(progn
|
||||||
(catch 'nomore
|
(catch 'nomore ;; don't iterate endless
|
||||||
(dolist (k keys)
|
(dolist (k keys) ;; loop over the key list, (car keys) is the most recent, due to 'reverse above
|
||||||
(if (equal first k)
|
(if (equal pressed k) ;; one more of the same key pressed in a row
|
||||||
(setq times (+ times 1))
|
(setq times (+ times 1)) ;; register
|
||||||
(throw 'nomore t))))
|
(throw 'nomore t)))) ;; another key, break the loop and rerturn the count
|
||||||
times)))
|
times)))
|
||||||
|
|
||||||
;;;;; kill/delete wrappers
|
;;;;; kill/delete wrappers
|
||||||
|
|||||||
Reference in New Issue
Block a user