branch: externals/auctex
commit dc6e8c44c988ec4824266b01d89b66375ef14a3c
Author: Arash Esbati <ar...@gnu.org>
Commit: Arash Esbati <ar...@gnu.org>

    Turn `y-or-n-p' into `always' for in-buffer completion
    
    * latex.el (LaTeX-completion-parse-args): Turn `y-or-n-p' into
    `always' inside `TeX-arg-conditional' for in-buffer completion.
---
 latex.el | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/latex.el b/latex.el
index 7c29306642..56992d54fb 100644
--- a/latex.el
+++ b/latex.el
@@ -7574,17 +7574,22 @@ or `LaTeX-environment-list' and returns it."
       (pop arg-list))
 
     ;; Check for `TeX-arg-conditional' here and change `arg-list'
-    ;; accordingly
+    ;; accordingly.
+    ;; FIXME: Turn `y-or-n-p' into `always' otherwise there will be a
+    ;; query during in-buffer completion.  This will work for most
+    ;; cases, but will also fail for example in hyperref.el.  This
+    ;; decision should revisited at a later stage:
     (when (assq 'TeX-arg-conditional arg-list)
-      (while (and arg-list
-                  (setq arg (car arg-list)))
-        (if (and (listp arg) (eq (car arg) 'TeX-arg-conditional))
-            (setq result (append (reverse (if (eval (nth 1 arg) t)
-                                              (nth 2 arg)
-                                            (nth 3 arg)))
-                                 result))
-          (push arg result))
-        (pop arg-list))
+      (cl-letf (((symbol-function 'y-or-n-p) #'always))
+        (while (and arg-list
+                    (setq arg (car arg-list)))
+          (if (and (listp arg) (eq (car arg) 'TeX-arg-conditional))
+              (setq result (append (reverse (if (eval (nth 1 arg) t)
+                                                (nth 2 arg)
+                                              (nth 3 arg)))
+                                   result))
+            (push arg result))
+          (pop arg-list)))
       (setq arg-list (nreverse result)))
 
     ;; Now parse the `arg-list':


Reply via email to