-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncs.el
More file actions
75 lines (58 loc) · 1.85 KB
/
Copy pathfuncs.el
File metadata and controls
75 lines (58 loc) · 1.85 KB
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
67
68
69
70
71
72
73
74
75
(define-minor-mode notifications-mode
"Notifications buffer mode"
:lighter " Notifications")
(defun notifications-open ()
"Open the notifications panel"
(interactive)
(if (and (notifications-buffer) (notifications-buffer-window))
(notifications-panel-switch)
(notifications-panel-create)))
(defun notifications-close ()
"Close the notifications panel"
(interactive)
(kill-buffer-and-window))
(defun notification-mark-read ()
"Mark the notification as read"
(interactive)
(read-only-mode -1)
(org-archive-subtree)
(save-buffer)
(read-only-mode t))
(defun notifications-create-bookmark (arg title)
(interactive "P\nsBookmark title: ")
(write-region
(concat "* [[file:"
(buffer-file-name)
"::"
(number-to-string (line-number-at-pos))
"]["
title
"]]\n")
nil
notifications-file 'append))
(defun notifications-create-todo (arg title description)
(interactive "P\nsTitle: \nsDescription: ")
(write-region
(concat "* " title "\n" description)
nil notifications-file 'append))
(defun notifications-panel-create ()
"Create the notifications panel"
(split-window nil notifications-panel-width "left")
(find-file notifications-file)
(setq-local window-size-fixed t)
(auto-revert-mode t)
(set-window-dedicated-p (selected-window) t)
(org-mode)
(read-only-mode t)
(notifications-mode)
(hidden-mode-line-mode t))
(defun notifications-panel-switch ()
"Switch to the notification panel"
(select-window (notifications-buffer-window)))
(defun notifications-buffer ()
"returns the buffer linked to the notifications file if it exists,
nil if it doesn't"
(find-buffer-visiting notifications-file))
(defun notifications-buffer-window ()
"Return the window that show the notifications buffer"
(get-buffer-window (notifications-buffer)))