1 ;;; muse-init.el --- Initialize muse-mode.
3 ;; Hacked on by Michael Olson
5 ;; In order to see the scripts that I use to publish my website to a
6 ;; remote webserver, check out
7 ;; http://www.mwolson.org/projects/SiteScripts.html.
12 (when (fboundp 'debian-pkg-add-load-path-item
)
13 (debian-pkg-add-load-path-item "/stuff/proj/emacs/muse/rel--3.02/lisp")
14 (debian-pkg-add-load-path-item "/stuff/proj/emacs/muse/rel--3.02/experimental"))
17 (require 'outline
) ; I like outline-style faces
18 (require 'muse
) ; load generic module
19 (require 'muse-colors
) ; load coloring/font-lock module
20 (require 'muse-mode
) ; load authoring mode
21 (require 'muse-blosxom
) ; load blosxom module
22 (require 'muse-docbook
) ; load DocBook publishing style
23 (require 'muse-html
) ; load (X)HTML publishing style
24 (require 'muse-texinfo
) ; load Info/PDF publishing styles
25 (require 'muse-wiki
) ; load Wiki support
26 (require 'muse-xml
) ; load experimental XML support
27 ;;(require 'muse-message) ; load message support (experimental)
31 ;; Here is an example of making a customized version of your favorite
32 ;; publisher. All this does is run `my-muse-blosoxm-finalize' on the
33 ;; published file immediately after saving it.
35 (unless (assoc "my-blosxom" muse-publishing-styles
)
36 (muse-derive-style "my-blosxom" "blosxom-xhtml"
37 :final
'my-muse-blosxom-finalize
)
39 (muse-derive-style "my-pdf" "pdf"
40 :before
'my-muse-pdf-prepare-buffer
)
42 (muse-derive-style "my-xhtml" "xhtml"
43 :header
"~/personal-site/muse/header.html"
44 :footer
"~/personal-site/muse/footer.html"))
46 ;; Here is my master project listing.
48 (setq muse-project-alist
52 :force-publish
("WikiIndex")
53 :default
"WelcomePage")
55 :path
"~/personal-site/site/web"))
58 ("~/proj/wiki/projects/"
59 :force-publish
("WikiIndex")
60 :default
"WelcomePage")
62 :path
"~/personal-site/site/projects"))
65 (,@(muse-project-alist-dirs "~/proj/wiki/blog")
68 ,@(muse-project-alist-styles "~/proj/wiki/blog"
69 "~/personal-site/site/blog"
74 :force-publish
("WikiIndex")
75 :default
"WelcomePage")
77 :path
"~/personal-site/site/notes")
79 :path
"~/personal-site/site/notes"))
84 :major-mode planner-mode
85 :visit-link planner-visit-link
)
86 (:base
"planner-xhtml"
87 :path
"~/proj/notmine/planner-out"))
91 (setq muse-wiki-interwiki-alist
92 '(("PlugWiki" .
"http://plug.student-orgs.purdue.edu/plugwiki/")
93 ("TheEmacsWiki" .
"http://www.emacswiki.org/cgi-bin/wiki/")
94 ("ArchWiki" .
"http://wiki.gnuarch.org/")
96 ("CERIAS" .
"http://www.cerias.purdue.edu/")
97 ("PLUG" .
"http://plug.student-orgs.purdue.edu/plugwiki/")))
101 ;; Turn relative links into absolute ones
102 (defun my-muse-pdf-make-links-absolute (str &rest ignored
)
103 "Make relative links absolute."
106 (if (string-match "\\`[/.]+" str
)
107 (replace-match "http://www.mwolson.org/" nil t str
)
110 ;; Make sure my interproject links become absolute when published in
112 (defun my-muse-pdf-prepare-buffer ()
113 (set (make-local-variable 'muse-publish-url-transforms
)
114 (cons 'my-muse-pdf-make-links-absolute muse-publish-url-transforms
)))
116 ;; Switch to the given project and prompt for a file
117 (defun my-muse-project-find-file (project)
119 (let ((muse-current-project (muse-project project
)))
120 (call-interactively 'muse-project-find-file
)))
122 ;; Make the current file display correctly in Xanga
124 (defun my-muse-blosxom-finalize (file output-path target
)
125 ;; (my-muse-prepare-entry-for-xanga output-path)
126 ;; For now, do nothing.
129 ;; I call this using C-c p x now.
131 (defun my-muse-prepare-entry-for-xanga (file)
132 "Mangle FILE so that Xanga doesn't bug out, saving to X clipboard.
134 If FILE is not specified, use the published version of the current file."
137 (expand-file-name (concat (muse-page-name) muse-blosxom-extension
)
139 :path
(car (muse-project-applicable-styles
141 (cddr (muse-project-of-file))))))))
143 (muse-with-temp-buffer
144 (insert-file-contents file
)
145 ;; Surround first line in <h3></h3>
146 (goto-char (point-min))
150 ;; Treat example regions properly
152 (while (re-search-forward "<pre[^>]*>" nil t
)
153 (setq beg
(match-end 0))
154 (setq end
(if (re-search-forward "</pre>" nil
1)
158 (narrow-to-region beg end
)
159 ;; Change spaces to
160 (goto-char (point-min))
161 (while (re-search-forward "^ +" nil t
)
162 (replace-match (apply 'concat
(make-list
163 (length (match-string 0))
165 ;; Change newline to <br />
166 (goto-char (point-min))
167 (while (re-search-forward "\n" nil t
)
168 (replace-match "<br />")))))
169 ;; Get rid of 2 spaces together and merge lines
170 (goto-char (point-min))
171 (while (re-search-forward (concat "["
175 ;; Remove trailing space
176 (goto-char (point-min))
177 (while (re-search-forward " *</p> *" nil t
)
178 (replace-match "</p>"))
179 ;; Make relative links work
180 (goto-char (point-min))
181 (while (re-search-forward "href=\"[/.]+" nil t
)
182 (replace-match "href=\"http://www.mwolson.org/" nil t
))
183 ;; Copy entry to clipboard
184 (clipboard-kill-ring-save (point-min) (point-max)))))
186 ;;; Key customizations
188 (global-set-key "\C-cpl" 'muse-blosxom-new-entry
)
189 (global-set-key "\C-cpL" #'(lambda () (interactive)
190 (my-muse-project-find-file "Blog")))
191 (global-set-key "\C-cpn" #'(lambda () (interactive)
192 (my-muse-project-find-file "MyNotes")))
193 (global-set-key "\C-cpp" #'(lambda () (interactive)
194 (my-muse-project-find-file "Plans")))
195 (global-set-key "\C-cpr" #'(lambda () (interactive)
196 (my-muse-project-find-file "Projects")))
197 (global-set-key "\C-cpw" #'(lambda () (interactive)
198 (my-muse-project-find-file "Website")))
199 (global-set-key "\C-cpx" 'my-muse-prepare-entry-for-xanga
)
203 (custom-set-variables
204 '(muse-blosxom-base-directory "~/proj/wiki/blog/")
205 '(muse-colors-autogen-headings (quote outline
))
206 '(muse-file-extension "muse")
207 '(muse-html-charset-default "utf-8")
208 '(muse-html-encoding-default (quote utf-8
))
209 '(muse-html-meta-content-encoding (quote utf-8
))
210 '(muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/common.css\" />
211 <link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"screen\" href=\"/screen.css\" />
212 <link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"print\" href=\"/print.css\" />")
213 '(muse-latex-header "~/personal-site/muse/header.tex")
214 '(muse-mode-auto-p nil nil
(muse-project))
215 '(muse-mode-highlight-p t nil
(muse-colors))
216 '(muse-mode-hook (quote (footnote-mode muse-wiki-update-custom-values
)))
217 '(muse-publish-desc-transforms (quote (muse-wiki-publish-pretty-title muse-wiki-publish-pretty-interwiki muse-publish-escape-specials-in-string
)))
218 '(muse-wiki-publish-small-title-words (quote ("the" "and" "at" "on" "of" "for" "in" "an" "a" "page" "anime")))
219 '(muse-xhtml-footer "~/personal-site/muse/generic-footer.html")
220 '(muse-xhtml-header "~/personal-site/muse/generic-header.html"))
222 '(muse-bad-link-face ((t (:foreground
"DeepPink" :underline
"DeepPink" :weight bold
))))
223 '(muse-link-face ((t (:foreground
"blue" :underline
"blue" :weight bold
)))))
225 ;;; muse-init.el ends here