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

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

[nongnu] elpa/julia-mode b66f8a4 274/352: Insertion of math symbols in j


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode b66f8a4 274/352: Insertion of math symbols in julia using auctex's mechanism
Date: Sun, 29 Aug 2021 11:23:00 -0400 (EDT)

branch: elpa/julia-mode
commit b66f8a44e9e6bc5e0093d4fd6160646ae5dd2108
Author: Antoine Levitt <antoine.levitt@gmail.com>
Commit: Antoine Levitt <antoine.levitt@gmail.com>

    Insertion of math symbols in julia using auctex's mechanism
---
 julia-mode.el | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/julia-mode.el b/julia-mode.el
index 737e44a..b67316a 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -3194,6 +3194,28 @@ strings."
 (puthash "\\mtteight" "𝟾" julia-latexsubs)
 (puthash "\\mttnine" "𝟿" julia-latexsubs)
 
+;; Math insertion in julia. Use it with
+;; (add-hook 'julia-mode-hook 'julia-math-mode)
+;; (add-hook 'inferior-julia-mode-hook 'julia-math-mode)
+
+(when (require 'latex nil t)
+  (defun julia-math-insert (s)
+    "Inserts math symbol given by `s'"
+    (when s
+      (let ((sym (gethash (concat "\\" s) julia-latexsubs)))
+        (when sym
+          (insert sym)))))
+
+  (define-minor-mode julia-math-mode
+    "A minor mode with easy access to TeX math commands. The
+command is only entered if it is supported in Julia. The
+following commands are defined:
+
+\\{LaTeX-math-mode-map}"
+    nil nil (list (cons (LaTeX-math-abbrev-prefix) LaTeX-math-keymap))
+    (if julia-math-mode
+        (set (make-local-variable 'LaTeX-math-insert-function) 
'julia-math-insert))))
+
 ;; Code for `inferior-julia-mode'
 (require 'comint)
 



reply via email to

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