[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode 4d2047666f 04/22: Remove old latexsub implement
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode 4d2047666f 04/22: Remove old latexsub implementation |
Date: |
Thu, 4 May 2023 11:00:51 -0400 (EDT) |
branch: elpa/julia-mode
commit 4d2047666fea43e053ead0c5501781b08520bd98
Author: Adam Beckmeyer <adam_gpg@thebeckmeyers.xyz>
Commit: Adam Beckmeyer <adam_gpg@thebeckmeyers.xyz>
Remove old latexsub implementation
---
julia-mode-tests.el | 44 +++++++++++++++++++++++++++++++++-----------
julia-mode.el | 30 +-----------------------------
2 files changed, 34 insertions(+), 40 deletions(-)
diff --git a/julia-mode-tests.el b/julia-mode-tests.el
index 72314a6dc4..ba4b488566 100644
--- a/julia-mode-tests.el
+++ b/julia-mode-tests.el
@@ -880,25 +880,47 @@ return fact(x)
end" 'end-of-defun "n == 0" "return fact(x)[ \n]+end" 'end 2))
;;;
-;;; substitution tests
+;;; latex completion tests
;;;
-(defun julia--substitute (contents position)
- "Call LaTeX subsitution in a buffer with `contents' at point
-`position', and return the resulting buffer."
+(defun julia--find-latex (contents position)
+ "Find bounds of LaTeX symbol in CONTENTS with point at POSITION."
(with-temp-buffer
(julia-mode)
(insert contents)
(goto-char position)
- (julia-latexsub)
+ (cons (julia-mode--latexsub-start-symbol)
(julia-mode--latexsub-end-symbol))))
+
+(ert-deftest julia--test-find-latex ()
+ (should (equal (julia--find-latex "\\alpha " 7) (cons 1 7)))
+ (should (equal (julia--find-latex "\\alpha " 3) (cons 1 7)))
+ (should (equal (julia--find-latex "x\\alpha " 8) (cons 2 8)))
+ (should (equal (julia--find-latex "x\\alpha " 3) (cons 2 8)))
+ ;; There is no valid substitution for \alpha(, but there could
+ ;; be. julia-mode-latexsub-completion-at-point-before will still
+ ;; give correct completion in this situation.
+ (should (equal (julia--find-latex "\\kappa\\alpha(" 13) (cons 7 14)))
+ (should (equal (julia--find-latex "\\kappa\\alpha(" 4) (cons 1 7))))
+
+;;;
+;;; abbrev tests
+;;;
+
+(defun julia--abbrev (contents position)
+ "Call `expand-abbrev' in buffer with CONTENTS at POSITION."
+ (with-temp-buffer
+ (julia-mode)
+ (abbrev-mode)
+ (insert contents)
+ (goto-char position)
+ (expand-abbrev)
(buffer-string)))
-(ert-deftest julia--test-substitutions ()
- (should (equal (julia--substitute "\\alpha " 7) "α "))
- (should (equal (julia--substitute "x\\alpha " 8) "xα "))
- (should (equal (julia--substitute "\\kappa\\alpha(" 13) "\\kappaα("))
- (should (equal (julia--substitute "\\alpha" 7) "α"))
- ; (should (equal (julia--substitute "\\alpha" 6) "α")) ; BROKEN
+(ert-deftest julia--test-latex-abbrev ()
+ (should (equal (julia--abbrev "\\alpha " 7) "α "))
+ (should (equal (julia--abbrev "x\\alpha " 8) "xα "))
+ (should (equal (julia--abbrev "\\kappa\\alpha(" 13) "\\kappaα("))
+ ; (should (equal (julia--abbrev "\\alpha(" 6) "α")) ; BROKEN
)
;;; syntax-propertize-function tests
diff --git a/julia-mode.el b/julia-mode.el
index 21efc27913..c367e5cada 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -786,31 +786,6 @@ strings."
(define-key julia-mode-map (kbd "<backtab>") 'julia-manual-deindent)
;; (See Julia issue #8947 for why we don't use the Emacs tex input mode.)
-(defun julia-latexsub ()
- "Perform a LaTeX-like Unicode symbol substitution."
- (interactive "*i")
- (let ((orig-pt (point)))
- (while (not (or (bobp) (= ?\\ (char-before))
- (= ?\s (char-syntax (char-before)))))
- (backward-char))
- (if (and (not (bobp)) (= ?\\ (char-before)))
- (progn
- (backward-char)
- (let ((sub (gethash (buffer-substring (point) orig-pt)
julia-mode-latexsubs)))
- (if sub
- (progn
- (delete-region (point) orig-pt)
- (insert sub))
- (goto-char orig-pt))))
- (goto-char orig-pt))))
-
-(defun julia-latexsub-or-indent (arg)
- "Either indent according to mode or perform a LaTeX-like symbol substution"
- (interactive "*i")
- (if (julia-latexsub)
- (indent-for-tab-command arg)))
-(define-key julia-mode-map (kbd "TAB") 'julia-latexsub-or-indent)
-
(defun julia-mode--latexsub-start-symbol ()
"Determine the start location for LaTeX-like symbol at point.
If there is not a LaTeX-like symbol at point, return nil."
@@ -898,10 +873,7 @@ following commands are defined:
"Regexp for matching `inferior-julia' prompt.")
(defvar inferior-julia-mode-map
- (let ((map2 (nconc (make-sparse-keymap) comint-mode-map)))
- ;; example definition
- (define-key map2 (kbd "TAB") 'julia-latexsub-or-indent)
- map2)
+ (nconc (make-sparse-keymap) comint-mode-map)
"Basic mode map for `inferior-julia-mode'.")
;;;###autoload
- [nongnu] elpa/julia-mode updated (a20367f282 -> 7e301f4414), ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 8078bb9d88 01/22: Add completion-at-point functions for completing LaTeX strings, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 307b4afa9a 03/22: Create julia-mode-abbrev-table filled with latexsub abbrevs, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode d52cb3e885 10/22: Provide alternative to indent-for-tab-command for use with company, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 77ff4f1146 15/22: comment code, fix docstring width, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode d684bf172a 17/22: further byte compilation docstring warning fixes, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 759e8a8e57 18/22: Merge branch 'master' into tp/find-latexsub-end, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode c87949315f 02/22: Remove hack for indentation in strings, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 4d2047666f 04/22: Remove old latexsub implementation,
ELPA Syncer <=
- [nongnu] elpa/julia-mode 0160fecf90 05/22: Override TAB to do completion in julia-mode buffers, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode f92227a87f 09/22: Fix whitespace, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode f359fd01c5 12/22: Add predicate to "around" latex symbol completion, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 347c5c11c5 14/22: cleanup tests, bit more verbose to compare matched string, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 74e13dc460 16/22: use cl-flet, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 15326d6992 08/22: Remove extraneous -mode suffix from julia-- functions, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 016721004c 19/22: Merge pull request #185 from JuliaEditorSupport/tp/find-latexsub-end, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 8f3afcb99e 21/22: ignore warnings on snaphot, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode f854352d76 11/22: Fix byte-compilation warnings for company-integration code, ELPA Syncer, 2023/05/04
- [nongnu] elpa/julia-mode 7e301f4414 22/22: Merge pull request #186 from tpapp/tp/remove-emacs-25, ELPA Syncer, 2023/05/04