[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex e8b451297a 33/39: Improve query of optional note
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex e8b451297a 33/39: Improve query of optional notes for natbib cite macros |
Date: |
Thu, 20 Jul 2023 04:21:51 -0400 (EDT) |
branch: externals/auctex
commit e8b451297a922515ef5ba277e8b936669a1013a8
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Improve query of optional notes for natbib cite macros
* style/natbib.el (LaTeX-arg-natbib-notes): Change the function to
read and insert only the post-note of a \cite macro, the pre-note
is queried inside the hook.
* style/revtex4-2.el ("revtex4-2"): Adjust the hook to the change
of `LaTeX-arg-natbib-notes'.
Use `function-noarg' as keyword class.
Add missing call of `font-latex-set-syntactic-keywords'.
---
style/natbib.el | 31 +++++++++++++++----------------
style/revtex4-2.el | 25 +++++++++++++++++--------
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/style/natbib.el b/style/natbib.el
index 3cac59606d..b7eb9838fc 100644
--- a/style/natbib.el
+++ b/style/natbib.el
@@ -74,7 +74,9 @@
;; Pre and post notes
(list
(car cmd)
- '(TeX-arg-conditional TeX-arg-cite-note-p
([LaTeX-arg-natbib-notes]) nil)
+ '(TeX-arg-conditional TeX-arg-cite-note-p
+ (["Pre-note"] LaTeX-arg-natbib-notes)
+ nil)
#'TeX-arg-cite))))
citecmds))
@@ -173,21 +175,18 @@
(reftex-set-cite-format 'natbib)))
TeX-dialect)
-(defun LaTeX-arg-natbib-notes (optional)
- "Prompt for two note arguments a natbib citation command.
-If OPTIONAL is non-nil, insert them in brackets, otherwise in
-braces."
- (let ((pre (TeX-read-string
- (TeX-argument-prompt optional nil "Pre-note")))
- (post (TeX-read-string
- (TeX-argument-prompt optional nil "Post-note"))))
- (TeX-argument-insert pre optional)
- (TeX-argument-insert post optional)
- ;; pre is given, post is empty: Make sure that we insert an
- ;; extra pair of `[]', otherwise pre becomes post
- (when (and pre (not (string= pre ""))
- (string= post ""))
- (insert LaTeX-optop LaTeX-optcl))))
+(defun LaTeX-arg-natbib-notes (_optional)
+ "Prompt for the post-note argument of a natbib citation command.
+OPTIONAL is ignored."
+ (let ((post (TeX-read-string
+ (TeX-argument-prompt t nil "Post-note")))
+ (TeX-arg-opening-brace LaTeX-optop)
+ (TeX-arg-closing-brace LaTeX-optcl))
+ ;; Pre-note is given, Post-note is empty: Make sure that we insert
+ ;; an extra pair of `[]', otherwise pre becomes post
+ (if (and (string-empty-p post) (= (preceding-char) ?\]))
+ (insert LaTeX-optop LaTeX-optcl)
+ (TeX-argument-insert post t))))
(defvar LaTeX-natbib-package-options '("numbers" "super" "authoryear"
"round" "square" "angle" "curly"
diff --git a/style/revtex4-2.el b/style/revtex4-2.el
index 26a5eff5d2..13020afbaa 100644
--- a/style/revtex4-2.el
+++ b/style/revtex4-2.el
@@ -1,6 +1,6 @@
;;; revtex4-2.el --- AUCTeX style for `revtex4-2.cls' (v4.2c) -*-
lexical-binding: t; -*-
-;; Copyright (C) 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2020--2023 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
@@ -38,6 +38,8 @@
(declare-function font-latex-add-keywords
"font-latex"
(keywords class))
+(declare-function font-latex-set-syntactic-keywords
+ "font-latex")
(defvar LaTeX-natbib-package-options)
(defvar LaTeX-url-package-options)
@@ -132,10 +134,14 @@ provided by REVTeX class."
;; VIII.1. Citing a reference
'("onlinecite"
- (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
+ (TeX-arg-conditional TeX-arg-cite-note-p
+ (["Pre-note"] LaTeX-arg-natbib-notes)
+ nil)
TeX-arg-cite)
'("textcite"
- (TeX-arg-conditional TeX-arg-cite-note-p ([LaTeX-arg-natbib-notes]) nil)
+ (TeX-arg-conditional TeX-arg-cite-note-p
+ (["Pre-note"] LaTeX-arg-natbib-notes)
+ nil)
TeX-arg-cite)
;; IX.2 video environment
@@ -192,13 +198,14 @@ provided by REVTeX class."
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("fbox" "*[{")
("keywords" "{")
- ("preprint" "")
- ("onecolumngrid" "")
- ("twocolumngrid" "")
- ("squeezetable" "")
("printtables" "*")
("printfigures" "*"))
'function)
+ (font-latex-add-keywords '("preprint"
+ "onecolumngrid"
+ "twocolumngrid"
+ "squeezetable")
+ 'function-noarg)
(font-latex-add-keywords '(("affiliation" "{")
("noaffiliation" "")
("collaboration" "{")
@@ -211,7 +218,9 @@ provided by REVTeX class."
("setfloatlink" ""))
'reference)
(font-latex-add-keywords '(("appendix*" ""))
- 'warning)))
+ 'warning)
+ ;; Tell font-lock about the update
+ (font-latex-set-syntactic-keywords)))
TeX-dialect)
(defvar LaTeX-revtex4-2-class-options
- [elpa] externals/auctex 93fa8bde57 17/39: Introduce new fontification keywords class "function-noarg", (continued)
- [elpa] externals/auctex 93fa8bde57 17/39: Introduce new fontification keywords class "function-noarg", Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 2969b24b52 16/39: ; * style/wasysym.el: Silence warnings from 'make dynvars-check'., Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 4bcad4772d 15/39: Simplify handling of package options, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex e0bc78a500 23/39: Support in-buffer completion for class/package names/options, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 5eac6b0800 29/39: Improve query for \newtheorem macro, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 38e729a75f 28/39: * latex.el (LaTeX-common-initialization): Replace `TeX-arg-eval'., Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 9ab3f77d53 31/39: * style/ntheorem.el (ntheorem"): Simplify additions to the parser., Tassilo Horn, 2023/07/20
- [elpa] externals/auctex b55368f75f 38/39: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 28aa6b99e4 18/39: Harmonize provisioning of package options, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 25bf8e13e9 24/39: ; (LaTeX-completion-documentclass-usepackage): Fix docstring., Tassilo Horn, 2023/07/20
- [elpa] externals/auctex e8b451297a 33/39: Improve query of optional notes for natbib cite macros,
Tassilo Horn <=
- [elpa] externals/auctex b4c27dd36b 02/39: Lift required GNU Emacs version to 26.1, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 7a347cd394 10/39: Remove compatibility code for Emacs<26, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex da28858e46 20/39: Improve handling of beamer class options, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 55bfb2b419 27/39: ; * latex.el (TeX-arg-tb): Fix docstring., Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 5fae21f4bf 35/39: * style/algpseudocodex.el ("algpseudocodex"): Add missing macros., Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 78bc8d6b56 36/39: * style/menukeys.el ("menukeys"): Replace `TeX-arg-eval'., Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 7cd0cdd60a 37/39: Speed up parsing, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex 1c3360b162 39/39: Release GNU AUCTeX 13.2.1, Tassilo Horn, 2023/07/20
- [elpa] externals/auctex c64c8a26eb 13/39: Add support for wasysym package, Tassilo Horn, 2023/07/20