[Top][All Lists]

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

[emacs-wiki-discuss] Re: Adding a new url type to planner mode

From: Sacha Chua
Subject: [emacs-wiki-discuss] Re: Adding a new url type to planner mode
Date: Sat, 29 May 2004 18:35:45 +0800
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Brad Collins <address@hidden> writes:

>   browse-url-default-windows-browser: ShellExecute failed: Access is
>   denied.

Hmmm. The new emacs-wiki support for flexible URLs makes this easier.
=) In the old planner one, you needed to make sure your function
returned a non-nil value.

Try this:

;; Add bxid to the list of URL protocols.
(add-to-list 'emacs-wiki-url-protocols '("bxid" planner-bxid-find nil)))

(defvar planner-bxid-path "d:/bram/" "Local bramble root.")
(defvar planner-bxid-extension ".yml" "Extension for YAML-encoded file.")

(defun planner-bxid-resolve (url)
  "Return the file path to URL."
  ;; Remove the bxid://
  (when (string-match "bxid:/?/?" url)
    (setq url (replace-match "" nil t url)))
  ;; Remove the -
   (concat url planner-bxid-extension)
   (concat planner-bxid-path
            "\\([A-Z0-9]\\)" "\\1/"
            (replace-regexp-in-string "-" "" url)))))

(defun planner-bxid-find (url)
  "If this is a BXID URL, jump to it."
  (find-file (planner-bxid-resolve url)))

> Here is the code for planner-bxid.el.  Please be nice, I'm not much of
> a programmer, and it's amazing this mess works at all:

You might want to use let instead of setqs for local variables. =)

Sacha Chua <address@hidden> - Ateneo CS faculty geekette
interests: emacs, gnu/linux, making computer science education fun
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C

reply via email to

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