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

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

[elpa] 231/299: Make TeX-completing-read-multiple return nil on empty in


From: Stefan Monnier
Subject: [elpa] 231/299: Make TeX-completing-read-multiple return nil on empty input.
Date: Sun, 02 Nov 2014 03:11:39 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit b6765929b0bd5614975470774ab2864a32885acf
Author: Tassilo Horn <address@hidden>
Date:   Wed Mar 12 08:56:24 2014 +0100

    Make TeX-completing-read-multiple return nil on empty input.
    
    * multi-prompt.el (multi-prompt): Return nil on empty input.
    
    * tex.el (TeX-completing-read-multiple): Define it so that empty
    input results in nil across different emacs versions (<= 24.3
    vs. later versions).
    
    * style/biblatex.el ("biblatex"): Use
    `TeX-completing-read-multiple' instead of
    `completing-read-multiple'.
    (LaTeX-arg-biblatex-cites): Use `TeX-completing-read-multiple' and
    adapt handling of return value.
    
    * style/pstricks.el (LaTeX-package-parameters): Adapt to
    `TeX-completing-read-multiple' change.
---
 ChangeLog         |   17 +++++++++++++++++
 multi-prompt.el   |    6 +++---
 style/biblatex.el |    8 ++++----
 style/pstricks.el |    2 +-
 tex.el            |   10 +++++++++-
 5 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 145ab10..2f61eda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2014-03-12  Tassilo Horn  <address@hidden>
+
+       * multi-prompt.el (multi-prompt): Return nil on empty input.
+
+       * tex.el (TeX-completing-read-multiple): Define it so that empty
+       input results in nil across different emacs versions (<= 24.3
+       vs. later versions).
+
+       * style/biblatex.el ("biblatex"): Use
+       `TeX-completing-read-multiple' instead of
+       `completing-read-multiple'.
+       (LaTeX-arg-biblatex-cites): Use `TeX-completing-read-multiple' and
+       adapt handling of return value.
+
+       * style/pstricks.el (LaTeX-package-parameters): Adapt to
+       `TeX-completing-read-multiple' change.
+
 2014-03-11  Tassilo Horn  <address@hidden>
 
        * latex.el (LaTeX-arg-usepackage-read-packages-with-options): Fix
diff --git a/multi-prompt.el b/multi-prompt.el
index 20edffa..25ba4c9 100644
--- a/multi-prompt.el
+++ b/multi-prompt.el
@@ -94,9 +94,9 @@ are the arguments to `completing-read'.  See that."
                                      initial nil)
                                (setq multi-prompt-found
                                      (cons extra multi-prompt-found)))))))))
-      (if answer 
-         (nreverse (cons answer multi-prompt-found))
-       multi-prompt-found))))
+      (if (string= answer "")
+         multi-prompt-found
+       (nreverse (cons answer multi-prompt-found))))))
 
 (defun multi-prompt-delete ()
   (interactive)
diff --git a/style/biblatex.el b/style/biblatex.el
index 88773fe..db96364 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -208,13 +208,13 @@ for citation keys."
             (TeX-argument-insert
              (TeX-read-string (TeX-argument-prompt t nil "Postnote"))
              (equal prenote ""))))
-      (setq items (completing-read-multiple
+      (setq items (TeX-completing-read-multiple
                   (TeX-argument-prompt optional prompt "Key")
                   (LaTeX-bibitem-list)))
       (apply 'LaTeX-add-bibitems items)
       ;; If input is empty, insert an empty group only the first time, when
       ;; `noinsert' flag is nil.
-      (unless (and (equal items '("")) noinsert)
+      (unless (and (not items) noinsert)
        (TeX-argument-insert (mapconcat 'identity items ",") optional))
       (setq noinsert t))))
 
@@ -240,7 +240,7 @@ for citation keys."
     ;; Setting Package Options
     '("ExecuteBibliographyOptions"
       [TeX-arg-eval  mapconcat 'identity
-                    (completing-read-multiple
+                    (TeX-completing-read-multiple
                      "Entry type: " LaTeX-biblatex-entrytype) ","]
       (TeX-arg-key-val LaTeX-biblatex-executebibliographyoptions-options))
     ;;; Bibliography Commands
@@ -292,7 +292,7 @@ for citation keys."
     '("defbibcheck" "Name" t)
     ;; Dynamic Entry Sets
     '("defbibentryset" "Set"
-      (TeX-arg-eval mapconcat 'identity (completing-read-multiple
+      (TeX-arg-eval mapconcat 'identity (TeX-completing-read-multiple
                                         "Keys: " (LaTeX-bibitem-list)) ","))
     ;;; Citation Commands
     '("cite" (TeX-arg-conditional TeX-arg-cite-note-p
diff --git a/style/pstricks.el b/style/pstricks.el
index 20dd19c..b54dd58 100644
--- a/style/pstricks.el
+++ b/style/pstricks.el
@@ -204,7 +204,7 @@ package PNAME"
             "Params (use <Up,Down> for history or RET for choices): ")
            nlist nil nil nil hlist))
     ;;
-    (if (and  (string= "" (car param)) (= (length param) 1))
+    (if (not param)
         (setq param (funcall fask nil t))
       (setq param (car (symbol-value hlist))))
     (TeX-argument-insert
diff --git a/tex.el b/tex.el
index c6cbbf9..23e99a0 100644
--- a/tex.el
+++ b/tex.el
@@ -689,7 +689,15 @@ overlays."
 edit-utils >= 2.32 for XEmacs."))
 
 (if (fboundp 'completing-read-multiple)
-    (defalias 'TeX-completing-read-multiple 'completing-read-multiple)
+    (defun TeX-completing-read-multiple
+       (prompt table &optional predicate require-match initial-input
+               hist def inherit-input-method)
+      "Like `completing-read-multiple' which see.
+Ensures that empty input results in nil across different emacs versions."
+      (let ((result (completing-read-multiple prompt table predicate
+                                             require-match initial-input
+                                             hist def inherit-input-method)))
+       (if (equal result '("")) nil result)))
   (defun TeX-completing-read-multiple
     (prompt table &optional predicate require-match initial-input
            hist def inherit-input-method)



reply via email to

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