[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 34818c0307 10/15: Simplify entering of captions
From: |
ELPA Syncer |
Subject: |
[elpa] externals/auctex 34818c0307 10/15: Simplify entering of captions in optional argument |
Date: |
Fri, 19 Jul 2024 18:57:30 -0400 (EDT) |
branch: externals/auctex
commit 34818c0307be48d5be323fde1f73c8b9f8cd4980
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Simplify entering of captions in optional argument
* style/listings.el
(LaTeX-listings-reftex-label-context-function): Delete function
and use `LaTeX-keyval-caption-reftex-context-function'.
(LaTeX-listings-auto-cleanup, "listings"): Allow literal "space"
when inserting the optional argument after environments. This
should simplify entering a value to the caption key.
---
style/listings.el | 43 +++++--------------------------------------
1 file changed, 5 insertions(+), 38 deletions(-)
diff --git a/style/listings.el b/style/listings.el
index d9352fc704..d8e1dce2a4 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -1,6 +1,6 @@
;;; listings.el --- AUCTeX style for `listings.sty' -*- lexical-binding: t;
-*-
-;; Copyright (C) 2004, 2005, 2009, 2013-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
;; Author: Ralf Angeli <angeli@iwi.uni-sb.de>
;; Maintainer: auctex-devel@gnu.org
@@ -322,7 +322,7 @@
(LaTeX-add-environments
`(,env
LaTeX-env-args
- [TeX-arg-key-val (LaTeX-listings-key-val-options)]
+ [TeX-arg-key-val (LaTeX-listings-key-val-options) nil nil ?\s]
(LaTeX-env-label-as-keyval "caption")
,(1- (string-to-number args)))))
(;; mandatory argument(s) only
@@ -343,7 +343,7 @@
(when (fboundp 'reftex-add-label-environments)
(reftex-add-label-environments
`((,env ?l "lst:" "~\\ref{%s}"
- LaTeX-listings-reftex-label-context-function
+ LaTeX-keyval-caption-reftex-context-function
(regexp "[Ll]isting")))))
(when (boundp 'reftex-label-regexps)
(add-to-list (make-local-variable 'reftex-label-regexps)
@@ -367,39 +367,6 @@
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-listings-auto-cleanup t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
-(defun LaTeX-listings-reftex-label-context-function (env)
- "Extract and return a context string for RefTeX.
-The context string is the value given to the caption key. If no
-caption key is found, an error is issued."
- (let* ((envstart (save-excursion
- (re-search-backward (concat "\\\\begin{" env "}")
- nil t)))
- (capt-key (save-excursion
- (re-search-backward "caption[ \t\n\r%]*=[ \t\n\r%]*"
- envstart t)))
- capt-start capt-end)
- (if capt-key
- (save-excursion
- (goto-char capt-key)
- (re-search-forward
- "caption[ \t\n\r%]*=[ \t\n\r%]*" nil t)
- (cond (;; Short caption inside [] is available, extract it only
- (looking-at-p (regexp-quote (concat TeX-grop LaTeX-optop)))
- (forward-char)
- (setq capt-start (1+ (point)))
- (setq capt-end (1- (progn (forward-sexp) (point)))))
- ;; Extract the entire caption which is enclosed in braces
- ((looking-at-p TeX-grop)
- (setq capt-start (1+ (point)))
- (setq capt-end (1- (progn (forward-sexp) (point)))))
- ;; Extract everything to next comma ,
- (t
- (setq capt-start (point))
- (setq capt-end (progn (skip-chars-forward "^,") (point)))))
- ;; Return the extracted string
- (buffer-substring-no-properties capt-start capt-end))
- (error "No caption found"))))
-
(TeX-add-style-hook
"listings"
(lambda ()
@@ -439,7 +406,7 @@ caption key is found, an error is issued."
;; New environments
(LaTeX-add-environments
'("lstlisting" LaTeX-env-args
- [TeX-arg-key-val (LaTeX-listings-key-val-options)]
+ [TeX-arg-key-val (LaTeX-listings-key-val-options) nil nil ?\s]
(LaTeX-env-label-as-keyval "caption")))
;; Append "lstlisting" to `LaTeX-label-alist':
@@ -458,7 +425,7 @@ caption key is found, an error is issued."
(when (fboundp 'reftex-add-label-environments)
(reftex-add-label-environments
'(("lstlisting" ?l "lst:" "~\\ref{%s}"
- LaTeX-listings-reftex-label-context-function
+ LaTeX-keyval-caption-reftex-context-function
(regexp "[Ll]isting")))))
;; Fontification
- [elpa] externals/auctex updated (3091f2ca61 -> 84e959333b), ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 34818c0307 10/15: Simplify entering of captions in optional argument,
ELPA Syncer <=
- [elpa] externals/auctex 70422fe0c7 12/15: * style/tabularray.el ("tabularray"): Load ninecolors.el., ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 9bc5d19aa5 13/15: ; * NEWS.org: Update the file., ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 84e959333b 15/15: Merge remote-tracking branch 'origin/master', ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 63087fc4bf 06/15: * style/longtable.el ("longtable"): Support \LTcaptype macro., ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 922545e8af 14/15: Update style/simpleicons.el to package v13.1.0, ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 7fcab23c4b 04/15: Update style/simpleicons.el to package v13.0.0, ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 08e7f159e8 02/15: Improve fontification of arguments, ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 306a561ad5 03/15: Add new style/authblk.el, ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 01e3e22c7c 08/15: ; * doc/changes.texi: Wrap nil in @code and refill paragraphs., ELPA Syncer, 2024/07/19
- [elpa] externals/auctex 7fca4a2016 01/15: Update style/acro.el to package v3.8, ELPA Syncer, 2024/07/19