[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
create keymap from read syntax
From: |
Jonas . Bernoulli |
Subject: |
create keymap from read syntax |
Date: |
Thu, 19 Apr 2007 12:33:34 +0200 |
User-agent: |
Internet Messaging Program (IMP) 3.2.3 |
hi,
i would like to store keymaps in a file and load them from there again.
(defun altmap-save-keymaps ()
(interactive)
(save-excursion
(let* ((file altmap-file)
(buf (get-buffer-create "*altmap-output*"))
(standard-output buf))
(princ "(altmap-set-keymaps")
(dolist (map altmap-keymaps)
(unless (looking-back "\n")
(princ "\n"))
(princ " '(")
(princ (symbol-name map))
(princ " ")
(princ (eval map))
(princ ")"))
(princ ")")
(with-current-buffer buf
(write-file file)))))
(defun altmap-set-keymaps (&rest args)
(while args
(let ((entry (car args)))
(if (listp entry)
(let ((symbol (indirect-variable (nth 0 entry)))
(value (nth 1 entry)))
(set symbol value))))
(setq args (cdr args))))
this works for sparse keymaps but for full keymaps it get this error when
evaluating altmap-set-keymaps as stored in altmap-file: Invalid size
char-table. i also manually modified the content of altmap-file to use a simple
setq, but it turned out the problem really is with the read syntax of the
keymap.
are the read syntax and printed representation of char-tables not identical?
does someone know how to work around this, or can even provide an example how
this can be done?
thx in advance
jonas
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- create keymap from read syntax,
Jonas . Bernoulli <=