emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] quick hack: muse-protocols.el


From: Brad Collins
Subject: [emacs-wiki-discuss] quick hack: muse-protocols.el
Date: Sun, 14 Aug 2005 16:37:26 +0700
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (windows-nt)

Attatched is a stab at adding url protocols to muse.

 To install this in Muse copy the file into the muse directory and
 make the following changes to in muse-mode.el.:

 change the first two lines in muse-visit-link-default to look like
 this:

  (if (string-match muse-url-regexp link)
      (muse-browse-url link)

 Then add the following lines to `define-derived-mode muse mode'

  (muse-set-sym-and-url-regexp 'muse-url-protocols
                                          muse-url-protocols)

 Finally add (require 'muse-protocols) to the top of the file.

 This should give you a bunch of URLs like google:// , info:// and
 man://

You can now add any of your own protocols as easily as you do with
planner and emacs wiki.

For example for adding a protocol for the site yubnub -- a Web Command
line service to both emacs-wiki and muse you could do the following:

(add-to-list 'emacs-wiki-url-protocols '("yubnub" planner-yubnub-find nil))
(add-to-list 'muse-url-protocols '("yubnub" planner-yubnub-find identity))

(defun planner-yubnub-find (url)
  "If this is a yubnub URL-command, jump to it."
  ;; Remove the yubnub://
  (setq yn-command (replace-regexp-in-string "yubnub://\\(.*\\)" "\\1" url))
  (browse-url (concat "http://yubnub.org/parser/parse?command="; yn-command)))


This was all a very trival process of copying functions from
emacs-wiki and renaming them for muse.  There was no coding involved,
so this can't really be considered a contribution, just a quick hack
in the right direction.

It seems to work okay, but I'm sure it will require a bit more hacking
from people who know more elisp than I do.

This was one of the last things keeping me from moving from emacs-wiki
to muse.  Now I have to figure out how to get muse-planner to work, and
why planner-notes-index is broken....

Enjoy,

b/

Attachment: muse-protocols.el
Description: muse-protocols.el

-- 
Brad Collins <address@hidden>, Bangkok, Thailand


reply via email to

[Prev in Thread] Current Thread [Next in Thread]