emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* cannot store link to an info ode?
@ 2006-05-21  2:19 T. V. Raman
  2006-05-21  3:31 ` Todd Neal
  0 siblings, 1 reply; 3+ messages in thread
From: T. V. Raman @ 2006-05-21  2:19 UTC (permalink / raw)
  To: emacs-orgmode

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

      
Email:  raman@users.sf.net
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman 
IRC:    irc://irc.freenode.net/#emacs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 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

* Re: cannot store link to an info ode?
  2006-05-21  3:31 ` Todd Neal
@ 2006-05-21  4:30   ` T. V. Raman
  0 siblings, 0 replies; 3+ messages in thread
From: T. V. Raman @ 2006-05-21  4:30 UTC (permalink / raw)
  To: tolchz; +Cc: emacs-orgmode

Applied your patch, works like a charm!

Thanks, and hope this gets into the next update to org-mode.el

-- 
Best Regards,
--raman

      
Email:  raman@users.sf.net
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman 
IRC:    irc://irc.freenode.net/#emacs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-21  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).