summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-05-30 13:37:01 +0800
committerJSDurand <mmemmew@gmail.com>2023-05-30 13:37:01 +0800
commitc4db065b93ff6eda371054bccc93ed485f90dde7 (patch)
treef8aae8bd56ec3c0d4954e615bf0e57aeade42f03
parent010da2d415be8481ce5a43f1ba8dd2ee47abf0d7 (diff)
TeX: add a hiero-processing function
* tex-conf.el (durand-tex-hiero): Send the region to the executable that translates it to the LaTeX commands that produce the corresponding hieroglyphs. This makes it convenient to obtain the correct LaTeX codes to use.
-rw-r--r--tex-conf.el21
1 files changed, 20 insertions, 1 deletions
diff --git a/tex-conf.el b/tex-conf.el
index 89065ea..5245c21 100644
--- a/tex-conf.el
+++ b/tex-conf.el
@@ -320,7 +320,7 @@ The list is in the variable `durand-o-things-list'"
(t
(user-error "Weird associated: %S" associated))))))
-;; Automatic braces
+;;; Automatic braces
(setq TeX-electric-sub-and-superscript t)
@@ -329,5 +329,24 @@ The list is in the variable `durand-o-things-list'"
;; (setq-default TeX-master nil)
+;;; hieroglyphs
+
+(defun durand-tex-hiero ()
+ "Translate the hieroglyph code in the region to proper latex
+ code."
+ (interactive)
+ (let ((text (cond ((use-region-p)
+ (buffer-substring-no-properties
+ (region-beginning)
+ (region-end)))
+ ((buffer-substring-no-properties
+ (point-min) (point-max)))))
+ (temp-buffer (get-buffer-create "*temp*")))
+ (call-process-region
+ text nil "sesh" nil temp-buffer)
+ (with-current-buffer temp-buffer
+ (kill-new (buffer-string)))
+ (kill-buffer temp-buffer)))
+
(provide 'tex-conf)
;;; tex-conf.el ends here