# HG changeset patch # User Oleksandr Gavenko # Date 1558209623 -10800 # Node ID b117f393fd9a7496a513c61b4020fa00156701f2 # Parent ae79beae573a35fce06821cccc73b27212f89648 Added bookmark creation for RST mode. diff -r ae79beae573a -r b117f393fd9a autobm.el --- a/autobm.el Thu May 16 00:26:05 2019 +0300 +++ b/autobm.el Sat May 18 23:00:23 2019 +0300 @@ -8,6 +8,7 @@ (defvar autobm-mode-handlers '((emacs-lisp-mode . (autobm-try-semantic)) (semantic-decoration-mode . (autobm-try-semantic)) + (rst-mode . (autobm-try-thingatpt)) (t . (autobm-try-which-func autobm-try-thingatpt))) "Alist of handlers by mode. Key is a mojor or minor mode name, or `t' as fallback. Value is a no-argument function or a list of such functions, @@ -22,6 +23,10 @@ (defun autobm-try-thingatpt () (cl-some #'thing-at-point autobm-try-thingatpt-things)) +(defun autobm-try-line () + (let ( (line (thing-at-point 'line)) ) + (substring line 0 (min (1- (length line)) 30)))) + (defun autobm-get-active-handlers () (let ( h handlers (modes (list major-mode)) ) (dolist (m minor-mode-list) @@ -54,7 +59,7 @@ (defun autobm-suggest () "Suggest bookmark name depending on buffer mode and local -context using `autobm-semantic-type-alist'. First checked major +context using `autobm-try-semantic-type-alist'. First checked major mode then active minor modes." (let ((result nil)) (catch 'exit