* Re: cannot store link to an info ode?
2006-05-21 2:19 cannot store link to an info ode? T. V. Raman
@ 2006-05-21 3:31 ` Todd Neal
2006-05-21 4:30 ` T. V. Raman
0 siblings, 1 reply; 3+ messages in thread
From: Todd Neal @ 2006-05-21 3:31 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
"T. V. Raman" <raman@users.sf.net> writes:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Adds an info: link to org-mode --]
[-- Type: text/x-patch, Size: 1820 bytes --]
--- ../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
[-- Attachment #3: Type: text/plain, Size: 299 bytes --]
> 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
[-- Attachment #4: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 3+ messages in thread