Po Lu [Fri, 10 Jun 2022 07:27:07 +0000 (15:27 +0800)]
Fix receiving drops from drop-only Motif programs
* lisp/x-dnd.el (x-dnd-xm-read-targets-table): Fix doc string.
(x-dnd-handle-motif): Recompute types and state on XmDROP_START
if no state already exists.
Stefan Kangas [Fri, 10 Jun 2022 06:17:35 +0000 (08:17 +0200)]
Merge from origin/emacs-28
d02c94090c Fix error reporting in process-async-https-with-delay 9a4862a973 * doc/misc/org.org: Remove spurious markup. 768ed1476a Make Tramp version check more robust 7f778c6943 Fix debugging with GDB when a breakpoint has multiple loca... 25e53e9391 ; * lisp/files.el (file-expand-wildcards): Doc fix. 3ea9357d10 Update documentation of 'aset' and 'store-substring'
Po Lu [Fri, 10 Jun 2022 03:45:27 +0000 (11:45 +0800)]
Don't rely on TARGETS to read selection targets for Motif DND
* lisp/x-dnd.el (x-dnd-types-alist):
(x-dnd-known-types): Fix formatting.
(x-dnd-xm-unpack-targets-table-header):
(x-dnd-xm-read-single-rec):
(x-dnd-xm-read-targets-table):
(x-dnd-xm-read-targets): New functions.
(x-dnd-handle-motif): Read targets from the targets table
of the drag window instead of the selection's TARGET target.
New setting for mouse-drag-copy-region to not put "" onto kill ring
* doc/emacs/frames.texi (Mouse Commands): Document it.
* lisp/mouse.el (mouse-drag-copy-region): Add value (bug#17211)
for not putting "" strings onto the kill ring.
(mouse-set-region, mouse-save-then-kill): Use the new value.
Po Lu [Thu, 9 Jun 2022 13:48:19 +0000 (21:48 +0800)]
Fix recalculation of `icon-title-format' after a frame is iconified
Previously it would only happen upon the next mode line
redisplay, meaning that just pressing C-z would not update the
implicit title, since C-z doesn't cause a redisplay.
* src/dispextern.h: Update prototypes.
* src/frame.h (SET_FRAME_ICONIFIED): De-slugify. Call
`gui_consider_frame_title', since `icon-title-format' might be
different from the current frame title.
* src/xdisp.c (gui_consider_frame_title): Export (also in
dispextern.h). (bug#55850)
Make `line-number-at-pos' work more like in earlier Emacs versions
* src/fns.c (Fline_number_at_pos): Allow calling with position
outside the region if called with ABSOLUTE non-nil (bug#55847).
This isn't announced in the doc string, but makes function
compatible with the version in earlier Emacs versions.
Stefan Baums [Sun, 5 Jun 2022 17:18:23 +0000 (19:18 +0200)]
Add support for the Kharoshthi script
* etc/NEWS: Announce the new language environment and script.
* etc/HELLO: Add Kharoshthi greeting.
* lisp/leim/quail/misc-lang.el ("kharoshthi"): New input method.
* lisp/language/misc-lang.el ("Kharoshthi"): New language
environment. Set up composition rules for Kharoshthi.
(Bug#55539)
Po Lu [Thu, 9 Jun 2022 08:34:18 +0000 (16:34 +0800)]
Implement `follow-tooltip' on NS as well
* lisp/term/ns-win.el (x-begin-drag): Pass `follow-tooltip'.
* src/nsfns.m (Fx_show_tip): Record last dx and dy.
(syms_of_nsfns): New staticpros.
* src/nsmenu.m ([EmacsTooltip moveTo:]): New method.
* src/nsselect.m (Fns_begin_drag): New parameter
`follow-tooltip'.
* src/nsterm.h (@interface EmacsWindow):
(EmacsTooltip): Update prototypes.
* src/nsterm.m ([EmacsWindow draggedImage:movedTo:]): Move any
tooltip to the right location.
([EmacsWindow beginDrag:forPasteboard...]): New parameter
`followTooltip'.
Po Lu [Thu, 9 Jun 2022 07:44:51 +0000 (15:44 +0800)]
Note caveats of `follow-tooltip' with system tooltips
* lisp/mouse.el (mouse-drag-and-drop-region): Turn off system
tooltips inside.
* src/xfns.c (Fx_begin_drag): Say that follow-tooltip doesn't
work with system tooltips.
Richard Hansen [Fri, 3 Jun 2022 01:05:40 +0000 (21:05 -0400)]
bindat: Improve str, strz documentation
* doc/lispref/processes.texi (Bindat Types): Expand the documentation
for the `str' and `strz' types to clarify expectations and explain
edge case behavior.
Po Lu [Thu, 9 Jun 2022 07:20:22 +0000 (07:20 +0000)]
Implement `follow-tooltip' for DND on Haiku
* lisp/term/haiku-win.el (x-begin-drag): Implement
`follow-tooltip'.
* src/haikufns.c (Fx_show_tip): Record last dx and dy.
(syms_of_haikufns): New staticpros.
* src/haikuselect.c (haiku_unwind_drag_message): Clear new flag.
(Fhaiku_drag_message): New argument `follow-tooltip'. Set new
flag.
(haiku_dnd_compute_tip_xy): New function.
(haiku_note_drag_motion): Move tooltip if flag is true.
* src/haikuterm.c (haiku_read_socket): Don't generate help event
if mouse moves onto a tooltip during DND.
* src/haikuterm.h: Update prototypes.
Juri Linkov [Thu, 9 Jun 2022 06:40:52 +0000 (09:40 +0300)]
Allow C-x 4 4, C-x 5 5, C-x t t to handle commands that use switch-to-buffer
* lisp/window.el (display-buffer-override-next-command):
Temporarily set switch-to-buffer-obey-display-actions to t,
and revert back to the original value afterwards.
This allows other-window-prefix, other-frame-prefix, other-tab-prefix,
windmove-display-in-direction to override the default behavior of
commands that use switch-to-buffer.
https://lists.gnu.org/archive/html/emacs-devel/2022-06/msg00483.html
Po Lu [Thu, 9 Jun 2022 05:11:08 +0000 (13:11 +0800)]
Also show mouse DND tooltip contents during interprogram drag-and-drop
* doc/lispref/frames.texi (Drag and Drop): Document new
parameter to `x-begin-drag'.
* lisp/mouse.el (mouse-drag-and-drop-region): Don't hide tooltip
when initiating interprogram drag-and-drop.
* lisp/term/haiku-win.el (x-begin-drag):
* lisp/term/ns-win.el (x-begin-drag): Add stubs for new
parameter.
* src/xfns.c (Fx_begin_drag): New parameter `follow-tooltip'.
(Fx_show_tip, syms_of_xfns): Add records of the last dx and dy
given to `x-show-tip'.
* src/xterm.c (x_clear_dnd_monitors): New function.
(x_dnd_begin_drag_and_drop): Save monitor attributes list if
appropriate.
(x_dnd_compute_tip_xy, x_dnd_update_tooltip_position): New
function.
(x_dnd_update_state, handle_one_xevent): Update tooltip position
during DND mouse movement.
(syms_of_xterm): Update staticpros.
* src/xterm.h: Update prototypes.
Ken Brown [Wed, 8 Jun 2022 17:09:21 +0000 (13:09 -0400)]
Fix error reporting in process-async-https-with-delay
* test/src/process-tests.el (process-async-https-with-delay): Use
'plist-get' instead of 'assq' in testing for a connection error.
The 'status' variable is a plist, not an alist. (Bug#55849)
Juri Linkov [Wed, 8 Jun 2022 17:10:12 +0000 (20:10 +0300)]
* lisp/rect.el: Return correct positions of region-beginning/end (bug#55234)
(rectangle-mark-mode): Add advices for region-beginning and region-end.
(rectangle--region-beginning, rectangle--region-end): New advices.
(rectangle--extract-region): Let-bind rectangle-mark-mode around
region-beginning and region-end to use the original functions.
Po Lu [Wed, 8 Jun 2022 12:33:42 +0000 (20:33 +0800)]
Allow running some DND tests interactively
* src/xselect.c (x_get_local_selection): Respect new variable.
(syms_of_xselect): New variable
`x-treat-local-requests-remotely'.
* test/lisp/dnd-tests.el (x-begin-drag, gui-set-selection):
Don't redefine these functions under X.
(dnd-tests-verify-selection-data): Use
`x-get-selection-internal' under X.
(dnd-tests-extract-selection-data): New function.
(dnd-tests-begin-text-drag): Update accordingly.
(dnd-tests-begin-file-drag, dnd-tests-begin-drag-files):
Temporarily skip these tests under X.
Po Lu [Wed, 8 Jun 2022 12:04:26 +0000 (20:04 +0800)]
Simplify XDND toplevel freeing code
* src/xterm.c (x_free_dnd_toplevels): New function.
(x_dnd_cleanup_drag_and_drop, x_dnd_begin_drag_and_drop): Record
an unwind function to free DND toplevels instead of doing that
manually everywhere.
Manuel Giraud [Wed, 8 Jun 2022 11:51:41 +0000 (13:51 +0200)]
Fix last-modified meaning in bookmark.el
* lisp/bookmark.el (bookmark-update-last-modified): New function
to update the last-modified field.
(bookmark-send-edited-annotation, bookmark-relocate)
(bookmark-rename): Use `bookmark-update-last-modified' in
annotations editing, relocation and renaming.
Michael Albinus [Wed, 8 Jun 2022 10:06:56 +0000 (12:06 +0200)]
Factor out test configuration for remote files
* lisp/emacs-lisp/ert-x.el (tramp-methods)
(tramp-default-host-alist): Declare.
(ert-remote-temporary-file-directory): New defconst.
* test/README: Mention dnd-tests.el.
* test/lisp/autorevert-tests.el
(auto-revert-test-remote-temporary-file-directory): Remove.
Replace all uses by `ert-remote-temporary-file-directory'.
* test/lisp/dnd-tests.el (ert-x): Require.
(dnd-tests-temporary-file-directory): Remove. Replace all uses by
`ert-remote-temporary-file-directory'.
* test/lisp/filenotify-tests.el
(file-notify-test-remote-temporary-file-directory): Remove.
Replace all uses by `ert-remote-temporary-file-directory'.
* test/lisp/shadowfile-tests.el (ert-x): Require.
(shadow-test-remote-temporary-file-directory): Remove. Replace
all uses by `ert-remote-temporary-file-directory'.
* test/lisp/net/tramp-tests.el: Don't require ert.
(ert-remote-temporary-file-directory): Define if it doesn't exist.
(tramp-test-temporary-file-directory): Remove. Replace all uses
by `ert-remote-temporary-file-directory'.
* lisp/emacs-lisp/bytecomp.el (byte-compile--reify-function):
Don't transpose doc string and interactive spec, which must come
in this order.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-function-attributes): New test.
Po Lu [Wed, 8 Jun 2022 07:08:09 +0000 (15:08 +0800)]
Make responding to selection requests work inside popups
* src/xfns.c (Fx_file_dialog):
* src/xmenu.c (x_menu_wait_for_event, create_and_show_popup_menu)
(create_and_show_dialog, x_menu_show): Defer selection requests.
* src/xselect.c (x_get_foreign_selection)
(x_handle_selection_notify): Add some more info to selection
trace.
* src/xterm.c (x_defer_selection_requests): Make non-static.
(x_release_selection_requests_and_flush): New function.
(x_dnd_begin_drag_and_drop): Use DEFER_SELECTIONS instead.
(x_wait_for_cell_change): Fix initial value of rc for pushed
back events.
(handle_one_xevent): Allow GTK to respond to selections in its
windows too.
* src/xterm.h (DEFER_SELECTIONS): New slug of code.
Po Lu [Wed, 8 Jun 2022 00:49:51 +0000 (08:49 +0800)]
More fixes to mouse event reporting during drag-and-drop
* src/xterm.c (x_dnd_begin_drag_and_drop): Don't reset
dpyinfo->grabbed when quitting.
(handle_one_xevent): Keep track of dpyinfo->grabbed as well
inside the drag-and-drop event loop.
Dmitry Gutov [Tue, 7 Jun 2022 22:08:22 +0000 (01:08 +0300)]
pcomplete-parse-arguments: Fix last change
* lisp/pcomplete.el (pcomplete-parse-arguments):
Throw the previous value of 'pcomplete-stub' (a list) rather than
the newly constructed one (bug#50470).
* lisp/progmodes/elisp-mode.el (elisp-mode-syntax-propertize):
Give ,@ a prefix syntax so that we can properly identify symbols
that follow it, i.e., ,@foo (bug#44418).
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--rubric): Fix
the name that's recorded in the file -- this is only used by
loaddefs-gen now, I think.
* lisp/textmodes/artist.el (artist-mouse-draw-continously):
(artist-mouse-draw-continously):
(artist-mouse-draw-poly):
(artist-mouse-draw-1point):
(artist-mouse-draw-2points):
(artist-mouse-draw-2points): Work better when the window is zoomed
(bug#46035).
Allow hooks to alter the process in prolog-ensure-process
* lisp/progmodes/prolog.el (prolog-ensure-process): Start the mode
after starting the process, so that the mode hook can talk to the
process (bug#46003).
Stefan Monnier [Tue, 7 Jun 2022 14:30:47 +0000 (10:30 -0400)]
find-func.el: Fix bug#41104
* lisp/emacs-lisp/find-func.el (find-function-advised-original): Look
at the actual function definition rather than
`advice--symbol-function` which sometimes returns only the advice.
Po Lu [Tue, 7 Jun 2022 13:45:17 +0000 (21:45 +0800)]
Add selection stuff to DND tests
* test/lisp/dnd-tests.el (dnd-tests-selection-table): New
defvar.
(gui-set-selection): Actually implement in a way that validates
the local value and stores it for future use.
(dnd-tests-verify-selection-data): New function.
(dnd-tests-begin-text-drag): Add tests for the contents of
various selections.
Eli Zaretskii [Tue, 7 Jun 2022 13:01:04 +0000 (16:01 +0300)]
Fix debugging with GDB when a breakpoint has multiple locations
* lisp/progmodes/gdb-mi.el (gdb-breakpoints--add-breakpoint-row):
New function, extracted from 'gdb-breakpoints-list-handler-custom'.
Don't print "in <unknown>" for header-rows of breakpoints with
multiple locations that don't have a function name attached.
(gdb-breakpoints-list-handler-custom): Add to the breakpoint table
also any locations in multiple-location breakpoints, which are
supported since GDB 6.8.
Po Lu [Tue, 7 Jun 2022 10:23:52 +0000 (18:23 +0800)]
Fix more bugs with DND selection handling
* src/xterm.c (x_defer_selection_requests)
(x_release_selection_requests): New functions.
(x_dnd_begin_drag_and_drop): Use those functions to defer
selections instead. Fix error signalled when ownership of
XdndSelection is lost.
(handle_one_xevent): Likewise.
Po Lu [Tue, 7 Jun 2022 07:44:05 +0000 (15:44 +0800)]
Remove mentions of GNOME MediaKeys from dbus documentation examples
* doc/misc/dbus.texi (Properties and Annotations):
* lisp/net/dbus.el (dbus-get-all-managed-objects): Remove
mentions of obsolete GNOME APIs from example text.
Po Lu [Tue, 7 Jun 2022 05:49:41 +0000 (13:49 +0800)]
Improve compatibility with some clients of the Motif drop protocol
* lisp/select.el (x-dnd-targets-list): New defvar.
(xselect-convert-to-targets): Convert XdndSelection based on the
DND targets list.
* src/xfns.c (Fx_begin_drag): Pass new argument.
* src/xselect.c (struct x_selection_request): New struct.
(x_push_current_selection_request):
(x_pop_current_selection_request): New functions.
(x_selection_request_lisp_error, x_reply_selection_request)
(x_handle_selection_request, x_convert_selection)
(syms_of_xselect_for_pdumper): Correctly handle recursive
requests for MULTIPLE by maintaining a stack of selection
requests, converted selections, and other data.
* src/xterm.c (x_dnd_begin_drag_and_drop): New argument
`selection_target_list'. Bind it to the DND targets list.
(syms_of_xterm): New defvar and associated defsym.
* src/xterm.h: Update prototypes.
Po Lu [Tue, 7 Jun 2022 02:44:08 +0000 (02:44 +0000)]
Update Haiku drag-and-drop code
* lisp/term/haiku-win.el (haiku-drag-and-drop): Don't allow
dropping on places other than the text area (it doesn't work).
Also respect mouse-yank-at-point.
Po Lu [Tue, 7 Jun 2022 02:39:55 +0000 (10:39 +0800)]
Don't allow dropping on invalid drop sites
* lisp/x-dnd.el (x-dnd-drop-data): If dropping on something
other than the text area, don't set point.
(x-dnd-handle-xdnd, x-dnd-handle-motif): Don't pretend dropping
on the mode line is ok.
Po Lu [Tue, 7 Jun 2022 01:26:15 +0000 (09:26 +0800)]
Fix two crashes when a display connection is lost
This fixes errors caused by invalid error traps being left on
the error handler stack if an IO error causes a non-local exit
out of the protected code, and another crash caused by
delete_frame trying to read async input.
* src/eval.c (unwind_to_catch, push_handler_nosignal): Save and
restore the X error handler stack.
* src/lisp.h (struct handler): [HAVE_X_WINDOWS]: New field
`x_error_handler_depth'.
* src/xterm.c (struct x_error_message_stack): Make string a
regular string.
(x_unwind_errors_to): New function.
(x_error_catcher, x_catch_errors_with_handler)
(x_uncatch_errors_after_check, x_uncatch_errors): Update the
stack depth.
(x_check_errors): Stop manually unwinding since unwind_to_catch
now does that for us.
(x_had_errors_p, x_clear_errors): Update for new type of
`string'.
(x_connection_closed): Block input between just before
delete_frame to when the terminal is unlinked.
Po Lu [Mon, 6 Jun 2022 12:23:20 +0000 (20:23 +0800)]
Update comments in X error handling code
* src/xterm.c (struct x_error_message_stack, x_error_message)
(x_error_catcher, x_catch_errors, x_had_errors_p)
(x_clear_errors): Long-overdue comment update. Describe the
fields of the error message stack, and the fact that
`x_error_message' is a stack, not a pointer to a string (which
has been true since 2006). Also describe the updated conditions
used to find an applicable error handler and to call
x_uncatch_errors_after_check.