Added bookmark creation for RST mode.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sat, 18 May 2019 23:00:23 +0300
changeset 1590 b117f393fd9a
parent 1589 ae79beae573a
child 1591 dd81e33d0dd0
Added bookmark creation for RST mode.
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