build common css into single css file
[iankelling.org] / iank-mod.el
1 ;; Copyright (C) 2016 Ian Kelling
2
3 ;; This program is free software: you can redistribute it and/or modify
4 ;; it under the terms of the GNU General Public License as published by
5 ;; the Free Software Foundation, either version 3 of the License, or
6 ;; (at your option) any later version.
7
8 ;; This program is distributed in the hope that it will be useful,
9 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ;; GNU General Public License for more details.
12
13 ;; You should have received a copy of the GNU General Public License
14 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 (defun iankmod-start ()
17 (interactive)
18 (shell-command "/a/h/get-comments" "*messages*")
19 (find-file "/tmp/hcomments")
20 (iankmod 1))
21 (defun iankmod-save ()
22 (interactive)
23 (shell-command "/a/h/set-comments" "*messages*"))
24
25
26 (defun iankmod-set-state (state)
27 (beginning-of-line)
28 (re-search-forward "|" nil t)
29 (re-search-forward "[^|]*" nil t)
30 (replace-match state)
31 (forward-line))
32
33 (defun iankmod-pick ()
34 (interactive)
35 (iankmod-set-state "picked"))
36
37 (defun iankmod-ban ()
38 (interactive)
39 (iankmod-set-state "banned"))
40
41 ;; for test comments, or comments we just want to delete from the
42 ;; db for whatever reason.
43 (defun iankmod-delete ()
44 (interactive)
45 (iankmod-set-state "delete"))
46
47 (defun iankmod-moderate ()
48 (interactive)
49 (iankmod-set-state "moderated"))
50
51 (define-minor-mode iankmod
52 "Moderation of comments for iankelling.org"
53 :keymap (let ((map (make-sparse-keymap)))
54 (define-key map (kbd "p") 'iankmod-pick)
55 (define-key map (kbd "b") 'iankmod-ban)
56 (define-key map (kbd "m") 'iankmod-moderate)
57 (define-key map (kbd "x") 'iankmod-save)
58 (define-key map (kbd "d") 'iankmod-delete)
59 map))