summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2012-04-21 10:11:00 (GMT)
committer Jaromil <jaromil@dyne.org>2012-04-21 10:11:00 (GMT)
commitadef6f0acbaa63f5f3437f306732831d4bcf8946 (patch)
treec8dba85126485b08af22e486a73a0ca70257853f
parent940abafaaa93bbe1b737919bfbb1125b55ef96bc (diff)
correct home-dir in Emacs and some minor fixes to confs and aspect
-rw-r--r--elisp/autoload.el134
-rw-r--r--elisp/autorg.el52
-rw-r--r--elisp/moinmoin.el590
-rwxr-xr-xmac/AutOrg.command1
-rw-r--r--mac/Info.plist16
5 files changed, 739 insertions, 54 deletions
diff --git a/elisp/autoload.el b/elisp/autoload.el
new file mode 100644
index 0000000..c82edde
--- /dev/null
+++ b/elisp/autoload.el
@@ -0,0 +1,134 @@
+;; Jaromil's Emacs
+;; list of autoloads
+
+(provide 'autoload)
+
+;; word count
+(autoload 'word-count-mode "word-count"
+ "Minor mode to count words." t nil)
+
+; use antiword on doc files
+(autoload 'no-word "no-word" "word to txt")
+(add-to-list 'auto-mode-alist '("\\.doc\\'" . no-word))
+; requires antiword and the no-doc.el extension
+; http://www.emacswiki.org/emacs/AntiWord
+
+;; make hypertexts in any document
+(defun load-linkd () (interactive)
+ "internal linking to browse any major mode"
+ (require 'linkd)
+ (linkd-mode)
+ )
+
+; grep directories
+(defun grep-on-the-fly ()
+ "grep the whole directory for something defaults to term at cursor position"
+ (interactive)
+ (setq default (thing-at-point 'symbol))
+ (setq needle (or (read-string (concat "grep for <" default "> ")) default))
+ (setq needle (if (equal needle "") default needle))
+ (grep (concat "egrep -s -i -n " needle " * /dev/null")))
+(global-set-key "\C-x." 'grep-on-the-fly)
+(global-set-key [f8] 'next-error)
+
+; fullscreen
+(defun toggle-fullscreen ()
+ (interactive)
+ (set-frame-parameter nil 'fullscreen (if (frame-parameter nil
+ 'fullscreen) nil
+ 'fullboth)))
+(global-set-key [(meta return)] 'toggle-fullscreen)
+
+;;; E-Mail
+(defun load-email () (interactive)
+ "load some e-mail mode extensions when answering emails"
+ (mail-mode) )
+(add-to-list 'auto-mode-alist '("mutt" . load-email) )
+(autoload 'turn-on-tinyprocmail-mode "tinyprocmail" "" t)
+(autoload 'turn-off-tinyprocmail-mode "tinyprocmail" "" t)
+(autoload 'tinyprocmail-mode "tinyprocmail" "" t)
+(add-hook 'tinyprocmail-:load-hook 'tinyprocmail-install)
+;; Procmail files usually end to suffix "*.rc", like file-name.rc
+;; Some older procmail files start with "rc.*", like rc.file-name
+(autoload 'aput "assoc")
+(aput 'auto-mode-alist
+ "\\.\\(procmail\\)?rc$"
+ 'turn-on-tinyprocmail-mode)
+
+
+;;; Encryption
+(require 'pgg)
+(require 'org-crypt)
+(org-crypt-use-before-save-magic)
+
+
+;;; DOT mode
+(defun load-graphviz () (interactive)
+ "load Graphviz DOT language helpers for graph creation"
+ (require 'graphviz-dot-mode)
+ (graphviz-dot-mode) )
+
+;;; MUSE
+;; (require 'muse)
+(defun load-muse () (interactive)
+ "load MUSE extension for many online publishing functionalities"
+ (require 'muse-jaromil)
+ (setq debug-on-error t)
+ (muse-mode)
+ )
+(add-to-list 'auto-mode-alist '("\\.muse\\'" . load-muse) )
+
+;;; HTMLize sourcecode
+(defun load-html () (interactive)
+ "load htmlize to transform code into html for online web publishing"
+;; (require 'htmlize)
+ (require 'css-mode)
+ (require 'htmlfontify)
+; (add-to-list 'load-path "~/jrml/conf/emacs/elisp/nxhtml")
+; (add-to-list 'load-path "~/jrml/conf/emacs/elisp/nxhtml/etc/schema")
+ (require 'nxhtml-autostart)
+ )
+
+;; LUA mode
+(setq auto-mode-alist (cons '("\\.lua$" . lua-mode) auto-mode-alist))
+(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
+
+
+;; word count
+(autoload 'word-count-mode "word-count"
+ "Minor mode to count words." t nil)
+
+;;; TPP mode
+(autoload 'tpp-mode "tpp-mode" "TPP mode." t)
+(add-to-list 'auto-mode-alist '("\\.tpp$" . tpp-mode) )
+
+
+;;; weblogger mode
+(defun load-webedit () (interactive)
+ "load weblogger xmlrpc editing of websites: webloggers and mediawiki"
+ (require 'weblogger)
+ (require 'mediawiki)
+
+ )
+
+;; make hypertexts in any document
+(defun load-linkd () (interactive)
+ "internal linking to browse any major mode"
+ (require 'linkd)
+ (linkd-mode)
+ )
+
+
+;; Pastebin extension
+(defun pastebin-region ()
+ (interactive)
+ "load pastebin extension and executes a pastebin for selected region"
+ (require 'pastebin)
+ (pastebin)
+)
+
+;; moinmoin
+(require 'moinmoin)
+
+
+;;;; EOF
diff --git a/elisp/autorg.el b/elisp/autorg.el
index 1d9a661..01a962e 100644
--- a/elisp/autorg.el
+++ b/elisp/autorg.el
@@ -32,13 +32,14 @@
; load color-themes extension
(require 'color-theme)
(color-theme-initialize)
-(color-theme-matrix)
+(color-theme-gray30)
+; (color-theme-matrix)
; (color-theme-blippblopp)
; (color-theme-dark-laptop)
; transparency (thanks dreamer!)
-(set-frame-parameter (selected-frame) 'alpha '(90 50))
-(add-to-list 'default-frame-alist '(alpha 90 50))
+(set-frame-parameter (selected-frame) 'alpha '(98 50))
+(add-to-list 'default-frame-alist '(alpha 98 50))
; start listening to commandline invokations
(server-start)
@@ -156,46 +157,5 @@
;; set our favourite: Anonymous!
(set-face-font
-'default "-*-Inconsolata-normal-normal-normal-*-14-*-*-*-c-80-*")
-
-;;; E-Mail
-(defun load-email () (interactive)
- "load some e-mail mode extensions when answering emails"
- (mail-mode) )
-(add-to-list 'auto-mode-alist '("mutt" . load-email) )
-
-;; word count
-(autoload 'word-count-mode "word-count"
- "Minor mode to count words." t nil)
-
-; use antiword on doc files
-(autoload 'no-word "no-word" "word to txt")
-(add-to-list 'auto-mode-alist '("\\.doc\\'" . no-word))
-; requires antiword and the no-doc.el extension
-; http://www.emacswiki.org/emacs/AntiWord
-
-;; make hypertexts in any document
-(defun load-linkd () (interactive)
- "internal linking to browse any major mode"
- (require 'linkd)
- (linkd-mode)
- )
-
-; grep directories
-(defun grep-on-the-fly ()
- "grep the whole directory for something defaults to term at cursor position"
- (interactive)
- (setq default (thing-at-point 'symbol))
- (setq needle (or (read-string (concat "grep for <" default "> ")) default))
- (setq needle (if (equal needle "") default needle))
- (grep (concat "egrep -s -i -n " needle " * /dev/null")))
-(global-set-key "\C-x." 'grep-on-the-fly)
-(global-set-key [f8] 'next-error)
-
-; fullscreen
-(defun toggle-fullscreen ()
- (interactive)
- (set-frame-parameter nil 'fullscreen (if (frame-parameter nil
- 'fullscreen) nil
- 'fullboth)))
-(global-set-key [(meta return)] 'toggle-fullscreen)
+'default "-*-Inconsolata-normal-normal-normal-*-16-*-*-*-*-*-*")
+
diff --git a/elisp/moinmoin.el b/elisp/moinmoin.el
new file mode 100644
index 0000000..a89d942
--- /dev/null
+++ b/elisp/moinmoin.el
@@ -0,0 +1,590 @@
+;;; Use raw text to fetch this code, see EmacsForMoinMoin for tutorial ;; and discussion.
+
+;;; Download link: ;;http://moinmo.in/EmacsForMoinMoin/MoinMoinMode?action=raw
+
+;;; moinmoin-mode.el --- a major mode to edit MoinMoin wiki pages
+
+;; Written by ASK, distributed under GPL
+
+;; Filename: moinmoin-mode.el
+;; Keywords: moinmoin, wiki
+;; Description: a major mode to edit MoinMoin wiki pages
+;; Compatibility: GNU Emacs 22.0.50.1 (probably others)
+;; Last modified: 2006-04-15
+
+;; This file is NOT part of GNU Emacs.
+
+; (require 'screen-lines) ; uses screen-lines.el by Yuji Minejima, tested with 0.55
+
+(longlines-mode)
+
+;;; Definition of font faces
+(defgroup moinmoin nil
+ "Major mode for MoinMoin wiki pages"
+ :prefix "moinmoin-")
+
+(defface moinmoin-h5 '((t (:foreground "tan3" :slant italic)))
+ "Face name to use for 5-level headings in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-h4 '((t (:inherit moinmoin-h5 :slant normal :foreground "tan4")))
+ "Face name to use for 4-level headings in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-h3 '((t (:inherit moinmoin-h4 :weight bold)))
+ "Face name to use for 3-level headings in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-h2 '((t (:inherit moinmoin-h3 :height 1.2)))
+ "Face name to use for 3-level headings in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-h1 '((t (:inherit moinmoin-h2 :height 1.4)))
+ "Face name to use for 3-level headings in moinmoin"
+ :group 'moinmoin)
+
+(defface moinmoin-smiley '((t (:foreground "green4" :weight bold)))
+ "Face name to use smileys in moinmoin"
+ :group 'moinmoin)
+
+(defface moinmoin-table-separator '((t (:foreground "salmon" :weight bold)))
+ "Face name to use for separation of columns in tables of moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-table-pi '((t (:foreground "plum3")))
+ "Face name to use for processing instructions in tables of moinmoin"
+ :group 'moinmoin)
+
+(defface moinmoin-anchor '((t (:foreground "tan3" :height 0.8)))
+ "Face name to use for anchors (targets) in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-anchor-ref-id '((t (:foreground "blue2" :height 0.8 :underline t)))
+ "Face name to use for id in anchor reference in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-anchor-ref-title '((t (:foreground "blue4" :underline t)))
+ "Face name to use for title in anchors reference in moinmoin"
+ :group 'moinmoin)
+
+(defface moinmoin-macro-name '((t (:foreground "plum3")))
+ "Face name to use for names of macros in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-macro-parameters '((t (:foreground "plum4")))
+ "Face name to use for parameters of macros in moinmoin"
+ :group 'moinmoin)
+
+(defface moinmoin-item '((t (:foreground "brown" :weight bold)))
+ "Face name to use for items in lists in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-item-2 '((t (:foreground "brown")))
+ "Face name to use for second-level items in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-blockquote-indent '((t (:background "aquamarine1")))
+ "Face name to use for blockquote indentation in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-blockquote-text '((t (:foreground "aquamarine4")))
+ "Face name to use for blockquote text in moinmoin"
+ :group 'moinmoin)
+
+(defface moinmoin-code '((t (:foreground "purple4")))
+ "Face name to use for code inside braces in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-code-braces '((t (:foreground "plum3")))
+ "Face name to use for baces which delimit code inside braces in moinmoin"
+ :group 'moinmoin)
+
+(defface moinmoin-pi '((t (:foreground "plum3" :weight bold)))
+ "Face name to use for processing instructions in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-comment '((t (:foreground "maroon3")))
+ "Face name to use for comments in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-rule '((t (:foreground "tomato2" :weight bold)))
+ "Face name to use for rules in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-ss '((t (:foreground "grey" ))) ;; try also :height 0.1
+ "Face name to use for syntactic sugar in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-tt '((t (:foreground "cyan4")))
+ "Face name to use for typewriter text in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-entity '((t (:foreground "grey")))
+ "Face name to use for HTML entities in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-email '((t (:foreground "blue2")))
+ "Face name to use for emails in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-url '((t (:foreground "blue2" :height 0.8)))
+ "Face name to use for URLs in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-url-title '((t (:foreground "blue4" :underline t)))
+ "Face name to use for title of URL in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-wiki-link '((t (:foreground "blue4" :weight bold)))
+ "Face name to use for CamelCase links in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-inter-wiki-link '((t (:foreground "blue3" :weight bold)))
+ "Face name to use for inter wiki links in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-bold '((t (:weight bold)))
+ "Face name to use for bold text in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-italic '((t (:slant italic)))
+ "Face name to use for italic text in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-underline '((t (:underline t)))
+ "Face name to use for underlined text in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-stroke '((t (:strike-through t)))
+ "Face name to use for stroked text in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-subscript '((t (:height 0.8)))
+ "Face name to use for subscripts in moinmoin"
+ :group 'moinmoin)
+(defface moinmoin-superscript '((t (:height 0.8)))
+ "Face name to use for superscripts in moinmoin"
+ :group 'moinmoin)
+
+
+;;; Font lock setup
+(defconst moinmoin-url-prefix
+ "\\(?:http\\|https\\|ftp\\|nntp\\|news\\|mailto\\|telnet\\|wiki\\|file\\|irc\\|attachment\\|inline\\|drawing\\)"
+ "Bracketed regexp matching URL prefixes in moinmoin")
+(defconst moinmoin-url-punctuation
+ "]\"'}|:,.)?!" ; start with ]
+ "Punctuation in URLs of moinmoin")
+(defconst moinmoin-pi-re
+ "^#\\(?:format\\|refresh\\|redirect\\|deprecated\\|pragma\\|form\\|acl\\|language\\).*$"
+ "Regexp for processing instructions in moinmoin")
+(defconst moinmoin-smiley-re
+ "\\(?:<:(\\|X-(\\|:)\\|:-))\\|:(\\|/!\\\\\\|{X}\\|{OK}\\|B-)\\|{2}\\|>:>\\|;-)\\|<!>\\|:o\\||-)\\|;)\\||)\\|(!)\\|:-(\\|:-)\\|{o}\\|:D\\|(./)\\|B)\\|{*}\\|:\\\|:-?\\|{i}\\|{3}\\|{1}\\|:)\\)"
+ "Regexp for smileys in moinmoin")
+
+(defun moinmoin-formatted-code-matcher (bound)
+ "Search for formatted code
+This is supposed to be bug-to-bug compatible with moinmoin-1.5.2"
+ (catch 'match
+ (while (< (point) bound)
+ (unless (search-forward-regexp "{{{" bound t)
+ (throw 'match nil))
+ (let ((start-brace-begin (match-beginning 0))
+ (start-brace-end (match-end 0))
+ pi-begin pi-end
+ code-begin code-end
+ end-brace-begin end-brace-end)
+ (unless (get-text-property start-brace-begin 'moinmoin-verbatim)
+ (goto-char start-brace-end)
+ (if (looking-at "#!.*\n")
+ (setq pi-begin (match-beginning 0)
+ pi-end (match-end 0)
+ code-begin (match-end 0))
+ (setq code-begin start-brace-end))
+ (goto-char code-begin)
+ (let ((not-first-line))
+ (while (looking-at
+ "\\(?:##.*\\|`.*?`\\|{{{.*?}}}\\|.\\)*?\\(?:\\(}}}\\)\\|\n\\)")
+ (goto-char (match-end 0))
+ (when (and (match-beginning 1) ; non-paired `}}}'
+ not-first-line)
+ (setq code-end (match-beginning 1)
+ end-brace-begin (match-beginning 1)
+ end-brace-end (match-end 1))
+ (set-match-data (list start-brace-begin end-brace-end
+ start-brace-begin start-brace-end
+ pi-begin pi-end
+ code-begin code-end
+ end-brace-begin end-brace-end))
+ (throw 'match t))
+ (setq not-first-line t)))
+ (throw 'match nil))))))
+
+
+(defun moinmoin-bracketed-url-matcher (bound)
+ "Search for bracketed URLs"
+ (catch 'match
+ (while (< (point) bound)
+ (unless (search-forward-regexp
+ (concat "\\(\\[\\)"
+ "\\(" moinmoin-url-prefix "?:.*?\\) +"
+ "\\(.*?\\)?"
+ "\\(\\]\\)") bound t)
+ (throw 'match nil))
+ (unless (get-text-property (match-beginning 0) 'moinmoin-verbatim)
+ (throw 'match t)))))
+
+(defun moinmoin-setup-font-lock ()
+ (setq font-lock-beginning-of-syntax-function '(lambda () (goto-char 1)))
+ (setq font-lock-multiline t)
+ (make-local-variable 'font-lock-extra-managed-props)
+ (add-to-list 'font-lock-extra-managed-props 'moinmoin-verbatim)
+ ; Not Comment Start
+ (add-to-list 'font-lock-extra-managed-props 'display)
+ (font-lock-add-keywords nil `(
+ ("\\(?:^\\|[^|]\\)\\(\\(?:||\\)+\\)\\(<.*?>\\)?"
+ (1 'moinmoin-table-separator)
+ (2 'moinmoin-table-pi t t))
+ ("'''\\(.*?\\)'''" (1 'moinmoin-bold prepend))
+ ("\\(?:[^']\\|^\\)''\\([^'].*?[^']\\)''[^']" (1 'moinmoin-italic prepend))
+ ("\\(__\\)\\(.*?\\)\\(__\\)"
+ (1 'moinmoin-ss t) (2 'moinmoin-underline prepend) (3 'moinmoin-ss t))
+ ("\\(--(\\)\\(.*?\\)\\()--\\)"
+ (1 'moinmoin-ss t) (2 'moinmoin-stroke prepend) (3 'moinmoin-ss t))
+ ("\\(,,\\)\\(.*?\\)\\(,,\\)"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-subscript 'display '(raise -0.3)) prepend)
+ (3 'moinmoin-ss t))
+ ("\\(\\^\\)\\(.*?\\)\\(\\^\\)"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-superscript 'display '(raise 0.3)) prepend)
+ (3 'moinmoin-ss t))
+ ("''+" (0 'moinmoin-ss t))
+ ("^ +\\(?:\\*\\|.*?::\\|\\(?:[0-9]+\\|[aAiI]\\)\\.\\) "
+ (0 'moinmoin-item-2))
+ ("^ \\(?:\\*\\|.*?::\\|\\(?:[0-9]+\\|[aAiI]\\)\\.\\) "
+ (0 'moinmoin-item))
+ ("^\\( +\\)\\(.*\\)"
+ (1 'moinmoin-blockquote-indent)
+ (2 'moinmoin-blockquote-text))
+ ("&[A-Za-z0-9]*;" (0 'moinmoin-entity prepend))
+ (,(concat "\\(?:^\\| \\)\\(" moinmoin-smiley-re "\\)[[:space:]]")
+ (1 'moinmoin-smiley t))
+ ("\\(?:^\\|[^A-Za-z!]\\)\\(\\(?:\\.\\./\\)?/?[A-Z][a-z]+[A-Z][a-z][A-Za-z]*\\(?:/[A-Z][a-z]+[A-Z][a-z][A-Za-z]*\\)?\\)"
+ (1 'moinmoin-wiki-link t))
+ (,(concat "[A-Z][A-Za-z]+:"
+ "[^[:space:]'\":<|]"
+ "\\(?:[^" moinmoin-url-punctuation "[:space:]]\\|"
+ "[" moinmoin-url-punctuation "]"
+ "[^" moinmoin-url-punctuation "[:space:]]\\)+")
+ (0 'moinmoin-inter-wiki-link t))
+ ("\\(\\[\"\\)\\(?:\\(.*?:.*\\)\\|\\(.*?\\)\\)\\(\"\\]\\)"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-inter-wiki-link 'moinmoin-verbatim t) t t)
+ (3 (list 'face 'moinmoin-wiki-link 'moinmoin-verbatim t) t t)
+ (4 'moinmoin-ss t))
+ ;;ur'%(url_guard)s(%(url)s)\:([^\s\<%(punct)s]|([%(punct)s][^\s\<%(punct)s]))+'
+ (,(concat "\\<" moinmoin-url-prefix ":"
+ "\\(?:[^" moinmoin-url-punctuation "<[:space:]]\\|"
+ "[" moinmoin-url-punctuation "]"
+ "[^" moinmoin-url-punctuation "<[:space:]]\\)+")
+ (0 'moinmoin-url t))
+ ("[A-Za-z0-9_+-]+@[A-Za-z0-9_-]+\\(?:\\.[A-Za-z0-9_-]+\\)+"
+ (0 'moinmoin-email t))
+ ("-\\{4,\\}" (0 'moinmoin-rule t))
+ ;; macros
+ ("\\(\\[\\[\\)\\([A-Za-z0-9]+\\)\\(?:\\((\\)\\(.*?\\)\\()\\)\\)?\\(\\]\\]\\)"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-macro-name 'moinmoin-verbatim t) t)
+ (3 'moinmoin-ss t t)
+ (4 (list 'face 'moinmoin-macro-parameters 'moinmoin-verbatim t) t t)
+ (5 'moinmoin-ss t t)
+ (6 'moinmoin-ss t))
+ ("\\(\\[\\[Anchor(\\)\\(.*?\\)\\()\\]\\]\\)"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-anchor 'moinmoin-verbatim t) t)
+ (3 'moinmoin-ss t))
+ ("\\(\\[#\\)\\(.*?\\) +\\(.*?\\)?\\(\\]\\)"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-anchor-ref-id 'moinmoin-verbatim t) t)
+ (3 (list 'face 'moinmoin-anchor-ref-title 'moinmoin-verbatim t) t t)
+ (4 (list 'face 'moinmoin-ss 'moinmoin-verbatim t) t))
+ ;; typewriter (tt) overrides the above
+ ("\\({{{\\)\\(.*?\\)\\(}}}\\)"
+ (1 (list 'face 'moinmoin-ss 'moinmoin-verbatim t) keep)
+ (2 (list 'face 'moinmoin-tt 'moinmoin-verbatim t) t)
+ (3 (list 'face 'moinmoin-ss 'moinmoin-verbatim t) keep))
+ ("\\(`\\)\\(.*?\\)\\(`\\)"
+ (1 'moinmoin-ss keep) ; cannot match `{{{' thus no need for ncs
+ (2 (list 'face 'moinmoin-tt 'moinmoin-verbatim t) t)
+ (3 'moinmoin-ss keep))
+ ;; headers overrides tt and biu
+ ("^\\(= \\)\\(.*\\)\\( =\\)$"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-h1 'moinmoin-verbatim t) t)
+ (3 'moinmoin-ss t))
+ ("^\\(== \\)\\(.*\\)\\( ==\\)$"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-h2 'moinmoin-verbatim t) t)
+ (3 'moinmoin-ss t))
+ ("^\\(=== \\)\\(.*\\)\\( ===\\)$"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-h3 'moinmoin-verbatim t) t)
+ (3 'moinmoin-ss t))
+ ("^\\(==== \\)\\(.*\\)\\( ====\\)$"
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-h4 'moinmoin-verbatim t) t)
+ (3 'moinmoin-ss t))
+ ("^\\(=====\\(=*\\) \\)\\(.*\\)\\( \\2=====\\)$" ; 5th and all others
+ (1 'moinmoin-ss t)
+ (3 (list 'face 'moinmoin-h5 'moinmoin-verbatim t) t)
+ (4 'moinmoin-ss t))
+ ;; comments and pi
+ ("^##.*$"
+ (0 (list 'face 'moinmoin-comment 'moinmoin-verbatim t) t))
+ (,moinmoin-pi-re
+ (0 (list 'face 'moinmoin-pi 'moinmoin-verbatim t) t))
+ (moinmoin-bracketed-url-matcher
+ (1 'moinmoin-ss t)
+ (2 (list 'face 'moinmoin-url 'moinmoin-verbatim t) t)
+ (3 (list 'face 'moinmoin-url-title 'moinmoin-verbatim t) t t)
+ (4 (list 'face 'moinmoin-ss 'moinmoin-verbatim t) t))
+ (moinmoin-formatted-code-matcher
+ (1 (list 'face 'moinmoin-code-braces 'moinmoin-verbatim t) t)
+ (2 (list 'face 'moinmoin-pi 'moinmoin-verbatim t) t t)
+ (3 (list 'face 'moinmoin-code 'moinmoin-verbatim t) t)
+ (4 (list 'face 'moinmoin-code-braces 'moinmoin-verbatim t) t))
+ ) 'set))
+
+
+;;; Automagic typing helpers
+(defun moinmoin-insert-quote ()
+ "Convert double quote to HTML entity (&ldquo; or &rdquo;)"
+ (interactive)
+ (cond
+ ((or (get-text-property (point) 'moinmoin-verbatim)
+ (looking-back "\\[\\|= *\\|^\\(?:[^\"]*\"[^\"]*\"\\)*[^\"]*\"[^\"]*"))
+ (insert "\""))
+ ((or (looking-back "[[:space:]]") (eq (point) 1))
+ (insert "&ldquo;"))
+ (t (insert "&rdquo;"))))
+
+(defun moinmoin-insert-dash ()
+ "Insert different types of dashes.
+`----' and `-' stays unchanged
+`--' is converted to `&ndash;'
+`---' is converted to `&mdash;'
+`)--' is not changed'
+`<-' is converted to `&larr;'"
+ (interactive)
+ (cond
+ ((get-text-property (point) 'moinmoin-verbatim)
+ (insert "-"))
+ ((looking-back "---\\|&mdash;")
+ (replace-match "----" t t))
+ ((looking-back "--\\|&ndash;")
+ (replace-match "&mdash;" t t))
+ ((looking-back ")-")
+ (replace-match ")--" t t))
+ ((looking-back "<")
+ (replace-match "&larr;" t t))
+ ((looking-back "-")
+ (replace-match "&ndash;" t t))
+ (t (insert "-"))))
+
+(defun moinmoin-insert-lparen ()
+ "&ndash;( to --("
+ (interactive)
+ (cond
+ ((get-text-property (point) 'moinmoin-verbatim)
+ (insert "("))
+ ((looking-back "&ndash;")
+ (replace-match "--(" t t))
+ (t (insert "("))))
+
+(defun moinmoin-insert-greater-than ()
+ "-> to &rarr;"
+ (interactive)
+ (cond
+ ((get-text-property (point) 'moinmoin-verbatim)
+ (insert ">"))
+ ((looking-back "-")
+ (replace-match "&rarr;" t t))
+ (t (insert ">"))))
+
+(defun moinmoin-insert-item ()
+ "Start new item or row
+If current line starts with item prefix insert newline and the same
+prefix in front of the rest of line.
+If it is table then finish the line and add the new one"
+ (interactive)
+ (when (bolp) (backward-char))
+ (cond
+ ((looking-back "^\\( *||\\).*") ; in a table
+ (let ((prefix (match-string 1)))
+ (end-of-line)
+ (looking-back "[^|]\\(|*\\)")
+ (replace-match "||" t t nil 1)
+ (insert "\n" prefix)))
+ ((looking-back "^\\( +\\(?:\\* \\|\\(?:[0-9]+\\|[aAiI]\\)\\. \\|\\)\\).*")
+ (let ((prefix (match-string 1)))
+ (insert "\n")
+ (insert prefix)))))
+
+
+;;; Header manipulation helpers
+(defun moinmoin-is-header ()
+ "Is point in a header line?
+If yes the title is in \\1"
+ (save-excursion
+ (beginning-of-line)
+ (looking-at "=+ \\(.*\\) =+$")))
+
+(defun moinmoin-increase-header-level ()
+ "Add `=' in the beginning and end of current line"
+ (save-excursion
+ (beginning-of-line) (insert "=")
+ (end-of-line) (insert "=")))
+
+(defun moinmoin-decrease-header-level ()
+ "Decrease level of the header
+Warns if point in a top-level header or not in a header"
+ (save-excursion
+ (beginning-of-line)
+ (if (looking-at "=\\(=+ .* =+\\)=$")
+ (replace-match "\\1" t)
+ (warn "cannot decrease level"))
+ ))
+
+(defun moinmoin-change-header-level (increment)
+ "Increase or decrease level of header according to INCREMENT"
+ (interactive "r")
+ (if (eq increment 1)
+ (moinmoin-increase-header-level)
+ (moinmoin-decrease-header-level)))
+
+(defun moinmoin-change-header-levels-in-region (increment start end)
+ "Increase or decrease level of all headers in the region according to INCREMENT"
+ (interactive "p\nr")
+ (save-excursion
+ (goto-char start)
+ (while (progn
+ (when (moinmoin-is-header)
+ (moinmoin-change-header-level increment))
+ (and (zerop (forward-line)) (< (point) end))))
+ ))
+
+(defun moinmoin-insert-equal (increment)
+ "Do-what-I-mean with header level or insert `='.
+With active region increase or decrease level of all headers in region.
+On an empty line starts new header.
+On a header line increase or decrease level.
+Otherwise just insert `='"
+ (interactive "p")
+ (if mark-active
+ (progn
+ (moinmoin-change-header-levels-in-region
+ increment (region-beginning) (region-end))
+ (setq deactivate-mark nil))
+ (cond
+ ((looking-at "^$")
+ (insert "= =")
+ (backward-char 2))
+ ((moinmoin-is-header)
+ (moinmoin-change-header-level increment))
+ (t (insert "=")))))
+
+
+;;; Anchor insertion and navigation
+(defun moinmoin-list-anchors ()
+ "List anchors in the current buffer"
+ (let ((lst))
+ (save-excursion
+ (goto-char 1)
+ (while (search-forward-regexp "\\[\\[Anchor(\\([^])\n]*\\))\\]\\]" nil t)
+ (setq lst (cons (match-string-no-properties 1) lst))))
+ lst))
+
+(defvar moinmoin-anchor-history "Minibuffer history of anchors")
+(defun moinmoin-completing-read-anchor (prompt &optional require-match)
+ "Read non-empty anchor using complition of all the anchors in the current buffer"
+ (let ((anchor
+ (completing-read "Anchor: " (moinmoin-list-anchors)
+ nil require-match
+ nil moinmoin-anchor-history)))
+ (when (string-equal anchor "")
+ (error "Empty anchor"))
+ anchor))
+
+(defun moinmoin-insert-number-sign (&optional no-title)
+ (interactive "P")
+ "After `[' insert a reference to anchor inputed using completition,
+If no argument given also insert the title of the section which contains
+the anchor."
+ (cond
+ ((and (looking-back "\\[")
+ (not (get-text-property (point) 'moinmoin-verbatim)))
+ (let* ((anchor (moinmoin-completing-read-anchor "Anchor: "))
+ (title
+ (unless no-title
+ (condition-case nil
+ (moinmoin-get-anchored-header anchor)
+ (error (message "No header for anchor %s" anchor) nil)))))
+ (insert "#" anchor " ")
+ (if title
+ (insert title "]")
+ (insert "]") (backward-char))))
+ (t ; not after "["
+ (insert "#"))))
+
+(defun moinmoin-insert-anchor ()
+ "Insert anchor (using the title if point is in a header)"
+ (interactive)
+ (cond
+ ((moinmoin-is-header)
+ (let ((anchor-name
+ (replace-regexp-in-string ; remove non-anchor symbols
+ "[^A-Za-z0-9]+" "-"
+ (match-string-no-properties 1) t t)))
+ (forward-line)
+ (insert "[[Anchor(" anchor-name ")]]\n")))
+ (t
+ (insert "[[Anchor()]]") (backward-char 3))))
+
+(defun moinmoin-anchor-read-or-ask (&optional prompt)
+ "DWIM to get anchor: read [#... ] on current line (before point) or ask user."
+ (cond
+ ((and
+ (search-backward
+ "[#" (save-excursion (beginning-of-line) (point)) t)
+ (looking-at "\\[#\\([^]\n ]+\\)"))
+ (match-string-no-properties 1))
+ (t
+ (moinmoin-completing-read-anchor (or prompt "Anchor: ") t))))
+
+(defun moinmoin-goto-anchor (&optional anchor)
+ "Go to anchor
+If ANCHOR is nil (e.g., if called interactively) read reference
+to it from the current line or ask user. So if there is an
+anchor on the current line but you want to jump to something
+different go to the beginning of the line first."
+ (interactive)
+ (unless anchor
+ (setq anchor (moinmoin-anchor-read-or-ask)))
+ (goto-char 1)
+ (search-forward (concat "[[Anchor(" anchor ")]]")))
+
+(defun moinmoin-get-anchored-header (anchor)
+ "Get title of the section which contains ANCHOR"
+ (save-excursion
+ (moinmoin-goto-anchor anchor)
+ (search-backward-regexp "^=+ \\(.*\\) =+$" nil)
+ (match-string-no-properties 1)))
+
+(defun moinmoin-insert-anchored-header (&optional to-kill-ring)
+ "Insert title of the section which contains anchor, with prefix save it to kill-ring"
+ (interactive "P")
+ (let ((header (moinmoin-get-anchored-header nil)))
+ (if to-kill-ring
+ (kill-new header)
+ (insert header))))
+
+
+;;; Setup
+(define-derived-mode moinmoin-mode outline-mode "MoinMoin"
+ "Set major mode for editing MoinMoin pages"
+ (make-local-variable 'outline-regexp)
+ (setq outline-regexp "=+")
+ (make-local-variable 'outline-heading-end-regexp)
+ (setq outline-heading-end-regexp " =+\n")
+ (local-set-key "\"" 'moinmoin-insert-quote)
+ (local-set-key "-" 'moinmoin-insert-dash)
+ (local-set-key "(" 'moinmoin-insert-lparen)
+ (local-set-key ">" 'moinmoin-insert-greater-than)
+ (local-set-key "=" 'moinmoin-insert-equal)
+ (local-set-key "#" 'moinmoin-insert-number-sign)
+ (local-set-key (kbd "M-RET") 'moinmoin-insert-item)
+ (local-set-key (kbd "C-c a") 'moinmoin-insert-anchor)
+ (local-set-key (kbd "C-c g") 'moinmoin-goto-anchor)
+ (toggle-truncate-lines 0) ; do not truncate
+; (screen-lines-mode 1) ; use screen lines
+ (moinmoin-setup-font-lock)
+ (abbrev-mode 1)
+ (set-fill-column 65000)
+ (auto-fill-mode 0))
+
+(add-to-list 'auto-mode-alist '("\\.wiki$" . moinmoin-mode))
+
+(provide 'moinmoin)
diff --git a/mac/AutOrg.command b/mac/AutOrg.command
index 9e7273d..505d38f 100755
--- a/mac/AutOrg.command
+++ b/mac/AutOrg.command
@@ -17,6 +17,7 @@ cd $appbase
# generate the emacs initialization
rm -f $appbase/$autorg/.emacs
cat <<EOF > $appbase/$autorg/.emacs
+(setq default-directory "$HOME" )
(add-to-list 'load-path "$appbase/$autorg")
(require 'autorg)
EOF
diff --git a/mac/Info.plist b/mac/Info.plist
index b6a5d5d..ad015e7 100644
--- a/mac/Info.plist
+++ b/mac/Info.plist
@@ -485,14 +485,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
<key>NSMenuItem</key>
<dict>
<key>default</key>
- <string>Emacs.app/New Buffer Containing Selection</string>
+ <string>AutOrg.app/New Buffer Containing Selection</string>
</dict>
<key>NSMessage</key>
<string>requestService</string>
<key>NSUserData</key>
<string>open-selection</string>
<key>NSPortName</key>
- <string>Emacs</string>
+ <string>AutOrg</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
@@ -502,14 +502,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
<key>NSMenuItem</key>
<dict>
<key>default</key>
- <string>Emacs.app/Open Selected File</string>
+ <string>AutOrg.app/Open Selected File</string>
</dict>
<key>NSMessage</key>
<string>requestService</string>
<key>NSUserData</key>
<string>open-file</string>
<key>NSPortName</key>
- <string>Emacs</string>
+ <string>AutOrg</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
@@ -519,14 +519,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
<key>NSMenuItem</key>
<dict>
<key>default</key>
- <string>Emacs.app/Email Selection</string>
+ <string>AutOrg.app/Email Selection</string>
</dict>
<key>NSMessage</key>
<string>requestService</string>
<key>NSUserData</key>
<string>mail-selection</string>
<key>NSPortName</key>
- <string>Emacs</string>
+ <string>AutOrg</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
@@ -536,14 +536,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
<key>NSMenuItem</key>
<dict>
<key>default</key>
- <string>Emacs.app/Send Email to Selected Address</string>
+ <string>AutOrg.app/Send Email to Selected Address</string>
</dict>
<key>NSMessage</key>
<string>requestService</string>
<key>NSUserData</key>
<string>mail-to</string>
<key>NSPortName</key>
- <string>Emacs</string>
+ <string>AutOrg</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>