Po Lu [Wed, 9 Mar 2022 13:29:17 +0000 (21:29 +0800)]
Make XInput 2 features work on GTK 2 builds
* src/xfns.c (setup_xi_event_mask): On GTK 2, select for
button, motion, entry/exit and key events.
* src/xmenu.c (create_and_show_popup_menu): Clear XI grab if
appropriate.
* src/xterm.c (handle_one_xevent): Pass some kinds of input
extension events to GTK manually on versions of GTK+ that don't
understand them.
Po Lu [Wed, 9 Mar 2022 03:21:36 +0000 (03:21 +0000)]
Improve handling of tooltips inside menus on Haiku
* src/haiku_support.cc (BMenu_run): Make
`process_pending_signals_function' return a struct timespec.
* src/haiku_support.h: Update prototypes.
* src/haikumenu.c (haiku_process_pending_signals_for_menu):
Return result of `timer_run'.
* src/haikuterm.c (haiku_flush): Flip buffers if frame is dirty.
Paul Eggert [Wed, 9 Mar 2022 02:46:47 +0000 (18:46 -0800)]
Decouple mod-test.c from Gnulib
mod-test.c should not use Gnulib code, as that creates
unnecessary coupling between Emacs internals and this test module.
Also Gnulib code is compiled without -fPIC whereas mod-test.c
needs -fPIC and recompiling Gnulib with -fPIC would be too painful.
* src/Makefile.in (LIB_NANOSLEEP): New macro.
(LIBES): Use it.
* test/Makefile.in (REPLACE_FREE, FREE_SOURCE_0, FREE_SOURCE_0):
Remove. All uses removed.
(LIB_CLOCK_GETTIME, LIB_NANOSLEEP): New macros.
(MODULE_CFLAGS): Do not -I from lib as that would include Gnulib
modifications to standard .h files (e.g., "#define nanosleep
rpl_nanosleep") and we don’t want the Gnulib replacements.
Instead, for gmp.h (on platforms lacking <gmp.h>) simply '-I.'
with a suitable gmp.h.
(gmp.h): New rule to create a suitable gmp.h.
($(test_module)): Depend on config.h since the code uses config.h.
Depend on gmp.h if we need to create a suitable one.
If compiling mini-gmp.h, compile the original one and not
the Emacs-specific one, to lessen coupling with Emacs internals.
Link with LIB_CLOCK_GETTIME and LIB_NANOSLEEP.
(clean): Remove gmp.h.
* test/src/emacs-module-resources/mod-test.c: Don’t include timespec.h.
All uses of timespec.h APIs changed to use system-supplied APIs.
Change _Static_assert to plain assert, so that we needn’t rely
on Gnulib’s _Static_assert.
(timespec_le) [CLOCK_REALTIME]: New function.
Change use of timespec_cmp changed to use this instead.
(Fmod_test_sleep_until, Fmod_test_nanoseconds):
Define these functions and their Lisp names mod-test-sleep-until
and mod-test-nanoseconds only if CLOCK_REALTIME,
since they now won’t work on platforms lacking CLOCK_REALTIME.
(Fmod_test_nanoseconds): Just use _Static_assert since it
should work on all platforms.
* test/src/emacs-module-tests.el (mod-test-sleep-until)
(mod-test-nanoseconds, mod-test-double):
Skip test if the corresponding functione is not defined.
Paul Eggert [Wed, 9 Mar 2022 02:46:47 +0000 (18:46 -0800)]
Do not include <attribute.h> from <config.h>
This is because mod-test.c shouldn’t use source code from lib,
but it does need to include <config.h>.
* lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c:
* lib-src/make-docfile.c, lib-src/movemail.c:
* lib-src/seccomp-filter.c, src/dynlib.h, src/lisp.h:
* src/syssignal.h, src/sysstdio.h, src/systhread.h, src/tparam.h:
Include <attribute.h>.
* src/conf_post.h: Do not include <attribute.h>.
All uses of attribute.h macros replaced with their _GL_ equivalents.
* lisp/eshell/esh-var.el (eshell-parse-variable-ref): Use
'eshell-unescape-inner-double-quote' and improve robustness of quoted
variable name matching.
(eshell-parse-indices): Use 'eshell-unescape-inner-double-quote'.
* doc/misc/eshell.texi (Dollars Expansion): Improve wording of
subscript notation.
Stefan Monnier [Tue, 8 Mar 2022 03:27:19 +0000 (22:27 -0500)]
(cl-macro-list): Simplify by unifying the variants
* lisp/emacs-lisp/cl-macs.el (cl-macro-list): Add the &whole and the
dotted tail cases from `cl-macro-list1`.
(cl-macro-list1, cl-define-compiler-macro-list): Delete edebug elem specs.
(cl-destructuring-bind, cl-define-compiler-macro): Use `cl-macro-list`
instead, now that it covers all the cases we need.
Po Lu [Mon, 7 Mar 2022 13:36:25 +0000 (21:36 +0800)]
Correctly handle exposure in oldXMenu
* oldXMenu/Activate.c (XMenuActivate): Call set expose_func if
no pane was found.
(XMenuActivateSetExposeFunction): New function.
* oldXMenu/XMenu.h: New typedef `expose_func'. Update
prototypes.
* src/xmenu.c (x_menu_expose_event): New function.
(x_menu_show): Set expose event handler.
* src/xterm.c (x_dispatch_event): Make `static' only on GTK.
* src/xterm.h: Expose `x_dispatch_event' on no-toolkit builds.
* lisp/net/tramp-compat.el (tramp-file-name-handler): Declare.
(tramp-compat-exec-path): Use it.
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-gvfs-handle-expand-file-name): Rewrite tilde handling.
(tramp-gvfs-handle-get-home-directory): New defun.
* lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-sh-handle-get-home-directory): New defun.
(tramp-sh-handle-expand-file-name): Rewrite tilde handling.
* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-smb-handle-expand-file-name): Rewrite tilde handling.
(tramp-smb-handle-get-home-directory): New defun.
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add 'tramp-get-home-directory'.
(tramp-sudoedit-handle-expand-file-name): Rewrite tilde handling.
(tramp-sudoedit-handle-get-home-directory): New defun.
* lisp/net/tramp.el (tramp-file-name-for-operation):
Add `tramp-get-home-directory'.
(tramp-get-home-directory): New defun.
(tramp-handle-abbreviate-file-name): Use it.
(tramp-set-file-uid-gid, tramp-get-remote-uid)
(tramp-get-remote-gid): Use `tramp-file-name-handler'.
(tramp-get-remote-null-device): Do not check for null VEC, it
doesn't happen anymore.
Restore documented Emacs 27.2 behaviour of browse-url-of-dired-file
* lisp/net/browse-url.el (browse-url-of-dired-file): Restore the
documented behaviour -- open a web browser instead of passing to
the various handlers.
* lisp/net/browse-url.el (browse-url--file-name-coding-system):
Factor out into own function.
(browse-url-file-url): Property encode non-ASCII characters so
that external browsers can understand them.
(browse-url-emacs): Make `W' in Dired work with non-ASCII file
names (bug#54271).
Po Lu [Mon, 7 Mar 2022 00:53:50 +0000 (08:53 +0800)]
Get rid of a loop through all frames when processing events
* src/xterm.c (handle_one_xevent): Just flip back buffer of f
and any instead.
(flush_dirty_back_buffer_on): New function.
(flush_dirty_back_buffers): Delete function.
* lisp/progmodes/gdb-mi.el (bindat): Require.
(gdb-invalidate-locals): Use `-stack-list-variables` instead of
the deprecated `-stack-list-locals`. Additionally, this allow
function arguments to be displayed in the locals buffer.
(gdb-locals-values-buffer, gdb-locals-values-buffer-name)
(gdb-locals-simple-values-only, gdb-locals-values-table): New
variables.
(gdb-locals-values-handler-custom): Create a new gdb buffer for
extracting local variable values. To
extract the values for 'complex' data-types, the command
`-stack-list-locals` is used with the `--all-values` flag.
The extracted values are then stored in a hash-table for later use in
the `gdb-locals-handler-custom` that performs the actual update of the
Local variable buffer.
All variable values are filtered to fit it into a single line, being
truncated as necessary by the user customizable option
`gdb-locals-value-limit`.
The old behavior of hiding complex values can be restored using the
customizable `gdb-locals-simple-values-only` option.
Patch amended by William Xu <william.xwl@gmail.com>.
* lisp/url/url-http.el (url-http): Factor out url-interactive-p.
* lisp/url/url-auth.el (url-basic-auth):
(url-basic-auth):
(url-digest-prompt-creds): Use it to not query the user.
* lisp/url/url-queue.el (url-queue-start-retrieve): Don't send a
bogus empty Authorization header (bug#54246) -- this triggers
Cloudflare's anti-attack software. Instead rely on
url-request-noninteractive.
* lisp/url/url-vars.el (url-interactive-p): New utility function.
Don't accept whitespace or hex floats in rgbi: colour specs
`color-values-from-color-spec` (new in Emacs 28) erroneously accepted
leading whitespace and hex floats in rgbi: components.
Reported by Philip Kaludercic.
* src/xfaces.c (parse_float_color_comp): Disallow leading whitespace
and hex floats.
* test/src/xfaces-tests.el
(xfaces-internal-color-values-from-color-spec): Add test cases.
Po Lu [Sun, 6 Mar 2022 02:02:03 +0000 (10:02 +0800)]
Reduce non-toolkit scroll bar flicker
* src/xterm.c (x_scroll_bar_create): Initialize double buffer
for scroll bar.
(x_scroll_bar_set_handle)
(x_scroll_bar_remove, x_scroll_bar_expose): Draw to back buffer
instead.
(x_scroll_bar_end_update): New function.
(x_scroll_bar_clear): Fill the scroll bar with the background
instead when double buffered.
* src/xterm.h (struct scroll_bar): New field `x_drawable'.
Robert Pluim [Sat, 5 Mar 2022 19:00:09 +0000 (20:00 +0100)]
Use pselect instead of select in nsterm.m
* src/nsterm.m ([EmacsApp fdhandler:]): Use pselect instead of
the single remaining use of select (because we try to avoid using
select directly) (bug#54245).
Po Lu [Sat, 5 Mar 2022 10:20:04 +0000 (10:20 +0000)]
Obey decorator-specified width and height of tooltip frames on Haiku
* src/haiku_support.cc (BWindow_dimensions): New functions.
* src/haiku_support.h: Update prototypes.
* src/haikufns.c (Fx_show_tip): Use actual dimensions, because
the decorator might specify a minimum width and height for the
tooltip frame.
* src/haikuterm.c (haiku_update_size_hints): Ignore tooltip
frames.
Paul Eggert [Sat, 5 Mar 2022 03:21:38 +0000 (19:21 -0800)]
Fix process-attributes time precision on BSD
* src/sysdep.c (timeval_to_timespec) [__FreeBSD__ || DARWIN_OS]:
Remove; no longer needed.
(make_lisp_s_us) [__FreeBSD__ || DARWIN_OS || __OpenBSD__]:
New function.
(make_lisp_timeval) [__FreeBSD__ || DARWIN_OS || __OpenBSD__]:
Rework in terms of make_lisp_s_us.
(system_process_attributes) [__FreeBSD__ || DARWIN_OS ||
__OpenBSD__]: Simplify by using the above. This fixes some minor
problems where timestamps promised more precision than was
actually available.
Paul Eggert [Sat, 5 Mar 2022 03:21:38 +0000 (19:21 -0800)]
Fix process-attributes time precision on GNU/Linux
* src/sysdep.c [GNU_LINUX]:
(time_from_jiffies): Simplify by using time-convert. Change args
and result type. All uses changed.
(ltime_from_jiffies): Remove; call time_from_jiffies instead.
(put_jiffies): New function.
(get_up_time): Return Lisp_Object not struct timespec.
All uses changed. Simplify by using time-add.
(system_process_attributes): Simplify by using the above.
This fixes some minor problems where timestamps promised more
precision than was actually available. When info is not
available (e.g., sysconf fails) do not place it into the alist.
* src/timefns.c (float_time): Now extern.
Po Lu [Sat, 5 Mar 2022 02:44:26 +0000 (10:44 +0800)]
Remove render code in x_scroll_run and drop NoExpose events instead
* src/xterm.c (x_scroll_run): Stop avoiding NoExpose events
through XRenderComposite.
(handle_one_xevent): Drop NoExpose events to placate some code
in Athena widgets.
Dmitry Gutov [Sat, 5 Mar 2022 02:32:54 +0000 (04:32 +0200)]
project-shell: Ensure the resulting buffer is live
* lisp/progmodes/project.el (project-shell):
Make sure to recreate the shell if the buffer exists but not live
(https://lists.gnu.org/archive/html/emacs-devel/2022-03/msg00017.html).
Stefan Monnier [Fri, 4 Mar 2022 17:18:41 +0000 (12:18 -0500)]
trace.el: Preserve the line structure
Print newlines appearing inside values (i.e. inside strings) as \n
rather than actual newlines so as to avoid messing up the main
structure of the trace buffer.
* doc/misc/info.texi (Emacs Info Variables): Mention
Info--default-directory-list.
* lisp/info.el (Info-default-directory-list): Default to nil to
avoid statting directories on Emacs startup (bug#27933).
(Info--default-directory-list): Factored out into own function.
(Info-default-dirs): Append value of Info-default-directory-list
to the value returned from Info--default-directory-list.
Andrew G Cohen [Fri, 4 Mar 2022 08:20:01 +0000 (16:20 +0800)]
Turn expiry on for nnselect groups
Articles in (persistent) groups from the gnus/nnselect backend will
now be run through the expiry process upon exit, like other persistent
groups. Expiry is not on by default for ephemeral nnselect groups but
may be turned on with nnselect-allow-ephemeral-expiry set to t.
* lisp/gnus/nnselect.el (nnselect-request-expire-articles): Make
article expiry work.
(nnselect-allow-ephemeral-expiry): New variable.
* doc/misc/gnus.texi (Creating Search Groups): Document
nnselect-allow-ephemeral-expiry.
Po Lu [Fri, 4 Mar 2022 01:42:33 +0000 (09:42 +0800)]
Pass core scroll wheel events outside the edit widget to Emacs on GTK
* src/xterm.c (x_construct_mouse_click): Translate coordinates
if the event window is not the edit widget window.
(handle_one_xevent): Treat core scroll wheel events specially,
if mouse_or_wdesc_frame did not find the frame.