]> git.eshelyaron.com Git - emacs.git/commitdiff
Arrange for dialog boxes during emacsclient requests on Android
authorPo Lu <luangruo@yahoo.com>
Sun, 25 Feb 2024 03:41:02 +0000 (11:41 +0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 28 Feb 2024 17:52:22 +0000 (18:52 +0100)
* lisp/server.el (server-execute): Bind use-dialog-box-override
if (featurep 'android).

* lisp/subr.el (use-dialog-box-override): New option.
(use-dialog-box-p): Always display dialog boxes if variable is
set.

(cherry picked from commit 05116eac0c199b0c8409a32b349a42a21b5a0fb0)

lisp/server.el
lisp/subr.el

index 66e6d729f8abbcf3ab6bedf320a5b1ad002462fc..b65053267a60f03d0914a8d5c0d284aa0e9fb4c2 100644 (file)
@@ -1439,7 +1439,11 @@ invocations of \"emacs\".")
   ;; including code that needs to wait.
   (with-local-quit
     (condition-case err
-        (let ((buffers (server-visit-files files proc nowait)))
+        (let ((buffers (server-visit-files files proc nowait))
+              ;; On Android, the Emacs server generally can't provide
+              ;; feedback to the user except by means of dialog boxes,
+              ;; which are displayed in the GUI emacsclient wrapper.
+              (use-dialog-box-override (featurep 'android)))
           (mapc 'funcall (nreverse commands))
           (let ((server-eval-args-left (nreverse evalexprs)))
             (while server-eval-args-left
index 3387328ad3b17952d86bb3a54413c059985f239b..705f53219d7214ce90f3d6f3b8d8b1a1a06102b5 100644 (file)
@@ -3836,16 +3836,22 @@ confusing to some users.")
 
 (declare-function android-detect-keyboard "androidfns.c")
 
+(defvar use-dialog-box-override nil
+  "Whether `use-dialog-box-p' should always return t.")
+
 (defun use-dialog-box-p ()
   "Return non-nil if the current command should prompt the user via a dialog box."
-  (and last-input-event                 ; not during startup
-       (or (consp last-nonmenu-event)   ; invoked by a mouse event
-           (and (null last-nonmenu-event)
-                (consp last-input-event))
-           (and (featurep 'android)    ; Prefer dialog boxes on Android.
-                (not (android-detect-keyboard))) ; If no keyboard is connected.
-           from--tty-menu-p)            ; invoked via TTY menu
-       use-dialog-box))
+  (or use-dialog-box-override
+      (and last-input-event                 ; not during startup
+           (or (consp last-nonmenu-event)   ; invoked by a mouse event
+               (and (null last-nonmenu-event)
+                    (consp last-input-event))
+               (and (featurep 'android)        ; Prefer dialog boxes on
+                                        ; Android.
+                    (not (android-detect-keyboard))) ; If no keyboard is
+                                                     ; connected.
+               from--tty-menu-p)            ; invoked via TTY menu
+           use-dialog-box)))
 
 ;; Actually in textconv.c.
 (defvar overriding-text-conversion-style)