emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 4d3442ebad5 2/2: Merge remote-tracking branch 'origin/ma


From: Po Lu
Subject: feature/android 4d3442ebad5 2/2: Merge remote-tracking branch 'origin/master' into feature/android
Date: Wed, 19 Jul 2023 21:23:30 -0400 (EDT)

branch: feature/android
commit 4d3442ebad5cb1e1005cd5eca7e91c95e767ed65
Merge: 882e1d659fe e2cc16fbd0d
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 doc/misc/erc.texi                               | 27 ++++---
 etc/ERC-NEWS                                    | 23 +++---
 lisp/emacs-lisp/comp.el                         | 48 ++++++++-----
 lisp/erc/erc-nicks.el                           |  6 ++
 lisp/erc/erc.el                                 |  4 +-
 src/fileio.c                                    |  4 +-
 src/xterm.c                                     | 95 ++++++++++++++++++++-----
 test/src/comp-resources/comp-test-funcs-dyn2.el | 31 ++++++++
 test/src/comp-tests.el                          |  7 +-
 9 files changed, 185 insertions(+), 60 deletions(-)

diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi
index 63ea94d9b2e..2e216629a1d 100644
--- a/doc/misc/erc.texi
+++ b/doc/misc/erc.texi
@@ -1218,15 +1218,14 @@ you aren't familiar with @samp{use-package} or have no 
interest in
 learning it.  For our purposes, it's just a means of presenting
 configuration details in a tidy, standardized format.  If it helps,
 just pretend it's some make-believe, pseudo configuration language.
-Although the syntax below is easy enough to intuit and adapt to your
-setup, you may wish to keep the following in mind (or @pxref{Top,,,
-use-package,}):
+And while the syntax below is easy enough to intuit and adapt to your
+setup, you may wish to keep the following in mind:
 
 @itemize @bullet
 @item
 Each @code{use-package} ``declaration'' focuses on a library
 ``feature'', which is just a symbol you'd normally @code{require} in
-your config @pxref{Named Features,,, elisp,}).
+your config.
 
 @item
 Emacs loads anything in a @code{:config} section @emph{after} loading
@@ -1235,6 +1234,10 @@ whatever library @code{provide}s the declaration's 
feature.
 @item
 Everything in a @code{:custom} or @code{:custom-face} section is
 basically something you'd find in your @code{custom-file}.
+
+@item
+For more info, @pxref{Named Features,,, elisp,}, or @pxref{Top,,,
+use-package,}.
 @end itemize
 
 @noindent
@@ -1300,12 +1303,12 @@ settings (@pxref{Sample configuration via Customize}).
 
 (use-package erc-goodies
   ;; Turn on read indicators when joining channels.
-  :hook (erc-join . my-erc-enable-read-indicator-on-join))
+  :hook (erc-join . my-erc-enable-keep-place-indicator-on-join))
 
 (defvar my-erc-read-indicator-channels '("#emacs")
   "Channels in which to show a `keep-place-indicator'.")
 
-(defun my-erc-enable-read-indicator-on-join ()
+(defun my-erc-enable-keep-place-indicator-on-join ()
   "Enable read indicators for certain queries or channels."
   (when (member (erc-default-target) my-erc-read-indicator-channels)
     (erc-keep-place-indicator-mode +1)))
@@ -1313,14 +1316,16 @@ settings (@pxref{Sample configuration via Customize}).
 ;; Handy commands from the Emacs Wiki.
 (defun erc-cmd-TRACK (&optional target)
   "Start tracking TARGET or that of current buffer."
-  (setq erc-track-exclude (delete (or target (erc-default-target))
-                                  erc-track-exclude)))
+  (setq erc-track-exclude
+        (delete (or target (erc-default-target) (current-buffer))
+                erc-track-exclude)))
 
 (defun erc-cmd-UNTRACK (&optional target)
   "Stop tracking TARGET or that of current buffer."
-  (setq erc-track-exclude (cl-pushnew (or target (erc-default-target))
-                                      erc-track-exclude
-                                      :test #'equal)))
+  (setq erc-track-exclude
+        (cl-pushnew (or target (erc-default-target) (current-buffer))
+                    erc-track-exclude
+                    :test #'equal)))
 
 @end lisp
 
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index cd0b8e5f823..4c881e32ab4 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -15,13 +15,14 @@ GNU Emacs since Emacs version 22.1.
 * Changes in ERC 5.6
 
 ** Module 'keep-place' has gained a more flamboyant cousin.
-Remember your place in ERC buffers a bit more easily while retaining
-the freedom to look around.  Optionally sync the indicator to any
-progress made when you haven't yet caught up to the live stream.  See
-options 'erc-keep-place-indicator-style' and friends, and try M-x
+Remember your place in ERC buffers more easily while retaining the
+freedom to look around, all with the help of a configurable, visible
+indicator.  Optionally sync the indicator to any progress made when
+you haven't yet caught up to the live stream.  See options
+'erc-keep-place-indicator-style' and friends, and try M-x
 keep-place-indicator-mode to see it in action.
 
-** Module 'fill' now offers a style based on 'visual-line-mode'.
+** Module 'fill' offers a style based on 'visual-line-mode'.
 This fill style mimics the "hanging indent" look of 'erc-fill-static'
 and provides some movement and editing commands to optionally tame the
 less familiar aspects of 'visual-line' behavior.  An interactive
@@ -29,7 +30,7 @@ helper called 'erc-fill-wrap-nudge' allows for dynamic 
"refilling" of
 buffers on the fly.  Set 'erc-fill-function' to 'erc-fill-wrap' to get
 started.
 
-** A new module for nickname highlighting has joined ERC.
+** A module for nickname highlighting has joined ERC.
 Automatic nickname coloring has come to ERC core.  Users familiar with
 'erc-hl-nicks', from which this module directly descends, will already
 be familiar with its suite of handy options.  By default, each
@@ -140,7 +141,7 @@ This is especially handy when using the option 
'erc-fill-wrap-merge'
 to omit repeated speaker tags, which can make message boundaries less
 detectable by tired eyes.
 
-** Some keybindings are now set by modules rather than their libraries.
+** Modules rather than their libraries set major-mode keybindings.
 To put it another way, simply loading a built-in module's library no
 longer modifies 'erc-mode-map'.  Instead, modifications occur during
 module setup.  This should not impact most user configs since ERC
@@ -149,7 +150,7 @@ previously created.  Note that while all affected bindings 
still
 reside in 'erc-mode-map', future built-in modules will use their own
 minor-mode maps, and new third-party modules should do the same.
 
-** The option 'erc-timestamp-format-right' has been deprecated.
+** Option 'erc-timestamp-format-right' deprecated.
 Having to account for this option prevented other ERC modules from
 easily determining what right-hand stamps would look like before
 insertion, which is knowledge needed for certain UI decisions.  The
@@ -270,7 +271,7 @@ encouraged to keep a module's name aligned with its group's 
as well as
 the provided feature of its containing library, if only for the usual
 reasons of namespace hygiene and discoverability.
 
-*** ERC now supports arbitrary CHANTYPES.
+*** ERC supports arbitrary CHANTYPES.
 Specifically, channels can be prefixed with any predesignated
 character, mainly to afford more flexibility to specialty services,
 like bridges to other protocols.
@@ -281,7 +282,7 @@ specify a subcommand to actually carry out anything of 
consequence.
 Built-in modules can now provide more detailed help for a particular
 subcommand by telling ERC to defer to a specialized handler.
 
-*** Longtime quasi modules have been made proper.
+*** Longtime quasi modules made proper.
 The 'fill' module is now defined by 'define-erc-module'.  The same
 goes for ERC's imenu integration, which has 'imenu' now appearing in
 the default value of 'erc-modules'.
@@ -299,7 +300,7 @@ third-party code, the key takeaway is that more 
'font-lock-face'
 properties encountered in the wild may be combinations of faces rather
 than lone ones.
 
-*** Prompt input is split before 'erc-pre-send-functions' has a say.
+*** Prompt input split before 'erc-pre-send-functions' gets a say.
 Hook members are now treated to input whose lines have already been
 adjusted to fall within the allowed length limit.  For convenience,
 third-party code can request that the final input be "re-filled" prior
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 4892733d456..b35e1b97e9d 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -1301,33 +1301,45 @@ clashes."
           (make-temp-file (comp-c-func-name function-name "freefn-")
                           nil ".eln")))
   (let* ((f (symbol-function function-name))
+         (byte-code (byte-compile function-name))
          (c-name (comp-c-func-name function-name "F"))
-         (func (make-comp-func-l :name function-name
-                                 :c-name c-name
-                                 :doc (documentation f t)
-                                 :int-spec (interactive-form f)
-                                 :command-modes (command-modes f)
-                                 :speed (comp-spill-speed function-name)
-                                 :pure (comp-spill-decl-spec function-name
-                                                             'pure))))
+         (func
+          (if (comp-lex-byte-func-p byte-code)
+              (make-comp-func-l :name function-name
+                                :c-name c-name
+                                :doc (documentation f t)
+                                :int-spec (interactive-form f)
+                                :command-modes (command-modes f)
+                                :speed (comp-spill-speed function-name)
+                                :pure (comp-spill-decl-spec function-name
+                                                            'pure))
+            (make-comp-func-d :name function-name
+                              :c-name c-name
+                              :doc (documentation f t)
+                              :int-spec (interactive-form f)
+                              :command-modes (command-modes f)
+                              :speed (comp-spill-speed function-name)
+                              :pure (comp-spill-decl-spec function-name
+                                                          'pure)))))
       (when (byte-code-function-p f)
         (signal 'native-compiler-error
                 '("can't native compile an already byte-compiled function")))
-      (setf (comp-func-byte-func func)
-            (byte-compile (comp-func-name func)))
+      (setf (comp-func-byte-func func) byte-code)
       (let ((lap (byte-to-native-lambda-lap
                   (gethash (aref (comp-func-byte-func func) 1)
                            byte-to-native-lambdas-h))))
         (cl-assert lap)
         (comp-log lap 2 t)
-        (let ((arg-list (aref (comp-func-byte-func func) 0)))
-          (setf (comp-func-l-args func)
-                (comp-decrypt-arg-list arg-list function-name)
-                (comp-func-lap func)
-                lap
-                (comp-func-frame-size func)
-                (comp-byte-frame-size (comp-func-byte-func func))))
-        (setf (comp-ctxt-top-level-forms comp-ctxt)
+        (if (comp-func-l-p func)
+            (let ((arg-list (aref (comp-func-byte-func func) 0)))
+              (setf (comp-func-l-args func)
+                    (comp-decrypt-arg-list arg-list function-name)))
+          (setf (comp-func-d-lambda-list func) (cadr f)))
+        (setf (comp-func-lap func)
+              lap
+              (comp-func-frame-size func)
+              (comp-byte-frame-size (comp-func-byte-func func))
+              (comp-ctxt-top-level-forms comp-ctxt)
               (list (make-byte-to-native-func-def :name function-name
                                                   :c-name c-name)))
         (comp-add-func-to-ctxt func))))
diff --git a/lisp/erc/erc-nicks.el b/lisp/erc/erc-nicks.el
index 3f753adc625..67f513f8d3e 100644
--- a/lisp/erc/erc-nicks.el
+++ b/lisp/erc/erc-nicks.el
@@ -480,6 +480,12 @@ Abandon search after examining LIMIT faces."
   "Uniquely colorize nicknames in target buffers."
   ((if erc--target
        (progn
+         (erc-with-server-buffer
+           (unless erc-nicks-mode
+             (erc--warn-once-before-connect 'erc-nicks-mode
+               "Module `nicks' must be enabled or disabled session-wide."
+               " Toggling it in individual target buffers is unsupported.")
+             (erc-nicks-mode +1))) ; but do it anyway
          (setq erc-nicks--downcased-skip-nicks
                (mapcar #'erc-downcase erc-nicks-skip-nicks))
          (add-function :filter-return (local 'erc-button--modify-nick-function)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 03c21059a92..eca6a90d706 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -6350,7 +6350,9 @@ This option mainly prevents text accidentally entered 
into Emacs
 from being sent to the server.  Offending sources include
 terminal multiplexers, desktop-automation scripts, and anything
 capable of rapidly submitting successive lines of prompt input.
-For example, entering \"one\\ntwo\\nthree\\n\" will send \"one\"
+For example, if you could somehow manage to type \"one \\`RET'
+two \\`RET' three \\`RET'\" at the prompt in less than
+`erc-accidental-paste-threshold-seconds', ERC would send \"one\"
 to the server, leave \"two\" at the prompt, and insert \"three\"
 into an \"overflow\" buffer.  See `erc-inhibit-multiline-input'
 and `erc-warn-about-blank-lines' for suppression involving input
diff --git a/src/fileio.c b/src/fileio.c
index 67a34d8415d..d24f25c2e06 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2644,7 +2644,7 @@ internal_delete_file (Lisp_Object filename)
 #endif
 
 /* Return -1 if FILE is a case-insensitive file name, 0 if not,
-   and a positive errno value if the result cannot be determined.  */
+   and 1 if the result cannot be determined.  */
 
 static int
 file_name_case_insensitive_err (Lisp_Object file)
@@ -2678,7 +2678,7 @@ file_name_case_insensitive_err (Lisp_Object file)
     return - (res == 0);
 # endif
   if (errno != EINVAL)
-    return errno;
+    return 1;
 #endif
 
 #if defined CYGWIN || defined DOS_NT
diff --git a/src/xterm.c b/src/xterm.c
index 1865324d87a..f454733c659 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5497,12 +5497,24 @@ xi_populate_device_from_info (struct x_display_info 
*dpyinfo,
      no input.
 
      The device attachment is a device ID whose meaning varies
-     depending on the device use.  If the device is a master device,
-     then the attachment is the device ID of the other device in its
-     seat (the master keyboard for master pointer devices, and vice
-     versa).  Otherwise, it is the ID of the master device the slave
+     depending on the device's use.  If a device is a master device,
+     then its attachment is the device ID of the other device in its
+     seat (the master keyboard for master pointer devices and vice
+     versa.)  Otherwise, it is the ID of the master device the slave
      device is attached to.  For slave devices not attached to any
-     seat, its value is undefined.  */
+     seat, its value is undefined.
+
+     Emacs receives ordinary pointer and keyboard events from the
+     master devices associated with each seat, discarding events from
+     slave devices.  However, multiplexing events from touch devices
+     onto a master device poses problems: if both dependent and direct
+     touch devices are attached to the same master pointer device, the
+     coordinate space of touch events sent from that seat becomes
+     ambiguous.  In addition, the X server does not send TouchEnd
+     events to cancel ongoing touch sequences if the slave device that
+     is their source is detached.  As a result of these ambiguities,
+     touch events are processed from and recorded onto their slave
+     devices instead.  */
 
   xi_device->device_id = device->deviceid;
   xi_device->grab = 0;
@@ -5516,7 +5528,7 @@ xi_populate_device_from_info (struct x_display_info 
*dpyinfo,
 #ifdef HAVE_XINPUT2_2
   xi_device->touchpoints = NULL;
   xi_device->direct_p = false;
-#endif
+#endif /* HAVE_XINPUT2_1 */
 
 #ifdef HAVE_XINPUT2_1
   if (!dpyinfo->xi2_version)
@@ -5582,9 +5594,34 @@ xi_populate_device_from_info (struct x_display_info 
*dpyinfo,
        case XITouchClass:
          {
            touch_info = (XITouchClassInfo *) device->classes[c];
-           xi_device->direct_p = touch_info->mode == XIDirectTouch;
+
+           /* touch_info->mode indicates the coordinate space that
+              this device reports in its touch events.
+
+              DirectTouch means that the device uses a coordinate
+              space that corresponds to locations on the screen.  It
+              is set by touch screen devices which are overlaid
+              over the raster itself.
+
+              The other value (DependentTouch) means that the device
+              uses a separate abstract coordinate space corresponding
+              to its own surface.  Emacs ignores events from these
+              devices because it does not support recognizing touch
+              gestures from surfaces other than the screen.
+
+              Master devices may report multiple touch classes for
+              attached slave devices, leaving the nature of touch
+              events they send ambiguous.  The problem of
+              discriminating between these events is bypassed
+              entirely through only processing touch events from the
+              slave devices where they originate.  */
+
+           if (touch_info->mode == XIDirectTouch)
+             xi_device->direct_p = true;
+           else
+             xi_device->direct_p = false;
          }
-#endif
+#endif /* HAVE_XINPUT2_2 */
        default:
          break;
        }
@@ -5611,7 +5648,7 @@ xi_populate_device_from_info (struct x_display_info 
*dpyinfo,
     }
 
   SAFE_FREE ();
-#endif
+#endif /* HAVE_XINPUT2_1 */
 }
 
 /* Populate our client-side record of all devices, which includes
@@ -13443,7 +13480,7 @@ xi_handle_new_classes (struct x_display_info *dpyinfo, 
struct xi_device_t *devic
   device->scroll_valuator_count = 0;
 #ifdef HAVE_XINPUT2_2
   device->direct_p = false;
-#endif
+#endif /* HAVE_XINPUT2_2 */
 
   for (i = 0; i < num_classes; ++i)
     {
@@ -13461,10 +13498,34 @@ xi_handle_new_classes (struct x_display_info 
*dpyinfo, struct xi_device_t *devic
        case XITouchClass:
          touch = (XITouchClassInfo *) classes[i];
 
+         /* touch_info->mode indicates the coordinate space that this
+            device reports in its touch events.
+
+            DirectTouch means that the device uses a coordinate space
+            that corresponds to locations on the screen.  It is set
+            by touch screen devices which are overlaid over the
+            raster itself.
+
+            The other value (DependentTouch) means that the device
+            uses a separate abstract coordinate space corresponding
+            to its own surface.  Emacs ignores events from these
+            devices because it does not support recognizing touch
+            gestures from surfaces other than the screen.
+
+            Master devices may report multiple touch classes for
+            attached slave devices, leaving the nature of touch
+            events they send ambiguous.  The problem of
+            discriminating between these events is bypassed entirely
+            through only processing touch events from the slave
+            devices where they originate.  */
+
          if (touch->mode == XIDirectTouch)
            device->direct_p = true;
+         else
+           device->direct_p = false;
+
          break;
-#endif
+#endif /* HAVE_XINPUT2_2 */
        }
     }
 
@@ -13502,7 +13563,7 @@ xi_handle_new_classes (struct x_display_info *dpyinfo, 
struct xi_device_t *devic
     }
 }
 
-#endif
+#endif /* HAVE_XINPUT2_1 */
 
 /* Handle EVENT, a DeviceChanged event.  Look up the device that
    changed, and update its information with the data in EVENT.  */
@@ -32250,10 +32311,12 @@ reported as iconified.  */);
 
   DEFVAR_BOOL ("x-input-grab-touch-events", x_input_grab_touch_events,
               doc: /* Non-nil means to actively grab touch events.
-This means touch sequences that started on an Emacs frame will
-reliably continue to receive updates even if the finger moves off the
-frame, but may cause crashes with some window managers and/or external
-programs.  */);
+This means touch sequences that are obtained through a passive grab on
+an Emacs frame (or a parent window of such a frame) will reliably
+continue to receive updates, but may cause crashes with some window
+managers and/or external programs.  Changing this option is only
+useful when other programs are making their own X requests pertaining
+to the window hierarchy of an Emacs frame.  */);
   x_input_grab_touch_events = true;
 
   DEFVAR_BOOL ("x-dnd-fix-motif-leave", x_dnd_fix_motif_leave,
diff --git a/test/src/comp-resources/comp-test-funcs-dyn2.el 
b/test/src/comp-resources/comp-test-funcs-dyn2.el
new file mode 100644
index 00000000000..3d70489d1ca
--- /dev/null
+++ b/test/src/comp-resources/comp-test-funcs-dyn2.el
@@ -0,0 +1,31 @@
+;;; comp-test-funcs-dyn2.el -*- lexical-binding: nil; no-byte-compile: t; -*-
+
+;; Copyright (C) 2023 Free Software Foundation, Inc.
+
+;; Author: Alan Mackenzie <acm@muc.de>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; Test the compilation of a function under dynamic binding.
+
+;;; Code:
+
+(defun comp-tests-result-lambda ()
+  (lambda (bar) (car bar)))
+
+(provide 'comp-test-funcs-dyn2)
+;;; comp-test-funcs-dyn2.el ends here.
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index ce7899d9d4c..30dfd669ded 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -33,7 +33,8 @@
 
 (eval-and-compile
   (defconst comp-test-src (ert-resource-file "comp-test-funcs.el"))
-  (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el")))
+  (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el"))
+  (defconst comp-test-dyn-src2 (ert-resource-file "comp-test-funcs-dyn2.el")))
 
 (when (native-comp-available-p)
   (message "Compiling tests...")
@@ -44,6 +45,7 @@
 ;; names used in this file.
 (require 'comp-test-funcs comp-test-src)
 (require 'comp-test-dyn-funcs comp-test-dyn-src) ;Non-standard feature name!
+(require 'comp-test-funcs-dyn2 comp-test-dyn-src2)
 
 (defmacro comp-deftest (name args &rest docstring-and-body)
   "Define a test for the native compiler tagging it as :nativecomp."
@@ -1528,4 +1530,7 @@ folded."
           (equal (comp-mvar-typeset mvar)
                  comp-tests-cond-rw-expected-type))))))))
 
+(ert-deftest comp-tests-result-lambda ()
+  (native-compile 'comp-tests-result-lambda)
+  (should (eq (funcall (comp-tests-result-lambda) '(a . b)) 'a)))
 ;;; comp-tests.el ends here



reply via email to

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