org.el (org-store-link, org-open-at-point): New link type "help"

* org.el (org-store-link, org-open-at-point): New link type
"help".
This commit is contained in:
Bastien Guerry 2012-08-11 09:11:55 +02:00
parent 16b2af9fdb
commit 73c1948c15
1 changed files with 17 additions and 0 deletions

View File

@ -8844,6 +8844,13 @@ For file links, arg negates `org-context-in-file-links'."
nil nil nil)))) nil nil nil))))
(org-store-link-props :type "calendar" :date cd))) (org-store-link-props :type "calendar" :date cd)))
((eq major-mode 'help-mode)
(setq link (concat "help:" (save-excursion
(goto-char (point-min))
(looking-at "^[^ ]+")
(match-string 0))))
(org-store-link-props :type "help"))
((eq major-mode 'w3-mode) ((eq major-mode 'w3-mode)
(setq cpltxt (if (and (buffer-name) (setq cpltxt (if (and (buffer-name)
(not (string-match "Untitled" (buffer-name)))) (not (string-match "Untitled" (buffer-name))))
@ -9722,6 +9729,8 @@ application the system uses for this file type."
(setq type "file" path link)) (setq type "file" path link))
((string-match org-link-re-with-space3 link) ((string-match org-link-re-with-space3 link)
(setq type (match-string 1 link) path (match-string 2 link))) (setq type (match-string 1 link) path (match-string 2 link)))
((string-match "^help:+\\(.+\\)" link)
(setq type "help" path (match-string 1 link)))
(t (setq type "thisfile" path link))) (t (setq type "thisfile" path link)))
(throw 'match t))) (throw 'match t)))
@ -9775,6 +9784,14 @@ application the system uses for this file type."
((assoc type org-link-protocols) ((assoc type org-link-protocols)
(funcall (nth 1 (assoc type org-link-protocols)) path)) (funcall (nth 1 (assoc type org-link-protocols)) path))
((equal type "help")
(let ((f-or-v (intern path)))
(cond ((fboundp f-or-v)
(describe-function f-or-v))
((boundp f-or-v)
(describe-variable f-or-v))
(t (error "Not a known function or variable")))))
((equal type "mailto") ((equal type "mailto")
(let ((cmd (car org-link-mailto-program)) (let ((cmd (car org-link-mailto-program))
(args (cdr org-link-mailto-program)) args1 (args (cdr org-link-mailto-program)) args1