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

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

[nongnu] elpa/cdlatex 64c1440441 05/13: No check for math environment ou


From: ELPA Syncer
Subject: [nongnu] elpa/cdlatex 64c1440441 05/13: No check for math environment outside of latex buffers
Date: Sat, 12 Aug 2023 12:59:19 -0400 (EDT)

branch: elpa/cdlatex
commit 64c144044104db622de44effdc68fcb4f58714cb
Author: Carsten Dominik <dominik@Carstens-MacBook-Pro.local>
Commit: Carsten Dominik <dominik@Carstens-MacBook-Pro.local>

    No check for math environment outside of latex buffers
    
    For example, this will make the mode work well in org-mode files.
---
 electricindex.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/electricindex.el b/electricindex.el
index 1b3e512030..51bae80c9e 100644
--- a/electricindex.el
+++ b/electricindex.el
@@ -94,12 +94,11 @@ Here is a list of features: \\<electricindex-mode-map>
 Entering `electricindex-mode' calls the hook electricindex-mode-hook."
   :lighter " EI")
 
-(defalias 'electricindex--texmathp
-  (if (fboundp 'texmathp) #'texmathp
-    ;; FIXME: Maybe we could do better, but why bother: the users who want it
-    ;; can install AUCTeX.  Tho maybe we should move texmathp into its
-    ;; own package so it can be used even when AUCTeX is not
-    ;; installed/activated.
+(defun electricindex-active-here ()
+  (if (eq major-mode 'latex-mode)
+      (if (fboundp 'texmathp)
+          (texmathp)
+        t)
     t))
 
 ;;; ===========================================================================
@@ -108,7 +107,7 @@ Entering `electricindex-mode' calls the hook 
electricindex-mode-hook."
 (defun electricindex-digit ()
   "Insert digit, maybe as an index to a quantity in math environment."
   (interactive)
-  (if (not (electricindex--texmathp))
+  (if (not (electricindex-active-here))
       (self-insert-command 1)
     (let ((digit (char-to-string (event-basic-type last-command-event))))
       (if (looking-back "[a-zA-Z]" (1- (point)))



reply via email to

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