]> git.eshelyaron.com Git - emacs.git/log
emacs.git
2 years agoMake application configurable in 'with-connection-local-variables'
Michael Albinus [Fri, 18 Mar 2022 11:25:32 +0000 (12:25 +0100)]
Make application configurable in 'with-connection-local-variables'

* doc/lispref/variables.texi (Connection Local Variables):
Explain 'connection-local-default-application'.

* etc/NEWS: Mention 'connection-local-default-application'.

* lisp/files-x.el (connection-local-default-application): New variable.
(connection-local-criteria-for-default-directory): Use it.  (Bug#54405)

* test/lisp/files-x-tests.el
(files-x-test-with-connection-local-variables): Extend test.

2 years agoSpeed up number-to-string for fixnums
Mattias Engdegård [Fri, 18 Mar 2022 10:43:10 +0000 (11:43 +0100)]
Speed up number-to-string for fixnums

Do the binary-to-decimal conversion by hand for fixnums instead of
calling sprintf.  This results in a noticeable speed increase (on my
machine, 2.2× faster excluding GC).

* src/data.c (Fnumber_to_string): Don't use sprintf for fixnums.

2 years agoImplement drag-and-drop of files on Haiku
Po Lu [Fri, 18 Mar 2022 09:21:39 +0000 (09:21 +0000)]
Implement drag-and-drop of files on Haiku

* lisp/term/haiku-win.el (haiku-dnd-selection-converters): Add
new selection converter.
(haiku-dnd-convert-uri-list): New function.
(x-begin-drag): Allow selection converters to change message
field type.

* src/haikuselect.c (haiku_lisp_to_message): Perform more error
checking.

2 years agoMerge from origin/emacs-28
Stefan Kangas [Fri, 18 Mar 2022 06:01:18 +0000 (07:01 +0100)]
Merge from origin/emacs-28

530c3491e8 Improve documentation of bookmark default sorting
11492259b1 ; * doc/lispref/display.texi (Overlay Arrow): More accurat...

2 years agoAllow dragging messages with file names on Haiku
Po Lu [Fri, 18 Mar 2022 05:48:10 +0000 (05:48 +0000)]
Allow dragging messages with file names on Haiku

* src/haiku_select.cc (be_add_refs_data): New function.
* src/haikuselect.c (haiku_lisp_to_message): Handle `ref' type
correctly.
* src/haikuselect.h: Update prototypes.

2 years agoAllow dragging files from Dired to other programs
Po Lu [Fri, 18 Mar 2022 05:17:19 +0000 (13:17 +0800)]
Allow dragging files from Dired to other programs

* etc/NEWS: Announce new user option `dired-mouse-drag-files'.
* lisp/dired.el (dired-mouse-drag-files): New user option.
(dired-mouse-drag): New command.
(dired-mouse-drag-files-map): New variable.
(dired-insert-set-properties): Add additional keymap if mouse
dragging is enabled.

* lisp/select.el (xselect-convert-to-targets): Handle new
form of selection converters.
(xselect-convert-to-username):
(xselect-convert-to-text-uri-list):
(xselect-uri-list-available-p): New functions.
(selection-converter-alist): Add them as selection converters.

* src/xselect.c (x_get_local_selection): Handle new form of
selection converters.
(syms_of_xselect): Update doc strings.

2 years agoImprove documentation of bookmark default sorting
Karl Fogel [Fri, 18 Mar 2022 02:18:26 +0000 (21:18 -0500)]
Improve documentation of bookmark default sorting

* lisp/bookmark.el (bookmark-alist, bookmark-store,
  bookmark-maybe-sort-alist): Update doc strings and comments.

2 years agoMinor fixes to DND support
Po Lu [Fri, 18 Mar 2022 00:22:50 +0000 (08:22 +0800)]
Minor fixes to DND support

* src/xterm.c (x_dnd_begin_drag_and_drop): Free targets
afterwards.
(handle_one_xevent): Only calculate dnd_grab if DND is in
progress.

2 years agoRemove some early-bootstrap dependencies for `advice`
Stefan Monnier [Thu, 17 Mar 2022 23:07:59 +0000 (19:07 -0400)]
Remove some early-bootstrap dependencies for `advice`

The dependencies between `advice`, cl-generic`, `bytecomp`, `cl-lib`,
`simple`, `help`, ... were becoming unmanageable.
Break the reliance on `advice` (which includes making sure the
compiler is not needed during the early bootstrap).

* lisp/simple.el (pre-redisplay-function): Set without using `add-function`.

* lisp/loadup.el (advice, simple): Move to after `cl-generic`.

* lisp/help.el (command-error-function): Set without using `add-function`.
(help-command-error-confusable-suggestions): Explicitly call
`command-error-default-function` instead.

* lisp/emacs-lisp/cl-macs.el (pcase--mutually-exclusive-p): Don't
optimize during early-bootstrap.

* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Tiny simplification.
(cl-defmethod): Label the obsolescence warning as it should.
(cl--generic-compiler): New variable.
(cl--generic-get-dispatcher): Use it.
(cl--generic-prefill-dispatchers): Make freshly made dispatchers.

2 years agoPut bytecode stack frame metadata in a struct
Mattias Engdegård [Mon, 14 Mar 2022 11:57:29 +0000 (12:57 +0100)]
Put bytecode stack frame metadata in a struct

Using a plain C struct instead of type-punning Lisp_Object stack slots
makes the bytecode interpreter code more type-safe and potentially
faster (from better alias analysis), and the special-purpose accessors
are no longer needed.  It also reduces the stack requirements when
using 64-bit Lisp_Object on 32-bit platforms.

* src/bytecode.c (enum stack_frame_index)
(sf_get_ptr, sf_set_ptr, sf_get_lisp_ptr, sf_set_lisp_ptr,
sf_get_saved_pc, sf_set_saved_pc): Remove.
(BC_STACK_SIZE): Now in bytes, not Lisp words.
(struct bc_frame): New.
(init_bc_thread, mark_bytecode, Finternal_stack_stats, valid_sp)
(exec_byte_code):
* src/lisp.h (struct handler, get_act_rec, set_act_rec):
Adapt to new struct bc_frame.

2 years agoRestore HOME after mailcap-parsing-and-mailcap-mime-info
Lars Ingebrigtsen [Thu, 17 Mar 2022 15:11:39 +0000 (16:11 +0100)]
Restore HOME after mailcap-parsing-and-mailcap-mime-info

* test/lisp/net/mailcap-tests.el
(mailcap-parsing-and-mailcap-mime-info): Restore HOME after the
test (bug#54435).

2 years agoEnable Tramp reloading
Michael Albinus [Thu, 17 Mar 2022 14:32:01 +0000 (15:32 +0100)]
Enable Tramp reloading

* lisp/net/tramp.el (tramp-file-name): Add ;;;###tramp-autoload
cookie.  (Bug#50869)

* test/lisp/net/tramp-tests.el (tramp-test47-unload): Do not skip.
Test reload.

2 years ago* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Warn suspicious args
Stefan Monnier [Thu, 17 Mar 2022 14:07:35 +0000 (10:07 -0400)]
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Warn suspicious args

2 years agoAvoid repeated prompts in `M-x shell' if using ~/.emacs_bash
Lars Ingebrigtsen [Thu, 17 Mar 2022 14:04:07 +0000 (15:04 +0100)]
Avoid repeated prompts in `M-x shell' if using ~/.emacs_bash

* lisp/shell.el (shell): Use `shell-eval-command' to avoid
repeated prompts (bug#9961).

2 years agoMake shell-resync-dirs work with zsh
Lars Ingebrigtsen [Thu, 17 Mar 2022 13:50:05 +0000 (14:50 +0100)]
Make shell-resync-dirs work with zsh

* lisp/shell.el (shell-resync-dirs): Use shell-eval-command to
avoid getting confused by zsh (bug#54384).
(shell-eval-command): New function.

2 years ago(seq-contains-p): Refine the non-nil returned value
Stefan Monnier [Thu, 17 Mar 2022 13:54:41 +0000 (09:54 -0400)]
(seq-contains-p): Refine the non-nil returned value

* lisp/emacs-lisp/seq.el (seq-contains-p): Like `cl-some` return the
value returned by the test function rather than t.

2 years ago; * doc/lispref/display.texi (Overlay Arrow): More accurate text.
Eli Zaretskii [Thu, 17 Mar 2022 12:55:59 +0000 (14:55 +0200)]
; * doc/lispref/display.texi (Overlay Arrow): More accurate text.

2 years agoFix a use of 'cl-defgeneric'.
Philipp Stephani [Tue, 15 Mar 2022 23:10:08 +0000 (00:10 +0100)]
Fix a use of 'cl-defgeneric'.

* lisp/progmodes/xref.el (xref-match-length): Use 'cl-defmethod'
instead of 'cl-defgeneric'.

2 years agoMake `?' work again in read-multiple-choice
Lars Ingebrigtsen [Thu, 17 Mar 2022 11:55:24 +0000 (12:55 +0100)]
Make `?' work again in read-multiple-choice

* lisp/emacs-lisp/rmc.el (read-multiple-choice): Make the `?' key
work again to show the help text.

2 years agoFormat long help texts better in read-multiple-choice
Felician Nemeth [Thu, 17 Mar 2022 11:44:43 +0000 (12:44 +0100)]
Format long help texts better in read-multiple-choice

* lisp/emacs-lisp/rmc.el (rmc--show-help): Format long help texts
better (bug#54430).

2 years agoImprove propagation of gnus/nnselect group info
Andrew G Cohen [Fri, 4 Mar 2022 08:44:40 +0000 (16:44 +0800)]
Improve propagation of gnus/nnselect group info

* lisp/gnus/nnselect.el (nnselect-push-info): Speed up pushing the
nnselect info back to the originating groups.

2 years agoFix bug in nnselect fetching new articles in a thread
Andrew G Cohen [Fri, 4 Mar 2022 08:29:50 +0000 (16:29 +0800)]
Fix bug in nnselect fetching new articles in a thread

* lisp/gnus/nnselect.el (nnselect-request-thread): Ignore the
Retrieval Status Value in comparing whether articles are the same.

2 years agoDon't use the original sender's address as the envelope-from
Sean Whitton [Thu, 17 Mar 2022 10:57:14 +0000 (11:57 +0100)]
Don't use the original sender's address as the envelope-from

* lisp/gnus/message.el (message-resend): Avoid setting the
envelope-from to the original sender's address rather than the
resender's (bug#54429).

2 years agoImprove LaTeX symbol prettification
Arash Esbati [Thu, 17 Mar 2022 10:44:15 +0000 (11:44 +0100)]
Improve LaTeX symbol prettification

* lisp/textmodes/tex-mode.el (tex--prettify-symbols-alist):
Support macros which used to be part of textcomp package.

2 years agoPrevent invisible frames from acting as drag sources
Po Lu [Thu, 17 Mar 2022 09:41:41 +0000 (17:41 +0800)]
Prevent invisible frames from acting as drag sources

* src/xterm.c (x_dnd_begin_drag_and_drop): Error out if f is
invisible.  It makes no sense for an invisible frame to be a
drag source, so the function just hangs.

2 years ago* src/haikuselect.c (Fhaiku_drag_message): Clear display grab after drag ends.
Po Lu [Thu, 17 Mar 2022 09:14:53 +0000 (09:14 +0000)]
* src/haikuselect.c (Fhaiku_drag_message): Clear display grab after drag ends.

2 years agoFix creating frames with an initial value of `fullscreen' on Haiku
Po Lu [Thu, 17 Mar 2022 08:51:32 +0000 (08:51 +0000)]
Fix creating frames with an initial value of `fullscreen' on Haiku

* src/haikufns.c (haiku_create_frame): Set configury_done and do
pending fullscreen change if any.
* src/haikuterm.c (haiku_fullscreen): Defer actually setting
fullscreen until configury_done is set.
* src/haikuterm.h (struct haiku_output): New field
`configury_done'.

2 years agoDo not cache directories with Tramp sshfs
Michael Albinus [Thu, 17 Mar 2022 08:09:54 +0000 (09:09 +0100)]
Do not cache directories with Tramp sshfs

* lisp/net/tramp-sshfs.el (tramp-methods) <sshfs>:
Add "-o dir_cache=no" to `tramp-mount-args'.  (Bug#54126)

2 years agoFix mouse movement on Haiku
Po Lu [Thu, 17 Mar 2022 07:17:13 +0000 (07:17 +0000)]
Fix mouse movement on Haiku

* src/haiku_support.cc (MouseMoved): Make sure grab view exists
before comparing against it.

2 years agoDisplay drag-and-drop messages in echo area on non-graphics displays
Po Lu [Thu, 17 Mar 2022 07:12:23 +0000 (15:12 +0800)]
Display drag-and-drop messages in echo area on non-graphics displays

* lisp/mouse.el (mouse-drag-and-drop-region-display-tooltip)
(mouse-drag-and-drop-region-hide-tooltip): New functions.
(mouse-drag-and-drop-region): Use them instead of calling
`x-hide-tip' and `x-show-tip' directly.

2 years agoFix compilation error of xterm.c
Eli Zaretskii [Thu, 17 Mar 2022 06:56:42 +0000 (08:56 +0200)]
Fix compilation error of xterm.c

* src/xterm.c (x_dnd_begin_drag_and_drop): Use current_count only
if defined.  Reported by Tassilo Horn <tsdh@gnu.org>.

2 years agoPrevent delivery of duplicate events when window is grabbed on Haiku
Po Lu [Thu, 17 Mar 2022 05:31:03 +0000 (05:31 +0000)]
Prevent delivery of duplicate events when window is grabbed on Haiku

* src/haiku_support.cc (grab_view, grab_view_locker): New
variables.
(MouseMoved, MouseDown, MouseUp): Keep track of the grab and
don't deliver motion events to any other view.

2 years ago* src/xterm.c (x_dnd_begin_drag_and_drop): Always initialize hold_quit.
Po Lu [Thu, 17 Mar 2022 04:53:36 +0000 (12:53 +0800)]
* src/xterm.c (x_dnd_begin_drag_and_drop): Always initialize hold_quit.

2 years agoRestore old PGTK scrolling code
Po Lu [Thu, 17 Mar 2022 03:59:56 +0000 (11:59 +0800)]
Restore old PGTK scrolling code

* src/pgtkterm.c (pgtk_copy_bits): Restore old code using
cairo_surface_create_similar.  (bug#54040)

2 years agoMake GTK inspector available on PGTK
Po Lu [Thu, 17 Mar 2022 03:51:32 +0000 (11:51 +0800)]
Make GTK inspector available on PGTK

* src/pgtkfns.c (Fx_gtk_debug): New function.
(syms_of_pgtkfns): Define new subr.

2 years ago; * lisp/term/haiku-win.el (x-begin-drag): Fix compiler warning.
Po Lu [Thu, 17 Mar 2022 03:49:23 +0000 (11:49 +0800)]
; * lisp/term/haiku-win.el (x-begin-drag): Fix compiler warning.

2 years ago* lisp/term/haiku-win.el (x-begin-drag): Fix type code of B_MIME_TYPE.
Po Lu [Thu, 17 Mar 2022 03:46:18 +0000 (03:46 +0000)]
* lisp/term/haiku-win.el (x-begin-drag): Fix type code of B_MIME_TYPE.

2 years agoImplement cross-program drag-and-drop on Haiku
Po Lu [Thu, 17 Mar 2022 03:42:19 +0000 (03:42 +0000)]
Implement cross-program drag-and-drop on Haiku

* doc/lispref/frames.texi (Drag and Drop): Fix documentation of
`x-begin-drag' to match actual function arity.
* lisp/term/haiku-win.el (haiku-dnd-selection-value): New
variable.
(haiku-dnd-selection-converters): New variable.
(haiku-dnd-convert-string): New function.
(gui-backend-get-selection, gui-backend-set-selection): Handle
XdndSelection specially.
(x-begin-drag): New function.

* src/haiku_select.cc (be_create_simple_message)
(be_add_message_data): New functions.
* src/haiku_support.cc (WAIT_FOR_RELEASE): New message type.
(class EmacsView, MouseUp): If waiting for release, reply and
drop event.
(be_drag_message, be_drag_message_thread_entry): New functions.
* src/haiku_support.h: Update prototypes.

* src/haikuselect.c (lisp_to_type_code, haiku_lisp_to_message)
(Fhaiku_drag_message): New functions.
(syms_of_haikuselect): Define new subr.

* src/haikuselect.h: Update prototypes.

2 years agoImprove GTK support for X11 drag-n-drop
Po Lu [Thu, 17 Mar 2022 00:54:30 +0000 (08:54 +0800)]
Improve GTK support for X11 drag-n-drop

* src/xterm.c (x_dnd_begin_drag_and_drop): Run nested GTK event
loop instead, so GTK gets the correct events.

2 years agoSimplify generate-new-buffer-name randomness
Paul Eggert [Thu, 17 Mar 2022 00:21:55 +0000 (17:21 -0700)]
Simplify generate-new-buffer-name randomness

* src/buffer.c (Fgenerate_new_buffer_name):
Simplify by calling get_random instead of Frandom;
that’s random enough here.

2 years agoImprove random bignum generation
Paul Eggert [Thu, 17 Mar 2022 00:21:55 +0000 (17:21 -0700)]
Improve random bignum generation

* src/bignum.c (get_random_limb, get_random_limb_lim)
(get_random_bignum): New functions, for more-efficient
generation of random bignums without using Frem etc.
* src/fns.c (get_random_fixnum): New function.
(Frandom): Use it, and get_random_bignum.
Be consistent about signalling nonpositive integer arguments;
since zero is invalid, Qnatnump is not quite right here.
* src/sysdep.c (get_random_ulong): New function.

2 years agoStrip positions from symbols before the eval in eval-{when,and}-compile.
Alan Mackenzie [Wed, 16 Mar 2022 19:23:24 +0000 (19:23 +0000)]
Strip positions from symbols before the eval in eval-{when,and}-compile.

This fixes bug #54079.

* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment): Change
the position of 'byte-run-strip-symbol-positions' in the eval-when-compile
entry.  Add a call to `byte-run-strip-symbol-positions' in the
eval-and-compile entry.

2 years agoReport buffer-name when local mode-line is invalid
Robert Pluim [Mon, 7 Mar 2022 10:26:25 +0000 (11:26 +0100)]
Report buffer-name when local mode-line is invalid

* lisp/files.el (hack-local-variables-prop-line): Add '(buffer-name)'
to the message reporting the malformed mode-line.

2 years agoGuard against custom entries that can contain NULs
Robert Pluim [Sat, 26 Feb 2022 10:46:32 +0000 (11:46 +0100)]
Guard against custom entries that can contain NULs

There are custom entries that contain lambda's as values by default,
which can result in them containing embedded NULs after
byte-compilation, which wreaks havoc when they are saved to .emacs and
later read in.  (Bug#52554)

* lisp/cus-edit.el (custom-save-all): Bind
print-escape-control-characters to t.
* lisp/startup.el (startup--load-user-init-file): Bind
inhibit-null-byte-detection to t.

2 years agoImprove error message for 'not running' processes
Robert Pluim [Wed, 9 Feb 2022 09:01:36 +0000 (10:01 +0100)]
Improve error message for 'not running' processes

The current error message is simply 'not running', but
'status_message' can give information about why the process is in that
state, such as network errors, so return that as well.  (Bug#53762)

* src/process.c (send_process, Fprocess_send_eof): Add the output of
'status_message' to the error string.

2 years ago* lisp/net/tramp-sh.el (tramp-find-file-exists-command): Fix comment.
Manuel Giraud [Wed, 16 Mar 2022 16:38:18 +0000 (17:38 +0100)]
* lisp/net/tramp-sh.el (tramp-find-file-exists-command): Fix comment.

2 years agoLink with libdl when using pgtk
Robert Pluim [Wed, 16 Mar 2022 14:24:35 +0000 (15:24 +0100)]
Link with libdl when using pgtk

* configure.ac: Define LIBMODULES on GNU/Linux when using pgtk, even
when not using modules, since pgtkterm.c uses dlsym.  (Bug#54378)

2 years ago* doc/lispref/frames.texi (x-begin-drag): Improve wording.
Po Lu [Wed, 16 Mar 2022 13:47:37 +0000 (21:47 +0800)]
* doc/lispref/frames.texi (x-begin-drag): Improve wording.

2 years agoFix 32-bit Haiku build
Po Lu [Wed, 16 Mar 2022 13:43:37 +0000 (13:43 +0000)]
Fix 32-bit Haiku build

* src/haikuselect.h (be_enum_message): Fix declaration for
32-bit types.

2 years agoAdd support for dropping plain text on Haiku
Po Lu [Wed, 16 Mar 2022 13:24:18 +0000 (13:24 +0000)]
Add support for dropping plain text on Haiku

* haiku-win.el (haiku-dnd-handle-drag-n-drop-event): Handle
`text/plain'.

2 years agoRedo Haiku DND support
Po Lu [Wed, 16 Mar 2022 13:18:12 +0000 (13:18 +0000)]
Redo Haiku DND support

* lisp/term/haiku-win.el (haiku-dnd-handle-drag-n-drop-event):
Update for new DND event format.
* src/haiku_io.c (haiku_len): Handle DRAG_AND_DROP_EVENTs.
* src/haiku_select.cc (be_enum_message, be_get_refs_data)
(be_get_message_data): New function.
* src/haiku_support.cc (class Emacs): Remove `RefsReceived'.
(MessageReceived): Generate new kind of drag-n-drop events.
* src/haiku_support.h (enum haiku_event_type): Rename
`REFS_EVENT' to `DRAG_AND_DROP_EVENT'.
(struct haiku_refs_event): Delete struct.
(struct haiku_drag_and_drop_event): New struct.
* src/haikuselect.c (haiku_message_to_lisp): New function.
(syms_of_haikuselect): New symbols.
* src/haikuselect.h: Update prototypes.
* src/haikuterm.c (haiku_read_socket): Handle new type of
drag-and-drop events by serializing drop message to Lisp and
letting Lisp code do the processing.
* src/haikuterm.h: Update prototypes.

2 years agoFix last change in frames.texi
Eli Zaretskii [Wed, 16 Mar 2022 12:46:36 +0000 (14:46 +0200)]
Fix last change in frames.texi

* doc/lispref/frames.texi (Drag and Drop): Improve and clarify the
wording.

2 years agoPacify compiler warning in handle_one_xevent
Po Lu [Wed, 16 Mar 2022 11:43:06 +0000 (19:43 +0800)]
Pacify compiler warning in handle_one_xevent

* src/xterm.c (x_dnd_get_target_window): Set proto_out even if
it won't be used because target is None.  Reported by Lars
Ingebrigtsen <larsi@gnus.org>.

2 years agoCorrect last change for return-frame drags
Po Lu [Wed, 16 Mar 2022 09:07:17 +0000 (17:07 +0800)]
Correct last change for return-frame drags

* src/xterm.c (handle_one_xevent): Use `x_any_window_to_frame'
to determine `x_dnd_return_frame_object'.

2 years agoFix minor bugs with XDND support
Po Lu [Wed, 16 Mar 2022 09:03:19 +0000 (17:03 +0800)]
Fix minor bugs with XDND support

* lisp/mouse.el (mouse-drag-and-drop-region): Report more
selection targets for the benefit of Qt and Mozilla.
* lisp/select.el (xselect--encode-string)
(selection-converter-alist): Add new selection targets.

* src/xterm.c (x_dnd_get_window_proxy): New function.
(x_dnd_get_target_window): New argument proto_out, and return
first window with XdndAware instead of bottommost window.
(handle_one_xevent): Use new argument `proto_out'.

2 years agoFix XI 2.0 build
Po Lu [Wed, 16 Mar 2022 07:51:02 +0000 (15:51 +0800)]
Fix XI 2.0 build

* src/xterm.c (handle_one_xevent): Move declaration of dummy out
of HAVE_XINPUT2_1.

2 years agoFix tooltip text properties showing up in dragged text
Po Lu [Wed, 16 Mar 2022 07:18:02 +0000 (15:18 +0800)]
Fix tooltip text properties showing up in dragged text

* lisp/mouse.el (mouse-drag-and-drop-region): Directly call
x-show-tip and x-hide-tip instead of going through tooltip-show.

2 years agoMerge from origin/emacs-28
Stefan Kangas [Wed, 16 Mar 2022 05:30:35 +0000 (06:30 +0100)]
Merge from origin/emacs-28

62e830c3d9 * doc/misc/transient.texi: Fix @dircategory to "Emacs misc...

2 years agoBetter handle drag-and-drop from one Emacs frame to another
Po Lu [Wed, 16 Mar 2022 04:33:15 +0000 (12:33 +0800)]
Better handle drag-and-drop from one Emacs frame to another

* doc/lispref/frames.texi (Drag and Drop): Document new
parameter `return-frame' to `x-begin-drag'.
* lisp/mouse.el (mouse-drag-and-drop-region): Utilize new
feature.

* src/xfns.c (Fx_begin_drag): New parameter `return-frame'.
* src/xterm.c (x_dnd_begin_drag_and_drop): New parameter
return_frame_p.
(handle_one_xevent): Set new flags and return frame whenever
appropriate.
* src/xterm.h: Update prototypes.

2 years ago* src/xfns.c (Fx_begin_drag): Improve doc string.
Po Lu [Wed, 16 Mar 2022 03:45:46 +0000 (11:45 +0800)]
* src/xfns.c (Fx_begin_drag): Improve doc string.

2 years agoAdd support for dragging text from Emacs to other programs
Po Lu [Wed, 16 Mar 2022 03:29:36 +0000 (11:29 +0800)]
Add support for dragging text from Emacs to other programs

This still probably needs some more protection from
malfunctioning clients which delete windows at random, but I
don't know if that's a problem in practice.

* doc/emacs/frames.texi (Drag and Drop):
* doc/lispref/frames.texi (Drag and Drop): Document new
features.

* etc/NEWS: Announce new function `x-begin-drag' and new user
option `mouse-drag-and-drop-region-cross-program'.

* lisp/mouse.el (mouse-drag-and-drop-region-cross-program): New
user option.
(x-begin-drag): New variable declaration.
(mouse-drag-and-drop-region): If the mouse moves out of an Emacs
frame, begin a window system drag.
* lisp/x-dnd.el (x-dnd-handle-xdnd): Remove left-over debugging
code.

* src/xfns.c (Fx_set_mouse_absolute_pixel_position): Fix
indentation of opening paren.
(Fx_begin_drag): New function.
(syms_of_xfns): Define new subr.
* src/xselect.c (x_timestamp_for_selection): New function.

* src/xterm.c (X_DND_SUPPORTED_VERSION): New preprocessor
declaration.
(x_dnd_get_window_proto, x_dnd_send_enter, x_dnd_send_position)
(x_dnd_send_leave, x_dnd_send_drop, x_set_dnd_targets)
(x_dnd_begin_drag_and_drop): New functions.
(handle_one_xevent): Handle drag-and-drop motion and button
events when active.
(x_free_frame_resources): If f is the DND source, stop
drag-and-drop.
(x_term_init): Intern new atoms.
(syms_of_xterm): New symbol QXdndSelection.

* src/xterm.h (struct x_display_info): New atoms
Xatom_XdndAware, Xatom_XdndSelection, Xatom_XdndTypeList,
Xatom_XdndActionCopy, Xatom_XdndActionMove,
Xatom_XdndActionLink, Xatom_XdndActionAsk,
Xatom_XdndActionPrivate, Xatom_XdndActionList,
Xatom_XdndActionDescription, Xatom_XdndProxy, Xatom_XdndEnter,
Xatom_XdndPosition, Xatom_XdndStatus, Xatom_XdndLeave,
Xatom_XdndDrop, and Xatom_XdndFinished.

2 years agoFix build with GTK 3.18.0 or earlier
Po Lu [Wed, 16 Mar 2022 00:41:24 +0000 (08:41 +0800)]
Fix build with GTK 3.18.0 or earlier

* src/gtkutil.c (xg_update_scroll_bar_pos)
(xg_update_horizontal_scrollbar_pos): Avoid
gtk_widget_queue_allocate on older GTK versions.

2 years agoClean up implementation of N0 per UAX#9
Eli Zaretskii [Tue, 15 Mar 2022 19:21:20 +0000 (21:21 +0200)]
Clean up implementation of N0 per UAX#9

* src/bidi.c (bidi_resolve_brackets): Instead of requiring
prev_for_neutral's type to be known, fall back on SOS, per
the UBA.

2 years ago* doc/misc/transient.texi: Fix @dircategory to "Emacs misc features" for dir.
Juri Linkov [Tue, 15 Mar 2022 17:28:50 +0000 (19:28 +0200)]
* doc/misc/transient.texi: Fix @dircategory to "Emacs misc features" for dir.

2 years agoExtract `gnus-collect-urls-from-article' from `gnus-summary-browse-url'
Sam Steingold [Tue, 15 Mar 2022 16:22:48 +0000 (12:22 -0400)]
Extract `gnus-collect-urls-from-article' from `gnus-summary-browse-url'

* lisp/gnus-sum.el (gnus-collect-urls-from-article):
New function, extracted from `gnus-summary-browse-url'.
(gnus-summary-browse-url): Use it.

2 years ago* lisp/url/url-vars.el: Cosmetic changes
Stefan Monnier [Tue, 15 Mar 2022 14:18:07 +0000 (10:18 -0400)]
* lisp/url/url-vars.el: Cosmetic changes

(url-mime-separator-chars): Simplify.
(url-interactive-p): Tweak docstring.

2 years agodoctex-mode: Try and fix bug#35140
Stefan Monnier [Tue, 15 Mar 2022 14:12:46 +0000 (10:12 -0400)]
doctex-mode: Try and fix bug#35140

* lisp/textmodes/tex-mode.el (doctex-syntax-propertize-rules):
Add support for the new ^^X and consider the first ^ of ^^A to be the
closing char for the previous comment.
(doctex-font-lock-^^A): Simplify accordingly.

2 years agoFix byte-code button in help--describe-command
Lars Ingebrigtsen [Tue, 15 Mar 2022 11:44:50 +0000 (12:44 +0100)]
Fix byte-code button in help--describe-command

* lisp/help.el (help--describe-command): Fix byte-code button
(bug#24235).

2 years agoRevert "New command `gnus-summary-browse-all-urls' bound to "v""
Lars Ingebrigtsen [Tue, 15 Mar 2022 11:36:06 +0000 (12:36 +0100)]
Revert "New command `gnus-summary-browse-all-urls' bound to "v""

This reverts commit f52dcfd03ad542704d9a43faab0c33be09ab442e.

It was never agreed that this should be added.

2 years agoFix some minor glitches with Haiku scroll bars
Po Lu [Tue, 15 Mar 2022 04:46:01 +0000 (04:46 +0000)]
Fix some minor glitches with Haiku scroll bars

* src/haiku_support.cc (MouseDown): Don't start overscroll if
dragging started inside a button.

2 years agoFix crashes when trying to pop up a menu on GTK 2
Po Lu [Tue, 15 Mar 2022 04:14:56 +0000 (12:14 +0800)]
Fix crashes when trying to pop up a menu on GTK 2

* src/xterm.c (handle_one_xevent): Respect finish when
dispatching copy.

2 years agoFix some issues with input on GTK 2 builds
Po Lu [Tue, 15 Mar 2022 04:09:45 +0000 (12:09 +0800)]
Fix some issues with input on GTK 2 builds

* src/xfns.c (setup_xi_event_mask): Don't ask for XI key press
on GTK 2.

2 years agoFix extraneous ifdef in xwidgets code
Po Lu [Tue, 15 Mar 2022 02:28:54 +0000 (10:28 +0800)]
Fix extraneous ifdef in xwidgets code

* xterm.c (handle_one_xevent): Pass GesturePinchEnd events to
xwidgets regardless of no-longer-present define.

2 years ago* src/xterm.c (handle_one_xevent): Fix use of wrong motion structure.
Po Lu [Tue, 15 Mar 2022 02:24:13 +0000 (10:24 +0800)]
* src/xterm.c (handle_one_xevent): Fix use of wrong motion structure.

2 years agoStop relying on dynlib for PGTK interrupt input
Po Lu [Tue, 15 Mar 2022 00:54:30 +0000 (08:54 +0800)]
Stop relying on dynlib for PGTK interrupt input

* src/pgtkterm.c (pgtk_term_init): Use dlopen and dlsym directly
instead of dynlib functions.  (bug#54378)

2 years agoEUDC: Fix a bug and some docstrings
Thomas Fitzsimmons [Mon, 14 Mar 2022 21:33:42 +0000 (17:33 -0400)]
EUDC: Fix a bug and some docstrings

* lisp/net/eudc.el (eudc-register-protocol): Add doc string.
(eudc-expand-inline): Add TRY-ALL-SERVERS to docstring.
(eudc-query-with-words): Fix early-return bug reported by
Alexander Adolf.
(eudc-menu): Add doc string.
(eudc-install-menu): Likewise.

2 years agoAnother fix for the no-toolkit build
Paul Eggert [Mon, 14 Mar 2022 20:14:23 +0000 (13:14 -0700)]
Another fix for the no-toolkit build

This should be better in the long run.
* oldXMenu/Activate.c (XMenuActivate): Revert previous change,
eliminating the goto it introduced.
* oldXMenu/XMenuInt.h: Include <attribute.h>, for FALLTHROUGH.

2 years agoPrefer CALLN
Paul Eggert [Mon, 14 Mar 2022 15:55:46 +0000 (08:55 -0700)]
Prefer CALLN

* src/bytecode.c (Fbyte_code):
* src/composite.c (Fclear_composition_cache):
Prefer CALLN to doing it by hand.
* src/fns.c (ccall2): Remove.  All uses replaced by CALLN.

2 years agoNew command `gnus-summary-browse-all-urls' bound to "v"
Sam Steingold [Fri, 11 Mar 2022 18:59:46 +0000 (13:59 -0500)]
New command `gnus-summary-browse-all-urls' bound to "v"

* lisp/gnus-sum.el (gnus-collect-urls-from-article): New function,
  extracted from `gnus-summary-browse-url'.
(gnus-summary-browse-url): Use it; also use `browse-url-button-open-url'
  to handle the prefix argument.
(gnus-summary-browse-all-urls): New command.
(gnus-summary-mode-map): Bind `gnus-summary-browse-all-urls' to "v".

2 years agoFix the no toolkit build
Po Lu [Mon, 14 Mar 2022 13:48:47 +0000 (21:48 +0800)]
Fix the no toolkit build

* Activate.c (XMenuActivate): Stop relying on fallthroughs
inside switch statement.  (bug#54382)

2 years agoFix RFC2047 encoding of Disposition-Notification-To
Lars Ingebrigtsen [Mon, 14 Mar 2022 13:46:25 +0000 (14:46 +0100)]
Fix RFC2047 encoding of Disposition-Notification-To

* lisp/mail/rfc2047.el (rfc2047-header-encoding-alist): Encode
Disposition-Notification-To as an address header (bug#54383).

2 years agoHandle position specification hints on X toolkit builds
Po Lu [Mon, 14 Mar 2022 13:37:42 +0000 (21:37 +0800)]
Handle position specification hints on X toolkit builds

* src/xterm.c (x_wm_set_size_hint): Set PPosition and USPosition
independently of Xt.

2 years ago* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Simplify Edebug spec
Stefan Monnier [Mon, 14 Mar 2022 13:28:18 +0000 (09:28 -0400)]
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Simplify Edebug spec

2 years agoImprove the execute-kbd-macro doc string
Lars Ingebrigtsen [Mon, 14 Mar 2022 11:16:27 +0000 (12:16 +0100)]
Improve the execute-kbd-macro doc string

* src/macros.c (Fexecute_kbd_macro): Improve the doc string
(bug#14206).

2 years agoMake Edebug specification for 'cl-defstruct' more lenient.
Philipp Stephani [Mon, 14 Mar 2022 09:59:03 +0000 (10:59 +0100)]
Make Edebug specification for 'cl-defstruct' more lenient.

For example, 'xref-item' uses the list form of ':noinline'.

* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Accept ':noinline' and
':named' with an argument.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct/edebug): New
unit test.

2 years agoDon't always escape "." and "?" in `prin1'
Lars Ingebrigtsen [Mon, 14 Mar 2022 09:27:12 +0000 (10:27 +0100)]
Don't always escape "." and "?" in `prin1'

* src/print.c (print_object): Only escape "." and "?" when
appearing as the first character in a symbol (bug#23130).

2 years agoInit 'rest' in 'balance-windows-2' (Bug#54380)
Martin Rudalics [Mon, 14 Mar 2022 09:26:36 +0000 (10:26 +0100)]
Init 'rest' in 'balance-windows-2' (Bug#54380)

* lisp/window.el (balance-windows-2): Give 'rest' an initial
value (Bug#54380).

2 years agoClean up some Haiku toolkit code
Po Lu [Mon, 14 Mar 2022 06:48:34 +0000 (06:48 +0000)]
Clean up some Haiku toolkit code

* src/haiku_io.c (haiku_read_with_timeout): Accept `bigtime_t'
instead of `time_t' for values which are cast to bigtime_t
anyway.
* src/haiku_support.cc (BMenu_run): Read all help events instead
of just one.
* src/haiku_support.h: Update prototypes.

2 years ago; Merge from origin/emacs-28
Stefan Kangas [Mon, 14 Mar 2022 05:30:42 +0000 (06:30 +0100)]
; Merge from origin/emacs-28

The following commit was skipped:

8e7a3f21e0 Fix evaluation of negated argument predicates in Eshell

2 years agoMerge from origin/emacs-28
Stefan Kangas [Mon, 14 Mar 2022 05:30:41 +0000 (06:30 +0100)]
Merge from origin/emacs-28

1ec4063017 ; * admin/make-tarball.txt: Minor updates.

2 years agoFix extraneous overscroll activation on Haiku
Po Lu [Mon, 14 Mar 2022 02:45:55 +0000 (02:45 +0000)]
Fix extraneous overscroll activation on Haiku

* src/haiku_support.cc (class EmacsScrollBar): New field
`maybe_overscroll'.
(MouseDown): Set that field.
(MouseUp): Clear that field.
(MouseMoved): Also test `maybe_overscroll' to ensure that a grab
started inside the scroll bar.

2 years agoFix tool-bar highlight persisting after mouse moves onto WM frame
Po Lu [Mon, 14 Mar 2022 01:05:48 +0000 (09:05 +0800)]
Fix tool-bar highlight persisting after mouse moves onto WM frame

* src/xterm.c (handle_one_xevent): Always report MotionNotify
coordinates in terms of the edit widget.

2 years ago* src/bytecode.c: Include sysstdio.h, for fprint, stderr.
Glenn Morris [Mon, 14 Mar 2022 01:03:11 +0000 (18:03 -0700)]
* src/bytecode.c: Include sysstdio.h, for fprint, stderr.

; Ref https://hydra.nixos.org/build/169207408

2 years agoEnable overscroll on Haiku horizontal scroll bars
Po Lu [Mon, 14 Mar 2022 00:54:10 +0000 (00:54 +0000)]
Enable overscroll on Haiku horizontal scroll bars

* src/haiku_support.cc (MouseMoved): Handle horizontal
directions correctly.
* src/haikuterm.c (haiku_set_horizontal_scroll_bar_thumb):
Enable overscrolling on scroll bar widget.

2 years agoFix scroll bar movement right before overscroll begins on Haiku
Po Lu [Mon, 14 Mar 2022 00:45:00 +0000 (00:45 +0000)]
Fix scroll bar movement right before overscroll begins on Haiku

* src/haikuterm.c (haiku_set_scroll_bar_thumb): Make sure value
and size are within bounds even if portion adjustment is off.

2 years agoReally fix find-func for defgeneric
Lars Ingebrigtsen [Sun, 13 Mar 2022 20:15:35 +0000 (21:15 +0100)]
Really fix find-func for defgeneric

* lisp/emacs-lisp/find-func.el (find-function-regexp): Really add
defgeneric.

2 years agoMake vtable sorting stable
Lars Ingebrigtsen [Sun, 13 Mar 2022 20:13:49 +0000 (21:13 +0100)]
Make vtable sorting stable

* lisp/emacs-lisp/vtable.el (vtable--sort): Make the sorting
stable.

2 years agoClang debug notes
Paul Eggert [Sun, 13 Mar 2022 19:03:46 +0000 (12:03 -0700)]
Clang debug notes

* etc/DEBUG: Don’t imply Clang works as well as GCC when
debugging Emacs.  Mention a coverage problem with Clang.

2 years agoFix evaluation of negated argument predicates in Eshell
Jim Porter [Sun, 13 Mar 2022 14:36:37 +0000 (15:36 +0100)]
Fix evaluation of negated argument predicates in Eshell

* lisp/eshell/em-pred.el (eshell-add-pred-func): Let-bind 'pred' so
the lambdas see the original value (bug#54369).

Committed on the wrong branch.

Do not merge to master.

2 years agoFix evaluation of negated argument predicates in Eshell
Jim Porter [Sun, 13 Mar 2022 14:36:37 +0000 (15:36 +0100)]
Fix evaluation of negated argument predicates in Eshell

* lisp/eshell/em-pred.el (eshell-add-pred-func): Let-bind 'pred' so
the lambdas see the original value (bug#54369).