[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-remark ec693af64a 01/16: feat: org-remark-info-mode
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-remark ec693af64a 01/16: feat: org-remark-info-mode to support Info-mode #65 |
Date: |
Sat, 29 Jul 2023 18:58:47 -0400 (EDT) |
branch: externals/org-remark
commit ec693af64a4dd94993365f3802adf6b1e67ad34c
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
feat: org-remark-info-mode to support Info-mode #65
---
org-remark-info.el | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/org-remark-info.el b/org-remark-info.el
new file mode 100644
index 0000000000..1d24a0e8cf
--- /dev/null
+++ b/org-remark-info.el
@@ -0,0 +1,81 @@
+;;; org-remark-info.el --- Support Org-roam with Info-mode -*-
lexical-binding: t; -*-
+
+;; URL: https://github.com/nobiot/org-remark
+;; Created: 16 January 2023
+;; Last modified: 16 July 2023
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ol-info)
+(require 'info)
+(defvar org-remark-prop-source-file)
+
+;;;###autoload
+(define-minor-mode org-remark-info-mode
+ "Enable Org-remark to work with `Info-mode' for Info documentation reader."
+ :global t
+ :group 'org-remark
+ (if org-remark-info-mode
+ ;; Enable
+ (progn
+ (add-hook 'org-remark-source-find-file-name-functions
+ #'org-remark-info-get-node)
+ (add-hook 'org-remark-highlight-link-to-source-functions
+ #'org-remark-info-link))
+ ;; Disable
+ (remove-hook 'org-remark-source-find-file-name-functions
+ #'org-remark-info-get-node)
+ (remove-hook 'org-remark-highlight-link-to-source-functions
+ #'org-remark-info-link)))
+
+(defun org-remark-info-get-node ()
+ "Return the current Info file/node."
+ (when (eq major-mode 'Info-mode)
+ (concat (file-name-nondirectory Info-current-file)
+ "/"
+ Info-current-node)))
+
+(defun org-remark-info-link (_filname _point)
+ "Return \"info:\" link with current point in `Info-mode' buffer.
+
+This function only works when the mode is `Info-mode'.
+
+Assume the point is on the highlight in source Info document
+buffer and `ol-info' is loaded. The latter is necessary for
+`org-store-link' to work wiht Info buffer."
+ (when (eq major-mode 'Info-mode)
+ (org-store-link nil nil)))
+
+(cl-defmethod org-remark-highlight-get-constructors (&context (major-mode
Info-mode))
+ "Construct lists for creating MAJOR-MODE specific hierarchy.
+
+This method is for `Info-mode'.
+
+Return the value in a alist like this:
+
+ (SOURCE-FILENAME-FN TITLE-FN PROP-TO-FIND)"
+ (let* ((headline-1 (list
+ ;; SOURCE-FILENAME-FN
+
+ ;; Don't include the full directory path for Info
+ ;; node. This may change when Emacs version or
+ ;; package version changes.
+ (lambda () (file-name-nondirectory Info-current-file))
+ ;; TITLE-FN
+ (lambda () (file-name-nondirectory Info-current-file))
+ ;; PROP-TO-FIND
+ "org-remark-info-file"))
+ (headline-2 (list
+ ;; SOURCE-FILENAME-FN
+ #'org-remark-info-get-node
+ ;; TITLE-FN
+ (lambda () Info-current-node)
+ ;; PROP-TO-FIND
+ org-remark-prop-source-file))
+ (headline-constructors (list headline-1 headline-2)))
+ headline-constructors))
+
+(provide 'org-remark-info)
+;;; org-remark-info.el ends here
- [elpa] externals/org-remark updated (4c0137d90a -> d73c72cfc3), ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark 430066da54 03/16: fix: headline-add, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark 05d280b5fa 05/16: fix(legacy): compilation warning #66, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark ef14f4e600 02/16: Merge branch 'dev/nov.el' into dev/1.2.0, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark 6333938f12 11/16: feat: Allow function to render icons, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark efe2c4d504 13/16: refactor: logic to add an icon, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark 346fe9cf69 15/16: refactor: separate org-remark-icon into its own feature/file, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark ec693af64a 01/16: feat: org-remark-info-mode to support Info-mode #65,
ELPA Syncer <=
- [elpa] externals/org-remark 87404b78d3 14/16: Merge branch 'main' into dev/1.2.0, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark b44092e6cf 06/16: style: make org-remark-highlight-save obsolete and add alias, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark a0624e2ebc 04/16: fix: make sure new top-level headline is appended, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark c6941579e3 09/16: refactor(nov): nov can defer loading org-remark, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark 6ef0b47bd2 12/16: fix: revert-buffer duplicates highlights, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark c701d9ceaa 07/16: style: silence compiler warning, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark 8ae3c426e0 08/16: fix: default highlighter color for dark theme, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark 0e05580760 10/16: feat(info): Advice to support rendering Info nodes in same buffer, ELPA Syncer, 2023/07/29
- [elpa] externals/org-remark d73c72cfc3 16/16: docs(info): Add copyright and commentary to source header, ELPA Syncer, 2023/07/29