[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex f0145f4 30/42: Add new function `LaTeX-env-longt
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex f0145f4 30/42: Add new function `LaTeX-env-longtable' |
Date: |
Thu, 23 Nov 2017 06:06:13 -0500 (EST) |
branch: externals/auctex
commit f0145f462bb2253627138d98d39da49842bd2178
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Add new function `LaTeX-env-longtable'
* style/longtable.el (LaTeX-env-longtable): Add new function.
Move the body of the anonymous function into this in order to make
it available for other styles loading longtable.
---
style/longtable.el | 73 ++++++++++++++++++++++++++++--------------------------
1 file changed, 38 insertions(+), 35 deletions(-)
diff --git a/style/longtable.el b/style/longtable.el
index aeb275e..b57833b 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -1,6 +1,6 @@
;;; longtable.el --- AUCTeX style for `longtable.sty'.
-;; Copyright (C) 2013--2016 Free Software Foundation, Inc.
+;; Copyright (C) 2013--2017 Free Software Foundation, Inc.
;; Maintainer: address@hidden
;; Author: Mosè Giordano <address@hidden>
@@ -46,44 +46,47 @@ insert line break macro."
(LaTeX-insert-ampersands
LaTeX-longtable-skipping-regexp #'LaTeX-array-count-columns))
+(defun LaTeX-env-longtable (environment)
+ "Insert a longtable-like ENVIRONMENT with caption and label."
+ (let* ((pos (completing-read (TeX-argument-prompt t nil "Position")
+ '(("l") ("r") ("c"))))
+ (fmt (TeX-read-string "Format: " LaTeX-default-format))
+ (caption (TeX-read-string "Caption: "))
+ (short-caption (when (>= (length caption)
LaTeX-short-caption-prompt-length)
+ (TeX-read-string "(Optional) Short caption: "))))
+ (setq LaTeX-default-format fmt)
+ (LaTeX-insert-environment environment
+ (concat
+ (unless (zerop (length pos))
+ (concat LaTeX-optop pos LaTeX-optcl))
+ (concat TeX-grop fmt TeX-grcl)))
+ ;; top caption -- do nothing if user skips caption
+ (unless (zerop (length caption))
+ ;; insert `\caption[short-caption]{caption':
+ (insert TeX-esc "caption")
+ (when (and short-caption (not (string= short-caption "")))
+ (insert LaTeX-optop short-caption LaTeX-optcl))
+ (insert TeX-grop caption)
+ ;; ask for a label and insert it
+ (LaTeX-label environment 'environment)
+ ;; the longtable `\caption' is equivalent to a
+ ;; `\multicolumn', so it needs a `\\' at the
+ ;; end of the line. Prior to that, add } to
+ ;; close `\caption{'
+ (insert TeX-grcl "\\\\")
+ ;; fill the caption
+ (LaTeX-fill-paragraph)
+ ;; Insert a new line and indent
+ (LaTeX-newline)
+ (indent-according-to-mode))
+ ;; Insert suitable number of &'s, suppress line break
+ (LaTeX-item-longtable t)))
+
(TeX-add-style-hook
"longtable"
(lambda ()
(LaTeX-add-environments
- '("longtable" (lambda (environment)
- (let* ((pos (completing-read (TeX-argument-prompt t nil
"Position")
- '(("l") ("r") ("c"))))
- (fmt (TeX-read-string "Format: "
LaTeX-default-format))
- (caption (TeX-read-string "Caption: "))
- (short-caption (when (>= (length caption)
LaTeX-short-caption-prompt-length)
- (TeX-read-string "(Optional) Short
caption: "))))
- (setq LaTeX-default-format fmt)
- (LaTeX-insert-environment environment
- (concat
- (unless (zerop (length pos))
- (concat LaTeX-optop pos
LaTeX-optcl))
- (concat TeX-grop fmt
TeX-grcl)))
- ;; top caption -- do nothing if user skips caption
- (unless (zerop (length caption))
- ;; insert `\caption[short-caption]{caption':
- (insert TeX-esc "caption")
- (when (and short-caption (not (string= short-caption
"")))
- (insert LaTeX-optop short-caption LaTeX-optcl))
- (insert TeX-grop caption)
- ;; ask for a label and insert it
- (LaTeX-label environment 'environment)
- ;; the longtable `\caption' is equivalent to a
- ;; `\multicolumn', so it needs a `\\' at the
- ;; end of the line. Prior to that, add } to
- ;; close `\caption{'
- (insert TeX-grcl "\\\\")
- ;; fill the caption
- (LaTeX-fill-paragraph)
- ;; Insert a new line and indent
- (LaTeX-newline)
- (indent-according-to-mode))
- ;; Insert suitable number of &'s, suppress line break
- (LaTeX-item-longtable t)))))
+ '("longtable" LaTeX-env-longtable))
(TeX-add-symbols
;; Commands to end table rows
- [elpa] externals/auctex 20b6fd0 21/42: Add test abount truncation of list, (continued)
- [elpa] externals/auctex 20b6fd0 21/42: Add test abount truncation of list, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 474cc4f 23/42: ; * doc/tex-ref.tex (): Fix typo and copyright year., Tassilo Horn, 2017/11/23
- [elpa] externals/auctex fe06211 24/42: Fix doc strings and comments, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 9e1aa85 22/42: Make preview-latex parsing robust to fix Bug#20773, Bug#27088, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 5d8ac95 25/42: Cosmetic Change, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 837d590 27/42: Remove use of .runandhide operator, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex f362325 28/42: ; * latex.el (LaTeX-document-style-hook): Fix a typo., Tassilo Horn, 2017/11/23
- [elpa] externals/auctex ea7ff48 29/42: * tex.el (TeX-math-input-method-off-regexp): Turn defvar into defcustom., Tassilo Horn, 2017/11/23
- [elpa] externals/auctex b2571b6 40/42: Don't set company-minimum-prefix-length in tex mode buffers, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 0d8e6c6 34/42: Document `TeX-math-input-method-off-regexp' properly., Tassilo Horn, 2017/11/23
- [elpa] externals/auctex f0145f4 30/42: Add new function `LaTeX-env-longtable',
Tassilo Horn <=
- [elpa] externals/auctex 213b705 33/42: Mention the necessity of GNU make, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 842471c 37/42: Give proper argument to `TeX-command-expand', Tassilo Horn, 2017/11/23
- [elpa] externals/auctex b69d894 39/42: * doc/changes.texi: Mention compatibility of preview with GS 9.22., Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 5d6839e 36/42: Add test for the recent change about `TeX-kpathsea-path-delimiter', Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 5f007f1 42/42: Regenerate tex-site.el and docs, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex b20eea0 26/42: Fix Copyright year, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 463ead7 35/42: Document `TeX-view-evince-keep-focus', Tassilo Horn, 2017/11/23
- [elpa] externals/auctex 420ec0e 32/42: Bug fix and code refactoring related to kpathsea, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex ee4cc54 31/42: Add new style/xltabular.el, Tassilo Horn, 2017/11/23
- [elpa] externals/auctex c03ca2c 38/42: Improve style/epigraph.el, Tassilo Horn, 2017/11/23