emacs-diffs
[Top][All Lists]
Advanced

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

master 2b67609c340: Repair test failures stemming from Android merge


From: Po Lu
Subject: master 2b67609c340: Repair test failures stemming from Android merge
Date: Tue, 8 Aug 2023 08:22:40 -0400 (EDT)

branch: master
commit 2b67609c34051ceb0359675342f54e3ac9719840
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Repair test failures stemming from Android merge
    
    * lisp/kmacro.el (kmacro-step-edit-query)
    (kmacro-step-edit-pre-command): Use `dummy-event' instead of
    [nil] to continue a kbd macro; this is because nil now has a
    function key map.
    * src/androidfns.c (Fx_hide_tip): Allow calling this as a stub.
    * src/fileio.c (Finsert_file_contents): In adherence to the
    documentation, forbid supplying a BEG offset even for seekable
    files, i.e. /dev/urandom on Linux kernel based systems.
---
 lisp/kmacro.el   | 17 ++++++++++++-----
 src/androidfns.c |  9 +++++++--
 src/fileio.c     | 11 +++++++++--
 3 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 7489076ea2e..588b2d14943 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -1189,7 +1189,10 @@ following additional answers: `insert', `insert-1', 
`replace', `replace-1',
        (setq act (lookup-key kmacro-step-edit-map
                              (vector (with-current-buffer (current-buffer) 
(read-event))))))))
 
-    ;; Resume macro execution and perform the action
+    ;; Resume macro execution and perform the action.
+    ;; Suffixing executing-kbd-macro with `dummy-event'
+    ;; is done when pre-command-hook must be called
+    ;; again as part of this keyboard macro's execution.
     (cond
      ((cond
        ((eq act 'act)
@@ -1220,18 +1223,21 @@ following additional answers: `insert', `insert-1', 
`replace', `replace-1',
        ((member act '(replace-1 replace))
        (setq kmacro-step-edit-inserting (if (eq act 'replace-1) 1 t))
        (if (= executing-kbd-macro-index (length executing-kbd-macro))
-           (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
+           (setq executing-kbd-macro (vconcat executing-kbd-macro
+                                               [dummy-event])
                  kmacro-step-edit-appending t))
        nil)
        ((eq act 'append)
        (setq kmacro-step-edit-inserting t)
        (if (= executing-kbd-macro-index (length executing-kbd-macro))
-           (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
+           (setq executing-kbd-macro (vconcat executing-kbd-macro
+                                               [dummy-event])
                  kmacro-step-edit-appending t))
        t)
        ((eq act 'append-end)
        (if (= executing-kbd-macro-index (length executing-kbd-macro))
-           (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
+           (setq executing-kbd-macro (vconcat executing-kbd-macro
+                                               [dummy-event])
                  kmacro-step-edit-inserting t
                  kmacro-step-edit-appending t)
          (setq kmacro-step-edit-active 'append-end))
@@ -1314,7 +1320,8 @@ following additional answers: `insert', `insert-1', 
`replace', `replace-1',
       (setq this-command #'ignore))
      ((eq kmacro-step-edit-active 'append-end)
       (if (= executing-kbd-macro-index (length executing-kbd-macro))
-         (setq executing-kbd-macro (vconcat executing-kbd-macro [nil])
+         (setq executing-kbd-macro (vconcat executing-kbd-macro
+                                             [dummy-event])
                kmacro-step-edit-inserting t
                kmacro-step-edit-appending t
                kmacro-step-edit-active t)))
diff --git a/src/androidfns.c b/src/androidfns.c
index 0270f58b6b9..9e8372f524b 100644
--- a/src/androidfns.c
+++ b/src/androidfns.c
@@ -2410,11 +2410,16 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
   (void)
 {
 #ifdef ANDROID_STUBIFY
+  /* Fx_hide_tip is called from pre-command-hook (in turn called from
+     the tests.)  Since signaling here prevents any tests from being
+     run, refrain from protesting if this stub is called.  */
+#if 0
   error ("Android cross-compilation stub called!");
+#endif /* 0 */
   return Qnil;
-#else
+#else /* !ANDROID_STUBIFY */
   return android_hide_tip (true);
-#endif
+#endif /* ANDROID_STUBIFY */
 }
 
 DEFUN ("android-detect-mouse", Fandroid_detect_mouse,
diff --git a/src/fileio.c b/src/fileio.c
index b2186a027d4..4c00f1e5ff4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4177,11 +4177,18 @@ by calling `format-decode', which see.  */)
            replace = Qunbound;
        }
 
-      seekable = emacs_fd_lseek (fd, 0, SEEK_CUR) != (off_t) -1;
-      if (!NILP (beg) && !seekable)
+      /* Forbid specifying BEG together with a special file, as per
+        the doc string.  */
+
+      if (!NILP (beg))
        xsignal2 (Qfile_error,
                  build_string ("cannot use a start position in a non-seekable 
file/device"),
                  orig_filename);
+
+      /* Now ascertain if this file is seekable, by detecting if
+        seeking leads to -1 being returned.  */
+      seekable
+       = emacs_fd_lseek (fd, 0, SEEK_CUR) != (off_t) -1;
     }
 
   if (end_offset < 0)



reply via email to

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