[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1ab4b8e 29/34: Allow nil in sub/super-script prefix custom
From: |
Vitalie Spinu |
Subject: |
[elpa] master 1ab4b8e 29/34: Allow nil in sub/super-script prefix customization |
Date: |
Tue, 7 May 2019 16:05:32 -0400 (EDT) |
branch: master
commit 1ab4b8e582450a1b1780e69c823d63c4622b8a1e
Author: Vitalie Spinu <address@hidden>
Commit: Vitalie Spinu <address@hidden>
Allow nil in sub/super-script prefix customization
---
company-math.el | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
diff --git a/company-math.el b/company-math.el
index 7f352e9..b18c7fe 100644
--- a/company-math.el
+++ b/company-math.el
@@ -45,18 +45,24 @@
:type 'string)
(defcustom company-math-subscript-prefix "__"
- "Prefix to use for unicode subscripts.
-It will also work after `company-math-symbol-prefix'.
-This variable will take effect in a new Emacs session."
+ "Prefix for unicode subscripts.
+When nil, no custom prefix is active. Irrespective of the value
+of this variable, prefix composed of `company-math-symbol-prefix'
+and \"_\" is always active (\"\\_\"). This variable takes effect
+in a new Emacs session."
:group 'company-math
- :type 'string)
+ :type '(choice (const :tag "No Custom Prefix" nil)
+ string))
(defcustom company-math-superscript-prefix "^^"
- "Prefix to use for unicode subscripts.
-It will also work after `company-math-symbol-prefix'.
-This variable will take effect in a new Emacs session."
+ "Prefix for unicode superscripts.
+When nil, no custom prefix is active. Irrespective of the value
+of this variable, prefix composed of `company-math-symbol-prefix'
+and \"^\" is always active (\"\\^\"). This variable takes effect
+in a new Emacs session."
:group 'company-math
- :type 'string)
+ :type '(choice (const :tag "No Custom Prefix" nil)
+ string))
;; no more custom since since v.1.2
(when (boundp 'company-math-prefix-regexp)
@@ -67,10 +73,12 @@ This variable will take effect in a new Emacs session."
"[^ \t\n]+"))
(let ((psym (regexp-quote company-math-symbol-prefix))
- (psub (regexp-quote company-math-subscript-prefix))
- (psup (regexp-quote company-math-superscript-prefix)))
- (defvar company-math--unicode-prefix-regexp
- (concat "\\(" psym "\\|" psub "\\|" psup "\\)[^ \t\n]*")))
+ (psub (when company-math-symbol-prefix
+ (concat "\\|" (regexp-quote company-math-subscript-prefix))))
+ (psup (when company-math-superscript-prefix
+ (concat "\\|" (regexp-quote company-math-superscript-prefix)))))
+ (setq company-math--unicode-prefix-regexp
+ (concat "\\(" psym psub psup "\\)[^ \t\n]*")))
(defcustom company-math-allow-unicode-symbols-in-faces t
"List of faces to allow the insertion of Unicode symbols.
@@ -127,9 +135,11 @@ property :symbol being the corresponding unicode symbol."
(defconst company-math--unicode
(append
- (append (company-math--make-candidates math-symbol-list-subscripts
company-math-subscript-prefix)
+ (append (when company-math-subscript-prefix
+ (company-math--make-candidates math-symbol-list-subscripts
company-math-subscript-prefix))
(company-math--make-candidates math-symbol-list-subscripts (concat
company-math-symbol-prefix "_"))
- (company-math--make-candidates math-symbol-list-superscripts
company-math-superscript-prefix)
+ (when company-math-superscript-prefix
+ (company-math--make-candidates math-symbol-list-superscripts
company-math-superscript-prefix))
(company-math--make-candidates math-symbol-list-superscripts
(concat company-math-symbol-prefix "^")))
company-math--symbols)
"List of math completion candidates for unicode backend.")
- [elpa] master 3c906cd 15/34: Always offer completions (workaround for company issue #476), (continued)
- [elpa] master 3c906cd 15/34: Always offer completions (workaround for company issue #476), Vitalie Spinu, 2019/05/07
- [elpa] master d0db15e 13/34: [Fix #6] Add `tex-math` to `company-math-allow-latex-symbols-in-faces`, Vitalie Spinu, 2019/05/07
- [elpa] master 26bf67b 34/34: [company-math] Merge from upstream, Vitalie Spinu, 2019/05/07
- [elpa] master a8a98e3 24/34: [Fix #11] Don't require at least one character in prefix regexp, Vitalie Spinu, 2019/05/07
- [elpa] master ce46d91 16/34: Merge pull request #7 from cpitclaudel/always-offer-completions, Vitalie Spinu, 2019/05/07
- [elpa] master 2cb03c4 23/34: Version 1.2, Vitalie Spinu, 2019/05/07
- [elpa] master 0263e9c 27/34: [Fix #12] Make default sub/super-script prefix __ and ^^, Vitalie Spinu, 2019/05/07
- [elpa] master 3481f03 32/34: Merge pull request #15 from Kaligule/patch-1, Vitalie Spinu, 2019/05/07
- [elpa] master e89ddb2 31/34: Enable latex backend in org-mode per default, Vitalie Spinu, 2019/05/07
- [elpa] master 6ffd24c 22/34: Implement unicode sub(super)scripting, Vitalie Spinu, 2019/05/07
- [elpa] master 1ab4b8e 29/34: Allow nil in sub/super-script prefix customization,
Vitalie Spinu <=
- [elpa] master 982c4ef 28/34: Readme, Vitalie Spinu, 2019/05/07
- [elpa] master 92b9968 33/34: Fix checkdoc, Vitalie Spinu, 2019/05/07
- [elpa] master b585117 11/34: Edit before ELPA merge, Vitalie Spinu, 2019/05/07
- [elpa] master 6c08f80 09/34: Fix custom interface, Vitalie Spinu, 2019/05/07
- [elpa] master 2e24a08 18/34: Version 1.1, Vitalie Spinu, 2019/05/07
- [elpa] master 0815c9e 19/34: Readme fixes, Vitalie Spinu, 2019/05/07
- [elpa] master 21ac1c7 14/34: Update readme as per TeX-mode-hook problem, Vitalie Spinu, 2019/05/07
- [elpa] master 0d9d2ba 26/34: Don't search for prefix through string boundary, Vitalie Spinu, 2019/05/07
- [elpa] master 34b4b52 25/34: Typo, Vitalie Spinu, 2019/05/07
- [elpa] master 7e7f8c7 30/34: Version 1.3, Vitalie Spinu, 2019/05/07