1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(defun zyd-expand-and-complete-with-denote ()
(interactive)
(let ((limit (- (point) 2)))
(when (looking-back "((" limit)
(progn
(call-interactively #'denote-link-or-create)
(let ((end-of-link (point)))
(goto-char limit)
(delete-char 2)
(goto-char end-of-link))))))
(defun zyd-try-to-complete-then-cycle (&optional arg)
(interactive)
(zyd-expand-and-complete-with-denote)
(org-cycle arg))
(define-key org-mode-map (kbd "<tab>") #'zyd-expand-and-complete-with-denote)