Generalize code.
--- a/.emacs-my Mon Mar 21 00:18:46 2011 +0200
+++ b/.emacs-my Mon Mar 21 00:37:44 2011 +0200
@@ -36,37 +36,36 @@
;;; ----------------------------------------------------------------
(message "mode groups")
-(defmacro my-travel-symb-tree (name func tree)
- `(cond
- ((symbolp ,tree)
- (,func ,tree)
- )
- ((listp ,tree)
- (mapcar ,name ,tree)
- )
- (t (error "Only tree of symbols allowed."))
- ) )
+(defmacro my-defun-rename-symb-tree (name doc func)
+ "Travel by TREE and applies FUNC to each symbol."
+ `(defun ,name (tree)
+ ,doc
+ (cond
+ ((symbolp tree)
+ (,func tree)
+ )
+ ((listp tree)
+ (mapcar ',name tree)
+ )
+ (t (error "Only tree of symbols allowed."))
+ )))
-(defun my-feature2mode (tree)
- "Convert TREE of features to TREE of modes for these features. Single symbol allowed."
- (my-travel-symb-tree
- 'my-feature2mode
- (lambda (symb) (intern (concat (symbol-name symb) "-mode")))
- tree))
+(my-defun-rename-symb-tree
+ my-feature2mode
+ "Convert TREE of features to TREE of modes for these features. Single symbol allowed."
+ (lambda (symb) (intern (concat (symbol-name symb) "-mode"))))
-(defun my-mode2hook (tree)
- "Convert TREE of modes to TREE of hooks for these modes. Single symbol allowed."
- (my-travel-symb-tree
- 'my-feature2mode
- (lambda (symb) (intern (concat (symbol-name tree) "-hook")))
- tree))
+(my-defun-rename-symb-tree
+ my-mode2hook
+ "Convert TREE of modes to TREE of hooks for these modes. Single symbol allowed."
+ (lambda (symb) (intern (concat (symbol-name symb) "-hook")))
+ )
-(defun my-mode2modemap (tree)
- "Convert TREE of modes to TREE of keymaps for these modes. Single symbol allowed."
- (my-travel-symb-tree
- 'my-feature2mode
- (lambda (symb) (intern (concat (symbol-name tree) "-map")))
- tree))
+(my-defun-rename-symb-tree
+ my-mode2modemap
+ "Convert TREE of modes to TREE of keymaps for these modes. Single symbol allowed."
+ (lambda (symb) (intern (concat (symbol-name symb) "-map")))
+ )
(defvar my-devel-mode-list
'(