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

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

[emacs-wiki-discuss] planner-browse-position-url quick fix


From: Romain Francoise
Subject: [emacs-wiki-discuss] planner-browse-position-url quick fix
Date: Tue, 21 Jun 2005 17:06:00 +0200

Hi,

The new planner-browse-position-url function is nice but unfortunately
in my setup one of the functions in find-file-hook clobbers the match
data, so after the call to find-file match-string returns nil.  This
makes string-to-number signal an error.

I suggest the following to make this function more robust:

--- orig/planner.el
+++ mod/planner.el
@@ -1659,8 +1659,10 @@
 (defun planner-browse-position-url (url)
   "If this is a position URL, jump to it."
   (when (string-match "^pos://\\(.+\\)#\\([0-9]+\\)$" url)
-    (find-file (match-string 1 url))
-    (goto-char (string-to-number (match-string 2 url)))
+    (let ((file (match-string 1 url))
+         (pos (string-to-number (match-string 2 url))))
+      (find-file file)
+      (goto-char pos))
     t))
 
 ;;;###autoload

Cheers,

-- 
Romain Francoise <address@hidden> | Last night the whole of hell
it's a miracle -- http://orebokech.com/ | came down to bathe and dine
                                        | with us.





reply via email to

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