autobm.el
changeset 1287 3848ca89b2b6
parent 1286 bfbf02088de8
child 1288 6333a733046f
equal deleted inserted replaced
1286:bfbf02088de8 1287:3848ca89b2b6
     1 ;;; autobm.el --- suggest bookmark name from local context
     1 ;;; autobm.el --- suggest bookmark name from local context
       
     2 
       
     3 (require 'cl-lib)
     2 
     4 
     3 (defvar autobm-mode-handlers
     5 (defvar autobm-mode-handlers
     4   '((emacs-lisp-mode . (autobm-try-semantic))
     6   '((emacs-lisp-mode . (autobm-try-semantic))
     5     (semantic-decoration-mode . (autobm-try-semantic))
     7     (semantic-decoration-mode . (autobm-try-semantic))
     6     (t . (autobm-try-which-func autobm-try-thingatpt)))
     8     (t . (autobm-try-which-func autobm-try-thingatpt)))
    13 
    15 
    14 (defvar autobm-try-thingatpt-things
    16 (defvar autobm-try-thingatpt-things
    15   '(symbol url email))
    17   '(symbol url email))
    16 
    18 
    17 (defun autobm-try-thingatpt ()
    19 (defun autobm-try-thingatpt ()
    18   (let ((things autobm-try-thingatpt-things) name)
    20   (cl-some #'thing-at-point autobm-try-thingatpt-things))
    19     (while (and things (not name))
       
    20       (setq name (thing-at-point (car things)))
       
    21       (setq things (cdr things)))
       
    22     name))
       
    23 
    21 
    24 (defun autobm-get-active-handlers ()
    22 (defun autobm-get-active-handlers ()
    25   (let ( h handlers (modes (list t)) )
    23   (let ( h handlers (modes (list t)) )
    26     (dolist (m minor-mode-list)
    24     (dolist (m minor-mode-list)
    27       (when (and (boundp m) (symbol-value m))
    25       (when (and (boundp m) (symbol-value m))