Eli Zaretskii [Sun, 10 Apr 2022 13:45:43 +0000 (16:45 +0300)]
Fix WebP image support on MS-Windows
* src/image.c (init_webp_functions) [WINDOWSNT]: Load Demux
functions from the WebPDemux DLL. Load internal functions where
the public APIs are inline functions defined in the WebP headers.
(WebPAnimDecoderOptionsInit) [WINDOWSNT]: Define to call
'WebPAnimDecoderOptionsInitInternal'.
(WebPDemux): Define to call 'WebPDemuxInternal'.
(WebPAnimDecoderNew): Define to call
'WebPAnimDecoderNewInternal'.
(syms_of_image) <webpdemux>: New symbol.
* lisp/term/w32-win.el (dynamic-library-alist): Add a member for
'webpdemux'.
Po Lu [Sun, 10 Apr 2022 11:33:51 +0000 (19:33 +0800)]
Attribute filtered events to the right source device
* src/xterm.c (handle_one_xevent): Attribute core events sent by
input methods like I-Bus to the extension device that caused
them to be sent.
* src/xterm.h (struct x_display_info): New fields
`pending_keystroke_time' and `pending_keystroke_source'.
* configure.ac (HAVE_RSVG): Also include the webpdemux library.
It was new in version 0.4.4, and we require 0.6.0, so it should be
safe.
* src/image.c: Include demux.h.
(enum webp_keyword_index, webp_format): Include :index for
animations.
(init_webp_functions): Add Windows LOAD_DLLs.
(struct webp_cache, webp_create_cache)
(webp_prune_animation_cache, webp_get_animation_cache): New
functions.
(webp_load): Support animated webp images (bug#54242).
Po Lu [Sun, 10 Apr 2022 01:31:24 +0000 (09:31 +0800)]
Try harder to own DND selections
* src/xterm.c (x_dnd_do_unsupported_drop): Fix computation of
local value.
(x_dnd_begin_drag_and_drop): Try to own the selection if we do
have a local value.
Po Lu [Sat, 9 Apr 2022 05:30:32 +0000 (13:30 +0800)]
Handle hierarchy events for updating scroll valuators correctly
* src/keyboard.c (gen_help_event, kbd_buffer_store_help_event):
Make sure to initialize the event buffer correctly.
* src/xterm.c (xi_populate_device_from_info): New function.
(x_init_master_valuators): Factor out most of the valuator
tracking code to that function.
(handle_one_xevent): Handle device enable and disable events in
a more detailed fashion.
Po Lu [Sat, 9 Apr 2022 03:35:08 +0000 (11:35 +0800)]
Minor cleanups in X Windows drag-and-drop code
* src/keyboard.c (kbd_buffer_get_event): Don't dereference f if
nil when generating mouse motion event.
* src/xterm.c (x_dnd_send_enter, x_dnd_send_position)
(x_dnd_send_leave, x_dnd_send_drop, x_send_scroll_bar_event):
Use NoEventMask instead of 0.
Po Lu [Sat, 9 Apr 2022 01:02:24 +0000 (09:02 +0800)]
Clean up XI2 scroll valuator tracking code
* src/xterm.c (x_get_scroll_valuator_delta): Accept a pointer to
a device instead of the device id.
(handle_one_xevent): Pass the previously found device.
Po Lu [Sat, 9 Apr 2022 00:41:00 +0000 (08:41 +0800)]
Fix subpixel AA with alpha-background on Cairo on X
* xterm.c (x_set_cr_source_with_gc_foreground)
(x_set_cr_source_with_gc_background): Set operator back to OVER
if alpha-background isn't to be respected.
Alan Third [Wed, 30 Mar 2022 21:40:03 +0000 (22:40 +0100)]
Fix scrollbars on macOS 10.13 and below (bug#54623)
Make any build on macOS 10.13 and below follow the same drawing path
as the GNUstep port. macOS 10.14 and above will use EmacsLayer.
* src/nsterm.h (EmacsLayer):
* src/nsterm.m ([EmacsView makeBackingLayer]):
([EmacsView unlockFocus]):
([EmacsView windowDidChangeBackingProperties:]):
([EmacsView copyRect:to:]): Remove any code required for macOS 10.13
and below, and fix the #if's to enforce strict separation of the
drawing paths.
(ns_update_end):
(ns_unfocus): Fix #ifs so that flushWindow is called on old macOS
versions as well as GNUstep.
Enable warnings when building as a developer with Clang
The configure-script logic that automatically enables warnings when
building in a development tree didn't work for Clang because it was
identified as an old GCC version.
* configure.ac: Don't test Clang version as if it were GCC.
Po Lu [Fri, 8 Apr 2022 10:50:48 +0000 (18:50 +0800)]
Interpolate scrolls coming from mice by default
* lisp/pixel-scroll.el
(pixel-scroll-precision-interpolate-mice): New
user option.
(pixel-scroll-precision): If the class of the last event device
is `mouse', interpolate the next scroll.
Po Lu [Fri, 8 Apr 2022 00:13:49 +0000 (08:13 +0800)]
Make device reporting work for tool bar clicks
* src/dispextern.h: Update prototyupes.
* src/xdisp.c (handle_tool_bar_click): Pass Qt to that function
instead.
(handle_tool_bar_click_with_device): New function.
* src/xterm.c (handle_one_xevent): Pass device to tool bar click
logic.
Stefan Monnier [Thu, 7 Apr 2022 19:59:09 +0000 (15:59 -0400)]
OClosure: New function `function-documentation`
As mentioned in the original OClosure commit, OClosures (ab)use the
bytecode's docstring slot to hold the OClosure's type. This currently
prevents OClosures from having their own docstring.
Introduce a new generic function `function-documentation` to fetch the
docstring of a function, which can then be implemented in various
different ways depending on the OClosure's type.
* lisp/simple.el (function-documentation): New generic function.
(bad-package-check): Strength-reduce `eval` to `symbol-value`.
* src/doc.c (Fdocumentation): Use it.
* lisp/emacs-lisp/oclosure.el (oclosure--accessor-docstring): New function.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test):
Add test for accessor's docstrings.
Po Lu [Thu, 7 Apr 2022 13:16:11 +0000 (21:16 +0800)]
Expose the name of an event's input device to Lisp
This name can be used to identify the device for special
treatment, i.e. only interpolating scrolls coming from mice and
not touchpads inside pixel-scroll-precision-mode.
* doc/lispref/commands.texi (Command Loop Info): Document new
variable `last-event-device'.
* etc/NEWS: Announce new variable `last-event-device'.
* src/frame.h (struct frame): New field `last_mouse_device'.
* src/keyboard.c (read_char): Clear last-event-device.
(kbd_buffer_get_event): Set last-event-device to the event's
recorded device.
(init_keyboard): Clear last-event-device.
(syms_of_keyboard): New defvar `last-event-device'.
* src/termhooks.h (struct input_event): New field `device'.
(EVENT_INIT): Set it to the special value `Qt' by default.
* src/xterm.c (x_init_master_valuators): Record the device's
name.
(x_dnd_begin_drag_and_drop): Only preserve last event device if
the mouse ended up in the source frame.
(x_note_mouse_movement): New argument `source'.
(handle_one_xevent): Set input event sources whenever
appropriate.
(mark_xterm): Mark device names.
* src/xterm.h (struct xi_device_t): New field `name'.
Po Lu [Thu, 7 Apr 2022 11:43:15 +0000 (19:43 +0800)]
Fix xwidget smooth scrolling when the default pointer is not a touchpad
* xwidget.c (find_suitable_pointer): New argument
`need_smooth'. Try to find a touchpad if that is set.
(xwidget_button_1, xwidget_button, xwidget_motion_notify)
(xwidget_scroll, xwidget_pinch, xw_notify_virtual_upwards_until)
(xw_notify_virtual_downwards_until):
(xw_maybe_synthesize_crossing):
(xwidget_motion_or_crossing, synthesize_focus_in_event): Set
parameter accordingly.
Andrew G Cohen [Tue, 22 Mar 2022 05:04:58 +0000 (13:04 +0800)]
Encrypt some parameters in auth-source plstore backend
The auth-source plstore backend allows a list of extra parameters but
currently stores them all unencrypted. This allows a plist with
:unencrypted and :encrypted keys to specify which extra parameters to
encrypt in the plstore file.
* lisp/auth-source.el (auth-source-plstore-create): Allow specifying
both unencrypted and encrypted extra parameters.
Jai Flack [Thu, 7 Apr 2022 11:14:01 +0000 (13:14 +0200)]
Add a mu backend for gnus-search
* lisp/gnus-search.el (gnus-search-mu-program): New defcustom
(gnus-search-mu-switches): New defcustom
(gnus-search-mu-remove-prefix): New defcustom
(gnus-search-mu-config-directory): New defcustom
(gnus-search-mu-raw-queries-p): New defcustom
(gnus-search-mu): New subclass of gnus-search-indexed
(gnus-search-transform-expression): New method
(gnus-search-mu-handle-date): New function
(gnus-search-mu-handle-flag): New function
(gnus-search-indexed-extract): New method
(gnus-search-indexed-search-command): New method (bug#54662).
* test/lisp/ses-tests.el (ses--cells, foo, bar, B2, toto): Do not
do any outer defvar, but set the defvar only under the
with-suppressed-warnings directive to silence the byte-compiler.
Kien Nguyen [Wed, 6 Apr 2022 09:58:02 +0000 (11:58 +0200)]
Make file-name-split returns driver name as well in Windows
* lisp/files.el (file-name-split): Returns driver name as well in
Windows.
* lisp/net/browse-url.el (browse-url-file-url): Don't hexify colon
character in file path for Windows (bug#54721).
Markus Kopp [Wed, 6 Apr 2022 09:27:19 +0000 (17:27 +0800)]
Use CUA functions to scroll pages with pixel-scroll-scroll-mode
* lisp/pixel-scroll.el (pixel-scroll-interpolate-down)
(pixel-scroll-interpolate-up): Use `cua-scroll-up' and
`cua-scroll-down' to scroll if
`pixel-scroll-precision-interpolate-page' is off. (bug#54696)
Po Lu [Wed, 6 Apr 2022 04:27:57 +0000 (12:27 +0800)]
Clean up more PGTK code
* lisp/term/pgtk-win.el (featurep):
(pgtk):
(pgtk-use-im-context):
(pgtk-handle-nxopen):
(pgtk-handle-nxopentemp):
(pgtk-ignore-1-arg):
([C-drag-n-drop]):
([M-drag-n-drop]):
([C-M-drag-n-drop]):
(pgtk-alternate-modifier):
(pgtk-right-alternate-modifier):
(pgtk-right-command-modifier):
(pgtk-right-control-modifier):
(pgtk-do-hide-emacs):
(pgtk-hide-others):
(pgtk-do-hide-others):
(pgtk-emacs-info-panel):
(pgtk-do-emacs-info-panel):
(pgtk-next-frame):
(pgtk-prev-frame):
(after-make-frame-functions):
(tool-bar-mode):
(pgtk-toggle-toolbar):
(pgtk-print-buffer):
(scalable-fonts-allowed):
(pgtk-standard-fontset-spec):
(pgtk-store-cut-buffer-internal):
(pgtk-copy-including-secondary):
(pgtk-paste-secondary):
(pgtk-suspend-error):
(window-system-initialization):
(after-init-hook): Remove code mindlessly copied from ns-win.el,
delete unused custom group, write doc strings and rename
variables duplicated from X to their names on X. Also reformat
comments and code.
(pgtk-use-im-context-handler): New function.
* src/pgtkfns.c (syms_of_pgtkfns): Delete useless
AppleScript (!) code copied from NS.
* src/pgtkselect.c: Write FIXME about selection API usage.
* src/pgtkterm.c (get_keysym_name): Implement correctly instead
of sprintf'ing the numeric value of the keysym into a static
buffer.
(pgtk_set_window_size):
(xg_scroll_callback): Delete code that was #if 0'd out and
doesn't make sense on PGTK.
(pgtk_delete_terminal): Remove misleading comment.
Paul Eggert [Wed, 6 Apr 2022 00:48:05 +0000 (17:48 -0700)]
Port Org encode-time usage back to Emacs 25
* lisp/org/ol.el (org-store-link):
* lisp/org/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
* lisp/org/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org/org-macro.el (org-macro--vc-modified-time):
* lisp/org/org-macs.el (org-2ft, org-matcher-time):
* lisp/org/org-table.el (org-table-eval-formula):
* lisp/org/org.el (org-read-date, org-display-custom-time)
(org-time-string-to-time, org-timestamp-change):
Don’t assume Emacs 27 encode-time, since standalone Org still
works with Emacs 25 and it’s easier if we minimize differences
from standalone Org. Problem reported by Max Nikulin (Bug#54731).
This reverts much of 2021-12-16T17:40:21Z!eggert@cs.ucla.edu.
Paul Eggert [Wed, 6 Apr 2022 00:20:34 +0000 (17:20 -0700)]
Pacify gcc -Wanalyzer-null-dereference
* src/xterm.c (handle_one_xevent): Don’t dereference HOLD_QUIT if
it’s null. Potential problem found with gcc 11.2.1 20220127 (Red
Hat 11.2.1-9), when configured with --enable-gcc-warnings.
Juri Linkov [Tue, 5 Apr 2022 19:20:16 +0000 (22:20 +0300)]
New commands for navigating completions from the minibuffer.
* lisp/simple.el (minibuffer-local-shell-command-map):
* lisp/minibuffer.el (minibuffer-local-completion-map):
Bind "M-<up>" to minibuffer-choose-previous-completion,
"M-<down>" to minibuffer-choose-next-completion,
"M-S-<up>" to minibuffer-previous-completion,
"M-S-<down>" to minibuffer-next-completion,
"M-RET" to minibuffer-choose-completion.
(with-minibuffer-completions-window): New macro.
(minibuffer-previous-completion, minibuffer-next-completion)
(minibuffer-choose-previous-completion)
(minibuffer-choose-next-completion)
(minibuffer-choose-completion): New commands.
Juri Linkov [Tue, 5 Apr 2022 18:54:11 +0000 (21:54 +0300)]
Use base prefix and suffix instead of completion-base-position (bug#49931)
* lisp/minibuffer.el (minibuffer-completion-help):
Set completion-base-affixes from base-prefix and base-suffix.
In completion-list-insert-choice-function handle
string values of start/end as prefix/suffix.
* lisp/simple.el (completion-base-affixes)
(completion-use-base-affixes): New variables.
(choose-completion): Let-bind base-affixes to completion-base-affixes.
Use base-affixes when completion-use-base-affixes is non-nil.
(completion-setup-function): Sync values of base-affixes and
completion-base-affixes.
Juri Linkov [Tue, 5 Apr 2022 17:52:28 +0000 (20:52 +0300)]
* test/lisp/replace-tests.el: New tests for query-replace (bug#54733)
* test/lisp/replace-tests.el (query-replace-tests): New defconst.
(query-replace--perform-tests): New function.
(query-replace-tests, query-replace-search-function-tests): New ert-deftest.
Robert Pluim [Tue, 1 Mar 2022 14:24:08 +0000 (15:24 +0100)]
Reject invalid time-string in appt-add immediately
* lisp/calendar/appt.el (appt-add): Check the provided time-string for
validity immediately after reading it rather than after reading all
the parameters. (Bug#54210)
Michael Albinus [Tue, 5 Apr 2022 15:08:03 +0000 (17:08 +0200)]
Handle remote system processes
* doc/lispref/files.texi (Magic File Names):
Add list-system-processes and process-attributes.
* doc/lispref/processes.texi (System Processes): Document changes
in list-system-processes and process-attributes.
* doc/misc/tramp.texi (Customizing Completion): Use @ftable.
(Remote processes): Document changes in list-system-processes and
process-attributes.
* etc/NEWS: Document changes in proced, list-system-processes and
process-attributes.
* lisp/proced.el (proced-show-remote-processes): New defcustom.
(proced-remote-directory): Remove.
(proced-filter-alist): Use it.
(proced-user-name): New defun.
(proced-available): Set it to t.
(proced-mode): Adapt docstring.
(proced): Adapt docstring. Acknowledge prefix argument.
(proced-format): Change initialization of `standard-attributes'.
(proced-send-signal, proced-renice): Adapt docstring. Remove
special handling of prefix argument.
Po Lu [Tue, 5 Apr 2022 12:03:48 +0000 (20:03 +0800)]
Mark some data during drag-and-drop
It doesn't make sense to prevent the return frame or movement
frame from being deleted, but we should at least protect them
from garbage collection.
* src/alloc.c (garbage_collect): Call mark_xterm.
* src/xterm.c (x_dnd_begin_drag_and_drop)
(x_dnd_cleanup_drag_and_drop): Clear movement and return frames
upon DND completion.
(mark_xterm): Mark those frames.
* src/xterm.h: Update prototypes.
* lisp/minibuffer.el (completion--insert-one-column) : Remove the extra
new-line at the end.
* lisp/simple.el (next-completion) : Fix behavior when
completion-wrap-movement and remove bobp and eobp. This removes the
extra tab ad the end of the list before wrapping or going to the
minibuffer and apparently also fixes bug#54374
(switch-to-completions) : Simplify condition code and remove comment not
applicable anymore.
Po Lu [Tue, 5 Apr 2022 08:19:02 +0000 (16:19 +0800)]
Allow dropping text to the root window
* src/xterm.c (x_dnd_send_unsupported_drop): Allow dropping to
the root window.
(handle_one_xevent): Send unsupported drops to the last toplevel
instead of the target window.
Po Lu [Tue, 5 Apr 2022 03:37:29 +0000 (11:37 +0800)]
Add support for dragging text onto windows that don't support any DND protocol
* src/xselect.c (x_own_selection): Export function.
(x_handle_selection_request): Handle selection requests to the
pending DND time.
(x_set_pending_dnd_time): New function.
* src/xterm.c (x_dnd_send_unsupported_drop): New function.
Implement according to the suggestions in the XDND protocol
specification.
(x_dnd_get_target_window): Return the toplevel window as well.
(x_dnd_cleanup_drag_and_drop, x_dnd_begin_drag_and_drop)
(x_dnd_update_state, handle_one_xevent): Send unsupported drops
and use last seen toplevel instead of target for `return_frame'.
* src/xterm.h: Update prototypes.
Po Lu [Tue, 5 Apr 2022 00:54:03 +0000 (00:54 +0000)]
Respect new DND options when dragging to ourselves on Haiku
* lisp/mouse.el (mouse-drag-and-drop-region): Allow dragging to
the current frame if we know `return-frame' doesn't work.
* lisp/term/haiku-win.el (haiku-dnd-drag-handler): New function.
* src/haiku_support.cc (MouseMoved): Don't send drag motion
events for the drag frame.
* src/haikuselect.c (haiku_note_drag_motion_1)
(haiku_note_drag_motion_2, haiku_note_drag_motion): New
functions.
(syms_of_haikuselect): New variable `haiku-drag-track-function'.
* src/haikuterm.c (haiku_read_socket): Note mouse motion in that
case.q
* src/haikuterm.h: Update prototypes.