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

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

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


From: Marco Gidde
Subject: [emacs-wiki-discuss] Links on dynamically created pages
Date: Sun, 07 Aug 2005 17:24:48 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Hey,

I use planner exclusively within Emacs (i.e. no publishing) to
organize my programming tasks and thoughts and of course this works
very fine as long as I am the only one who creates tasks. But as I am
an employee and the company I work for uses a professional tool (Lotus
Notes) to manage tasks and bug reports, the question arose how to
integrate their lists into planner. It wasn't too difficult: export
the database as structured text and convert it to a list of tasks and
notes as planner likes it.

Now I didn't want to create a second file besides the export file but
instead use a temporary buffer called *lotus-bugs* or the like with
planner-mode activated. The problem is that planner and emacs-wiki are
really mad about files and note links like
[[*lotus-bugs*#1206][*lotus-bugs*:1206]] on the same page or on
regular plan pages doesn't work since *lotus-bugs* is _not_ a file.

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).

I hope this small patch is useful enough (and doesn't break something
else :-)) to be integrated into the main branch. Anyway, thanks for a
really nice and flexible tool.


Marco



* looking for address@hidden/emacs-wiki--main--1.0--patch-121 to compare with
* comparing to address@hidden/emacs-wiki--main--1.0--patch-121
M  emacs-wiki.el

* modified files

--- orig/emacs-wiki.el
+++ mod/emacs-wiki.el
@@ -1286,6 +1286,7 @@
       ;; The name list is current since the last time the buffer was
       ;; highlighted
       (let* ((base (emacs-wiki-wiki-base link-name))
+            (base-buffer (get-buffer base))
              (file (emacs-wiki-page-file base))
              (tag  (and (not (emacs-wiki-wiki-url-p link))
                         (emacs-wiki-wiki-tag link)))
@@ -1302,13 +1303,17 @@
                     parent-name)))
              (parent-backlink (and parent-allowed-backlink-p
                                    (emacs-wiki-get-current-backlink)))
-             (newbuf (if (null file)
-                         (funcall find-file-function
-                                  (expand-file-name
-                                   base
-                                   (file-name-directory
-                                    (buffer-file-name))))
-                       (funcall find-file-function file)))
+             (newbuf (if (and base-buffer (not (buffer-file-name base-buffer)))
+                        (progn
+                          (setq refresh-buffer nil)
+                          (switch-to-buffer base-buffer))
+                      (if (null file)
+                          (funcall find-file-function
+                                   (expand-file-name
+                                    base
+                                    (file-name-directory
+                                     (buffer-file-name))))
+                        (funcall find-file-function file))))
              (emacs-wiki-create-backlinks
               (and emacs-wiki-create-backlinks parent-allowed-backlink-p))
              (make-link-p (and emacs-wiki-create-backlinks




reply via email to

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