From 2f9af9636c115994919afe674c8ff26a733ca4b2 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Tue, 23 Aug 2022 10:09:26 +0200 Subject: [PATCH] Move org-man to the bottom of the file --- .../software/emacs/emacs.d/lib/org_mode.el | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/home-manager/software/emacs/emacs.d/lib/org_mode.el b/home-manager/software/emacs/emacs.d/lib/org_mode.el index abcd834..54481db 100644 --- a/home-manager/software/emacs/emacs.d/lib/org_mode.el +++ b/home-manager/software/emacs/emacs.d/lib/org_mode.el @@ -11,46 +11,6 @@ :ensure t :after org) -(when (is-linux-p) -;;; org-man.el - Support for links to manpages in Org - - (org-add-link-type "man" 'org-man-open) - (add-hook 'org-store-link-functions 'org-man-store-link) - - (defcustom org-man-command 'man - "The Emacs command to be used to display a man page." - :group 'org-link - :type '(choice (const man) (const woman))) - - (defun org-man-open (path) - "Visit the manpage on PATH. - PATH should be a topic that can be thrown at the man command." - (funcall org-man-command path)) - - (defun org-man-store-link () - "Store a link to a manpage." - (when (memq major-mode '(Man-mode woman-mode)) - ;; This is a man page, we do make this link - (let* ((page (org-man-get-page-name)) - (link (concat "man:" page)) - (description (format "Manpage for %s" page))) - (org-store-link-props - :type "man" - :link link - :description description)))) - - (defun org-man-get-page-name () - "Extract the page name from the buffer name." - ;; This works for both `Man-mode' and `woman-mode'. - (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) - (match-string 1 (buffer-name)) - (error "Cannot create link to this man page"))) - - (provide 'org-man) - -;;; org-man.el ends here - (require 'org-man)) - (use-package org-ref :ensure t :after org @@ -464,3 +424,44 @@ ;; Calender should start on Monday (setq calendar-week-start-day 1) + +;; enable org-man +(when (is-linux-p) +;;; org-man.el - Support for links to manpages in Org + + (org-add-link-type "man" 'org-man-open) + (add-hook 'org-store-link-functions 'org-man-store-link) + + (defcustom org-man-command 'man + "The Emacs command to be used to display a man page." + :group 'org-link + :type '(choice (const man) (const woman))) + + (defun org-man-open (path) + "Visit the manpage on PATH. + PATH should be a topic that can be thrown at the man command." + (funcall org-man-command path)) + + (defun org-man-store-link () + "Store a link to a manpage." + (when (memq major-mode '(Man-mode woman-mode)) + ;; This is a man page, we do make this link + (let* ((page (org-man-get-page-name)) + (link (concat "man:" page)) + (description (format "Manpage for %s" page))) + (org-store-link-props + :type "man" + :link link + :description description)))) + + (defun org-man-get-page-name () + "Extract the page name from the buffer name." + ;; This works for both `Man-mode' and `woman-mode'. + (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) + (match-string 1 (buffer-name)) + (error "Cannot create link to this man page"))) + + (provide 'org-man) + +;;; org-man.el ends here + (require 'org-man))