-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtkacz.el
121 lines (93 loc) · 3.31 KB
/
tkacz.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
;;; tkacz.el --- Emacs interface for Tkacz -*- lexical-binding: t; coding: utf-8 -*-
;; Copyright (c) 2020-2021 Thibault Polge <[email protected]>
;; Author: Thibault Polge <[email protected]>
;; Maintainer: Thibault Polge <[email protected]>
;;
;; Keywords: bib
;; Homepage: https://github.com/thblt/tkacz
;; Version: 0
;; 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 <http://www.gnu.org/licenses/>.
;;; Commentary:
;; See README.
;;; Code:
(require 'json)
(require 'tabulated-list)
(require 'wid-browse)
(require 'widget)
(defgroup tkacz nil
"The strange document manager."
:group 'applications)
;;;; Server process
(defvar tkacz--server-process
nil
"The Tkacz server process.")
;;;; Main view
(defun tkacz ()
"Run Tkacz."
(interactive)
(switch-to-buffer (get-buffer-create "*Tkacz*"))
(tkacz-mode))
(define-derived-mode tkacz-mode widget-browse-mode "*Tkacz*"
:group 'tkacz
(setq-local mode-line-format tkacz-mode-line-format
fill-column (window-body-width))
(font-lock-mode)
(let ((inhibit-read-only t))
(erase-buffer)
(widget-minor-mode)
(widget-insert (concat (propertize "Tkacz!\n" 'face 'bold)
(propertize "The strange reference manager" 'face 'italic)))
(center-paragraph)
(widget-insert "\n\n")
(widget-create 'editable-field
:size (- fill-column 30)
:format "Query Tkacz: %v " ; Text after the field!
"")
(widget-insert "\nSee also ")
(use-local-map widget-keymap)
(widget-setup)))
(defcustom tkacz-mode-line-format
'(:eval
(concat
(propertize " *Tkacz*" 'face 'bold)
(if (not tkacz-server-process)
(propertize " Waiting for server…" 'face 'warning)
" At your service.")))
"Mode line definition for Tkacz's home view.")
;;;; List view
(define-derived-mode tkacz-list-mode tabulated-list-mode "*Tkacz*"
:group 'tkacz
(setq-local mode-line-format tkacz-mode-line-format)
(hl-line-mode)
(setq tabulated-list-format)
)
;;;; Side views
(defun tkacz-side-view (buffer side &optional action noswap)
"Control the display of BUFFER as a side view on SIDE.
BUFFER is a buffer, or nil.
SIDE is one of 'top, 'right, 'bottom or 'left.
ACTION can be:
- nil to toggle the view (hide if visible, show if not)
- 'hide to force hide
- 'show or t to show the buffer.
By default, this will replace an existing side buffer, unless
NOSWAP is non-nil."
)
;; Notes to self:
;; (display-buffer-in-side-window (get-buffer-create "*TZ collections*") '((side . top)))
;; (display-buffer-in-side-window (get-buffer-create "*TZ Notes*") '((side . right)))
;; (display-buffer-in-side-window (get-buffer-create "*TZ Details*") '((side . bottom)))
;;;;; Customizations
(provide 'tkacz)
;;; tkacz.el ends here