Installing This Wiki

Instructions for Ubuntu Breezy

These instructions are deprecated. Use the muse installation instructions below.

 ; Emacs-Wiki
 ;(add-to-list 'load-path "/home/stefan/emacs-wiki")
 (require 'emacs-wiki)
 ;(require 'emacs-wiki-menu)
 (load "~/.elisp/latex2png.el")
 (require 'emacs-wiki-srctag)
 (require 'emacs-wiki-table)
 ;; Inline LaTeX
 (push '("latex" t t t gs-latex-tag) emacs-wiki-markup-tags)
 (setq gs-latex2png-scale-factor 1.2)
 (browse-url-netscape-program "mozilla-firefox")
 (emacs-wiki-directories (quote ("~/work/phd-wiki")) nil (emacs-wiki))
 (emacs-wiki-file-ignore-regexp "\\`\\(\\.?#.*\\|.*,v\\|.*~\\|\\.\\.?\\|.*\\.bib\\|.*\\.el\\|.*\\.py\\|.*\\.pyc\\|.*\\.css\\|.*\\.xml\\)\\'")
 (emacs-wiki-maintainer "mailto:stefan(by)")
 (emacs-wiki-publishing-directory "~/phd-wiki-web")
 (emacs-wiki-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" href=\"phd.css\" />")

Using muse + planner + ledger

   sudo ./debian/rules binary-indep

after extracting.

--- muse-latex2png.el~  2005-12-13 11:57:21.000000000 +0200
+++ muse-latex2png.el   2005-12-13 13:31:22.000000000 +0200
@@ -62,7 +62,7 @@
 (defun muse-publish-latex-tag (beg end attrs)
   (let ((end-marker (set-marker (make-marker) (1+ end)))
         (pubdir (concat (file-name-directory
-                         muse-publishing-current-output-path)
+                         output-path)
       (narrow-to-region beg end)

;; muse
(require 'muse-mode)
(require 'muse-latex2png)
(require 'muse-html)
(require 'muse-colors)
(require 'muse-wiki)
(require 'muse-backlink)
(setq latex2png-scale-factor 1.2)
(setq muse-colors-evaluate-lisp-tags nil)

;; planner
(require 'planner)
(require 'planner-publish)
(require 'planner-id)
(require 'planner-cyclic)
(require 'planner-deadline)
(require 'planner-multi)
(require 'planner-accomplishments)
(require 'planner-lisp)
(require 'planner-appt)
(require 'planner-bibtex)
(require 'planner-calendar)
(require 'remember-planner)

(setq planner-project "phdplanner")

(global-set-key (kbd "<f9> t") 'planner-create-task-from-buffer)
(global-set-key (kbd "<f9> n") 'remember)
(global-set-key (kbd "<f9> <f9>") 'planner-goto-today)
(global-set-key (kbd "<f9> u") 'planner-update-task)
(global-set-key (kbd "<f9> e") 'planner-edit-task-description)
(global-set-key (kbd "<f9> m") 'planner-copy-or-move-task) ; move to different-date
(global-set-key (kbd "<f9> r") 'planner-replan-task) ; move to different task-page
(global-set-key (kbd "<f9> a") 'planner-create-note-from-task) ; annotate task
(global-set-key (kbd "<f9> f") 'planner-appt-forthcoming-display)

(require 'muse-project)
(setq muse-project-alist
      ("~/work/phd-wiki" :default "WelcomePage")
      (:base "html"
       :path "~/phd-wiki-web"
       :footer "~/work/phd-wiki/footer.html"
       :header "~/work/phd-wiki/header.html"
       :force-publish ("WikiIndex")

          :default "TaskPool"
          :major-mode planner-mode
          :visit-link planner-visit-link)
         (:base "planner-html"
          :path "~/phd-wiki-web/planner"
          :footer "~/work/phd-planner/footer.html"
          :force-publish ("PlannerIndex")

(setq mark-diary-entries-in-calendar t)
(setq planner-id-add-task-id t)
(setq remember-handler-functions '(remember-planner-append))
(setq remember-annotation-functions planner-annotation-functions)
(setq planner-carry-tasks-forward 5)
(setq planner-cyclic-diary-nag nil)
(setq planner-cyclic-diary-file (concat (planner-directory) "/cyclic_tasks"))
(setq planner-appt-task-use-appointments-section-flag t)


and set the following variables according to taste:

 (browse-url-browser-function (quote browse-url-netscape))
 (browse-url-netscape-program "mozilla-firefox")
 (muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" href=\"phd.css\">")
 (planner-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" href=\"../phd.css\">")
 (planner-day-page-template "<calendar arrows=\"t\">

* Tasks

* Schedule

* List of notes


* Notes


The header and footer files look like this:

<?xml version="1.0" encoding="<lisp>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en">
           (let ((current-project
                    (car (muse-project-of-file
               (when current-project
                 (concat current-project " - "))
               (muse-publishing-directive "title")))</lisp></title>
  <link rel="home" href="" />
    (muse-style-element :style-sheet muse-publishing-current-style)

  <script type="text/javascript" src="ASCIIMathML.js"></script>

  <meta name="generator" content="Muse" />
  <meta http-equiv="<lisp>muse-html-meta-http-equiv</lisp>" content="<lisp>muse-html-meta-content-type</lisp>" />

<h1 id="top"><lisp>

<!-- Page published by Emacs Muse begins here -->
<!-- Page published by Muse ends here -->
    <div class="navfoot">
      (when (muse-publishing-directive "related")
          "\n<p><strong>Related:</strong>\n        "
            (lambda (page)
              (concat "<a href=\"../bookmarks/"
                      page "\">" page "</a>"))
              (muse-publishing-directive "related"))
            "\n        ")
          "\n      </p>"))
      <hr />
    <table width="100%">

      "[ <a href=\""
      "\">Front</a> | <a href=\""
      (muse-wiki-resolve-project-page (muse-project))
      "\">" (car (muse-project)) "</a>"
      " | <a href=\""
      (muse-wiki-resolve-project-page (muse-project) "WikiIndex")
      " ]")

      <td align="right">
      <span class="footdate">
      Updated <lisp>(muse-publishing-directive "date")</lisp>


    <table width="100%">
      <td align="right">
      <a href=""
         style="text-decoration: none;">
        <img alt="Emacs Wiki" src="emacswiki.png" border="0" />

      <a href=""
         style="text-decoration: none;">
        <img alt="Made by Emacs Muse" src="muse-made-with.png" border="0" />



    <script type="text/javascript"><!--
        google_ad_client = "pub-6569222127370378";
        google_ad_width = 728;
        google_ad_height = 90;
        google_ad_format = "728x90_as";
        google_ad_type = "text_image";
        google_ad_channel ="4472834990";
        google_color_border = "336699";
        google_color_bg = "FFFFFF";
        google_color_link = "0000FF";
        google_color_url = "008000";
        google_color_text = "000000";
    <script type="text/javascript" src=""></script>

<div style="display: none;"><a href="">sub-sahara africa</a></div>
<a href=""></a>
<!-- <a href="">sahara trip</a> -->
<div style="position: absolute; top: -250px; left: -250px;"><a href="">subrahaman</a></div>
<a href=""><span style="display: none;">sahara trip</span></a>
<a href=""><!-- somewhere in the sahara --></a>
<a href=""><img src="IanKnot_small.png" height="1" width="1" border="0" alt="IanKnot"/></a>
<a href="" style="display: none;">rainbow</a>


For mathematical markup, also place ASCIIMathML.js in the published directory. You may want to edit ASCIIMathML.js to ignore "$" as the start of an equation.


I couldn't find a packaged version of ledger, so I compiled it from source. Python support is broken in the stable release (as of 2005/12/15), so take a deep breath and download the CVS version.

./configure --enable-python --prefix=$HOME CPPFLAGS=-I/usr/include/python2.4
make; make install
This might take a while...

The GNU Info documentation might not show up (in, for example, emacs). Make sure that $HOME/info/dir was created. Set the info-path variable in your ~/.emacs (using setq, or customize-group) to:

(add-to-list 'Info-default-directory-list (expand-file-name "~/info"))
(add-to-list 'Info-default-directory-list (expand-file-name "~/share/info"))

Muse issues

Adding a bibliography and references

pyblio_path = '/usr/share/pybliographer'
database = 'phd.bib'

import sys, types

import os.path
execfile(os.path.join(pyblio_path, ''))

import WikiFormat
output = Autoload.get_by_name('output','wiki')
if output is None:
    print 'Error: cannot load output format "wiki"'

    db = bibopen(database)
except Exception, e:
    print "Error opening %s (%s)" % (database, e)

def display(keys):
         , db, keys, sys.stdout)

def search(keys):
    results = []

    if (type(keys) == types.StringType):
        keys = [k.strip() for k in keys.split(',')]

    for key in keys:
        results += filter(lambda x: x.key == key, db.keys())


def list():
# -*- coding: UTF-8 -*-
# Modified: Stéfan van der Walt, 2004
# Support for Emacs-Wiki
# Copyright (C) 1998-2004 Frederic GOBRY
# Email :
# 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 2 
# 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
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

""" This is a module that codes bibliographies into Emacs-Wiki output """

import sys, string

from Pyblio import Autoload, Utils, Formatter

class WikiFormat (Formatter.Formatter):

    coding = 'HTML'
    def start_group (self, id, key_list = None):
        self.out.write("%s\n" % id)
        if key_list:
            self.length = 0
            for k in key_list:
                if len (k) > self.length:
                    self.length = len (k)
            self.length = 10

        # add [] plus one space
        self.length = self.length + 3

    def end_group (self):

    def start (self, key, entry):
        if key is None: key = self.next_key ()
        = ""
        self.key  = '**[%s]**\n' % key
        extra = self.length - len (self.key)
        if extra > 0:
            self.key = self.key + ' ' * extra
    def write (self, text, style = None):
        if style == 'bold':
   += ('**%s**' % text)
        elif style == 'italic' or style == 'slanted':
   += ('*%s*' % text)
        elif style == 'emph':
   += ('*%s*' % text)
   += text
    def separator (self):
        self.write (" ")
    def end (self): = string.strip (

        #text = Utils.format (, 79, self.length, self.length)
        text =
        self.out.write (self.key.strip() + ' ' + + '\n\n')

Autoload.register('output', 'wiki', WikiFormat)

(defun bib (&optional key)
"Search for an entry in my BiBTeX file using pybliographer"
(if key
    (shell-command-to-string (concat "cd ~/work/phd-wiki ; "
                                     "python -c \"import bib;'" key "')\""))
    (shell-command-to-string (concat "cd ~/work/phd-wiki ; "
                                     "python -c \"import bib; bib.list()\"")))

to your wiki file.

<lisp>(bib "searchterm")</lisp>


<lisp>(bib "firstkey, secondkey")</lisp>

to your wiki file.

Using three-part-links, e.g. project::page#anchor

Jim Ottaway provided the following plugin that enables three part links. Store it in ~/.elisp/thee-part-link.el:

;;; Three part links: project#page#anchor [or project::page#anchor].

(require 'muse-wiki)

;; This is a way of determining whether fontification is happening.
(defvar muse-colors-highlighting-p nil)
(defadvice muse-colors-region (around tpl activate)
  "Notice that fontification is taking place."
  (let ((muse-colors-highlighting-p t))

;; Redefine this to allow non-word characters in the page/anchor:
;; allow anything except [] and any sort of whitespace.
(defun muse-wiki-update-interwiki-regexp (value)
  "Update the value of `muse-wiki-interwiki-regexp' based on VALUE
and `muse-project-alist'."
  (setq muse-wiki-interwiki-regexp
        (concat "\\<\\(" (mapconcat 'car muse-project-alist "\\|")
                (when value (concat "\\|" (mapconcat 'car value "\\|")))
                "\\(?:\\(?:" muse-wiki-interwiki-delimiter
                "\\)\\([^]" muse-regexp-blank "\n[]+\\)\\)?"))
  (muse-configure-highlighting 'muse-colors-markup muse-colors-markup))

(muse-wiki-update-interwiki-regexp muse-wiki-interwiki-alist)

(defun muse-wiki-handle-interwiki (&optional string)
  "If STRING or point has an interwiki link, resolve it and
return the first match.
Match 1 is set to the link.
Match 2 is set to the description."
  (when (if string (string-match muse-wiki-interwiki-regexp string)
          (looking-at muse-wiki-interwiki-regexp))
    (let* ((project (match-string-no-properties 1 string))
           (subst (cdr (assoc project muse-wiki-interwiki-alist)))
           (page (match-string-no-properties  2 string))
           (anchor nil)
      (when (and page (string-match "\\(.+\\)\\(#[^#]+\\)" page))
        (setq anchor (and (not muse-colors-highlighting-p)
                          (match-string 2 page)))
        (setq page (match-string 1 page)))
      (if subst (if (functionp subst)
                    (funcall subst (concat page anchor))
                  (concat subst page anchor))
        (setq path (and (assoc project muse-project-alist)
                        (or page (not muse-wiki-ignore-bare-project-names))
                        (muse-wiki-resolve-project-page project page)))
        (when path
          (if (and muse-publishing-p
                   (string= project
                            (car (muse-project-of-file
              ;; For publishing, when the project in the link is the
              ;; same as current project an extra extension gets added
              ;; later in the publishing process [something to do with
              ;; the path returned here not matching
              ;; muse-file-regexp], so strip the extension here.  This
              ;; is a work-around.
              (concat (file-name-sans-extension path) anchor)
            (concat path anchor)))))))

(provide 'three-part-link)

and include in your .emacs file:

(require 'three-part-link)

sub-sahara africa
sahara trip IanKnot rainbow