]> code.delx.au - gnu-emacs-elpa/blob - emacswiki-generator.el
* ampc.el: Refine options for sending commands.
[gnu-emacs-elpa] / emacswiki-generator.el
1 ;; -*- lexical-binding: t -*-
2 ;; Copyright (C) 2012 Free Software Foundation, Inc.
3
4 ;; Author: Christopher Schmidt <christopher@ch.ristopher.com>
5 ;; Maintainer: Christopher Schmidt <christopher@ch.ristopher.com>
6 ;; Created: 2012-03-08
7 ;; Compatibility: GNU Emacs: 24.x
8
9 ;; This file is part of ampc.
10
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
15
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
23
24 ;;; Commentary:
25 ;; I use this file to generate the formatted EmacsWiki description of ampc from
26 ;; the `Commentary' section in ampc.el.
27
28 ;;; Code:
29 (let ((data))
30 (split-window-below)
31 (other-window 1)
32
33 (switch-to-buffer (get-buffer-create " *ampc EmacsWiki*"))
34
35 (delete-region (point-min) (point-max))
36
37 (with-temp-buffer
38 (insert-file-contents
39 (find-lisp-object-file-name 'ampc (symbol-function 'ampc)))
40 (delete-region (point-min)
41 (progn (search-forward-regexp "^;;; \\*\\* installation")
42 (move-beginning-of-line nil)))
43 (delete-region (progn (search-forward-regexp "^;;; Code:\n")
44 (previous-line 2)
45 (move-beginning-of-line nil)
46 (point))
47 (point-max))
48 (goto-char (point-min))
49 (replace-regexp "^;; ?" "")
50 (goto-char (point-min))
51 (replace-regexp "^; \\*\\* \\(.*\\)" "== \\1 ==\n")
52 (goto-char (point-min))
53 (replace-regexp "^; \\*\\*\\* \\(.*\\)" "=== \\1 ===\n")
54 (goto-char (point-min))
55 (replace-regexp "^\n\\(?1:\\((\\|\\.\\)\\(.*\n\\)+?\\)\n"
56 "\n<pre>\n\\1</pre>\n\n")
57 (goto-char (point-min))
58 (replace-regexp "ELPA" "[[ELPA]]")
59 (goto-char (point-min))
60 (replace-regexp "\\(this\\( \\|\n\\)file\\)" "\\1 (Lisp:ampc.el)")
61 (setf data (buffer-string)))
62 (insert data))
63
64 ;; Local Variables:
65 ;; fill-column: 80
66 ;; indent-tabs-mode: nil
67 ;; End: