commit 66899628f8a8c79ca8dfe32094f11a8320630fae (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Mon Feb 28 14:35:01 2022 +0800 Better fix for bug#13476 * lisp/faces.el (face-spec-recalc): Apply scroll bar foreground and background to the frame if changing the scroll-bar face. (scroll-bar): Restore previous declaration. That way, the default colors are used for toolkit scroll bars, instead of black and white. diff --git a/lisp/faces.el b/lisp/faces.el index 76da210280..4b582ac439 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1743,7 +1743,14 @@ The following sources are applied in this order: (and tail (face-spec-set-2 face frame (list :extend (cadr tail)))))) (setq face-attrs (face-spec-choose (get face 'face-override-spec) frame)) - (face-spec-set-2 face frame face-attrs))) + (face-spec-set-2 face frame face-attrs) + (when (and (fboundp 'set-frame-parameter) ; This isn't available + ; during loadup. + (eq face 'scroll-bar)) + ;; Set the `scroll-bar-foreground' and `scroll-bar-background' + ;; frame parameters. (bug#13476) + (set-frame-parameter frame 'scroll-bar-foreground (face-foreground face)) + (set-frame-parameter frame 'scroll-bar-background (face-background face))))) (defun face-spec-set-2 (face frame face-attrs) "Set the face attributes of FACE on FRAME according to FACE-ATTRS. @@ -2826,11 +2833,9 @@ used to display the prompt text." :group 'frames :group 'basic-faces) -(defface scroll-bar - '((((background light)) :foreground "black") - (((background dark)) :foreground "white")) +(defface scroll-bar '((t nil)) "Basic face for the scroll bar colors under X." - :version "28.1" + :version "21.1" :group 'frames :group 'basic-faces) commit f995169c7267683c89ccb2317dca41ab69bad0e6 Author: Po Lu Date: Mon Feb 28 14:04:23 2022 +0800 Improve treatment of toolkit scroll bars with the input extension * src/xterm.c (x_create_horizontal_toolkit_scroll_bar) (x_create_toolkit_scroll_bar): Set XI2 event mask appropriately. (handle_one_xevent): Make sure coordinates are correct for the frame's window when handling wheel events. diff --git a/src/xterm.c b/src/xterm.c index 520de5fcf0..be499f3e26 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7666,6 +7666,30 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) XDefineCursor (XtDisplay (widget), XtWindow (widget), f->output_data.x->nontext_cursor); +#ifdef HAVE_XINPUT2 + /* Ask for input extension button and motion events. This lets us + send the proper `wheel-up' or `wheel-down' events to Emacs. */ + if (FRAME_DISPLAY_INFO (f)->supports_xi2) + { + XIEventMask mask; + ptrdiff_t l = XIMaskLen (XI_LASTEVENT); + unsigned char *m; + + mask.mask = m = alloca (l); + memset (m, 0, l); + mask.mask_len = l; + + mask.deviceid = XIAllMasterDevices; + XISetMask (m, XI_ButtonPress); + XISetMask (m, XI_ButtonRelease); + XISetMask (m, XI_Motion); + XISetMask (m, XI_Enter); + XISetMask (m, XI_Leave); + + XISelectEvents (XtDisplay (widget), XtWindow (widget), + &mask, 1); + } +#endif #else /* !USE_MOTIF i.e. use Xaw */ /* Set resources. Create the widget. The background of the @@ -7867,6 +7891,30 @@ x_create_horizontal_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar) XDefineCursor (XtDisplay (widget), XtWindow (widget), f->output_data.x->nontext_cursor); +#ifdef HAVE_XINPUT2 + /* Ask for input extension button and motion events. This lets us + send the proper `wheel-up' or `wheel-down' events to Emacs. */ + if (FRAME_DISPLAY_INFO (f)->supports_xi2) + { + XIEventMask mask; + ptrdiff_t l = XIMaskLen (XI_LASTEVENT); + unsigned char *m; + + mask.mask = m = alloca (l); + memset (m, 0, l); + mask.mask_len = l; + + mask.deviceid = XIAllMasterDevices; + XISetMask (m, XI_ButtonPress); + XISetMask (m, XI_ButtonRelease); + XISetMask (m, XI_Motion); + XISetMask (m, XI_Enter); + XISetMask (m, XI_Leave); + + XISelectEvents (XtDisplay (widget), XtWindow (widget), + &mask, 1); + } +#endif #else /* !USE_MOTIF i.e. use Xaw */ /* Set resources. Create the widget. The background of the @@ -11465,6 +11513,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, double total_x = 0.0; double total_y = 0.0; + int real_x, real_y; + Window dummy; + for (int i = 0; i < states->mask_len * 8; i++) { if (XIMaskIsSet (states->mask, i)) @@ -11489,7 +11540,31 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = x_any_window_to_frame (dpyinfo, xev->event); if (!f) - goto XI_OTHER; + { +#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS + struct scroll_bar *bar + = x_window_to_scroll_bar (xi_event->display, + xev->event, 2); + + if (bar) + f = WINDOW_XFRAME (XWINDOW (bar->window)); + + if (!f) +#endif + goto XI_OTHER; + } + } + + if (FRAME_X_WINDOW (f) != xev->event) + XTranslateCoordinates (dpyinfo->display, + xev->event, FRAME_X_WINDOW (f), + lrint (xev->event_x), + lrint (xev->event_y), + &real_x, &real_y, &dummy); + else + { + real_x = lrint (xev->event_x); + real_y = lrint (xev->event_y); } #ifdef HAVE_XWIDGETS @@ -11518,8 +11593,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, && (fabs (delta) > 0)) continue; - window = window_from_coordinates (f, xev->event_x, - xev->event_y, NULL, + window = window_from_coordinates (f, real_x, real_y, NULL, false, false); if (WINDOWP (window)) @@ -11587,8 +11661,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, ? WHEEL_EVENT : HORIZ_WHEEL_EVENT); inev.ie.timestamp = xev->time; - XSETINT (inev.ie.x, lrint (xev->event_x)); - XSETINT (inev.ie.y, lrint (xev->event_y)); + XSETINT (inev.ie.x, lrint (real_x)); + XSETINT (inev.ie.y, lrint (real_y)); XSETFRAME (inev.ie.frame_or_window, f); inev.ie.modifiers = (signbit (fabs (total_y) >= fabs (total_x) @@ -11611,8 +11685,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, inev.ie.kind = TOUCH_END_EVENT; inev.ie.timestamp = xev->time; - XSETINT (inev.ie.x, lrint (xev->event_x)); - XSETINT (inev.ie.y, lrint (xev->event_y)); + XSETINT (inev.ie.x, lrint (real_x)); + XSETINT (inev.ie.y, lrint (real_y)); XSETFRAME (inev.ie.frame_or_window, f); } @@ -11644,6 +11718,17 @@ handle_one_xevent (struct x_display_info *dpyinfo, copy.xmotion.x_root = lrint (xev->root_x); copy.xmotion.y_root = lrint (xev->root_y); copy.xmotion.state = 0; + + if (xev->buttons.mask_len) + { + if (XIMaskIsSet (xev->buttons.mask, 1)) + copy.xmotion.state |= Button1Mask; + if (XIMaskIsSet (xev->buttons.mask, 2)) + copy.xmotion.state |= Button2Mask; + if (XIMaskIsSet (xev->buttons.mask, 3)) + copy.xmotion.state |= Button3Mask; + } + copy.xmotion.is_hint = False; copy.xmotion.same_screen = True; #endif @@ -11743,6 +11828,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, struct xwidget_view *xvw; #endif +#ifdef HAVE_XINPUT2_1 + /* Ignore emulated scroll events when XI2 native + scroll events are present. */ + if (xev->flags & XIPointerEmulated) + { + *finish = X_EVENT_DROP; + goto XI_OTHER; + } +#endif + #ifdef USE_MOTIF use_copy = true; copy.xbutton.type = (xev->evtype == XI_ButtonPress @@ -11773,16 +11868,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, } #endif -#ifdef HAVE_XINPUT2_1 - /* Ignore emulated scroll events when XI2 native - scroll events are present. */ - if (xev->flags & XIPointerEmulated) - { - *finish = X_EVENT_DROP; - goto XI_OTHER; - } -#endif - if (xev->evtype == XI_ButtonPress) x_display_set_last_user_time (dpyinfo, xev->time); commit 1de7382b574ff9f40319d7a075d952cb944f96ca Merge: 0f3ce51a0d e77fc8262a Author: Stefan Kangas Date: Mon Feb 28 06:33:06 2022 +0100 Merge from origin/emacs-28 e77fc8262a Update to Org 9.5.2-22-g33543d 9bce4b67f1 ; * lisp/help.el (with-help-window): Doc fix. (Bug#54170) 558b03a958 Add explicit '--no-heading' for ripgrep commit e77fc8262ad73f30b1983f403262dce6f0e4cb09 (refs/remotes/origin/emacs-28) Author: Kyle Meyer Date: Mon Feb 28 00:11:01 2022 -0500 Update to Org 9.5.2-22-g33543d diff --git a/lisp/org/oc-basic.el b/lisp/org/oc-basic.el index d82406affb..81b7e4471f 100644 --- a/lisp/org/oc-basic.el +++ b/lisp/org/oc-basic.el @@ -178,21 +178,29 @@ Return a hash table with citation references as keys and fields alist as values. " and "))) ('issued ;; Date are expressed as an array - ;; (`date-parts') or a "string (`raw'). - ;; In both cases, extract the year and - ;; associate it to `year' field, for - ;; compatibility with BibTeX format. + ;; (`date-parts') or a "string (`raw' + ;; or `literal'). In both cases, + ;; extract the year and associate it + ;; to `year' field, for compatibility + ;; with BibTeX format. (let ((date (or (alist-get 'date-parts value) + (alist-get 'literal value) (alist-get 'raw value)))) (cons 'year (cond ((consp date) (caar date)) ((stringp date) - (car (split-string date "-"))) + (replace-regexp-in-string + (rx + (minimal-match (zero-or-more anything)) + (group-n 1 (repeat 4 digit)) + (zero-or-more anything)) + (rx (backref 1)) + date)) (t (error "Unknown CSL-JSON date format: %S" - date)))))) + value)))))) (_ (cons field value)))) item) diff --git a/lisp/org/ol.el b/lisp/org/ol.el index 2cba33ed95..a03d85f618 100644 --- a/lisp/org/ol.el +++ b/lisp/org/ol.el @@ -183,7 +183,7 @@ link. (defcustom org-link-descriptive t "Non-nil means Org displays descriptive links. -E.g. [[https://orgmode.org][Org website]] is be displayed as +E.g. [[https://orgmode.org][Org website]] is displayed as \"Org Website\", hiding the link itself and just displaying its description. When set to nil, Org displays the full links literally. diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 6a2aa8ca5b..badf0e4769 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made." (defun org-git-version () "The Git version of Org mode. Inserted by installing Org or when a release is made." - (let ((org-git-version "release_9.5.2-17-gea6b74")) + (let ((org-git-version "release_9.5.2-22-g33543d")) org-git-version)) (provide 'org-version) diff --git a/lisp/org/org.el b/lisp/org/org.el index 7ea8d65f3b..d656a51591 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -17522,11 +17522,11 @@ this numeric value." (interactive "r") (let ((result "")) (while (/= beg end) - (when (get-char-property beg 'invisible) - (setq beg (next-single-char-property-change beg 'invisible nil end))) - (let ((next (next-single-char-property-change beg 'invisible nil end))) - (setq result (concat result (buffer-substring beg next))) - (setq beg next))) + (if (invisible-p beg) + (setq beg (next-single-char-property-change beg 'invisible nil end)) + (let ((next (next-single-char-property-change beg 'invisible nil end))) + (setq result (concat result (buffer-substring beg next))) + (setq beg next)))) (setq deactivate-mark t) (kill-new result) (message "Visible strings have been copied to the kill ring."))) commit 0f3ce51a0d5f2aabad3d3aeb3d86d52b152deef0 Author: Po Lu Date: Mon Feb 28 09:40:01 2022 +0800 Don't save menu bar events that land on the menu bar itself * src/xterm.c (handle_one_xevent): Ignore menu bar events which land on the menu bar itself instead of a button. diff --git a/src/xterm.c b/src/xterm.c index 2656b30472..520de5fcf0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11112,12 +11112,26 @@ handle_one_xevent (struct x_display_info *dpyinfo, && event->xbutton.y < FRAME_MENUBAR_HEIGHT (f) && event->xbutton.same_screen) { - if (!f->output_data.x->saved_menu_event) - f->output_data.x->saved_menu_event = xmalloc (sizeof *event); - *f->output_data.x->saved_menu_event = *event; - inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; - XSETFRAME (inev.ie.frame_or_window, f); - *finish = X_EVENT_DROP; +#ifdef USE_MOTIF + unsigned char column_type; + Widget widget; + + widget = XtWindowToWidget (dpyinfo->display, + event->xbutton.window); + XtVaGetValues (widget, XmNrowColumnType, &column_type, NULL); + + if (column_type != XmMENU_BAR) + { +#endif + if (!f->output_data.x->saved_menu_event) + f->output_data.x->saved_menu_event = xmalloc (sizeof *event); + *f->output_data.x->saved_menu_event = *event; + inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; + XSETFRAME (inev.ie.frame_or_window, f); + *finish = X_EVENT_DROP; +#ifdef USE_MOTIF + } +#endif } else goto OTHER; commit 0470ef007f268f19cad8c0c786559453c38fdde3 Author: Po Lu Date: Mon Feb 28 01:16:17 2022 +0000 Treat scroll bar information consistently on Haiku * src/haiku_support.cc (class EmacsScrollBar): New field `info'. (EmacsScrollBar): Obtain scroll bar info on initialization. (ButtonRegionFor): Use that information instead. diff --git a/src/haiku_support.cc b/src/haiku_support.cc index 12990b3378..20d04163fc 100644 --- a/src/haiku_support.cc +++ b/src/haiku_support.cc @@ -1561,6 +1561,7 @@ class EmacsScrollBar : public BScrollBar bool horizontal; enum haiku_scroll_bar_part current_part; float old_value; + scroll_bar_info info; EmacsScrollBar (int x, int y, int x1, int y1, bool horizontal_p) : BScrollBar (BRect (x, y, x1, y1), NULL, NULL, 0, 0, horizontal_p ? @@ -1569,6 +1570,7 @@ class EmacsScrollBar : public BScrollBar BView *vw = (BView *) this; vw->SetResizingMode (B_FOLLOW_NONE); horizontal = horizontal_p; + get_scroll_bar_info (&info); } void @@ -1624,9 +1626,6 @@ class EmacsScrollBar : public BScrollBar BRect bounds; BRect rect; float button_size; - scroll_bar_info info; - - get_scroll_bar_info (&info); bounds = Bounds (); bounds.InsetBy (0.0, 0.0); commit 9bce4b67f1770e288a16b44478f1a6dfdc1fc177 Author: Eli Zaretskii Date: Sun Feb 27 15:54:27 2022 +0200 ; * lisp/help.el (with-help-window): Doc fix. (Bug#54170) diff --git a/lisp/help.el b/lisp/help.el index 55fc61172d..fd331ac0d4 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1803,8 +1803,8 @@ Return VALUE." ;; window to an arbitrary buffer position. (defmacro with-help-window (buffer-or-name &rest body) "Evaluate BODY, send output to BUFFER-OR-NAME and show in a help window. -This construct is like `with-temp-buffer-window' but unlike that -puts the buffer specified by BUFFER-OR-NAME in `help-mode' and +This construct is like `with-temp-buffer-window', which see, but unlike +that, it puts the buffer specified by BUFFER-OR-NAME in `help-mode' and displays a message about how to delete the help window when it's no longer needed. The help window will be selected if `help-window-select' is non-nil. commit 6a10a3e8d489d7b4dcffd6b4c63cee77e73e2535 Author: Lars Ingebrigtsen Date: Sun Feb 27 14:32:38 2022 +0100 Merge from gnulib * m4/gnulib-common.m4 (gl_COMMON_BODY): * lib/gnulib.mk.in (CXXCPP): * lib/cdefs.h: Updated with admin/merge-gnulib. (This is in preparation to adding the nanosleep module later.) diff --git a/lib/cdefs.h b/lib/cdefs.h index 44d3826bca..cb2514504f 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -41,7 +41,9 @@ Similarly for __has_builtin, etc. */ #if (defined __has_attribute \ && (!defined __clang_minor__ \ - || 3 < __clang_major__ + (5 <= __clang_minor__))) + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))) # define __glibc_has_attribute(attr) __has_attribute (attr) #else # define __glibc_has_attribute(attr) 0 diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 6b90a80f64..3a9f5b9818 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -207,7 +207,6 @@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CRYPTOLIB = @CRYPTOLIB@ CXX = @CXX@ -CXXCPP = @CXXCPP@ CXXFLAGS = @CXXFLAGS@ CYGWIN_OBJ = @CYGWIN_OBJ@ C_SWITCH_MACHINE = @C_SWITCH_MACHINE@ diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index dbc4079614..c5ced04f18 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -69,7 +69,9 @@ AC_DEFUN([gl_COMMON_BODY], [ [/* Attributes. */ #if (defined __has_attribute \ && (!defined __clang_minor__ \ - || 3 < __clang_major__ + (5 <= __clang_minor__))) + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))) # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) #else # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr commit 558b03a958839a53bac761b20c800b6b6cf43468 Author: Dmitry Gutov Date: Sun Feb 27 15:28:04 2022 +0200 Add explicit '--no-heading' for ripgrep * lisp/progmodes/xref.el (xref-search-program-alist): Add explicit '--no-heading' for ripgrep (bug#54177). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 0ee7dd5cad..2fd5e19237 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1626,7 +1626,7 @@ IGNORES is a list of glob patterns for files to ignore." (ripgrep . ;; '!*/' is there to filter out dirs (e.g. submodules). - "xargs -0 rg --null -nH --no-messages -g '!*/' -e " + "xargs -0 rg --null -nH --no-heading --no-messages -g '!*/' -e " )) "Associative list mapping program identifiers to command templates. commit 704a40ad75fd01d7efafbb9db7b8d5ff403e44eb Author: Po Lu Date: Sun Feb 27 19:33:16 2022 +0800 Don't send help-echo on menu button arming not caused by motion events * lwlib/lwlib-Xm.c (xm_arm_callback): Ignore arming if the arm was not caused by an EnterNotify or MotionNotify event. diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index fa60fc89d0..25b1cc6b12 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -290,7 +290,12 @@ xm_arm_callback (Widget w, XtPointer client_data, XtPointer call_data) if (w != NULL) { instance = lw_get_widget_instance (w); - if (instance && instance->info->highlight_cb) + + if (instance && instance->info->highlight_cb + && (cbs->reason == XmCR_DISARM + || (cbs->event + && (cbs->event->type == EnterNotify + || cbs->event->type == MotionNotify)))) { call_data = cbs->reason == XmCR_DISARM ? NULL : wv; instance->info->highlight_cb (w, instance->info->id, call_data);