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

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

[emacs-wiki-discuss] Re: Links on dynamically created pages


From: Marco Gidde
Subject: [emacs-wiki-discuss] Re: Links on dynamically created pages
Date: Thu, 11 Aug 2005 10:09:52 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Michael Olson <address@hidden> writes:

> Marco Gidde <address@hidden> writes:
>
>> So I looked into emacs-wiki.el and modified emacs-wiki-visit-link to
>> suit my needs. Attached is a patch that checks wether the requested
>> buffer already exists and has not an associated buffer-file-name,
>> i.e. it is probably a temporary buffer. If this is the case, just
>> switch to this buffer and search the tag there, otherwise do the
>> usual thing (find-file or find-file-other-window).
>
> Thanks!  I've installed a slightly-modified version of this patch in
> emacs-wiki--main--1.0--patch-123.

Thanks for checking in. Yesterday I played around with muse and the
muse port of planner and the same problem occurred again, so a similar
patch for planner.el in the planner-muse branch is attached.

I wonder whether this feature might be useful for ordinary muse
projects too. But since I don't use such ... :-)


* looking for address@hidden/planner-muse--mwolson--1.0--patch-53 to compare 
with
* comparing to address@hidden/planner-muse--mwolson--1.0--patch-53
M  planner.el

* modified files

--- orig/planner.el
+++ mod/planner.el
@@ -1097,19 +1097,22 @@
   "Visit the URL or link named by LINK-NAME.
 REFRESH-BUFFER is an optional buffer to refresh on saving the visited page.
 This makes the bad link face in the linking buffer go away."
-  (let ((link (planner-link-target link-name))
-        newbuf)
+  (let ((link (planner-link-target link-name)))
     (if (string-match muse-url-regexp link)
         (planner-browse-url link other-window)
       ;; The name list is current since the last time the buffer was
       ;; highlighted
       (let* ((base (planner-link-base link-name))
+             (base-buffer (get-buffer base))
              (file (planner-page-file base t))
              (tag (planner-link-anchor link)))
-        (setq newbuf
-              (funcall
-               (if other-window 'find-file-other-window 'find-file)
-               (if (null file) base file)))
+        (if (and base-buffer (not (buffer-file-name base-buffer)))
+            (funcall
+             (if other-window 'switch-to-buffer-other-window 'switch-to-buffer)
+             base-buffer)
+          (funcall
+           (if other-window 'find-file-other-window 'find-file)
+           (or file base)))
         (when tag
           (goto-char (point-min))
           (re-search-forward (concat "^\\.?#" tag) nil t))))))




reply via email to

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