emacs-orgmode
[Top][All Lists]
Advanced

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

[Emacs-orgmode] Re: cannot store link to an info ode?


From: Todd Neal
Subject: [Emacs-orgmode] Re: cannot store link to an info ode?
Date: Sat, 20 May 2006 23:31:57 -0400
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

"T. V. Raman" <address@hidden> writes:

--- ../org.el   2006-05-20 23:28:27.491989152 -0400
+++ org.el      2006-05-20 23:23:37.445082984 -0400
@@ -2666,7 +2666,7 @@
 
 (defconst org-non-link-chars "]\t\n\r<>")
 (defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm"
-                          "wl" "mhe" "rmail" "gnus" "shell"))
+                          "wl" "mhe" "rmail" "gnus" "shell" "info"))
 (defconst org-link-re-with-space 
   (concat
    "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
@@ -7755,6 +7755,9 @@
        ((string= type "bbdb")
        (org-follow-bbdb-link path))
 
+       ((string= type "info")
+       (org-follow-info-link path))
+
        ((string= type "gnus")
        (let (group article)
          (if (not (string-match "\\`\\([^#]+\\)\\(#\\(.*\\)\\)?" path))
@@ -8022,6 +8025,17 @@
        (delete-window (get-buffer-window "*BBDB*"))
        (error "No matching BBDB record")))))
 
+
+(defun org-follow-info-link (name)
+  "Follow an info file & node link  to NAME."
+  (if (or (string-match "\\(.*\\):\\(.*\\)" name)
+          (string-match "\\(.*\\)" name))
+      (progn
+        (if (match-string 2 name) ; If there isn't a node, choose "Top"
+            (Info-find-node (match-string 1 name) (match-string 2 name))
+          (Info-find-node (match-string 1 name) "Top")))
+    (message (concat "Could not open: " name))))
+
 (defun org-follow-gnus-link (&optional group article)
   "Follow a Gnus link to GROUP and ARTICLE."
   (require 'gnus)
@@ -8385,6 +8399,11 @@
                        (bbdb-record-company (bbdb-current-record))))
            link (org-make-link cpltxt)))
 
+     ((eq major-mode 'Info-mode)
+      (setq link (org-make-link "info:" Info-current-file ":" 
Info-current-node))
+      (setq cpltxt (concat (file-name-nondirectory Info-current-file) ":" 
Info-current-node)))
+
+
      ((eq major-mode 'calendar-mode)
       (let ((cd (calendar-cursor-to-date)))
        (setq link
> I was mildly surprized/disappointed when C-c l org-store-link 
> raised an error in an info buffer.
> How about teaching org about info: links?
>
> -- 
> Best Regards,
> --raman


Here is a patch to do this.  I haven't tested it too much and there
may be a better way, but it works for me.

Todd

reply via email to

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