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)sun.ac.za")
 (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)
                         "/latex/")))
     (save-restriction
       (narrow-to-region beg end)


   
;; muse
(require 'muse-mode)
(require 'muse-latex2png)
(require 'muse-html)
(require 'muse-colors)
(require 'muse-wiki)
(require 'muse-backlink)
(footnote-mode)
(muse-backlink-install)
(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
      '(("phdwiki"
      ("~/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")
       ))

        ("phdplanner"
         ("~/work/phd-planner"
          :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")
          ))
        )
      )


(planner-appt-use-tasks)
(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)


(plan)

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>

* Notes

")

The header and footer files look like this:

<?xml version="1.0" encoding="<lisp>
  (muse-html-encoding)</lisp>"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
  <title><lisp>
           (let ((current-project
                    (car (muse-project-of-file
                            muse-publishing-current-file))))
             (concat
               (when current-project
                 (concat current-project " - "))
               (muse-publishing-directive "title")))</lisp></title>
  <link rel="home" href="http://mentat.za.net" />
  <lisp>
    (muse-style-element :style-sheet muse-publishing-current-style)
  </lisp>

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

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

<body>
<h1 id="top"><lisp>
    (muse-wiki-publish-pretty-title)</lisp></h1>

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

      <lisp>
      (concat
      "[ <a href=\""
      (muse-wiki-resolve-project-page)
      "\">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")
      "\">Index</a>"
      " ]")
      </lisp>
      </td>

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

      <hr/>

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

      <a href="http://www.mwolson.org/projects/EmacsMuse.html"
         style="text-decoration: none;">
        <img alt="Made by Emacs Muse" src="muse-made-with.png" border="0" />
      </a>
      </td>

      </tr>
    </table>

    </div>

    <hr/>
    <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>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

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

  </body>
</html>

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.

Ledger

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.

./acprep
./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
sys.path.append(pyblio_path)

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

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

try:
    db = bibopen(database)
except Exception, e:
    print "Error opening %s (%s)" % (database, e)
    sys.exit(-1)

def display(keys):
    Utils.generate(Fields.URL('pyblio-style-alpha.xml'),
                   output.data, 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())

    display(results)

def list():
    display(db.keys())
# -*- coding: UTF-8 -*-
#
# Modified: Stéfan van der Walt, 2004
# Support for Emacs-Wiki
#
# Copyright (C) 1998-2004 Frederic GOBRY
# Email : gobry@pybliographer.org
#          
# 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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# 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)
        else:
            self.length = 10

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

    def end_group (self):
        self.out.write("\n\n")
        pass

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

        #text = Utils.format (self.data, 79, self.length, self.length)
        text = self.data
        self.out.write (self.key.strip() + ' ' + self.data + '\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; bib.search('" key "')\""))
    (shell-command-to-string (concat "cd ~/work/phd-wiki ; "
                                     "python -c \"import bib; bib.list()\"")))
)
<lisp>(bib)</lisp>

to your wiki file.

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

or

<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))
    ad-do-it))

;; 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)
           path)
      (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
                                  muse-publishing-current-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
subrahaman
sahara trip IanKnot rainbow