summaryrefslogtreecommitdiff
path: root/contrib/lisp/org-man.el
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/lisp/org-man.el')
-rw-r--r--contrib/lisp/org-man.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/contrib/lisp/org-man.el b/contrib/lisp/org-man.el
index 27e8cca..a9db83d 100644
--- a/contrib/lisp/org-man.el
+++ b/contrib/lisp/org-man.el
@@ -7,27 +7,25 @@
;;
;; This file is not yet part of GNU Emacs.
;;
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
-;; GNU Emacs is distributed in the hope that it will be useful,
+;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
(require 'org)
-(org-add-link-type "man" 'org-man-open)
+(org-add-link-type "man" 'org-man-open 'org-man-export)
(add-hook 'org-store-link-functions 'org-man-store-link)
(defcustom org-man-command 'man
@@ -59,6 +57,17 @@ PATH should be a topic that can be thrown at the man command."
(match-string 1 (buffer-name))
(error "Cannot create link to this man page")))
+(defun org-man-export (link description format)
+ "Export a man page link from Org files."
+ (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
+ (desc (or description link)))
+ (cond
+ ((eq format 'html) (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
+ ((eq format 'latex) (format "\\href{%s}{%s}" path desc))
+ ((eq format 'texinfo) (format "@uref{%s,%s}" path desc))
+ ((eq format 'ascii) (format "%s (%s)" desc path))
+ (t path))))
+
(provide 'org-man)
;;; org-man.el ends here