unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* create keymap from read syntax
@ 2007-04-19 10:33 Jonas.Bernoulli
  0 siblings, 0 replies; only message in thread
From: Jonas.Bernoulli @ 2007-04-19 10:33 UTC (permalink / raw)
  To: help-gnu-emacs

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-19 10:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-19 10:33 create keymap from read syntax Jonas.Bernoulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).