From a19dc01ba2c43cd295c7378d92bbdce67d3adcb1 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 22 Apr 2007 22:52:26 +0000 Subject: [PATCH] Fix bug with browsing woman:// links 2007-04-22 Michael Olson * lisp/muse-protocols.el (muse-url-protocols): Remove stray quote character. (muse-protocol-find): Find protocols correctly. Rewrite to use catch/throw. (muse-browse-url): Don't concatenate "\`" here. Together, this fixes a bug with browsing woman:// links. git-archimport-id: mwolson@gnu.org--2006/muse--main--1.0--patch-302 --- ChangeLog | 7 +++++++ lisp/muse-protocols.el | 16 ++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63e9d62..ba5bf23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,13 @@ * IDEAS.muse: Add muse-slides.el to list of things to include before release. + * lisp/muse-protocols.el (muse-url-protocols): Remove stray quote + character. + (muse-protocol-find): Find protocols correctly. Rewrite to use + catch/throw. + (muse-browse-url): Don't concatenate "\`" here. Together, this + fixes a bug with browsing woman:// links. + * lisp/muse-project.el (muse-project-alist-styles): Deal with case where entry-dir has a trailing backslash. (muse-project-publish-file): If a style is malformed, skip it and diff --git a/lisp/muse-protocols.el b/lisp/muse-protocols.el index 16e036e..5913619 100644 --- a/lisp/muse-protocols.el +++ b/lisp/muse-protocols.el @@ -77,7 +77,7 @@ This is autogenerated from `muse-url-protocols'.") (defcustom muse-url-protocols '(("info://" muse-browse-url-info nil) ("man://" muse-browse-url-man nil) - ("woman://" 'muse-browse-url-woman nil) + ("woman://" muse-browse-url-woman nil) ("google://" muse-browse-url-google muse-resolve-url-google) ("http:/?/?" browse-url identity) ("https:/?/?" browse-url identity) @@ -121,14 +121,10 @@ queries." (defun muse-protocol-find (proto list) "Return the first element of LIST whose car matches the regexp PROTO." - (setq list (copy-alist list)) - (let (entry) - (while list - (when (string-match (caar list) proto) - (setq entry (car list) - list nil)) - (setq list (cdr list))) - entry)) + (catch 'found + (dolist (item list) + (when (string-match (concat "\\`" (car item)) proto) + (throw 'found item))))) ;;;###autoload (defun muse-browse-url (url &optional other-window) @@ -142,7 +138,7 @@ If OTHER-WINDOW is non-nil, open in a different window." (when other-window (switch-to-buffer-other-window (current-buffer))) (when (string-match muse-url-regexp url) - (let* ((proto (concat "\\`" (match-string 1 url))) + (let* ((proto (match-string 1 url)) (entry (muse-protocol-find proto muse-url-protocols))) (when entry (funcall (cadr entry) url))))) -- 2.11.4.GIT