[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 88a7563 81/95: Fix last improvement for skipping
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 88a7563 81/95: Fix last improvement for skipping of inline verbatim macros |
Date: |
Sun, 16 Apr 2017 01:27:01 -0400 (EDT) |
branch: externals/auctex
commit 88a75635097ab45b9136f1732e78bde317ef949c
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Fix last improvement for skipping of inline verbatim macros
* tex.el (TeX-ispell-tex-arg-verb-end): New function.
* tex-ispell.el (TeX-ispell-verb-delimiters): Replace
`TeX-ispell-verb-opening-delimiters' and
`TeX-ispell-verb-closing-delimiters' with new customizable option
`TeX-ispell-verb-delimiters'.
(TeX-ispell-skip-setcar): Use new function
`TeX-ispell-tex-arg-verb-end' with verbatim macros.
---
tex-ispell.el | 43 ++++++++++++++++++++-----------------------
tex.el | 24 ++++++++++++++++++++++++
2 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/tex-ispell.el b/tex-ispell.el
index 0b08f40..e1c5fd1 100644
--- a/tex-ispell.el
+++ b/tex-ispell.el
@@ -72,18 +72,6 @@
(require 'tex)
-(defcustom TeX-ispell-verb-opening-delimiters "{!|#\"*/+-"
- "String with all opening delimiters for verb macros.
-The elements must match `TeX-ispell-verb-closing-delimiters'."
- :group 'TeX-misc
- :type 'string)
-
-(defcustom TeX-ispell-verb-closing-delimiters "}!|#\"*/+-"
- "String with all closing delimiters for verb macros.
-The elements must match `TeX-ispell-verb-opening-delimiters'."
- :group 'TeX-misc
- :type 'string)
-
;; Add new macros here:
(eval-when-compile
(defvar TeX-ispell-skip-cmds-list
@@ -299,17 +287,26 @@ Environments for math or verbatim text are candidates for
this list."))
;; booktabs.sty
("\\\\cmidrule" . "{[-0-9]+}")
;; fontspec.sty
- ("\\\\fontspec" TeX-ispell-tex-arg-end 1 1 0)
- ;; listings.sty & fancyvrb.sty:
- (,(concat "\\\\\\(lstinline\\|Verb\\)\\(\\[[^]]*\\]\\)?"
- "[" TeX-ispell-verb-opening-delimiters "]")
- .
- ,(concat "[" TeX-ispell-verb-closing-delimiters "]"))
- ;; minted.sty
- (,(concat "\\\\mint\\(inline\\)?\\(\\[[^]]*\\]\\)?{\\([^}]+\\)}"
- "[" TeX-ispell-verb-opening-delimiters "]")
- .
- ,(concat "[" TeX-ispell-verb-closing-delimiters "]"))))
+ ("\\\\fontspec" TeX-ispell-tex-arg-end 1 1 0)))
+
+
+;; Special setup for verbatim macros:
+(defcustom TeX-ispell-verb-delimiters "!|#~\"*/+^-"
+ "String with all delimiters for verbatim macros.
+Characters special in regexps like `^' and `-' must come last and
+not be quoted. An opening brace `{' should not be used."
+ :group 'TeX-misc
+ :type 'string)
+
+;; listings.sty & fancyvrb.sty: With opt. argument only before verb content:
+(TeX-ispell-skip-setcar
+ `((,(concat "\\\\" (regexp-opt '("Verb" "lstinline")))
+ TeX-ispell-tex-arg-verb-end)))
+
+;; minted.sty: With opt. and mandatory argument before verb content:
+(TeX-ispell-skip-setcar
+ `((,(concat "\\\\" (regexp-opt '("mint" "mintinline")))
+ TeX-ispell-tex-arg-verb-end 1)))
;; Add environments here:
diff --git a/tex.el b/tex.el
index 8c37ae0..64e570d 100644
--- a/tex.el
+++ b/tex.el
@@ -6677,6 +6677,30 @@ skipped."
(message "Error skipping s-expressions at point %d" (point))
(sit-for 2))))
+(defun TeX-ispell-tex-arg-verb-end (&optional arg)
+ "Skip across an optional argument, ARG number of mandatory ones and verbatim
content.
+This function always checks if one optional argument in brackets
+is given and skips over it. If ARG is a number, it skips over
+that many mandatory arguments in braces. Then it checks for
+verbatim content to skip which is enclosed by a character given
+in `TeX-ispell-verb-delimiters' or in braces, otherwise raises an
+error."
+ (condition-case nil
+ (progn
+ (when (looking-at "[ \t\n]*\\[") (forward-sexp))
+ (when (and arg (looking-at "{"))
+ (forward-sexp arg))
+ (cond ((looking-at (concat "[" TeX-ispell-verb-delimiters "]"))
+ (forward-char)
+ (skip-chars-forward (concat "^" (string (char-before))))
+ (forward-char))
+ ((looking-at "{")
+ (forward-sexp))
+ (t (error nil))))
+ (error
+ (message (format "Verbatim delimiter is not one of %s"
+ (split-string TeX-ispell-verb-delimiters "" t)))
+ (sit-for 2))))
;;; Abbrev mode
- [elpa] externals/auctex 337ce76 33/95: Add new keys for package version 4.00, (continued)
- [elpa] externals/auctex 337ce76 33/95: Add new keys for package version 4.00, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 6bb49cc 39/95: * style/subfiles.el (LaTeX-subfiles-class-options): New function., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 4992f5a 46/95: Make customization to face specification to appear in, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex c97a654 48/95: * tex-ispell.el (TeX-ispell-skip-setcdr): Add entry for filecontents package., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 0dc770d 42/95: Prevent infinite loop in TeX-command-expand, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 841d4cb 45/95: Unify treatment of face argument over the relevant functions., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 72a6943 54/95: Add fallback for indentation when & is omitted, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 8fdc494 63/95: ; Provide fallback when no locale information is available, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 9d12a06 66/95: Use `TeX-replace-regexp-in-string' in style files, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex a71a72d 74/95: Add support for Japanese font command, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 88a7563 81/95: Fix last improvement for skipping of inline verbatim macros,
Tassilo Horn <=
- [elpa] externals/auctex 16f24dd 90/95: ; * style/minted.el (LaTeX-minted-add-syntactic-keywords-extra): Fix doc string., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex a46c307 77/95: Improve fontification of verbatim macros in style/minted.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 83890d6 86/95: Update package options in style/amsmath.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 94b227d 89/95: * doc/auctex.texi (Selecting a Command): Document `TeX-ispell-verb-delimiters'., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 4225941 59/95: Modify `TeX-expand-list-builtin' instead of `TeX-expand-list', Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 79361b5 58/95: Add new style/fvextra.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex d0908cb 51/95: Fix auto selection of japanese TeX engine, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex aac8694 67/95: Use compat function `TeX-replace-regexp-in-string' in core files, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 5a84d95 88/95: Fix `paragraph-start' and `paragraph-separate', Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 618bdf1 85/95: Append \b to regexp built from TeX control words, Tassilo Horn, 2017/04/16