diff options
author | David Aspinall <da@inf.ed.ac.uk> | 2009-07-30 13:00:55 +0000 |
---|---|---|
committer | David Aspinall <da@inf.ed.ac.uk> | 2009-07-30 13:00:55 +0000 |
commit | 3c39b98f2629ececd48b9c8fcb8b801b549ffd41 (patch) | |
tree | 7f34ff791586c45b8db9443473e4616ee0652946 | |
parent | 823843723f7974b1b665c00f7ead3de94a96dea9 (diff) |
Define maths-menu-insert-XX functions for convenience of user-defined keybindings
(replacing `x-symbol-INSERT-lambda', etc).
-rw-r--r-- | lib/maths-menu.el | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/maths-menu.el b/lib/maths-menu.el index 5e75eba7..1a114c86 100644 --- a/lib/maths-menu.el +++ b/lib/maths-menu.el @@ -8,6 +8,7 @@ ;; Version for Proof General modified by David Aspinall, 2007-8. ;; - Hooks added to insert tokenised versions of unicode characters. ;; - Added more characters to the menus. +;; - Define insertion functions following menu names (useful for keybindings) ;; $Id$ @@ -48,6 +49,8 @@ ;; the minibuffer via the menu, though presumably it could be added to ;; the minibuffer menu. + + ;;; Code: (defvar maths-menu-filter-predicate '(lambda (char) t) @@ -63,14 +66,19 @@ (pane-map (make-sparse-keymap name))) (define-key-after map (vector (intern name)) (cons name pane-map)) (dolist (elt pane) - (define-key-after pane-map - (vector (intern (string (car elt)))) ; convenient unique symbol - (list 'menu-item - (format "%c (%s)" (car elt) (cadr elt)) - `(lambda () + (let ((fname (intern + (concat "maths-menu-insert-" + (replace-regexp-in-string " " "-" (cadr elt)))))) + (fset fname + `(lambda () (interactive) - (funcall maths-menu-tokenise-insert ,(car elt))) - :visible `(funcall maths-menu-filter-predicate ,(car elt))))))) + (funcall maths-menu-tokenise-insert ,(car elt)))) + (define-key-after pane-map + (vector (intern (string (car elt)))) ; convenient unique symbol + (list 'menu-item + (format "%c (%s)" (car elt) (cadr elt)) + fname + :visible `(funcall maths-menu-filter-predicate ,(car elt)))))))) map)) (defvar maths-menu-menu |