commit 0b286ea45a0f46506371058c9f12c36a3573f817 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Tue Feb 15 07:27:31 2022 +0000 Fix parsing of some semibold font styles on Haiku * src/haiku_font_support.cc (font_style_to_flags): Accept "Semibold" to mean SemiBold as well. Reported by augiedoggie . diff --git a/src/haiku_font_support.cc b/src/haiku_font_support.cc index b92373b59e..3930cd965f 100644 --- a/src/haiku_font_support.cc +++ b/src/haiku_font_support.cc @@ -220,7 +220,9 @@ font_style_to_flags (char *st, struct haiku_font_pattern *pattern) if (pattern->weight == -1) pattern->weight = HAIKU_REGULAR; } - else if (token && !strcmp (token, "SemiBold")) + else if (token && (!strcmp (token, "SemiBold") + /* Likewise, this was reported by a user. */ + || !strcmp (token, "Semibold"))) pattern->weight = HAIKU_SEMI_BOLD; else if (token && !strcmp (token, "Bold")) pattern->weight = HAIKU_BOLD; commit 5129e713b09d401caa9d7b626ccb528f598e72c4 Author: Po Lu Date: Tue Feb 15 07:21:18 2022 +0000 Disable auto-lowering and raising on Haiku when a popup is active * src/haikuterm.c (haiku_new_focus_frame): (haiku_read_socket): Don't raise or lower if popup is activated. diff --git a/src/haikuterm.c b/src/haikuterm.c index 4547380783..f4e2452a6c 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -406,7 +406,7 @@ haiku_new_focus_frame (struct frame *frame) x_display_list->focused_frame = frame; - if (frame && frame->auto_raise) + if (frame && frame->auto_raise && !popup_activated_p) haiku_frame_raise_lower (frame, 1); } unblock_input (); @@ -2775,7 +2775,7 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit) need_flush = 1; } - if (f->auto_lower) + if (f->auto_lower && !popup_activated_p) haiku_frame_raise_lower (f, 0); haiku_new_focus_frame (x_display_list->focused_frame); commit 6f566021edc637c0e17ad1717e55440ca73bad38 Author: Po Lu Date: Tue Feb 15 13:41:52 2022 +0800 Replace use of `DefaultRootWindow' with our recorded root window * src/xfns.c (x_relative_mouse_position): (x_set_parent_frame): (Fx_mouse_absolute_pixel_position): (Fx_set_mouse_absolute_pixel_position): * src/xterm.c (x_iconify_frame): Use dpyinfo->root_window instead of DefaultRootWindow. diff --git a/src/xfns.c b/src/xfns.c index c490dc1802..0f8d6933b3 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -610,7 +610,7 @@ x_relative_mouse_position (struct frame *f, int *x, int *y) block_input (); XQueryPointer (FRAME_X_DISPLAY (f), - DefaultRootWindow (FRAME_X_DISPLAY (f)), + FRAME_DISPLAY_INFO (f)->root_window, /* The root window which contains the pointer. */ &root, @@ -910,7 +910,7 @@ x_set_parent_frame (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu block_input (); XReparentWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), - p ? FRAME_X_WINDOW (p) : DefaultRootWindow (FRAME_X_DISPLAY (f)), + p ? FRAME_X_WINDOW (p) : FRAME_DISPLAY_INFO (f)->root_window, f->left_pos, f->top_pos); #ifdef USE_GTK if (EQ (x_gtk_resize_child_frames, Qresize_mode)) @@ -6372,7 +6372,7 @@ selected frame's display. */) block_input (); XQueryPointer (FRAME_X_DISPLAY (f), - DefaultRootWindow (FRAME_X_DISPLAY (f)), + FRAME_DISPLAY_INFO (f)->root_window, &root, &dummy_window, &x, &y, &dummy, &dummy, (unsigned int *) &dummy); unblock_input (); @@ -6406,14 +6406,15 @@ The coordinates X and Y are interpreted in pixels relative to a position &deviceid)) { XIWarpPointer (FRAME_X_DISPLAY (f), deviceid, None, - DefaultRootWindow (FRAME_X_DISPLAY (f)), + FRAME_DISPLAY_INFO (f)->root_window, 0, 0, 0, 0, xval, yval); } XUngrabServer (FRAME_X_DISPLAY (f)); } else #endif - XWarpPointer (FRAME_X_DISPLAY (f), None, DefaultRootWindow (FRAME_X_DISPLAY (f)), + XWarpPointer (FRAME_X_DISPLAY (f), None, + FRAME_DISPLAY_INFO (f)->root_window, 0, 0, 0, 0, xval, yval); unblock_input (); diff --git a/src/xterm.c b/src/xterm.c index 60d87ccbf0..23317bf695 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -15075,7 +15075,7 @@ x_iconify_frame (struct frame *f) msg.xclient.data.l[0] = IconicState; if (! XSendEvent (FRAME_X_DISPLAY (f), - DefaultRootWindow (FRAME_X_DISPLAY (f)), + FRAME_DISPLAY_INFO (f)->root_window, False, SubstructureRedirectMask | SubstructureNotifyMask, &msg)) commit 5b0b9bafc01cc3061076583b19b6cd548268da8a Author: Po Lu Date: Tue Feb 15 12:52:30 2022 +0800 Improve the help message for the pgtk configure option * configure.ac: Describe the purpose of PGTK better. diff --git a/configure.ac b/configure.ac index 6f469cf0f0..945e2ff8d4 100644 --- a/configure.ac +++ b/configure.ac @@ -471,7 +471,7 @@ AC_ARG_WITH([ns],[AS_HELP_STRING([--with-ns], [use Nextstep (macOS Cocoa or GNUstep) windowing system. On by default on macOS.])],[],[with_ns=maybe]) OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build]) -OPTION_DEFAULT_OFF([pgtk], [use pure GTK build without reliance on X libs (Wayland support) (requires cairo) - Experimental]) +OPTION_DEFAULT_OFF([pgtk], [use GTK to support window systems other than X]) OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console]) OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support]) commit 249e3b7969a393e0fd4524ba71f1592676a1bc12 Author: Aleksandr Vityazev Date: Mon Feb 14 20:30:58 2022 +0000 ; * doc/lispref/variables.texi (Setting Variables): Fix a typo. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 9088397f9a..a520b3856c 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -883,7 +883,7 @@ then the following, in addition to setting @code{my-var} to @samp{2}, will also issue a message: @example -(setop my-var 2) +(setopt my-var 2) @end example The @code{setopt} macro can be used on regular, non-user option commit f6811ff8e2c2a3a4fe2a5fa40fcc230289450991 Author: Po Lu Date: Tue Feb 15 10:23:49 2022 +0800 * src/xterm.c (init_xterm): Use more reliable method to disable XI2. diff --git a/src/xterm.c b/src/xterm.c index 9c24a074e3..60d87ccbf0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -16952,7 +16952,11 @@ init_xterm (void) /* Emacs can handle only core input events when built without XI2 support, so make sure Gtk doesn't use Xinput or Xinput2 extensions. */ +#ifndef HAVE_GTK3 xputenv ("GDK_CORE_DEVICE_EVENTS=1"); +#else + gdk_disable_multidevice (); +#endif #endif } #endif commit bb33446f2a4a2540fe3fcbc07d9fadacb024f963 Author: Po Lu Date: Tue Feb 15 09:19:12 2022 +0800 Better handle devices being enabled on XI2 * src/xterm.c (handle_one_xevent): Don't abort on DeviceChanged if the device couldn't be found, instead regenerating the device hierarchy to see if it was enabled. diff --git a/src/xterm.c b/src/xterm.c index cff4b07c6e..9c24a074e3 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -581,6 +581,11 @@ x_free_xi_devices (struct x_display_info *dpyinfo) /* Setup valuator tracking for XI2 master devices on DPYINFO->display. */ +/* This function's name is a misnomer: these days, it keeps a + client-side record of all devices, which includes basic information + about the device and also touchscreen tracking information, instead + of just scroll valuators. */ + static void x_init_master_valuators (struct x_display_info *dpyinfo) { @@ -11906,7 +11911,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, device = xi_device_from_id (dpyinfo, device_changed->deviceid); if (!device) - emacs_abort (); + { + /* An existing device might have been enabled. */ + x_init_master_valuators (dpyinfo); + + /* Now try to find the device again, in case it was + just enabled. */ + device = xi_device_from_id (dpyinfo, device_changed->deviceid); + } + + /* If it wasn't enabled, then stop handling this event. */ + if (!device) + goto XI_OTHER; /* Free data that we will regenerate from new information. */ commit d43ca3855608752d26f3d615424339cd522322f4 Author: Eric Abrahamsen Date: Mon Feb 14 16:06:14 2022 -0800 Fix docstring and init of Gnus search -remove-prefix options * lisp/gnus/gnus-search.el (*-remove-prefix): For all engine defaults, remove incorrect docs stating this is a regexp (it's a string). Also, use `expand-file-name' to get the correct default value, not `concat' and (getenv "HOME"). diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index 4babe9f96f..605d8a34e9 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -167,10 +167,9 @@ Instead, use this: This variable can also be set per-server." :type '(repeat string)) -(defcustom gnus-search-swish++-remove-prefix (concat (getenv "HOME") "/Mail/") +(defcustom gnus-search-swish++-remove-prefix (expand-file-name "Mail/" "~") "The prefix to remove from each file name returned by swish++ -in order to get a group name (albeit with / instead of .). This is a -regular expression. +in order to get a group name (albeit with / instead of .). This variable can also be set per-server." :type 'regexp) @@ -204,10 +203,9 @@ This variable can also be set per-server." :type '(repeat string) :version "28.1") -(defcustom gnus-search-swish-e-remove-prefix (concat (getenv "HOME") "/Mail/") +(defcustom gnus-search-swish-e-remove-prefix (expand-file-name "Mail/" "~") "The prefix to remove from each file name returned by swish-e -in order to get a group name (albeit with / instead of .). This is a -regular expression. +in order to get a group name (albeit with / instead of .). This variable can also be set per-server." :type 'regexp @@ -252,7 +250,7 @@ This variable can also be set per-server." :type '(repeat string) :version "28.1") -(defcustom gnus-search-namazu-remove-prefix (concat (getenv "HOME") "/Mail/") +(defcustom gnus-search-namazu-remove-prefix (expand-file-name "Mail/" "~") "The prefix to remove from each file name returned by Namazu in order to get a group name (albeit with / instead of .). @@ -296,10 +294,9 @@ This variable can also be set per-server." :type '(repeat string) :version "28.1") -(defcustom gnus-search-notmuch-remove-prefix (concat (getenv "HOME") "/Mail/") +(defcustom gnus-search-notmuch-remove-prefix (expand-file-name "Mail/" "~") "The prefix to remove from each file name returned by notmuch -in order to get a group name (albeit with / instead of .). This is a -regular expression. +in order to get a group name (albeit with / instead of .). This variable can also be set per-server." :type 'regexp @@ -339,10 +336,9 @@ This variable can also be set per-server." :version "28.1" :type '(repeat string)) -(defcustom gnus-search-mairix-remove-prefix (concat (getenv "HOME") "/Mail/") +(defcustom gnus-search-mairix-remove-prefix (expand-file-name "Mail/" "~") "The prefix to remove from each file name returned by mairix -in order to get a group name (albeit with / instead of .). This is a -regular expression. +in order to get a group name (albeit with / instead of .). This variable can also be set per-server." :version "28.1" @@ -826,7 +822,7 @@ quirks.") :documentation "Location of the config file, if any.") (remove-prefix :initarg :remove-prefix - :initform (concat (getenv "HOME") "/Mail/") + :initform (expand-file-name "Mail/" "~") :type string :documentation "The path to the directory where the indexed mails are commit d6fba624e62bd2bc35dec5b5408a1f8e7ad77cc8 Author: Eric Abrahamsen Date: Mon Feb 14 15:11:37 2022 -0800 Fix manual documentation of Gnus tool bars * doc/misc/gnus.texi: The options `gnus-use-toolbar', `gnus-toolbar-thickness', and `gnus-summary-mail-toolbar' no longer exist. Other options in this section have been renamed from "toolbar" to "tool-bar". diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 6e8de0368c..eb675234f6 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -24141,37 +24141,22 @@ If you want to see them in the Cc and To fields, set: @end lisp -@subsubsection Toolbar +@subsubsection Tool bar @table @code -@item gnus-use-toolbar -@vindex gnus-use-toolbar -This variable specifies the position to display the toolbar. If -@code{nil}, don't display toolbars. If it is non-@code{nil}, it should -be one of the symbols @code{default}, @code{top}, @code{bottom}, -@code{right}, and @code{left}. @code{default} means to use the default -toolbar, the rest mean to display the toolbar on the place which those -names show. The default is @code{default}. - -@item gnus-toolbar-thickness -@vindex gnus-toolbar-thickness -Cons of the height and the width specifying the thickness of a toolbar. -The height is used for the toolbar displayed on the top or the bottom, -the width is used for the toolbar displayed on the right or the left. -The default is that of the default toolbar. - -@item gnus-group-toolbar +@item gnus-group-tool-bar @vindex gnus-group-toolbar -The toolbar in the group buffer. +Specifies the tool bar in the group buffer. It can be either a list +or a symbol referring to a list. Pre-defined symbols include +@code{gnus-group-tool-bar-gnome} and @code{gnus-group-tool-bar-retro}. -@item gnus-summary-toolbar +@item gnus-summary-tool-bar @vindex gnus-summary-toolbar -The toolbar in the summary buffer. - -@item gnus-summary-mail-toolbar -@vindex gnus-summary-mail-toolbar -The toolbar in the summary buffer of mail groups. +Specifies the tool bar in the summary buffer. It can be either a list +or a symbol referring to a list. Pre-defined symbols include +@code{gnus-summary-tool-bar-gnome} and +@code{gnus-summary-tool-bar-retro}. @end table commit b444311e2c2a5d6db36bbbd5453a02c606215011 Author: Eric Abrahamsen Date: Mon Feb 14 15:20:06 2022 -0800 Be more explicit about the meaning of "remove prefix" in Gnus search * doc/misc/gnus.texi (Search Engines): It's easy to get confused about what we're removing and why. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 306d66de64..6e8de0368c 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -21674,7 +21674,9 @@ engine. @item remove-prefix The directory part to be removed from the filenames returned by the search query. This absolute path should include everything up to the -top level of the message store. +top level of the message store. Note that this is the path to the +location of the actual messages, not to the search engine's indexes +(nor, in the case of Mairix, to its symlink directories). @item switches Additional command-line switches to be fed to the search program. The commit 8b34ba17b1e9420a421a65e3eaea45fec9044ead Author: Eli Zaretskii Date: Mon Feb 14 19:47:44 2022 +0200 ; * doc/lispref/variables.texi (Setting Variables): Fix markup. diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 8b5f50562e..9088397f9a 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -868,24 +868,27 @@ particular, @code{setopt} will run the setter function associated with the variable. For instance, if you have: @example +@group (defcustom my-var 1 "My var." :type 'number :set (lambda (var val) (set-default var val) (message "We set %s to %s" var val))) +@end group @end example -Then the following, in addition to setting @code{my-var} to @samp{2}, +@noindent +then the following, in addition to setting @code{my-var} to @samp{2}, will also issue a message: @example (setop my-var 2) @end example -@code{setopt} can be used on regular, non-user option variables, but -is much less efficient than @code{setq}. The main use case for this -macro is setting user options in the user's init file. +The @code{setopt} macro can be used on regular, non-user option +variables, but is much less efficient than @code{setq}. The main use +case for this macro is setting user options in the user's init file. @end defmac @node Watching Variables commit fa135ff305004f9fca85f0b0401a8dcc93c9ae1b Author: Eli Zaretskii Date: Mon Feb 14 19:38:56 2022 +0200 ; Improve a recently added NEWS entry about 'command-query'. diff --git a/etc/NEWS b/etc/NEWS index 657088c98d..b4acdf0e4f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -154,8 +154,15 @@ An autoload definition appears just as a '(defun . NAME)' and the +++ ** New function 'command-query'. -Commands that are marked with this function will prompt the user -before executing. +This function makes its argument command prompt the user for +confirmation before executing. + ++++ +** The 'disabled' property of a command's symbol can now be a list. +The first element of the list should be the symbol 'query', which will +cause the command disabled this way prompt the user with a y/n or a +yes/no question before executing. The new function 'command-query' is +a convenient method of making commands disabled in this way. --- ** 'count-lines' will now report buffer totals if given a prefix. commit fef0a6a2b4afe8de3cdfa53d658c007a0e791fb4 Author: Eli Zaretskii Date: Mon Feb 14 19:23:28 2022 +0200 Improve recent addition to documentation of face remapping * doc/lispref/display.texi (Basic Faces): Make the list of basic faces more complete. (Face Remapping): Improve wording of a recent addition; add cross-reference to "Basic Faces". diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 4d44afea2e..4a8694d481 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3321,12 +3321,15 @@ if you need to remove the remapping later. (face-remap-add-relative 'default :height 1.5) @end example -Note that face remapping does not work reliably for parent faces of -@dfn{basic faces}. (These are the faces that are used in mode lines, -header lines and the like.) For instance, @code{mode-line-inactive} -inherits from @code{mode-line}, but remapping @code{mode-line} won't -normally have the desired effect on @code{mode-line-inactive}. -Instead you have to remap @code{mode-line-inactive} directly. +Note that buffer-local face remapping does not work reliably for +parent faces of basic faces (@pxref{Basic Faces}). (These are the +faces that are used in mode lines, header lines, and other basic +decorations of windows and frames.) For instance, +@code{mode-line-inactive} inherits from @code{mode-line}, but +remapping @code{mode-line} won't normally have the desired effect on +@code{mode-line-inactive}, especially if done locally for some +buffers. Instead you have to remap @code{mode-line-inactive} +directly. @end defun @defun face-remap-remove-relative cookie @@ -3452,10 +3455,10 @@ usually assign faces to around 400 to 600 characters at each call. If your Emacs Lisp program needs to assign some faces to text, it is often a good idea to use certain existing faces or inherit from them, rather than defining entirely new faces. This way, if other users -have customized the basic faces to give Emacs a certain look, your -program will fit in without additional customization. +have customized those existing faces to give Emacs a certain look, +your program will fit in without additional customization. - Some of the basic faces defined in Emacs are listed below. In + Some of the @dfn{basic faces} defined in Emacs are listed below. In addition to these, you might want to make use of the Font Lock faces for syntactic highlighting, if highlighting is not already handled by Font Lock mode, or if some Font Lock faces are not in use. @@ -3467,6 +3470,28 @@ The default face, whose attributes are all specified. All other faces implicitly inherit from it: any unspecified attribute defaults to the attribute on this face (@pxref{Face Attributes}). +@item mode-line-active +@itemx mode-line-inactive +@itemx header-line +@itemx tab-line +Basic faces used for the mode line, header line, and tab line. + +@item tool-bar +@itemx tab-bar +@itemx fringe +@itemx scroll-bar +@itemx window-divider +@itemx border +@itemx child-frame-border +Basic faces used for the corresponding decorations of GUI frames. + +@item cursor +The basic face used for the text cursor. + +@item mouse +The basic face used for displaying mouse-sensitive text when the mouse +pointer is on that text. + @item bold @itemx italic @itemx bold-italic commit a90dc11e24895c4e6e5bfcfc991d8524f4075223 Author: Eli Zaretskii Date: Mon Feb 14 18:59:38 2022 +0200 Improve format of values returned by 'file-size-human-readable' * lisp/files.el (file-size-human-readable): Emit one digit of the fractional part of the size only if there's just one digit before the decimal point. diff --git a/lisp/files.el b/lisp/files.el index cfa1a5972c..b2792818e6 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1493,8 +1493,13 @@ in all cases, since that is the standard symbol for byte." (if (string= prefix "") "" "i") (or unit "B")) (concat prefix unit)))) - (format (if (and (>= (mod file-size 1.0) 0.05) + ;; Mimic what GNU "ls -lh" does: + ;; If the formatted size will have just one digit before the decimal... + (format (if (and (< file-size 10) + ;; ...and its fractional part is not too small... + (>= (mod file-size 1.0) 0.05) (< (mod file-size 1.0) 0.95)) + ;; ...then emit one digit after the decimal. "%.1f%s%s" "%.0f%s%s") file-size commit 3a3387f58e64f5e119ead50456c2fa6cef1e195b Author: Lars Ingebrigtsen Date: Mon Feb 14 15:16:42 2022 +0100 Fix typo in Face Remapping * doc/lispref/display.texi (Face Remapping): Fix typo. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 1f25bb8335..4d44afea2e 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3321,7 +3321,7 @@ if you need to remove the remapping later. (face-remap-add-relative 'default :height 1.5) @end example -Note that face remapping does not work reliably parent faces of +Note that face remapping does not work reliably for parent faces of @dfn{basic faces}. (These are the faces that are used in mode lines, header lines and the like.) For instance, @code{mode-line-inactive} inherits from @code{mode-line}, but remapping @code{mode-line} won't commit d52d913fa032a6cd1b6422cbbd44169b318ca174 Author: Lars Ingebrigtsen Date: Mon Feb 14 12:00:22 2022 +0100 Don't signal errors in abbrev-table-p * lisp/abbrev.el (abbrev-table-p): Ignore the error. * src/lread.c (oblookup): Signal `wrong-type-argument' instead of `error' if it turns out that we're not really in an obarray (bug#53988). diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 44328a2b28..214f7435d9 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -475,7 +475,8 @@ PROPS is a list of properties." (defun abbrev-table-p (object) "Return non-nil if OBJECT is an abbrev table." (and (obarrayp object) - (numberp (abbrev-table-get object :abbrev-table-modiff)))) + (numberp (ignore-error 'wrong-type-argument + (abbrev-table-get object :abbrev-table-modiff))))) (defun abbrev-table-empty-p (object &optional ignore-system) "Return nil if there are no abbrev symbols in OBJECT. diff --git a/src/lread.c b/src/lread.c index 502db1a8de..58b40ef37e 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4626,7 +4626,9 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff if (EQ (bucket, make_fixnum (0))) ; else if (!SYMBOLP (bucket)) - error ("Bad data in guts of obarray"); /* Like CADR error message. */ + /* Like CADR error message. */ + xsignal2 (Qwrong_type_argument, Qobarrayp, + build_string ("Bad data in guts of obarray")); else for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->u.s.next)) { @@ -5438,6 +5440,7 @@ This variable's value can only be set via file-local variables. See Info node `(elisp)Shorthands' for more details. */); Vread_symbol_shorthands = Qnil; DEFSYM (Qobarray_cache, "obarray-cache"); + DEFSYM (Qobarrayp, "obarrayp"); DEFSYM (Qmacroexp__dynvars, "macroexp--dynvars"); DEFVAR_LISP ("macroexp--dynvars", Vmacroexp__dynvars, diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el index 394eae48ee..947178473e 100644 --- a/test/lisp/abbrev-tests.el +++ b/test/lisp/abbrev-tests.el @@ -301,6 +301,10 @@ (inverse-add-abbrev table "Global" -1))) (should (string= (abbrev-expansion "text" table) "bar")))) +(ert-deftest test-abbrev-table-p () + (should-not (abbrev-table-p translation-table-vector)) + (should (abbrev-table-p (make-abbrev-table)))) + (provide 'abbrev-tests) ;;; abbrev-tests.el ends here commit 35bb4c1c3c64d09d9dea0ed7ba0314893e8f5f3c Author: Philip Kaludercic Date: Mon Feb 14 11:51:06 2022 +0100 Improve stability of message-hide-headers * message.el (message-hide-headers): Use a pointer instead of tracking the "end-of-headers" point manually (bug#53991). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 869ab3f82b..800c7dcea0 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8625,26 +8625,23 @@ From headers in the original article." message-hidden-headers)) (inhibit-point-motion-hooks t) (inhibit-modification-hooks t) - (end-of-headers (point-min))) + end-of-headers) (when regexps (save-excursion (save-restriction (message-narrow-to-headers) + (setq end-of-headers (point-min-marker)) (goto-char (point-min)) (while (not (eobp)) (if (not (message-hide-header-p regexps)) (message-next-header) - (let ((begin (point)) - header header-len) + (let ((begin (point))) (message-next-header) - (setq header (buffer-substring begin (point)) - header-len (- (point) begin)) - (delete-region begin (point)) - (goto-char end-of-headers) - (insert header) - (setq end-of-headers - (+ end-of-headers header-len)))))))) - (narrow-to-region end-of-headers (point-max)))) + (let ((header (delete-and-extract-region begin (point)))) + (save-excursion + (goto-char end-of-headers) + (insert-before-markers header)))))))) + (narrow-to-region end-of-headers (point-max))))) (defun message-hide-header-p (regexps) (let ((result nil) commit 9844b152a5c96d7aa0203a0573767241a1bbd043 Author: Po Lu Date: Mon Feb 14 18:39:56 2022 +0800 Premultiply background color by alpha for images * src/xterm.c (x_query_frame_background_color): Premultiply colors as X wants them when built without Cairo. diff --git a/src/xterm.c b/src/xterm.c index 9cde6c9a68..cff4b07c6e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3146,13 +3146,35 @@ static void x_query_frame_background_color (struct frame *f, XColor *bgcolor) { unsigned long background = FRAME_BACKGROUND_PIXEL (f); +#ifndef USE_CAIRO + XColor bg; +#endif if (FRAME_DISPLAY_INFO (f)->alpha_bits) { +#ifdef USE_CAIRO background = (background & ~FRAME_DISPLAY_INFO (f)->alpha_mask); background |= (((unsigned long) (f->alpha_background * 0xffff) >> (16 - FRAME_DISPLAY_INFO (f)->alpha_bits)) << FRAME_DISPLAY_INFO (f)->alpha_offset); +#else + if (FRAME_DISPLAY_INFO (f)->alpha_bits + && f->alpha_background < 1.0) + { + bg.pixel = background; + x_query_colors (f, &bg, 1); + bg.red *= f->alpha_background; + bg.green *= f->alpha_background; + bg.blue *= f->alpha_background; + + background = x_make_truecolor_pixel (FRAME_DISPLAY_INFO (f), + bg.red, bg.green, bg.blue); + background &= ~FRAME_DISPLAY_INFO (f)->alpha_mask; + background |= (((unsigned long) (f->alpha_background * 0xffff) + >> (16 - FRAME_DISPLAY_INFO (f)->alpha_bits)) + << FRAME_DISPLAY_INFO (f)->alpha_offset); + } +#endif } bgcolor->pixel = background; commit 4c2701fad1e7554908cecb7ee74dc7e85484e13e Author: Lars Ingebrigtsen Date: Mon Feb 14 11:39:55 2022 +0100 Fix typo in previous Face Remapping doc change * doc/lispref/display.texi (Face Remapping): Fix typo. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 280ea53455..1f25bb8335 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3322,7 +3322,7 @@ if you need to remove the remapping later. @end example Note that face remapping does not work reliably parent faces of -@dnf{basic faces}. (These are the faces that are used in mode lines, +@dfn{basic faces}. (These are the faces that are used in mode lines, header lines and the like.) For instance, @code{mode-line-inactive} inherits from @code{mode-line}, but remapping @code{mode-line} won't normally have the desired effect on @code{mode-line-inactive}. commit daf008e82b8ca7681ebe08b6ac1a1fa4d873bcd2 Author: Lars Ingebrigtsen Date: Mon Feb 14 11:38:11 2022 +0100 Note caveat about remapping basic faces * doc/lispref/display.texi (Face Remapping): Note caveat about basic faces (bug#53636). diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index b749d3d892..280ea53455 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3320,6 +3320,13 @@ if you need to remove the remapping later. ;; Increase the size of the 'default' face by 50%: (face-remap-add-relative 'default :height 1.5) @end example + +Note that face remapping does not work reliably parent faces of +@dnf{basic faces}. (These are the faces that are used in mode lines, +header lines and the like.) For instance, @code{mode-line-inactive} +inherits from @code{mode-line}, but remapping @code{mode-line} won't +normally have the desired effect on @code{mode-line-inactive}. +Instead you have to remap @code{mode-line-inactive} directly. @end defun @defun face-remap-remove-relative cookie diff --git a/etc/NEWS b/etc/NEWS index cd8cec32d5..657088c98d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -992,6 +992,12 @@ Emacs buffers, like indentation and the like. The new ert function * Incompatible Lisp Changes in Emacs 29.1 ++++ +** Remapping 'mode-line' no longer works as expected. +'mode-line' is now the parent face of the new 'mode-line-active' face, +and remapping parent of basic faces does not work reliably. +Instead of remapping 'mode-line', you have to remap 'mode-line-active'. + ** User option 'mail-source-ignore-errors' is now obsolete. The whole mechanism for prompting users to continue in case of mail-source errors has been removed, so this option is no longer commit b47d36f189d067ebf41098021da1d1e160db9d53 Author: Po Lu Date: Mon Feb 14 10:17:58 2022 +0000 Improve Haiku selection handling * lisp/select.el (gui--selection-value-internal): Use X types on Haiku as well. * lisp/term/haiku-win.el (haiku--selection-type-to-mime): Update types to correspond better with X. * src/haikuselect.c (Fhaiku_selection_data): (Fhaiku_selection_put): Remove a great deal of ad hoc code now handled by the regular selection machinery. diff --git a/lisp/select.el b/lisp/select.el index ca9061c0b0..42b50c44e6 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -176,7 +176,7 @@ decoded. If `gui-get-selection' signals an error, return nil." (memq window-system '(x haiku)) (eq type 'CLIPBOARD) (gui-backend-selection-owner-p type)) - (let ((request-type (if (memq window-system '(x pgtk)) + (let ((request-type (if (memq window-system '(x pgtk haiku)) (or x-select-request-type '(UTF8_STRING COMPOUND_TEXT STRING text/plain\;charset=utf-8)) 'STRING)) diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el index 4c06f7f58a..c4810f116d 100644 --- a/lisp/term/haiku-win.el +++ b/lisp/term/haiku-win.el @@ -86,7 +86,8 @@ DISPLAY may be set to the name of a display that will be initialized." "Convert symbolic selection type TYPE to its MIME equivalent. If TYPE is nil, return \"text/plain\"." (cond - ((memq type '(TEXT COMPOUND_TEXT STRING UTF8_STRING)) "text/plain") + ((eq type 'STRING) "text/plain;charset=iso-8859-1") + ((eq type 'UTF8_STRING) "text/plain") ((stringp type) type) ((symbolp type) (symbol-name type)) (t "text/plain"))) diff --git a/src/haikuselect.c b/src/haikuselect.c index e65ab827c5..65dac0e02f 100644 --- a/src/haikuselect.c +++ b/src/haikuselect.c @@ -97,20 +97,12 @@ fetch. */) return Qnil; Lisp_Object str = make_unibyte_string (dat, len); - Lisp_Object lispy_type = Qnil; - if (!strcmp (SSDATA (name), "text/utf-8") || - !strcmp (SSDATA (name), "text/plain")) - { - if (string_ascii_p (str)) - lispy_type = QSTRING; - else - lispy_type = QUTF8_STRING; - } - - if (!NILP (lispy_type)) - Fput_text_property (make_fixnum (0), make_fixnum (len), - Qforeign_selection, lispy_type, str); + /* `foreign-selection' just means that the selection has to be + decoded by `gui-get-selection'. It has no other meaning, + AFAICT. */ + Fput_text_property (make_fixnum (0), make_fixnum (len), + Qforeign_selection, Qt, str); block_input (); BClipboard_free_data (dat); @@ -125,10 +117,8 @@ DEFUN ("haiku-selection-put", Fhaiku_selection_put, Shaiku_selection_put, CLIPBOARD is the symbol `PRIMARY', `SECONDARY' or `CLIPBOARD'. NAME is a MIME type denoting the type of the data to add. DATA is the string that will be placed in the clipboard, or nil if the content is -to be removed. If NAME is the string "text/utf-8" or the string -"text/plain", encode it as UTF-8 before storing it into the clipboard. -CLEAR, if non-nil, means to erase all the previous contents of the -clipboard. */) +to be removed. CLEAR, if non-nil, means to erase all the previous +contents of the clipboard. */) (Lisp_Object clipboard, Lisp_Object name, Lisp_Object data, Lisp_Object clear) { @@ -138,13 +128,6 @@ clipboard. */) CHECK_STRING (data); block_input (); - /* It seems that Haiku applications counter-intuitively expect - UTF-8 data in both text/utf-8 and text/plain. */ - if (!NILP (data) && STRING_MULTIBYTE (data) && - (!strcmp (SSDATA (name), "text/utf-8") || - !strcmp (SSDATA (name), "text/plain"))) - data = ENCODE_UTF_8 (data); - char *dat = !NILP (data) ? SSDATA (data) : NULL; ptrdiff_t len = !NILP (data) ? SBYTES (data) : 0; commit 13b9268374669c368343ce4279041f2021b264f6 Author: Lars Ingebrigtsen Date: Mon Feb 14 11:20:41 2022 +0100 Add a mechanism for querying before executing a command * doc/emacs/custom.texi (Disabling): Document it. * doc/lispref/commands.texi (Disabling Commands): Document the low-level stuff. * lisp/simple.el (command-execute): Respect the `(query ...)' value for `disabled'. (command-execute--query): New function. (command-query): New function. diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index c4f112d668..a3c9c7c206 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2234,6 +2234,22 @@ is included in the message displayed when the command is used: "It's better to use `kill-region' instead.\n") @end example +@findex command-query + As a less heavy-handed alternative to disabling commands, you may +want to be queried before executing a command. For instance, to be +queried before executing the @kbd{M->} (@code{end-of-buffer}) +command, you could put something like the following in your init file: + +@example +(command-query + 'end-of-buffer + "Do you really want to go to the end of the buffer?") +@end example + +By default, you'll be queried with a @kbd{y}/@kbd{n} question, but if +you give a non-@code{nil} value to the third, optional argument, +you'll be queried with @kbd{yes}/@kbd{no} instead. + @findex disable-command @findex enable-command You can make a command disabled either by editing the initialization diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 01aa1e1fa4..a1628eabaa 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -3945,6 +3945,15 @@ what happens when a disabled command is invoked interactively. Disabling a command has no effect on calling it as a function from Lisp programs. +@findex command-query + The value of the @code{disabled} property can also be a list where +the first element is the symbol @code{query}. In that case, the user +will be queried whether to execute the command. The second element in +the list should be @code{nil} or non-@code{nil} to say whether to use +@code{y-or-n-p} or @code{yes-or-no-p}, respectively, and the third +element is the question to use. The @code{command-query} convenience +function should be used to enable querying for a command. + @deffn Command enable-command command Allow @var{command} (a symbol) to be executed without special confirmation from now on, and alter the user's init file (@pxref{Init diff --git a/etc/NEWS b/etc/NEWS index 0f956f18a2..cd8cec32d5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -152,6 +152,11 @@ An autoload definition appears just as a '(defun . NAME)' and the * Changes in Emacs 29.1 ++++ +** New function 'command-query'. +Commands that are marked with this function will prompt the user +before executing. + --- ** 'count-lines' will now report buffer totals if given a prefix. diff --git a/lisp/simple.el b/lisp/simple.el index 695871db50..accc119e2b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2381,12 +2381,17 @@ don't clear it." (setq current-prefix-arg prefix-arg) (setq prefix-arg nil) (when current-prefix-arg - (prefix-command-update)))))) + (prefix-command-update))))) + query) (if (and (symbolp cmd) (get cmd 'disabled) - disabled-command-function) - ;; FIXME: Weird calling convention! - (run-hooks 'disabled-command-function) + (or (and (setq query (and (consp (get cmd 'disabled)) + (eq (car (get cmd 'disabled)) 'query))) + (not (command-execute--query cmd))) + (and (not query) disabled-command-function))) + (when (not query) + ;; FIXME: Weird calling convention! + (run-hooks 'disabled-command-function)) (let ((final cmd)) (while (progn @@ -2410,6 +2415,21 @@ don't clear it." (put cmd 'command-execute-obsolete-warned t) (message "%s" (macroexp--obsolete-warning cmd (get cmd 'byte-obsolete-info) "command")))))))))) + +(defun command-execute--query (command) + "Query the user whether to run COMMAND." + (let ((query (get command 'disabled))) + (funcall (if (nth 1 query) #'yes-or-no-p #'y-or-n-p) + (nth 2 query)))) + +;;;###autoload +(defun command-query (command query &optional verbose) + "Make executing COMMAND issue QUERY to the user. +This will, by default, use `y-or-n-p', but if VERBOSE, +`yes-or-no-p' is used instead." + (put command 'disabled + (list 'query (not (not verbose)) query))) + (defvar minibuffer-history nil "Default minibuffer history list.