all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.