emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 1a9c542 2/4: [org-translate] New command ogt-term-display-


From: Eric Abrahamsen
Subject: [elpa] master 1a9c542 2/4: [org-translate] New command ogt-term-display-translations
Date: Fri, 16 Oct 2020 01:36:21 -0400 (EDT)

branch: master
commit 1a9c542f4c6e8d06b8e69466e99735cb6676fe4b
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    [org-translate] New command ogt-term-display-translations
    
    *
    packages/org-translate/org-translate.el (ogt-term-display-translations):
    Bound in the translation link keymap, for echoing the original and
    translation of the term link under point.
---
 packages/org-translate/org-translate.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/packages/org-translate/org-translate.el 
b/packages/org-translate/org-translate.el
index 66c9bca..0b908c1 100644
--- a/packages/org-translate/org-translate.el
+++ b/packages/org-translate/org-translate.el
@@ -293,6 +293,7 @@ fragilely, and deleted and re-set with abandon.")
 (defvar ogt-link-keymap
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "o") #'ogt-term-occur)
+    (define-key map (kbd "d") #'ogt-term-display-translations)
     map)
   "Keymap active on \"trans:\" type Org links.")
 
@@ -422,6 +423,19 @@ terms."
     ;; correctly in the sparse tree context.
     (occur (concat "trans:" id))))
 
+(defun ogt-term-display-translations ()
+  "Display original and translations for link under point."
+  (interactive)
+  (let ((bits (gethash
+              (org-element-property :path (org-element-context))
+              ogt-glossary-table)))
+    (message
+     (format
+      (concat
+       (mapconcat #'identity (alist-get 'source bits) ", ")
+       " : "
+       (mapconcat #'identity (alist-get 'translation bits) ", "))))))
+
 (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]