auctex-diffs
[Top][All Lists]
Advanced

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

master dc6e8c44: Turn `y-or-n-p' into `always' for in-buffer completion


From: Arash Esbati
Subject: master dc6e8c44: Turn `y-or-n-p' into `always' for in-buffer completion
Date: Tue, 10 Jan 2023 04:49:17 -0500 (EST)

branch: master
commit dc6e8c44c988ec4824266b01d89b66375ef14a3c
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@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 7c293066..56992d54 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

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