[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 4bc5aa2: [org-translate] Add keymap for translation links,

From: Eric Abrahamsen
Subject: [elpa] master 4bc5aa2: [org-translate] Add keymap for translation links, plus occur command
Date: Sat, 19 Sep 2020 18:43:14 -0400 (EDT)

branch: master
commit 4bc5aa2ecb1742259997c3a80012129bf959d383
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    [org-translate] Add keymap for translation links, plus occur command
    * packages/org-translate/org-translate.el (ogt-link-keymap): Keymap
    active on trans: type links.
    (ogt-term-occur): Command to show all occurances of a translation
    term in the buffer. Doesn't actually work (doesn't display anything)
    but we'll figure that out.
 packages/org-translate/org-translate.el | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/packages/org-translate/org-translate.el 
index b12bc40..e6ba42f 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -290,10 +290,16 @@ fragilely, and deleted and re-set with abandon.")
 (defvar-local ogt-source-segment-overlay nil
   "Overlay on the current source segment.")
+(defvar ogt-link-keymap
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "o") #'ogt-term-occur)
+    map)
+  "Keymap active on \"trans:\" type Org links.")
  :follow #'ogt-follow-link
- ;; Give it a :keymap!  Very nice.
+ :keymap ogt-link-keymap
  :export #'ogt-export-link)
 (defun ogt-follow-link (link)
@@ -409,6 +415,16 @@ By default, just remove it."
    (string ogt-segmentation-character) "" body-string))
+(defun ogt-term-occur ()
+  "Run `occur' for the glossary term at point.
+Available on \"trans:\" type links that represent glossary
+  (interactive)
+  (let ((id (org-element-property :path (org-element-context))))
+    ;; I thought I should use `org-occur', but that only seems to work
+    ;; correctly in the sparse tree context.
+    (occur (concat "trans:" id))))
 (defun ogt-prettify-segmenters (&optional begin end)
   "Add a display face to all segmentation characters.
 If BEGIN and END are given, prettify segmenters between those

reply via email to

[Prev in Thread] Current Thread [Next in Thread]