Created
November 29, 2023 23:47
-
-
Save wsgac/dd4ac9218155461b2c7f797aa1029725 to your computer and use it in GitHub Desktop.
Lem editor - ideas for improvement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :lem-core) | |
(defun undefine-key (keymap keyspec) | |
"Remove binding for KEYSPEC from KEYMAP. Two cases for KEYSPEC are | |
considered. If it's a symbol, try to remove the corresponding binding | |
from KEYMAP's FUNCTION-TABLE. If it's a string, parse the string into | |
chained components, try to extract the innermost chained hash table | |
from KEYMAP's TABLE and remove the relevant entry." | |
(check-type keyspec (or symbol string)) | |
(typecase keyspec | |
(symbol | |
(remhash keyspec (keymap-function-table keymap))) | |
(string | |
(loop | |
for k on (parse-keyspec keyspec) | |
with table = (keymap-table keymap) | |
while (and table (cdr k)) | |
do (setf table (gethash (car k) table nil)) | |
finally (remhash (car k) table)))) | |
(values)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment