Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-05-22 21:00:20 +08:00
commit 6dc9a3eeb7
9 changed files with 159 additions and 97 deletions

View file

@ -366,8 +366,8 @@ In an effort to help further tame ERC's complexity, the variable
'erc-default-recipients' is now expected to hold but a single target.
As a consequence, functions like 'erc-add-default-channel' that
imagine an alternate, aspirational model of buffer-target relations
have been deprecated. Grep for their names in ChangeLog.4 for
details.
have been deprecated. For specifics, see entries in Emacs'
ChangeLog.4 from around June 30, 2022.
A number of less consequential deprecations also debut in this
release. For example, the function 'erc-auto-query' was deemed too

View file

@ -78,10 +78,11 @@ keeps track of what channels you are on, and will join them
again when you get disconnected. When you restart Emacs, however,
those changes are lost, and the customization you saved the last
time is used again."
:type '(repeat (cons :tag "Server"
(regexp :tag "Name")
(repeat :tag "Channels"
(string :tag "Name")))))
:type '(alist :options (Libera.Chat)
:key-type (choice :tag "Server"
(symbol :tag "Network")
(regexp :tag "Host or domain"))
:value-type (repeat :tag "Channels" (string :tag "Name"))))
(defcustom erc-autojoin-timing 'connect
"When ERC should attempt to autojoin a channel.

View file

@ -117,7 +117,9 @@ join from that split has been detected or not.")
parsed 'notice (process-buffer proc)
'netjoin-done ?s (car elt))
(setq erc-netsplit-list (delq elt erc-netsplit-list)))
(delete nick elt))
;; Avoid `ignored-return-value' warning for `delete'.
(let ((tail (nthcdr 2 elt))) ; (t n1 ... nN)
(setcdr tail (delete nick (cdr tail)))))
(setq no-next-hook t))))
no-next-hook))

View file

@ -958,9 +958,17 @@ static void
free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
{
#ifdef HAVE_X_WINDOWS
XFreePixmap (dpyinfo->display, bm->pixmap);
if (bm->have_mask)
XFreePixmap (dpyinfo->display, bm->mask);
/* Free the pixmap and mask. Only do this if DPYINFO->display is
still set, which may not be the case if the connection has
already been closed in response to an IO error. */
if (dpyinfo->display)
{
XFreePixmap (dpyinfo->display, bm->pixmap);
if (bm->have_mask)
XFreePixmap (dpyinfo->display, bm->mask);
}
#ifdef USE_CAIRO
if (bm->stipple)
cairo_pattern_destroy (bm->stipple);

View file

@ -4252,9 +4252,9 @@ x_window (struct frame *f, long window_prompting)
#ifdef HAVE_X_I18N
FRAME_XIC (f) = NULL;
if (use_xim)
if (FRAME_DISPLAY_INFO (f)->use_xim)
create_frame_xic (f);
#endif
#endif /* HAVE_X_I18N */
f->output_data.x->wm_hints.input = True;
f->output_data.x->wm_hints.flags |= InputHint;
@ -4355,32 +4355,32 @@ x_window (struct frame *f)
#ifdef HAVE_X_I18N
FRAME_XIC (f) = NULL;
if (use_xim)
{
block_input ();
create_frame_xic (f);
if (FRAME_XIC (f))
{
/* XIM server might require some X events. */
unsigned long fevent = NoEventMask;
XGetICValues (FRAME_XIC (f), XNFilterEvents, &fevent, NULL);
if (FRAME_DISPLAY_INFO (f)->use_xim)
{
block_input ();
create_frame_xic (f);
if (FRAME_XIC (f))
{
/* XIM server might require some X events. */
unsigned long fevent = NoEventMask;
XGetICValues (FRAME_XIC (f), XNFilterEvents, &fevent, NULL);
if (fevent != NoEventMask)
{
XSetWindowAttributes attributes;
XWindowAttributes wattr;
unsigned long attribute_mask;
if (fevent != NoEventMask)
{
XSetWindowAttributes attributes;
XWindowAttributes wattr;
unsigned long attribute_mask;
XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
&wattr);
attributes.event_mask = wattr.your_event_mask | fevent;
attribute_mask = CWEventMask;
XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
attribute_mask, &attributes);
}
}
unblock_input ();
}
XGetWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
&wattr);
attributes.event_mask = wattr.your_event_mask | fevent;
attribute_mask = CWEventMask;
XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
attribute_mask, &attributes);
}
}
unblock_input ();
}
#endif
append_wm_protocols (FRAME_DISPLAY_INFO (f), f);
@ -4427,7 +4427,7 @@ x_window (struct frame *f)
initial_set_up_x_back_buffer (f);
#ifdef HAVE_X_I18N
if (use_xim)
if (FRAME_DISPLAY_INFO (f)->use_xim)
{
create_frame_xic (f);
if (FRAME_XIC (f))

View file

@ -798,13 +798,6 @@ typedef int (*Emacs_XIOErrorHandler) (Display *);
#define USE_CAIRO_XCB_SURFACE
#endif
/* Default to using XIM if available. */
#ifdef USE_XIM
bool use_xim = true;
#else
bool use_xim = false; /* configure --without-xim */
#endif
#if XCB_SHAPE_MAJOR_VERSION > 1 \
|| (XCB_SHAPE_MAJOR_VERSION == 1 && \
XCB_SHAPE_MINOR_VERSION >= 1)
@ -26702,7 +26695,12 @@ xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data)
/* No need to call XCloseIM. */
dpyinfo->xim = NULL;
XFree (dpyinfo->xim_styles);
/* Also free IM values; those are allocated separately upon
XGetIMValues. */
if (dpyinfo->xim_styles)
XFree (dpyinfo->xim_styles);
dpyinfo->xim_styles = NULL;
unblock_input ();
}
@ -26720,10 +26718,20 @@ xim_open_dpy (struct x_display_info *dpyinfo, char *resource_name)
XIM xim;
const char *locale;
if (use_xim)
if (dpyinfo->use_xim)
{
if (dpyinfo->xim)
XCloseIM (dpyinfo->xim);
{
XCloseIM (dpyinfo->xim);
/* Free values left over from the last time the IM
connection was established. */
if (dpyinfo->xim_styles)
XFree (dpyinfo->xim_styles);
dpyinfo->xim_styles = NULL;
}
xim = XOpenIM (dpyinfo->display, dpyinfo->rdb, resource_name,
emacs_class);
dpyinfo->xim = xim;
@ -26752,7 +26760,6 @@ xim_open_dpy (struct x_display_info *dpyinfo, char *resource_name)
build_string (locale));
}
}
else
#endif /* HAVE_XIM */
dpyinfo->xim = NULL;
@ -26821,7 +26828,7 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
{
dpyinfo->xim = NULL;
#ifdef HAVE_XIM
if (use_xim)
if (dpyinfo->use_xim)
{
#ifdef HAVE_X11R6_XIM
struct xim_inst_t *xim_inst = xmalloc (sizeof *xim_inst);
@ -26830,15 +26837,19 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
dpyinfo->xim_callback_data = xim_inst;
xim_inst->dpyinfo = dpyinfo;
xim_inst->resource_name = xstrdup (resource_name);
ret = XRegisterIMInstantiateCallback
(dpyinfo->display, dpyinfo->rdb, xim_inst->resource_name,
emacs_class, xim_instantiate_callback,
/* This is XPointer in XFree86 but (XPointer *) on Tru64, at
least, but the configure test doesn't work because
xim_instantiate_callback can either be XIMProc or
XIDProc, so just cast to void *. */
(void *) xim_inst);
eassert (ret == True);
/* The last argument is XPointer in XFree86 but (XPointer *) on
Tru64, at least, but the configure test doesn't work because
xim_instantiate_callback can either be XIMProc or XIDProc, so
just cast to void *. */
ret = XRegisterIMInstantiateCallback (dpyinfo->display,
dpyinfo->rdb,
xim_inst->resource_name,
emacs_class,
xim_instantiate_callback,
(void *) xim_inst);
eassert (ret);
#else /* not HAVE_X11R6_XIM */
xim_open_dpy (dpyinfo, resource_name);
#endif /* not HAVE_X11R6_XIM */
@ -26847,32 +26858,56 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
}
/* Close the connection to the XIM server on display DPYINFO. */
/* Close the connection to the XIM server on display DPYINFO.
Unregister any IM instantiation callback previously installed,
close the connection to the IM server if possible, and free any
retrieved IM values. */
static void
xim_close_dpy (struct x_display_info *dpyinfo)
{
#ifdef HAVE_XIM
if (use_xim)
{
#ifdef HAVE_X11R6_XIM
struct xim_inst_t *xim_inst = dpyinfo->xim_callback_data;
struct xim_inst_t *xim_inst;
Bool rc;
/* If dpyinfo->xim_callback_data is not set, then IM support wasn't
initialized, which can happen if Xlib doesn't understand the C
locale being used. */
if (dpyinfo->xim_callback_data)
{
xim_inst = dpyinfo->xim_callback_data;
if (dpyinfo->display)
{
Bool ret = XUnregisterIMInstantiateCallback
(dpyinfo->display, dpyinfo->rdb, xim_inst->resource_name,
emacs_class, xim_instantiate_callback, (void *) xim_inst);
eassert (ret == True);
rc = XUnregisterIMInstantiateCallback (dpyinfo->display,
dpyinfo->rdb,
xim_inst->resource_name,
emacs_class,
xim_instantiate_callback,
(void *) xim_inst);
eassert (rc);
}
xfree (xim_inst->resource_name);
xfree (xim_inst);
#endif /* HAVE_X11R6_XIM */
if (dpyinfo->display)
XCloseIM (dpyinfo->xim);
dpyinfo->xim = NULL;
XFree (dpyinfo->xim_styles);
}
#endif /* HAVE_X11R6_XIM */
/* Now close the connection to the input method server. This may
access the display connection, and isn't safe if the display has
already been closed. */
if (dpyinfo->display && dpyinfo->xim)
XCloseIM (dpyinfo->xim);
dpyinfo->xim = NULL;
/* Free the list of XIM styles retrieved. */
if (dpyinfo->xim_styles)
XFree (dpyinfo->xim_styles);
dpyinfo->xim_styles = NULL;
#endif /* HAVE_XIM */
}
@ -30825,14 +30860,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
dpyinfo->fixes_pointer_blanking = (egetenv ("EMACS_XFIXES") != NULL);
#endif
#ifdef HAVE_X_I18N
/* Avoid initializing input methods if the X library does not
support Emacs's locale. When the current locale is not
supported, decoding input method strings becomes undefined. */
if (XSupportsLocale ())
xim_initialize (dpyinfo, resource_name);
#endif
xsettings_initialize (dpyinfo);
/* This is only needed for distinguishing keyboard and process input. */
@ -30891,25 +30918,33 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
XSynchronize (dpyinfo->display, True);
}
#ifdef HAVE_X_I18N
{
AUTO_STRING (useXIM, "useXIM");
AUTO_STRING (UseXIM, "UseXIM");
Lisp_Object value = gui_display_get_resource (dpyinfo, useXIM, UseXIM,
Qnil, Qnil);
/* `USE_XIM' controls whether Emacs should use X input methods by
default, not whether or not XIM is available. */
#ifdef USE_XIM
dpyinfo->use_xim = true;
if (STRINGP (value)
&& (!strcmp (SSDATA (value), "false")
|| !strcmp (SSDATA (value), "off")))
use_xim = false;
#else
dpyinfo->use_xim = false;
#else /* !USE_XIM */
dpyinfo->use_xim = false;
if (STRINGP (value)
&& (!strcmp (SSDATA (value), "true")
|| !strcmp (SSDATA (value), "on")))
use_xim = true;
#endif
dpyinfo->use_xim = true;
#endif /* USE_XIM */
}
#ifdef HAVE_X_I18N
{
AUTO_STRING (inputStyle, "inputStyle");
AUTO_STRING (InputStyle, "InputStyle");
@ -30931,10 +30966,19 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
#ifdef USE_GTK
else if (!strcmp (SSDATA (value), "native"))
dpyinfo->prefer_native_input = true;
#endif
#endif /* HAVE_GTK */
}
}
#endif
/* Now that defaults have been set up, initialize input method
support. */
/* Avoid initializing input methods if the X library does not
support Emacs's locale. When the current locale is not
supported, decoding input method strings becomes undefined. */
if (XSupportsLocale ())
xim_initialize (dpyinfo, resource_name);
#endif /* HAVE_X_I18N */
#ifdef HAVE_X_SM
/* Only do this for the very first display in the Emacs session.
@ -31327,14 +31371,22 @@ x_delete_terminal (struct terminal *terminal)
#ifdef HAVE_X_I18N
/* We must close our connection to the XIM server before closing the
X display. */
if (dpyinfo->xim)
xim_close_dpy (dpyinfo);
xim_close_dpy (dpyinfo);
#endif
/* Destroy all bitmap images created on the display. */
image_destroy_all_bitmaps (dpyinfo);
/* Free the storage allocated to hold bitmap records. */
xfree (dpyinfo->bitmaps);
/* In case someone decides to use `bitmaps' again... */
dpyinfo->bitmaps = NULL;
dpyinfo->bitmaps_last = 0;
/* Normally, the display is available... */
if (dpyinfo->display)
{
image_destroy_all_bitmaps (dpyinfo);
XSetCloseDownMode (dpyinfo->display, DestroyAll);
/* Delete the scratch cursor GC, should it exist. */

View file

@ -649,7 +649,11 @@ struct x_display_info
/* The named coding system to use for this input method. */
Lisp_Object xim_coding;
#endif
/* Whether or not X input methods should be used on this
display. */
bool use_xim;
#endif /* HAVE_X_I18N */
/* A cache mapping color names to RGB values. */
struct color_name_cache_entry **color_names;
@ -929,11 +933,6 @@ struct x_display_info
Time quit_keysym_time;
};
#ifdef HAVE_X_I18N
/* Whether or not to use XIM if we have it. */
extern bool use_xim;
#endif
#ifdef HAVE_XINPUT2
/* Defined in xmenu.c. */
extern int popup_activated_flag;

View file

@ -51,7 +51,7 @@
;; argument, a `let*'-style VAR-LIST. Relying on such a macro is
;; unfortunate because in many ways it actually hampers readability by
;; favoring magic over verbosity. But without it (or something
;; similar), any failing test would cause all subsequent tests in this
;; similar), any failing test would cause all subsequent tests in a
;; file to fail like dominoes (making all but the first backtrace
;; useless).
;;

View file

@ -1032,7 +1032,7 @@ delivered."
(file-notify--test-cleanup))))
(file-notify--deftest-remote file-notify-test04-autorevert
"Check autorevert via file notification for remote files.")
"Check autorevert via file notification for remote files." t)
(ert-deftest file-notify-test05-file-validity ()
"Check `file-notify-valid-p' for files."