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/mwolson/lisp"))
16 (require 'outline
) ; I like outline-style faces
17 (require 'muse
) ; load generic module
18 (require 'muse-colors
) ; load coloring/font-lock module
19 (require 'muse-mode
) ; load authoring mode
20 (require 'muse-blosxom
) ; load blosxom module
21 (require 'muse-html
) ; load (X)HTML publishing style
22 (require 'muse-wiki
) ; load Wiki support
23 ;;(require 'muse-message) ; load message support (experimental)
27 ;; Here is an example of making a customized version of your favorite
28 ;; publisher. All this does is run `my-muse-blosoxm-finalize' on the
29 ;; published file immediately after saving it.
31 (unless (assoc "my-blosxom" muse-publishing-styles
)
32 (muse-derive-style "my-blosxom" "blosxom-xhtml"
33 :final
'my-muse-blosxom-finalize
)
35 (muse-derive-style "my-xhtml" "xhtml"
36 :header
"~/personal-site/muse/header.html"
37 :footer
"~/personal-site/muse/footer.html"))
39 ;; Here is my master project listing.
41 ;; Note that I not do anything useful with the ProjectsWiki and
42 ;; WebWiki projects; only the BlogWiki project is published.
44 (setq muse-project-alist
47 ("~/proj/wiki/web/" :default
"WelcomePage")
49 :path
"~/personal-site/site/web"))
52 ("~/proj/wiki/projects/" :default
"WelcomePage")
54 :path
"~/personal-site/site/projects"))
57 (,@(muse-blosxom-project-alist-dirs "~/proj/wiki/blog")
60 ,@(muse-blosxom-project-alist-entry "~/proj/wiki/blog"
61 "~/personal-site/site/blog"
67 :major-mode planner-mode
68 :visit-link planner-visit-link
)
71 :path
"~/proj/notmine/planner-out"))
75 (setq muse-wiki-interwiki-alist
76 '(("PlugWiki" .
"http://plug.student-orgs.purdue.edu/plugwiki/")
77 ("TheEmacsWiki" .
"http://www.emacswiki.org/cgi-bin/wiki/")
78 ("ArchWiki" .
"http://wiki.gnuarch.org/")
82 (or tag
"WelcomePage"))))
85 (concat "../projects/"
86 (or tag
"WelcomePage"))))))
90 ;; Make the current file display correctly in Xanga
92 (defun my-muse-blosxom-finalize (file output-path target
)
93 ;; (my-muse-prepare-entry-for-xanga output-path)
94 ;; For now, do nothing.
97 ;; I call this using C-c p x now.
99 (defun my-muse-prepare-entry-for-xanga (file)
100 "Mangle FILE so that Xanga doesn't bug out, saving to X clipboard.
102 If FILE is not specified, use the published version of the current file."
105 (expand-file-name (concat (muse-page-name) ".txt")
107 :path
(car (muse-project-applicable-styles
109 (cddr (muse-project-of-file))))))))
112 (insert-file-contents file t
)
113 ;; Surround first line in <h3></h3>
114 (goto-char (point-min))
118 ;; Treat example regions properly
120 (while (re-search-forward "<pre[^>]*>" nil t
)
121 (setq beg
(match-end 0))
122 (setq end
(if (re-search-forward "</pre>" nil
1)
126 (narrow-to-region beg end
)
127 ;; Change spaces to
128 (goto-char (point-min))
129 (while (re-search-forward "^ +" nil t
)
130 (replace-match (apply 'concat
(make-list
131 (length (match-string 0))
133 ;; Change newline to <br />
134 (goto-char (point-min))
135 (while (re-search-forward "\n" nil t
)
136 (replace-match "<br />")))))
137 ;; Get rid of 2 spaces together and merge lines
138 (goto-char (point-min))
139 (while (re-search-forward (concat "["
143 ;; Remove trailing space
144 (goto-char (point-min))
145 (while (re-search-forward " *</p> *" nil t
)
146 (replace-match "</p>"))
147 ;; Make relative links work
148 (goto-char (point-min))
149 (while (re-search-forward "href=\"/" nil t
)
150 (replace-match "href=\"http://www.mwolson.org/" nil t
))
151 ;; Copy entry to clipboard
152 (clipboard-kill-ring-save (point-min) (point-max))
153 ;; Don't prompt me about killing the buffer
154 (set-buffer-modified-p nil
))))
156 ;;; Key customizations
158 (global-set-key "\C-cpl" 'muse-blosxom-new-entry
)
159 (global-set-key "\C-cpL"
162 (find-file muse-blosxom-base-directory
)))
163 (global-set-key "\C-cpx" 'my-muse-prepare-entry-for-xanga
)
167 (custom-set-variables
168 '(muse-blosxom-base-directory "~/proj/wiki/blog/")
169 '(muse-blosxom-publishing-directory "~/personal-site/site/blog")
170 '(muse-colors-autogen-headings (quote outline
))
171 '(muse-file-extension "muse")
172 '(muse-html-charset-default "utf-8")
173 '(muse-html-encoding-default (quote utf-8
))
174 '(muse-html-meta-content-encoding (quote utf-8
))
175 '(muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/common.css\" />
176 <link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"screen\" href=\"/screen.css\" />
177 <link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"print\" href=\"/print.css\" />")
178 '(muse-xhtml-footer "~/personal-site/muse/generic-footer.html")
179 '(muse-xhtml-header "~/personal-site/muse/generic-header.html"))
181 '(muse-bad-link-face ((t (:foreground
"DeepPink" :underline
"DeepPink" :weight bold
))))
182 '(muse-link-face ((t (:foreground
"blue" :underline
"blue" :weight bold
)))))
184 ;;; muse-init.el ends here