commit fb5e43040fed987418e8855c677aa44e36f67e33 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Wed Jul 19 07:03:12 2023 +0000 Port file-name-case-insensitive-p to Haiku * src/fileio.c (file_name_case_insensitive_err): Don't return errno upon failure, just 1, since errno is not used in the sole caller. diff --git a/src/fileio.c b/src/fileio.c index 0a967a6631f..663d89b9dfc 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2525,7 +2525,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) @@ -2559,7 +2559,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 commit 8b1c92da79f967172afc3214bc9ee58bd08ddc17 Author: Po Lu Date: Wed Jul 19 13:51:41 2023 +0800 Improve commentary in xterm.c * src/xterm.c (xi_populate_device_from_info, xi_handle_new_classes) (syms_of_xterm): Improve commentary on touch events. diff --git a/src/xterm.c b/src/xterm.c index 645aa76513c..61b9d972e57 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. */ @@ -32189,10 +32250,12 @@ syms_of_xterm (void) 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, commit a4087f59558ae29f6dacaa6550eb4326912fe65e Author: Po Lu Date: Wed Jul 19 08:21:43 2023 +0800 Improve reliability of minor mode menu dispatch * lisp/mouse.el (minor-mode-menu-from-indicator): Instead of using the word at point, search for a matching enabled minor mode from the beginning of the string object when mode-line-compact is enabled. diff --git a/lisp/mouse.el b/lisp/mouse.el index 1e1f0808f9f..661980f4ac2 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -220,22 +220,44 @@ minor-mode-menu-from-indicator (list (completing-read "Minor mode indicator: " (describe-minor-mode-completion-table-for-indicator)))) - ;; If INDICATOR is a string object and `mode-line-compact' might be - ;; enabled, look for the word at its position and use that instead. - (when (and (consp indicator) - window - (with-selected-window window - mode-line-compact)) - (with-temp-buffer - (insert (car indicator)) - (goto-char (cdr indicator)) - (if-let ((thing (thing-at-point 'word))) - (setq indicator thing) - (setq indicator (car indicator))))) + ;; If INDICATOR is a string object, WINDOW is set, and + ;; `mode-line-compact' might be enabled, find a string in + ;; `minor-mode-alist' that is present within the INDICATOR and whose + ;; extents within INDICATOR contain the position of the object + ;; within the string. + (when window + (catch 'found + (with-selected-window window + (let ((alist minor-mode-alist) string position) + (when (and (consp indicator) mode-line-compact) + (with-temp-buffer + (insert (car indicator)) + (dolist (menu alist) + ;; If this is a valid minor mode menu entry, + (when (and (consp menu) + (setq string (format-mode-line (cadr menu) + nil window)) + (> (length string) 0)) + ;; Start searching for an appearance of (cdr menu). + (goto-char (point-min)) + (while (search-forward string nil 0) + ;; If the position of the string object is + ;; contained within, set indicator to the minor + ;; mode in question. + (setq position (1+ (cdr indicator))) + (and (>= position (match-beginning 0)) + (<= position (match-end 0)) + (setq indicator (car menu)) + (throw 'found nil))))))))))) ;; If INDICATOR is still a cons, use its car. (when (consp indicator) (setq indicator (car indicator))) - (let* ((minor-mode (lookup-minor-mode-from-indicator indicator)) + (let* ((minor-mode (if (symbolp indicator) + ;; indicator being set to a symbol means that + ;; the loop above has already found a + ;; matching minor mode. + indicator + (lookup-minor-mode-from-indicator indicator))) (mm-fun (or (get minor-mode :minor-mode-function) minor-mode))) (unless minor-mode (error "Cannot find minor mode for `%s'" indicator)) (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist))) commit dec15620d8c79d41808de9a5cbf6ad08f7399212 Author: Jim Porter Date: Tue Jul 18 14:07:03 2023 -0700 ; * etc/NEWS (Eshell): Fix typo. diff --git a/etc/NEWS b/etc/NEWS index c50f560282a..3117e907125 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -212,7 +212,7 @@ Eshell manual. +++ *** Eshell commands can now be explicitly-remote (or local). By prefixing a command name in Eshell with a remote identifier, like -"/ssh:user@remote:whoami", you can now runs commands on a particular +"/ssh:user@remote:whoami", you can now run commands on a particular host no matter your current directory. Likewise, you can run a command on your local system no matter your current directory via "/:whoami". For more information, see the "(eshell) Remote Access" commit f624b283bfcea8ab11ff4cf327d2999daf0d66d2 Author: Eli Zaretskii Date: Tue Jul 18 21:06:30 2023 +0300 Fix line number display under 'mode-line-format-right-align' * src/xdisp.c (Fbuffer_text_pixel_size): Restore window attributes important for redisplay of the target WINDOW. (Bug#64713) diff --git a/src/xdisp.c b/src/xdisp.c index 5d94dc003f3..3728228c6de 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11651,6 +11651,8 @@ DEFUN ("buffer-text-pixel-size", Fbuffer_text_pixel_size, Sbuffer_text_pixel_siz set_buffer_internal_1 (b); + ptrdiff_t base_line_pos = w->base_line_pos; + int end_valid = w->window_end_valid; if (!EQ (buffer, w->contents)) { wset_buffer (w, buffer); @@ -11663,6 +11665,11 @@ DEFUN ("buffer-text-pixel-size", Fbuffer_text_pixel_size, Sbuffer_text_pixel_siz unbind_to (count, Qnil); + /* Restore original values. This is important if this function is + called from some ':eval' form in the middle of redisplay. */ + w->base_line_pos = base_line_pos; + w->window_end_valid = end_valid; + return value; } commit 607f826edd49cf771bd97d222d223ebda3dedea3 Author: Po Lu Date: Tue Jul 18 21:26:05 2023 +0800 Fix event data leak * src/xterm.c (handle_one_xevent): Jump to XI_OTHER after handling touch ownership event. diff --git a/src/xterm.c b/src/xterm.c index 130a2c93b64..645aa76513c 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -24467,6 +24467,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, /* As a result, Emacs should complete whatever editing operations result from this touch sequence. */ touchpoint->ownership = TOUCH_OWNERSHIP_SELF; + + goto XI_OTHER; } case XI_TouchUpdate: commit c4f8ead08d12d1f82224e9af60482329771e254a Author: Po Lu Date: Tue Jul 18 16:15:05 2023 +0800 Fix display of minor mode menus when mode-line-compact is enabled * lisp/mouse.el (minor-mode-menu-from-indicator): New arg WINDOW. If INDICATOR is a string object and mode-line-compat is enabled within WINDOW, use the symbol within the object at its position instead. (mouse-minor-mode-menu): Pass posn-object and posn-window to minor-mode-menu-from-indicator. diff --git a/lisp/mouse.el b/lisp/mouse.el index 3c30361ad7d..1e1f0808f9f 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -206,8 +206,13 @@ mouse-double-click-time ;; Provide a mode-specific menu on a mouse button. -(defun minor-mode-menu-from-indicator (indicator) +(defun minor-mode-menu-from-indicator (indicator &optional window) "Show menu for minor mode specified by INDICATOR. + +INDICATOR is either a string object returned by `posn-object' or +the car of such an object. WINDOW may be the window whose mode +line is being displayed. + Interactively, INDICATOR is read using completion. If there is no menu defined for the minor mode, then create one with items `Turn Off' and `Help'." @@ -215,6 +220,21 @@ minor-mode-menu-from-indicator (list (completing-read "Minor mode indicator: " (describe-minor-mode-completion-table-for-indicator)))) + ;; If INDICATOR is a string object and `mode-line-compact' might be + ;; enabled, look for the word at its position and use that instead. + (when (and (consp indicator) + window + (with-selected-window window + mode-line-compact)) + (with-temp-buffer + (insert (car indicator)) + (goto-char (cdr indicator)) + (if-let ((thing (thing-at-point 'word))) + (setq indicator thing) + (setq indicator (car indicator))))) + ;; If INDICATOR is still a cons, use its car. + (when (consp indicator) + (setq indicator (car indicator))) (let* ((minor-mode (lookup-minor-mode-from-indicator indicator)) (mm-fun (or (get minor-mode :minor-mode-function) minor-mode))) (unless minor-mode (error "Cannot find minor mode for `%s'" indicator)) @@ -240,8 +260,10 @@ minor-mode-menu-from-indicator (defun mouse-minor-mode-menu (event) "Show minor-mode menu for EVENT on minor modes area of the mode line." (interactive "@e") - (let ((indicator (car (nth 4 (car (cdr event)))))) - (minor-mode-menu-from-indicator indicator))) + (let* ((posn (event-start event)) + (indicator (posn-object posn)) + (window (posn-window posn))) + (minor-mode-menu-from-indicator indicator window))) (defun mouse-menu-major-mode-map () (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)