;; Copyright (C) 2016 Ian Kelling ;; 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 . (defun iankmod-start () (interactive) (shell-command "/a/h/get-comments" "*messages*") (find-file "/tmp/hcomments") (iankmod 1)) (defun iankmod-save () (interactive) (shell-command "/a/h/set-comments" "*messages*")) (defun iankmod-set-state (state) (beginning-of-line) (re-search-forward "|" nil t) (re-search-forward "[^|]*" nil t) (replace-match state) (forward-line)) (defun iankmod-pick () (interactive) (iankmod-set-state "picked")) (defun iankmod-ban () (interactive) (iankmod-set-state "banned")) ;; for test comments, or comments we just want to delete from the ;; db for whatever reason. (defun iankmod-delete () (interactive) (iankmod-set-state "delete")) (defun iankmod-moderate () (interactive) (iankmod-set-state "moderated")) (define-minor-mode iankmod "Moderation of comments for iankelling.org" :keymap (let ((map (make-sparse-keymap))) (define-key map (kbd "p") 'iankmod-pick) (define-key map (kbd "b") 'iankmod-ban) (define-key map (kbd "m") 'iankmod-moderate) (define-key map (kbd "x") 'iankmod-save) (define-key map (kbd "d") 'iankmod-delete) map))