Looking back over my old posts, I found I didn’t cover basic muse setup at the time when I did my original muse series.
As I’ve mentioned previously, I generate the html (including the funky syntax highlighting) for my posts and squidoo lenses using muse with htmlize.
You can download muse here and if you are using emacs23 then you need the patched version of htmlize, available here.
The first thing I do with most third party modules, is I add the require lines and the paths I need.
(load "my-vars.el") (defconst *elisp-muse* (concat *elisp-3rd* "/muse-3.12/lisp")) (add-to-list 'load-path *elisp-muse*) (require 'htmlize) (require 'muse-mode) (require 'muse-publish) (require 'muse-html)
my-var.el
contains constants pointing to the top-level directories (I still haven’t got around to putting everything under emacs.d
)
(defconst *elisp-dir* (expand-file-name "~/emacs-files")) (defconst *elisp-3rd* (concat *elisp-dir* "/third-party")) (provide 'my-vars)
I use a couple of minor modes together with muse which are added to muse-mode-hook
. (Note, I’m still using longlines-mode as at work I’m unable to use emacs23 where visual-line-mode
was introduced)
(defun muse-minor-modes () (longlines-mode 1) (flyspell-mode 1) (font-lock-mode 0)) (add-hook 'muse-mode-hook 'muse-minor-modes)
And I like publishing to be activated by a single key.
(defun my-muse-publish () (interactive) (muse-publish-file (buffer-file-name) "html")) (define-key muse-mode-map [f7] 'my-muse-publish)
Just FYI. My configuration (at http://github.com/alexott/emacs-configs/tree/master at rc/emacs-rc-muse.el) for Muse also contains code and project settings which are used to generate my site from muse sources (I also wrote article about this – http://xtalk.msk.su/~ott/en/writings/EmacsMuseMyPage.html)
Hi Alex,
Thanks for the links. For everyone else, his article and accompanying code is a nice, fairly brief example of how to generate an entire (static) website from templates using muse.
My own usage is a bit more limited – generating the html for the posts and I rely on wordpress for the templating.
Hi
I am getting the following error
“An error has occurred while loading `/home/abdullah/.emacs’:
File error: Cannot open load file, htmlize”
I have extracted muse into ~/emacs/third-party/muse-3.12 and added the following lines in my .emacs file.
(defconst *elisp-dir* (expand-file-name “~/emacs”))
(defconst *elisp-3rd* (concat *elisp-dir* “/third-party”))
(defconst *elisp-muse* (concat *elisp-3rd* “/muse-3.12/lisp”))
(add-to-list ‘load-path *elisp-muse*)
(require ‘htmlize)
(require ‘muse-mode)
(require ‘muse-publish)
(require ‘muse-html)
Could you please help me?
If i comment the line (require htmlize) everything else loads fine. I tried M-x muse-mode and it changed to that mode. So my htmlize function is not loading properly. Any idea what the problem is?
Hi Abdullah,
htmlize.el is not included with the muse distribution. Did you download it (from here) and put it in your …/third-party directory? You also may need to add (add-to-list ‘load-path *elisp-3rd*) to your .emacs.
Hi,
Thanks for the help. It works now. I did not download that particular file as I am using emacs22 and I thought that htmlize.el should be downloaded only if you are using emcas23 .