emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Todd Neal <tolchz@tolchz.net>
To: emacs-orgmode@gnu.org
Subject: Re: cannot store link to an info ode?
Date: Sat, 20 May 2006 23:31:57 -0400	[thread overview]
Message-ID: <877j4g59zm.fsf@tolchz.net> (raw)
In-Reply-To: 17519.52802.196530.790504@localhost.localdomain

[-- 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

  reply	other threads:[~2006-05-21  3:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-21  2:19 cannot store link to an info ode? T. V. Raman
2006-05-21  3:31 ` Todd Neal [this message]
2006-05-21  4:30   ` T. V. Raman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877j4g59zm.fsf@tolchz.net \
    --to=tolchz@tolchz.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).