.emacs-my
changeset 605 c228c0414e0b
parent 604 9084d12d924d
child 606 959d64f49788
equal deleted inserted replaced
604:9084d12d924d 605:c228c0414e0b
    34 (setenv "ORGANIZATION" (concat user-full-name " <" user-mail-address  ">"))
    34 (setenv "ORGANIZATION" (concat user-full-name " <" user-mail-address  ">"))
    35 
    35 
    36 ;;; ----------------------------------------------------------------
    36 ;;; ----------------------------------------------------------------
    37 (message "mode groups")
    37 (message "mode groups")
    38 
    38 
    39 (defun my-modelist-to-hooklist (modes)
    39 (defmacro my-travel-symb-tree (name func tree)
    40   "Convert list of MODES to list of hooks for these modes."
    40   `(cond
    41   (mapcar
    41     ((symbolp ,tree)
    42    (lambda (mode) (intern (concat (symbol-name mode) "-hook")))
    42      (,func ,tree)
    43    modes
    43      )
    44    ) )
    44     ((listp ,tree)
       
    45      (mapcar ,name ,tree)
       
    46      )
       
    47     (t (error "Only tree of symbols allowed."))
       
    48     ) )
       
    49 
       
    50 (defun my-feature2mode (tree)
       
    51   "Convert TREE of features to TREE of modes for these features. Single symbol allowed."
       
    52   (my-travel-symb-tree
       
    53    'my-feature2mode
       
    54    (lambda (symb) (intern (concat (symbol-name symb) "-mode")))
       
    55    tree))
       
    56 
       
    57 (defun my-mode2hook (tree)
       
    58   "Convert TREE of modes to TREE of hooks for these modes. Single symbol allowed."
       
    59   (my-travel-symb-tree
       
    60    'my-feature2mode
       
    61    (lambda (symb) (intern (concat (symbol-name tree) "-hook")))
       
    62    tree))
       
    63 
       
    64 (defun my-mode2modemap (tree)
       
    65   "Convert TREE of modes to TREE of keymaps for these modes. Single symbol allowed."
       
    66   (my-travel-symb-tree
       
    67    'my-feature2mode
       
    68    (lambda (symb) (intern (concat (symbol-name tree) "-map")))
       
    69    tree))
    45 
    70 
    46 (defvar my-devel-mode-list
    71 (defvar my-devel-mode-list
    47   '(
    72   '(
    48     outline-mode
    73     outline-mode
    49     sh-mode script-mode
    74     sh-mode script-mode
    55     nsis-mode
    80     nsis-mode
    56     )
    81     )
    57   "List of development modes.")
    82   "List of development modes.")
    58 
    83 
    59 (defvar my-devel-mode-hook-list
    84 (defvar my-devel-mode-hook-list
    60    (my-modelist-to-hooklist my-devel-mode-list)
    85    (my-mode2hook my-devel-mode-list)
    61   "List of development mode hooks.")
    86   "List of development mode hooks.")
    62 
    87 
    63 (defvar my-scroll-margin-mode-list
    88 (defvar my-scroll-margin-mode-list
    64   '(
    89   '(
    65     vc-dir-mode
    90     vc-dir-mode
    71     compilation-mode
    96     compilation-mode
    72     )
    97     )
    73   "List of modes for enabling scroll margin.")
    98   "List of modes for enabling scroll margin.")
    74 
    99 
    75 (defvar my-scroll-margin-mode-hook-list
   100 (defvar my-scroll-margin-mode-hook-list
    76   (my-modelist-to-hooklist my-scroll-margin-mode-list)
   101   (my-mode2hook my-scroll-margin-mode-list)
    77   "List of mode hooks for enabling scroll margin.")
   102   "List of mode hooks for enabling scroll margin.")
    78 
   103 
    79 (defvar my-text-mode-list
   104 (defvar my-text-mode-list
    80   '(outline-mode text-mode)
   105   '(outline-mode text-mode)
    81   "List of text modes.")
   106   "List of text modes.")
    82 
   107 
    83 (defvar my-text-mode-hook-list
   108 (defvar my-text-mode-hook-list
    84   (my-modelist-to-hooklist my-text-mode-list)
   109   (my-mode2hook my-text-mode-list)
    85   "List of text mode hooks.")
   110   "List of text mode hooks.")
    86 
   111 
    87 ;;; ----------------------------------------------------------------
   112 ;;; ----------------------------------------------------------------
    88 (message "appearance")
   113 (message "appearance")
    89 
   114