Commit graph

677 commits

Author SHA1 Message Date
Po Lu
a4087f5955 Improve reliability of minor mode menu dispatch
* lisp/mouse.el (minor-mode-menu-from-indicator): Instead of using the
word at point, search for a matching enabled minor mode from the
beginning of the string object when mode-line-compact is enabled.
2023-07-19 08:21:43 +08:00
Po Lu
c4f8ead08d Fix display of minor mode menus when mode-line-compact is enabled
* lisp/mouse.el (minor-mode-menu-from-indicator): New arg
WINDOW.  If INDICATOR is a string object and mode-line-compat is
enabled within WINDOW, use the symbol within the object at its
position instead.
(mouse-minor-mode-menu): Pass posn-object and posn-window to
minor-mode-menu-from-indicator.
2023-07-18 16:15:05 +08:00
Eli Zaretskii
5fecdbcd81 Merge from origin/emacs-29
5ef7ff0573 ; Start a new ChangeLog.4 file.
11126c6d30 Fix 'C-h k' for "Paste from Kill Menu" in context menus
74ddfe811f ; * doc/misc/calc.texi (Rewrites Tutorial): Fix a typo (b...
08cda286c3 Improve the documentation of the XDS support
14d1c00e80 Allow reindentation of images inserted by 'mm-inline-image'
b63a9eda01 Fix "C-h k" and "C-h c" with Paste from Kill Menu
b36c21e27d Change cursor color on NS port when it matches the face b...
96714c106b Improve documentation of image-related commands
6a2863ca01 Fix handling of sliced images
5be79fd05a ; * etc/NEWS: Announce 'cyrillic-mongolian' IM.
ca1a0fda98 ; Fix last change.
ce63462dbd Add cyrillic-mongolian input method
5880179270 ; Minor addition to the Emacs FAQ
88847dee12 Jsonrpc: don't bind inhibit-read-only to t so early
cb8c87a423 Allow active region when IM is used

# Conflicts:
#	etc/NEWS
2023-04-15 12:43:37 -04:00
Eli Zaretskii
11126c6d30 Fix 'C-h k' for "Paste from Kill Menu" in context menus
* lisp/mouse.el (context-menu-region): Make the entries be
symbols, not just integers, to prevent "C-h c" from interpreting
them as character keys.  (Bug#62626)
2023-04-08 20:10:49 +03:00
Eli Zaretskii
3c55fbd4ad Merge from origin/emacs-29
cae528457c ; Add 2023 to copyright years.
b394359261 Improve documentation of 'isearch-open-overlay-temporary'
ab3210e709 Document 'use-package' in the 2 main manuals

# Conflicts:
#	etc/refcards/ru-refcard.tex
#	lib/explicit_bzero.c
#	m4/explicit_bzero.m4
2023-01-01 05:47:47 -05:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Eli Zaretskii
12424cf31d New option for selecting symbols by double-clicking
* lisp/mouse.el (mouse-1-double-click-prefer-symbols): New user
option.
(mouse-skip-word): If 'mouse-1-double-click-prefer-symbols' is
non-nil, skip over the entire symbol at point.  (Bug#60080)
2022-12-16 18:26:14 +02:00
Eli Zaretskii
5496f45437 Avoid signaling args-out-of-range in mouse.el
* lisp/mouse.el (mouse-posn-property): Avoid
signaling args-out-of-range errors when mode-line format uses
min-width 'display' property.  (Bug#59452)
2022-11-23 17:16:32 +02:00
Lars Ingebrigtsen
06d7161476 Fix some no-X build warnings
* lisp/cus-edit.el (fringe-bitmap-p): Autoload.

* lisp/image.el (clear-image-cache): Declare.

* lisp/mouse.el (dnd-begin-file-dram): Autoload.

* lisp/thumbs.el (image-supported-file-p): Declare (bug#57342).

* lisp/mail/rmailmm.el (rmail-mime-set-bulk-data):
* lisp/emacs-lisp/icons.el (icons--create): Avoid warnings on no-X
builds.
2022-08-22 19:22:33 +02:00
Stefan Kangas
fd4aad5697 ; * lisp/mouse.el: Delete stale comment. 2022-08-09 21:58:00 +02:00
Mattias Engdegård
8d68760dde ; Fix typos. 2022-07-02 13:32:41 +02:00
Visuwesh
9e08c04798 Make <mouse-2> in mode line more careful as well
* lisp/mouse.el (mouse-delete-other-windows): Only delete other
windows if the user didn't move the cursor off the
mode-line (bug#56198).
2022-06-26 17:45:45 +02:00
Visuwesh
cd6ce7e546 Make <mouse-3> in the mode line more careful
* lisp/mouse.el (mouse-delete-window): Only delete the window if
the user hasn't moved point out of the mode line before releasing
the button (bug#56198).
2022-06-26 17:30:04 +02:00
Lars Ingebrigtsen
e02ebe9137 Allow appending to the kill ring with mouse selections
* lisp/bindings.el (ignore-preserving-kill-region): New function.
(global-map): Use it.

* lisp/mouse.el (mouse-set-region, mouse-drag-region)
(mouse-drag-track): Allow appending to kill ring with mouse
selections (bug#32747).
2022-06-20 01:00:06 +02:00
Lars Ingebrigtsen
8cb7682e88 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.
2022-06-09 15:58:28 +02:00
Po Lu
dd8db560c2 Disable tooltip timeouts for drag-and-drop tooltips
* lisp/mouse.el (mouse-drag-and-drop-region-display-tooltip):
Don't time out the created tooltip.
2022-06-09 16:44:17 +08:00
Po Lu
0ba43e15d9 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.
2022-06-09 15:44:51 +08:00
Po Lu
2f31dbeadf 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.
2022-06-09 13:11:08 +08:00
Po Lu
cbc0d8f7c7 Don't display mouse face during mouse drag-and-drop
* lisp/mouse.el (mouse-drag-and-drop-region): Don't display
mouse face, since it leads to a lot of flicker.
2022-06-07 10:27:03 +08:00
Po Lu
eaff6569e2 Improve doc of `mouse-drag-mode-line-buffer'
* doc/emacs/frames.texi (Mouse Commands): Document
`mouse-drag-mode-line-buffer'.
* etc/NEWS: Explain where that option is supported.
* lisp/mouse.el (mouse-drag-mode-line-buffer): Likewise.
2022-06-04 13:27:03 +08:00
Po Lu
4f56ca6376 Add new user option `mouse-drag-mode-line-buffer'
* etc/NEWS: Announce new option.  Also add missing entries for
an earlier change.
* lisp/mouse.el (mouse-drag-mode-line-buffer): New user option.
(mouse-drag-mode-line): Implement that option.
2022-06-03 15:20:23 +08:00
Po Lu
2244dc5ce9 Fix help-echo tooltips interfering with mouse drag-and-drop
* lisp/mouse.el (mouse-drag-and-drop-region): Disable
tooltip-mode while mouse drag-and-drop is in progress.  Also
restore state correctly in some more cases.
2022-06-02 14:27:38 +08:00
Po Lu
5743b74d4b Improve mouse dragging
* lisp/mouse.el (mouse-drag-and-drop-region-display-tooltip):
Respect foreground and background parameters.
(mouse-drag-and-drop-region): Enable fine grained tracking.
2022-05-12 14:56:32 +08:00
Stefan Kangas
2fba71cf1f Fix handling double-click-time nil or t
* lisp/mouse.el (mouse-double-click-time): New function to always
return a number for `double-click-time'.
* lisp/emulation/viper-mous.el (viper-multiclick-timeout):
* lisp/foldout.el (foldout-mouse-swallow-events):
* lisp/help.el (help--read-key-sequence):
* lisp/org/org-mouse.el (org-mouse-show-context-menu): Use
'mouse-double-click-time' instead of 'double-click-time'.
* src/keyboard.c (syms_of_keyboard): Mention
'mouse-double-click-time' in doc string of 'double-click-time'.
* test/lisp/mouse-tests.el (mouse-test-mouse-double-click-time):
New test.
2022-05-02 12:03:08 +02:00
Lars Ingebrigtsen
a7f2eb3054 Make isearch respond to 'mouse-yank-at-point'
* doc/emacs/killing.texi (Secondary Selection): Document it.
* lisp/isearch.el (isearch-mouse-2): Make isearch respond to
mouse-yank-at-point (bug#7787).

* lisp/mouse.el (mouse-yank-at-point): Mention it.
2022-04-27 14:02:23 +02:00
Po Lu
1e1a66831b 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.
2022-04-05 00:54:03 +00:00
Po Lu
aea799838b Improve behavior of dragging text to windows on top of frames
* doc/lispref/frames.texi (Drag and Drop): Document new meaning
of `return-frame' in `x-begin-drag'.
* lisp/mouse.el (mouse-drag-and-drop-region): Use `now' when
calling `x-begin-drag'.
* src/xfns.c (Fx_begin_drag): Update doc string.
* src/xterm.c (x_dnd_begin_drag_and_drop): Accept return_frame
as a Lisp_Object and handle Qnow correctly.
(XTmouse_position): Ignore tooltip frames when processing
`drag-source'.
(syms_of_xterm): New defsym `now'.
* src/xterm.h: Update prototypes.
2022-04-04 13:10:01 +08:00
Po Lu
28f720e7c4 Make dragging stuff to a window above a frame work
* doc/lispref/frames.texi (Mouse Tracking):
* etc/NEWS: Announce new `drag-source' value of `track-mouse'.
* lisp/mouse.el (mouse-drag-and-drop-region): Use new value of
`track-mouse' during interprogram drag and drop.

* src/keyboard.c (make_lispy_position): Handle nil values of f
correctly.
* src/xdisp.c (define_frame_cursor1): Ignore if `drag-source' as
well.
(syms_of_xdisp): New defsym `drag-source'.
* src/xterm.c (XTmouse_position): Implement `drag-source'.
(mouse_or_wdesc_frame): Likewise.
2022-04-03 18:59:12 +08:00
Po Lu
7899e8daff Fix error on mouse move over something not a window while dragging text
* lisp/mouse.el (mouse-drag-and-drop-region): Handle non-window
values of `posn-window' correctly.
2022-04-02 15:59:15 +08:00
Po Lu
c8a49b69ab ; * lisp/mouse.el (mouse-drag-and-drop-region-scroll-margin): Fix type. 2022-04-02 15:48:57 +08:00
Po Lu
e351e9037c Add new option `mouse-drag-and-drop-region-scroll-margin'
* etc/NEWS: Announce new user option.
* lisp/mouse.el (mouse-drag-and-drop-region-scroll-margin): New
user option.
(mouse-drag-and-drop-region): Implement "scroll margin" like
behavior during mouse movement.
2022-04-02 15:45:00 +08:00
Po Lu
0a32037c92 Implement DELETE selection target for cross program drags
* lisp/mouse.el (mouse-drag-and-drop-region): Make sure mark
stays deactivated if a "cut" operation was performed.
* lisp/select.el (xselect-convert-to-delete): Don't clear
selection contents if it's the XdndSelection.
2022-04-02 14:59:08 +08:00
Po Lu
8aff4c0a36 Handle quitting correctly during interprogram drag-and-drop
* lisp/mouse.el (mouse-drag-and-drop-region): Handle quit
correctly by exiting the cross program drag and drop.
2022-03-23 11:30:13 +08:00
Lars Ingebrigtsen
c8bde5b0a3 Fix two no-X compilation warnings
* lisp/mouse.el (x-hide-tip, x-show-tip): Declare to avoid no-X
build compilation warnings (bug#54524).

* lisp/term/pgtk-win.el (window-system-initialization): Avoid no-X
compilation warning.
2022-03-22 21:14:21 +01:00
Po Lu
13762d24b8 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.
2022-03-17 15:12:23 +08:00
Po Lu
e8d7139b4e 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'.
2022-03-16 17:03:19 +08:00
Po Lu
47dcf72dec 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.
2022-03-16 15:20:10 +08:00
Po Lu
f62a6acd00 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.
2022-03-16 12:33:15 +08:00
Po Lu
e53fba3fd4 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.
2022-03-16 11:31:29 +08:00
Juri Linkov
17c75146a4 * lisp/mouse.el (context-menu-entry): Remove help-buffer-under-preparation.
(bug#53910)
2022-02-20 20:56:06 +02:00
Juri Linkov
3d0f5bc219 * lisp/mouse.el (context-menu-entry): Don't create menu for Help commands.
Help commands that describe keybindings call context-menu-entry bound to
a key.  This causes too much trouble when trying to build the context menu
in a temporary Help buffer that is not displayed in a window.
OTOH, there is no information in context menus useful for Help commands.
So `help-buffer-under-preparation' is added to filter out such calls.
(bug#53910)
2022-02-17 20:28:43 +02:00
Juri Linkov
437382734a * lisp/mouse.el (context-menu-map): Select only unselected window (bug#53910) 2022-02-10 20:57:42 +02:00
Po Lu
d41a5e7e33 Improve selection of fonts available from `mouse-set-font'
People get confused on a build without font dialogs (such as a
Lucid build) if `menu-set-font' and `mouse-set-font' don't
present them a list of the fonts actually available on their
system.

* lisp/mouse.el (mouse-generate-font-name-for-menu)
(mouse-generate-font-menu): New functions.
(mouse-select-font): Allow the user to select from all fonts
available on the system.
(mouse-set-font): Use `mouse-select-font' to display font menu.
2022-02-09 11:27:15 +08:00
Juri Linkov
791694c5fe * lisp/mouse.el (context-menu-map): Select clicked window (bug#53249). 2022-01-15 20:37:15 +02:00
Juri Linkov
f19b34376a More fixes for recently committed context-menu additions from bug#52973
* lisp/hi-lock.el (highlight-symbol-at-mouse): New defalias.
(hi-lock-face-symbol-at-mouse): Rename from hi-lock-symbol-at-mouse.
(hi-lock-context-menu): Use thing-at-mouse and middle-separator.

* lisp/man.el (Man-context-menu): Fix Man-at-mouse and use middle-separator.

* lisp/mouse.el (context-menu-functions): Remove context-menu-online-search.
Add occur-context-menu and dictionary-context-menu (bug#50552).
2022-01-15 20:33:45 +02:00
Lars Ingebrigtsen
639488b55a Revert "Add command to invoke a search engine"
This reverts commit 3f36d08362.

Similar functionality has been added to webjump, so this commit duplicated that.
2022-01-15 09:06:50 +01:00
Lars Ingebrigtsen
373618d3a8 Add new context menu functions to the context-menu-functions type
* lisp/mouse.el (context-menu-functions): Add new menu functions
to the defcustom type list (bug#52973).
2022-01-14 09:49:44 +01:00
Philip Kaludercic
3f36d08362 Add command to invoke a search engine
* mouse.el (context-menu-online-search): Add new function
(eww-search-prefix): Declare variable from eww.el
(mouse-online-search-at-point): Add new command
2022-01-14 09:47:02 +01:00
Jim Porter
3eaf3aeec8 Prevent further cases of duplicated separators in context menus
In some cases, context menu items are added before the overall prompt
string.  This could cause multiple consecutive separators to appear if
they "surround" the prompt string.  (Bug#52293)

* lisp/mouse.el (context-menu-map): Improve the de-duplication logic
to ignore non-menu-items when checking for consecutive separators.

* test/lisp/mouse-tests.el
(context-menu-map-remove-consecutive-separators)
(context-menu-map-remove-separators-at-beginning-or-end): New tests.
2022-01-04 10:18:15 +02:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00