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

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

[elpa] externals/auctex 8bc74dd 01/25: Update style/bigdelim.el to packa


From: Tassilo Horn
Subject: [elpa] externals/auctex 8bc74dd 01/25: Update style/bigdelim.el to package version 2.6
Date: Sun, 21 Mar 2021 11:44:39 -0400 (EDT)

branch: externals/auctex
commit 8bc74dd3adcde6c7b072abafe3c31ba2e05d5f7d
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Update style/bigdelim.el to package version 2.6
    
    * style/bigdelim.el (TeX-arg-bigdelim-brace): Support completion
    for more brace choices.  Insert the choice in braces only if the
    choice doesn't start with a backslash.
    ("bigdelim"): Add fontification support.
---
 style/bigdelim.el | 72 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 59 insertions(+), 13 deletions(-)

diff --git a/style/bigdelim.el b/style/bigdelim.el
index 30938d3..7f0dee5 100644
--- a/style/bigdelim.el
+++ b/style/bigdelim.el
@@ -1,6 +1,6 @@
 ;;; bigdelim.el --- AUCTeX style for `bigdelim.sty'  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011, 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2011--2021 Free Software Foundation, Inc.
 
 ;; Author: Mads Jensen <mje@inducks.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -26,28 +26,74 @@
 
 ;;; Commentary:
 
-;; This file adds support for `bigdelim.sty'.
+;; This file adds support for `bigdelim.sty', v2.6 from 2021/01/02.
 
 ;;; Code:
 
 (require 'tex)
 
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+                 "font-latex"
+                 (keywords class))
+
+(defun TeX-arg-bigdelim-brace (optional side &optional prompt)
+  "Prompt for a single brace, and do not insert the matching one.
+If OPTIONAL is non-nil, include the argument only if not empty.
+SIDE is one of the symbols `left' or `right'. PROMPT replaces the
+standard one."
+  (let* ((brace (completing-read
+                 (TeX-argument-prompt optional prompt "Brace")
+                 (if (eq side 'left)
+                     '("(" "[" "{" "\\langle" "|" "\\|" "\\lceil" "\\lfloor")
+                   '(")" "]" "}" "\\rangle" "|" "\\|" "\\rceil" "\\rfloor"))))
+         (TeX-arg-opening-brace (if (member (substring brace 0 1)
+                                            `("{" "}" ,TeX-esc))
+                                    ""
+                                  TeX-grop))
+         (TeX-arg-closing-brace (if (string= TeX-arg-opening-brace TeX-grop)
+                                    TeX-grcl
+                                 "")))
+    (TeX-argument-insert brace optional (when (member brace '("{" "}"))
+                                          TeX-esc))))
+
 (TeX-add-style-hook
  "bigdelim"
  (lambda ()
+
+   (TeX-run-style-hooks "multirow")
+
    (TeX-add-symbols
-    '("ldelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
-      "Width in multirow" [ "Text in multirow" ])
-    '("rdelim" TeX-arg-bigdelim-brace "Number of rows for multirow"
-      "Width in multirow" [ "Text in multirow" ])))
- TeX-dialect)
+    '("ldelim"
+      (TeX-arg-bigdelim-brace left)
+      "Number of rows for multirow"
+      (TeX-arg-eval completing-read
+                    (TeX-argument-prompt nil nil "Width in multirow")
+                    (append
+                     '("*")
+                     (mapcar (lambda (x)
+                               (concat TeX-esc (car x)))
+                             (LaTeX-length-list))))
+      [ "Text in multirow" ])
+    '("rdelim"
+      (TeX-arg-bigdelim-brace right)
+      "Number of rows for multirow"
+      (TeX-arg-eval completing-read
+                    (TeX-argument-prompt nil nil "Width in multirow")
+                    (append
+                     '("*")
+                     (mapcar (lambda (x)
+                               (concat TeX-esc (car x)))
+                             (LaTeX-length-list))))
+      [ "Text in multirow" ]))
 
-(defun TeX-arg-bigdelim-brace (optional &optional prompt)
-  "Prompt for a single brace, and do not insert the matching
-  right parentheses."
-  (let ((brace (read-from-minibuffer
-   (TeX-argument-prompt optional prompt "Brace") nil)))
-    (insert (format "%s" brace))))
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("ldelim" "|{\\{{[")
+                                ("rdelim" "|{\\{{["))
+                              'function)))
+ TeX-dialect)
 
 (defvar LaTeX-bigdelim-package-options nil
   "Package options for the bigdelim package.")



reply via email to

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