Skip to content

Commit c832172

Browse files
localauthorbdarcus
authored andcommitted
Use thing-at-point for citar-markdown-key-at-point
1 parent 3d3783c commit c832172

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

citar-markdown.el

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,12 @@
6464
;;;###autoload
6565
(defun citar-markdown-key-at-point ()
6666
"Return a citation key at point for pandoc markdown citations."
67-
(save-excursion
68-
(let* ((beg (progn
69-
(skip-chars-backward
70-
citar-markdown-regex-citation-key)
71-
(point)))
72-
(end (progn
73-
(skip-chars-forward
74-
citar-markdown-regex-citation-key)
75-
(point)))
76-
(str (buffer-substring-no-properties beg end)))
77-
(cadr (split-string str "[@;]")))))
67+
(interactive)
68+
(when (thing-at-point-looking-at citar-markdown-regex-citation-key)
69+
(let ((stab (copy-syntax-table)))
70+
(with-syntax-table stab
71+
(modify-syntax-entry ?@ "_")
72+
(cadr (split-string (thing-at-point 'symbol) "[]@;]"))))))
7873

7974
(provide 'citar-markdown)
8075
;;; citar-markdown.el ends here

0 commit comments

Comments
 (0)