[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] muse: possible bug visiting urls with anchors
From: |
Jim Ottaway |
Subject: |
[emacs-wiki-discuss] muse: possible bug visiting urls with anchors |
Date: |
Sun, 20 Nov 2005 11:41:56 +0000 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
I spotted this when using the `pos' url which uses a '#' character to
separate the file-name and the file position, but it applies to any
url that may use such an anchor.
It looks to me that such urls will never be visited correctly: the
link and anchor are split by muse-visit-link before they are used by
muse-visit-link-default, so muse-browse-url will never get the full
url.
Such links work, of course, in planner mode because planner has its
own visit-link function.
On the other hand, I find it surprising that this hasn't been noticed
before, so I at least half suspect that I may have misunderstood
something. Never the less, this patch makes urls with anchors work
for me.
Regards,
Jim Ottaway
--- orig/lisp/muse-mode.el
+++ mod/lisp/muse-mode.el
@@ -302,7 +302,7 @@
t t)
(error "There is no valid link at point")))
-(defun muse-visit-link-default (link &optional other-window anchor)
+(defun muse-visit-link-default (link &optional other-window)
"Visit the URL or link named by LINK.
If ANCHOR is specified, search for it after opening LINK.
@@ -311,7 +311,12 @@
in `muse-project-alist'."
(if (string-match muse-url-regexp link)
(muse-browse-url link)
- (let ((base-buffer (get-buffer link)))
+ (let ((anchor nil)
+ base-buffer)
+ (when (string-match "#" link)
+ (setq anchor (substring link (match-beginning 0))
+ link (substring link 0 (match-beginning 0))))
+ (setq base-buffer (get-buffer link))
(if (and base-buffer (not (buffer-file-name base-buffer)))
;; If file is temporary (no associated file), just switch to
;; the buffer
@@ -325,14 +330,14 @@
'find-file-other-window))
(if other-window
(find-file-other-window link)
- (find-file link))))))
- (if anchor
- (let ((pos (point)))
+ (find-file link)))))
+ (if anchor
+ (let ((pos (point)))
(goto-char (point-min))
(unless (re-search-forward (concat "^\\W*" (regexp-quote anchor)
"\\b")
nil t)
- (goto-char pos))))))
+ (goto-char pos)))))))
(defun muse-visit-link (link &optional other-window)
"Visit the URL or link named by LINK."
@@ -341,10 +346,7 @@
anchor)
(if visit-link-function
(funcall visit-link-function link other-window)
- (if (string-match "#" link)
- (setq anchor (substring link (match-beginning 0))
- link (substring link 0 (match-beginning 0))))
- (muse-visit-link-default link other-window anchor))))
+ (muse-visit-link-default link other-window))))
(defun muse-browse-result (style &optional other-window)
"Visit the current page's published result."
- [emacs-wiki-discuss] muse: possible bug visiting urls with anchors,
Jim Ottaway <=