This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  31536019c865fea583be91cf4d402f20c224b861 (commit)
       via  d5e8b7d38e5683161e542bb5b62a75df05b6e7a6 (commit)
      from  3ddc9b3fea146c516cb7cae68a329dec42ebb22c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 31536019c865fea583be91cf4d402f20c224b861
Author: Arash Esbati <arash.esb...@gmail.com>
Date:   Mon Oct 17 12:22:24 2016 +0200

    Do not insert unnecessary brackets for citation macros
    
    * style/natbib.el (LaTeX-arg-natbib-notes): Rename function name
    from `natbib-note-args'.
    Improve the insertion of arguments in order not to have an empty
    pair of brackets when both pre- and post-note are omitted.
    ("natbib"): Replace occurrence of `natbib-note-args' with
    `LaTeX-arg-natbib-notes'.

diff --git a/style/natbib.el b/style/natbib.el
index a224c5b..d56642c 100644
--- a/style/natbib.el
+++ b/style/natbib.el
@@ -32,7 +32,7 @@
     ;; The number in the cdr of the following list indicates how many
     ;; optional note arguments we consider useful.  Prompting for those
     ;; arguments will still depend upon `TeX-arg-cite-note-p'.
-    (let  ((citecmds 
+    (let  ((citecmds
            '(("cite" . 0)
              ("citet" . 1) ("citet*" . 1) ("citealt" . 1) ("citealt*" . 1)
              ("citep" . 2) ("citep*" . 2) ("citealp" . 2) ("citealp*" . 2)
@@ -41,11 +41,11 @@
              ("shortcites" . 0))))
 
       ;; Add these symbols
-      (apply 
+      (apply
        'TeX-add-symbols
        (mapcar
        (lambda (cmd)
-         (cond 
+         (cond
           ((= (cdr cmd) 0)
            ;; No optional arguments
            (list (car cmd) 'TeX-arg-cite))
@@ -59,14 +59,14 @@
            ;; Pre and post notes
            (list
             (car cmd)
-            '(TeX-arg-conditional TeX-arg-cite-note-p (natbib-note-args) nil)
+            '(TeX-arg-conditional TeX-arg-cite-note-p 
([LaTeX-arg-natbib-notes]) nil)
             'TeX-arg-cite))))
       citecmds))
 
       ;; Add the other symbols
       (TeX-add-symbols
        '("citetext" "Text")
-       '("bibpunct" ["Post note separator"] 
+       '("bibpunct" ["Post note separator"]
                 "Opening bracket"
                 "Closing bracket"
                 "Punctuation between multiple citations"
@@ -82,7 +82,7 @@
       (add-to-list
        'TeX-complete-list
        (list
-       (concat "\\\\\\(" 
+       (concat "\\\\\\("
                (mapconcat (lambda (x) (regexp-quote (car x)))
                           citecmds "\\|")
                
"\\)\\(\\[[^]\n\r\\%]*\\]\\)*{\\([^{}\n\r\\%,]*,\\)*\\([^{}\n\r\\%,]*\\)")
@@ -108,18 +108,22 @@
        (reftex-set-cite-format 'natbib))))
  LaTeX-dialect)
 
-(defun natbib-note-args (optional &optional _prompt _definition)
-  "Prompt for two note arguments a natbib citation command."
+(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."
   (if TeX-arg-cite-note-p
-      (let* ((pre (TeX-read-string
-                  (TeX-argument-prompt optional optional "Pre-note")))
-            (post (TeX-read-string
-                   (TeX-argument-prompt optional optional "Post-note"))))
-       (if (not (string= pre "")) (insert "[" pre "]"))
-       (if (not (string= post ""))
-           (insert "[" post "]")
-         ;; Make sure that we have an empty post note if pre is not empty
-         (if (string= pre "") (insert "[]"))))))
+      (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)))))
 
 (defvar LaTeX-natbib-package-options '("numbers" "super" "authoryear"
                                       "round" "square" "angle" "curly"

commit d5e8b7d38e5683161e542bb5b62a75df05b6e7a6
Author: Arash Esbati <arash.esb...@gmail.com>
Date:   Mon Oct 17 12:11:25 2016 +0200

    Use `TeX-argument-insert' instead of conditional `insert'
    
    * style/biblatex.el (LaTeX-arg-biblatex-natbib-notes): Use
    `TeX-argument-insert' instead of `insert' for arguments
    insertion.

diff --git a/style/biblatex.el b/style/biblatex.el
index 5a9d373..2b8ba85 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -223,24 +223,13 @@ for citation keys."
                  (TeX-argument-prompt optional nil "Prenote")))
            (post (TeX-read-string
                   (TeX-argument-prompt optional nil "Postnote"))))
-       (cond
-        (;; Both optional args are given
-         (and pre (not (string= pre ""))
-              post (not (string= post "")))
-         (insert LaTeX-optop pre LaTeX-optcl
-                 LaTeX-optop post LaTeX-optcl))
-        (;; pre is given, post is empty: Make sure that we insert an
-         ;; extra pair of `[]', otherwise pre becomes post
-         (and pre (not (string= pre ""))
-              (string= post ""))
-         (insert LaTeX-optop pre LaTeX-optcl
-                 LaTeX-optop LaTeX-optcl))
-        (;; pre is empty, post is given
-         (and (string= pre "")
-              post (not (string= post "")))
-         (insert LaTeX-optop post LaTeX-optcl))
-        (;; both empty
-         t (ignore))))))
+       (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)))))
 
 (TeX-add-style-hook
  "biblatex"

-----------------------------------------------------------------------

Summary of changes:
 style/biblatex.el |   25 +++++++------------------
 style/natbib.el   |   38 +++++++++++++++++++++-----------------
 2 files changed, 28 insertions(+), 35 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX

_______________________________________________
auctex-diffs mailing list
auctex-di...@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-diffs

Reply via email to