-
Notifications
You must be signed in to change notification settings - Fork 1
/
zettel2-mode.el
66 lines (48 loc) · 2.07 KB
/
zettel2-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
;;; zettel2-mode.el --- A mode for easy access to zettel2 functionality -*- lexical-binding: t; -*-
;; Copyright (C) 2022 Wojciech Siewierski
;; Author: Wojciech Siewierski
;; Keywords: outlines, org-mode, convenience
;; Version: 0.9
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; A mode exposing the zettel2 functionality
;;
;; The major mode has the advantage of `auto-mode-alist' being able to
;; enable it. On the other hand, M-tab doesn't work in it as it does
;; in `org-mode' due to pcomplete being bound to the specific
;; major-mode, so it's considered obsolete.
;;; Code:
(require 'zettel2)
(require 'org)
(defgroup zettel2-mode nil
"A mode exposing the zettel2 functionality."
:group 'zettel2)
(declare-function zettel2-graph "zettel2-graph")
(defvar zettel2-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c C-n") #'zettel2-create-note)
(define-key map (kbd "C-c C-M-r") #'zettel2-graph)
(define-key map (kbd "C-c C-r") #'zettel2-backrefs)
(define-key map (kbd "M-n") #'org-next-link)
(define-key map (kbd "M-p") #'org-previous-link)
map))
;;;###autoload
(define-derived-mode zettel2-mode org-mode "Zettel"
"A mode exposing the zettel2 functionality.")
(make-obsolete 'zettel2-mode 'zettel2-minor-mode "2022-09-04")
;;;###autoload
(define-minor-mode zettel2-minor-mode
"A minor mode exposing the zettel2 functionality."
:lighter " zettel"
:keymap zettel2-mode-map)
(provide 'zettel2-mode)
;;; zettel2-mode.el ends here