]> code.delx.au - gnu-emacs-elpa/commitdiff
Add emacswiki-generator.el.
authorChristopher Schmidt <christopher@ch.ristopher.com>
Thu, 8 Mar 2012 10:01:23 +0000 (11:01 +0100)
committerChristopher Schmidt <christopher@ch.ristopher.com>
Thu, 8 Mar 2012 10:01:23 +0000 (11:01 +0100)
ampc.el
emacswiki-generator.el [new file with mode: 0644]

diff --git a/ampc.el b/ampc.el
index 02b3334d425bf9a15a66c6bb8bc1503bc0071595..2c75c5c7ce3672ce82a69739f0169fd052642887 100644 (file)
--- a/ampc.el
+++ b/ampc.el
@@ -1694,11 +1694,7 @@ If ARG is omitted, use the selected entries in the current buffer."
          (status (concat "State:     " state
                          (when ampc-yield
                            (concat (make-string (- 10 (length state)) ? )
-                                   (ecase (% ampc-yield 4)
-                                     (0 "|")
-                                     (1 "/")
-                                     (2 "-")
-                                     (3 "\\"))))
+                                   (nth (% ampc-yield 4) '("|" "/" "-" "\\"))))
                          "\n"
                          (when (equal state "play")
                            (concat "Playing:   "
diff --git a/emacswiki-generator.el b/emacswiki-generator.el
new file mode 100644 (file)
index 0000000..5aafd2d
--- /dev/null
@@ -0,0 +1,65 @@
+;; Copyright (C) 2012 Free Software Foundation, Inc.
+
+;; Author: Christopher Schmidt <christopher@ch.ristopher.com>
+;; Maintainer: Christopher Schmidt <christopher@ch.ristopher.com>
+;; Created: 2012-03-08
+;; Compatibility: GNU Emacs: 24.x
+
+;; This file is NOT part of GNU Emacs.
+
+;; 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:
+;; I use this file to generate the formatted EmacsWiki description of ampc from
+;; the `Commentary' section in ampc.el.
+
+;;; Code:
+(let ((data))
+  (split-window-below)
+  (other-window 1)
+
+  (switch-to-buffer (get-buffer-create " *ampc EmacsWiki*"))
+
+  (delete-region (point-min) (point-max))
+
+  (with-temp-buffer
+    (insert-file-contents
+     (find-lisp-object-file-name 'ampc (symbol-function 'ampc)))
+    (delete-region (point-min)
+                   (progn (search-forward-regexp "^;;; \\*\\* installation")
+                          (move-beginning-of-line nil)))
+    (delete-region (progn (search-forward-regexp "^;;; Code:\n")
+                          (previous-line 2)
+                          (move-beginning-of-line nil)
+                          (point))
+                   (point-max))
+    (goto-char (point-min))
+    (replace-regexp "^;; ?" "")
+    (goto-char (point-min))
+    (replace-regexp "^; \\*\\* \\(.*\\)" "== \\1 ==\n")
+    (goto-char (point-min))
+    (replace-regexp "^; \\*\\*\\* \\(.*\\)" "=== \\1 ===\n")
+    (goto-char (point-min))
+    (replace-regexp "^\n\\(?1:\\((\\|\\.\\)\\(.*\n\\)+?\\)\n"
+                    "\n<pre>\n\\1</pre>\n\n")
+    (goto-char (point-min))
+    (replace-regexp "ELPA" "[[ELPA]]")
+    (setf data (buffer-string)))
+  (insert data))
+
+;; Local Variables:
+;; lexical-binding: t
+;; fill-column: 80
+;; indent-tabs-mode: nil
+;; End: