.emacs-my
changeset 1255 abba187b8cab
parent 1254 19c7b3be9b3a
child 1256 39879e285b7a
equal deleted inserted replaced
1254:19c7b3be9b3a 1255:abba187b8cab
   134   "Search for KEY in all known keymaps."
   134   "Search for KEY in all known keymaps."
   135   (mapatoms (lambda (ob) (when (and (boundp ob) (keymapp (symbol-value ob)))
   135   (mapatoms (lambda (ob) (when (and (boundp ob) (keymapp (symbol-value ob)))
   136                       (when (lookup-key (symbol-value ob) key)
   136                       (when (lookup-key (symbol-value ob) key)
   137                         (message "%S" ob))))
   137                         (message "%S" ob))))
   138             obarray))
   138             obarray))
       
   139 
       
   140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   141 (message "lisp, elisp")
       
   142 
       
   143 (setq list-command-history-max 256)
       
   144 
       
   145 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
       
   146 (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
       
   147 (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
       
   148 
       
   149 (defun my-emacs-lisp-mode-hook ()
       
   150   (setq tab-width 8))
       
   151 (add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-hook)
       
   152 
       
   153 (defun my-elisp-find-tag ()
       
   154   (interactive)
       
   155   (require 'etags)
       
   156   (ring-insert find-tag-marker-ring (point-marker))
       
   157   (unless (find-variable-at-point)
       
   158     (find-function-at-point)
       
   159     ))
       
   160 ;; Goto elisp definition.
       
   161 (define-key emacs-lisp-mode-map (kbd "M-.") 'my-elisp-find-tag)
       
   162 
       
   163 (if (not (fboundp 'global-prettify-symbols-mode))
       
   164     ;; http://www.emacswiki.org/emacs/PrettyLambda
       
   165     (font-lock-add-keywords
       
   166      'emacs-lisp-mode
       
   167      `(("(\\<\\(lambda\\)\\>"
       
   168         (1 (progn (compose-region (match-beginning 1) (match-end 1) ,(make-char 'greek-iso8859-7 107)) font-lock-keyword-face)) )))
       
   169   (global-prettify-symbols-mode 1))
       
   170 
       
   171 (defun my-dump-funcs ()
       
   172   "Dump all function calls in current buffer. Useful to explore
       
   173 elisp API from somebody else files."
       
   174   (interactive)
       
   175   (let* ( (cur-buffer (current-buffer)) (new-buffer (get-buffer-create (concat (buffer-name cur-buffer) "-funcs.el"))) symb )
       
   176     (while (search-forward-regexp "([[:alnum:]*]" nil t)
       
   177       (setq symb (thing-at-point 'symbol))
       
   178       (with-current-buffer new-buffer
       
   179         (insert-string symb)
       
   180         (insert-char ?\n 1)))
       
   181     (switch-to-buffer new-buffer)
       
   182     (shell-command-on-region (point-min) (point-max) "sort -u" nil t)
       
   183     ))
   139 
   184 
   140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   185 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   141 (message "mode groups")
   186 (message "mode groups")
   142 
   187 
   143 (defmacro my-defun-rename-symb-tree (name doc func)
   188 (defmacro my-defun-rename-symb-tree (name doc func)
  2534   (add-to-list 'auto-mode-alist '("\\.icf\\'" . iar-linker-config-mode))
  2579   (add-to-list 'auto-mode-alist '("\\.icf\\'" . iar-linker-config-mode))
  2535   )
  2580   )
  2536 (when (fboundp 'iar4-linker-config-mode)
  2581 (when (fboundp 'iar4-linker-config-mode)
  2537   (add-to-list 'auto-mode-alist '("\\.xcl\\'" . iar4-linker-config-mode))
  2582   (add-to-list 'auto-mode-alist '("\\.xcl\\'" . iar4-linker-config-mode))
  2538   )
  2583   )
  2539 
       
  2540 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
  2541 (message "lisp, elisp")
       
  2542 
       
  2543 (setq list-command-history-max 256)
       
  2544 
       
  2545 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
       
  2546 (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
       
  2547 (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
       
  2548 
       
  2549 (defun my-emacs-lisp-mode-hook ()
       
  2550   (setq tab-width 8))
       
  2551 (add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-hook)
       
  2552 
       
  2553 (defun my-elisp-find-tag ()
       
  2554   (interactive)
       
  2555   (require 'etags)
       
  2556   (ring-insert find-tag-marker-ring (point-marker))
       
  2557   (unless (find-variable-at-point)
       
  2558     (find-function-at-point)
       
  2559     ))
       
  2560 ;; Goto elisp definition.
       
  2561 (define-key emacs-lisp-mode-map (kbd "M-.") 'my-elisp-find-tag)
       
  2562 
       
  2563 (if (not (fboundp 'global-prettify-symbols-mode))
       
  2564     ;; http://www.emacswiki.org/emacs/PrettyLambda
       
  2565     (font-lock-add-keywords
       
  2566      'emacs-lisp-mode
       
  2567      `(("(\\<\\(lambda\\)\\>"
       
  2568         (1 (progn (compose-region (match-beginning 1) (match-end 1) ,(make-char 'greek-iso8859-7 107)) font-lock-keyword-face)) )))
       
  2569   (global-prettify-symbols-mode 1))
       
  2570 
       
  2571 (defun my-dump-funcs ()
       
  2572   "Dump all function calls in current buffer. Useful to explore
       
  2573 elisp API from somebody else files."
       
  2574   (interactive)
       
  2575   (let* ( (cur-buffer (current-buffer)) (new-buffer (get-buffer-create (concat (buffer-name cur-buffer) "-funcs.el"))) symb )
       
  2576     (while (search-forward-regexp "([[:alnum:]*]" nil t)
       
  2577       (setq symb (thing-at-point 'symbol))
       
  2578       (with-current-buffer new-buffer
       
  2579         (insert-string symb)
       
  2580         (insert-char ?\n 1)))
       
  2581     (switch-to-buffer new-buffer)
       
  2582     (shell-command-on-region (point-min) (point-max) "sort -u" nil t)
       
  2583     ))
       
  2584 
  2584 
  2585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2586 (message "c-mode, cc-mode, c++-mode")
  2586 (message "c-mode, cc-mode, c++-mode")
  2587 
  2587 
  2588 ;; Minor mode that highlights suspicious C and C++ constructions.
  2588 ;; Minor mode that highlights suspicious C and C++ constructions.