Augusto Stoffel [Tue, 8 Mar 2022 10:23:56 +0000 (11:23 +0100)]
New user option 'font-lock-ignore'
* lisp/font-lock (font-lock-ignore): New defcustom.
(font-lock-compile-keywords): Call 'font-lock--filter-keywords'.
(font-lock--match-keyword, font-lock--filter-keywords): New functions,
implement the functionality described in 'font-lock-ignore'.
* doc/lispref/modes.texi: Describe 'font-lock-ignore'.
Stefan Monnier [Fri, 1 Apr 2022 14:02:32 +0000 (10:02 -0400)]
cl-generic: Rework obsolescence checks for defmethod
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Silence obsolescence
warnings in the included methods.
(cl-defmethod): Reuse standard obsolescence checks.
Ignacio [Sun, 13 Mar 2022 20:05:18 +0000 (21:05 +0100)]
Better check for when clipboard or primary selection have changed
Previously it was done by just comparing new and old selection
text, now we use also selection timestamps for systems that
support it (only enabled in X for now). (bug#53894)
* lisp/select.el: (gui--last-selection-timestamp-clipboard)
(gui--last-selection-timestamp-primary): New variables.
(gui--set-last-clipboard-selection)
(gui--set-last-primary-selection)
(gui--clipboard-selection-unchanged-p)
(gui--primary-selection-unchanged-p): New functions.
Stefan Monnier [Fri, 1 Apr 2022 12:54:55 +0000 (08:54 -0400)]
OClosure: Add support for defmethod dispatch
* lisp/emacs-lisp/oclosure.el (oclosure--class): Add slot `allparents`.
(oclosure--class-make): Add corresponding arg `allparents`.
(oclosure, oclosure--build-class): Pass the new arg to the constructor.
(oclosure--define): Make the predicate function understand subtyping.
* lisp/emacs-lisp/cl-preloaded.el (cl--class-allparents): Move from
`cl-generic.el`.
* lisp/emacs-lisp/cl-generic.el (cl--generic-class-parents): Move to
`cl-preloaded.el` and rename to `cl--class-allparents`.
Adjust all callers.
(cl--generic-oclosure-tag, cl-generic--oclosure-specializers): New functions.
(cl-generic-generalizers) <oclosure-struct>: New generalizer.
* test/lisp/emacs-lisp/oclosure-tests.el (oclosure-test-gen):
New generic function.
(oclosure-test): Add test for dispatch on oclosure types.
* doc/misc/modus-themes.org (Enable and load): Clarify wording.
(Sample configuration with and without use-package): Improve sample
code on how to set up the themes.
(Customization Options): Update sample configuration.
(Option for box buttons, Option for mode line presentation)
(Option for completion framework aesthetics)
(Option for Org agenda constructs)
(Option for the headings' overall style): Document how to optionally
pass number values as a cons cell.
(Option for mouseover effects): Document new boolean user option.
(More accurate colors in terminal emulators): Write about the color
range in terminal emulators and provide sample palette for XTerm.
(Override colors): Use American English.
(Near-monochrome syntax highlighting): Provide sample code on how to
achieve a monochrome style.
(Full support for packages or face groups)
(Indirectly covered packages): Update lists of supported packages.
(Note on display-fill-column-indicator-mode): Reword node.
(Note on prism.el): Use American English.
(Note on SHR colors): Clarify statement.
(Note on the Notmuch logo): Remark that the Notmuch logo can be
disabled.
(Port the Modus themes to other platforms?): Use American English.
(Sources of the themes): Fix capitalization of proper nouns.
(Acknowledgements): Update list of contributors to the project.
* etc/themes/modus-operandi-theme.el:
* etc/themes/modus-vivendi-theme.el: Ensure that the theme is reified
as expected both at compiletime and runtime.
* etc/themes/modus-themes.el (require): Require 'cl-lib' and 'subr-x'
at compiletime.
(seq): Require the 'seq' library.
(modus-themes-completion-standard-first-match)
(modus-themes-completion-standard-selected)
(modus-themes-completion-extra-selected): Use correct symbol for
deprecated faces.
(modus-themes-slanted-constructs): Provide it as an alias of
'modus-themes-italic-constructs'.
(modus-themes-variable-pitch-headings): Remove obsolete user option.
(modus-themes-no-mixed-fonts): Remove obsolete user option alias.
(modus-themes-intense-mouseovers): Add new user option.
(modus-themes--headings-choice): Accept value as a cons cell.
(modus-themes-headings, modus-themes-org-agenda): Update user option
to accept number value as a cons cell.
(modus-themes-scale-headings, modus-themes-scale-1, modus-themes-scale-2)
(modus-themes-scale-3, modus-themes-scale-4, modus-themes-scale-title)
(modus-themes-scale-small): Remove obsolete user options.
(modus-themes-mode-line): Update user option to accept number values
as cons cells.
(modus-themes-mode-line-padding): Remove obsolete user option.
(modus-themes-completions): Add support for the 'text-also' property
and update it accordingly.
(modus-themes-success-deuteranopia): Remove obsolete user option.
(modus-themes-box-buttons): Update user option to accept number values
as cons cells.
(modus-themes--warn, modus-themes--list-or-warn)
(modus-themes--alist-or-seq): Add functions to check for correct value
in some user options.
(modus-themes--current-theme): Return the first Modus theme from
'current-enable-themes' (bug#54598).
(modus-themes--lang-check, modus-themes--prompt, modus-themes--paren)
(modus-themes--syntax-foreground, modus-themes--syntax-extra)
(modus-themes--syntax-string, modus-themes--syntax-comment)
(modus-themes--heading, modus-themes--agenda-structure)
(modus-themes--agenda-date, modus-themes--mode-line-attrs)
(modus-themes--completion, modus-themes--link, modus-themes--link-color)
(modus-themes--region, modus-themes--hl-line, modus-themes--button):
Make private functions check for the desired value. Refine them where
necessary.
(modus-themes-faces, modus-themes-custom-variables): Update supported
faces and relevant variables.
Po Lu [Fri, 1 Apr 2022 03:50:14 +0000 (11:50 +0800)]
Support Motif DND help
* src/xterm.c (x_dnd_xm_use_help): New state variable.
(x_dnd_begin_drag_and_drop): Clear new variable.
(handle_one_xevent): Set new variable if we get a key press
event F1 during the drag-and-drop session, and use help action
when dropping onto a Motif program if it is set.
Po Lu [Fri, 1 Apr 2022 01:50:58 +0000 (09:50 +0800)]
Make dropping files on Motif programs work
* lisp/dired.el (dired-mouse-drag): Announce "FILE" and
"FILE_NAME" as targets as well.
* lisp/select.el (xselect-convert-to-filename): Handle
XdndSelection specially.
(xselect-convert-to-xm-file): New function.
(selection-converter-alist): Add new converters.
Po Lu [Thu, 31 Mar 2022 13:53:04 +0000 (21:53 +0800)]
Fix Motif DND on window managers that don't support client lists
* src/xterm.c (x_dnd_compute_toplevels): Fix usage of
`x_uncatch_errors_after_check'.
(x_dnd_get_wm_state_and_proto): New function.
(x_dnd_get_target_window): Also return first toplevel window
found.
Po Lu [Thu, 31 Mar 2022 13:28:09 +0000 (21:28 +0800)]
Implement missing parts of the Motif drag and drop protocol
* src/xterm.c (xm_drop_start_reply): New structure.
(xm_get_drag_window): Don't grab the server since this leads to
weird freezes when creating the drag window.
(xm_read_drop_start_reply): New function.
(x_dnd_begin_drag_and_drop): Set Motif finish flag to 0.
(handle_one_xevent): When starting a motif drop, set the finish
flag to 1. When the receiver replies to our drop message, set
the finish flag to 2 if the drop was accepted, and only clear
the waiting for finish flag when a selection request for
XmTRANSFER_SUCCESS or XmTRANSFER_FAILURE arrives.
(x_term_init): New atoms.
* src/xterm.h (struct x_display_info): New atoms.
Tweak how functions are formatted in Implementation in *Help*
* lisp/emacs-lisp/cl-generic.el (cl--generic-describe): Include
the function name in the implementations (bug#54628). This
clarifies what we're talking about here, and avoids getting
(function ...) translated into #'...
Po Lu [Thu, 31 Mar 2022 09:21:37 +0000 (17:21 +0800)]
Implement Motif drop protocol
This is the second most widely implemented drag-and-drop
protocol on X Windows, but seems to have some unsolvable
problems (i.e. stuff will keep accumulating in the drag window
as long the target lists keep changing.) The implementation is
not yet complete and doesn't work with some programs.
* lisp/select.el (xselect-convert-xm-special): New functions.
(selection-converter-alist): Add new converters.
* lisp/x-dnd.el (x-dnd-handle-motif): Ignore messages sent by
the receiver.
* src/xterm.c (xm_targets_table_byte_order): New enum;
(SWAPCARD32, SWAPCARD16): New macros.
(xm_targets_table_rec, xm_drop_start_message)
(xm_drag_initiator_info, xm_drag_receiver_info): New structures.
(XM_DRAG_SIDE_EFFECT, xm_read_targets_table_header)
(xm_read_targets_table_rec, xm_find_targets_table_idx)
(x_atoms_compare, xm_write_targets_table)
(xm_write_drag_initiator_info, xm_get_drag_window)
(xm_setup_dnd_targets, xm_send_drop_message)
(xm_read_drag_receiver_info): New functions.
(x_dnd_compute_toplevels): Correctly free some temp data.
(x_dnd_get_window_proxy, x_dnd_get_window_proto)
(x_set_frame_alpha): Likewise.
(handle_one_xevent): If the window has no XDND proto but has
motif drag receiver data, send a motif drop protocol request.
(x_term_init): New atoms for Motif DND support.
* src/xterm.h (struct x_display_info): Add new atoms.
Stefan Monnier [Wed, 30 Mar 2022 17:54:56 +0000 (13:54 -0400)]
cl-generic: Use OClosures for `cl--generic-isnot-nnm-p`
Rewrite the handling of `cl-no-next-method` to get rid of the hideous
hack used in `cl--generic-isnot-nnm-p` and also to try and move
some of the cost to the construction of the effective method rather
than its invocation. This speeds up method calls measurably when
there's a `cl-call-next-method` in the body.
* lisp/loadup.el ("emacs-lisp/oclosure"): Load.
* lisp/emacs-lisp/oclosure.el (oclosure-define): Remove workaround now
that we're preloaded.
* lisp/emacs-lisp/cl-generic.el (cl--generic-method): Rename `uses-cnm`
to `call-con` to reflect it's not a boolean any more.
(cl-defmethod): Adjust to the new name and new values.
(cl-generic-define-method): Adjust to the new name.
(cl--generic-lambda): Use the new `curried` calling convention.
(cl--generic-no-next-method-function): Delete function.
(cl--generic-nnm): New type.
(cl-generic-call-method): Rewrite to support the various
calling conventions.
(cl--generic-nnm-sample, cl--generic-cnm-sample): Delete consts.
(cl--generic-isnot-nnm-p): Rewrite using `oclosure-type`.
(cl--generic-method-info): Add support for new calling convention.
Po Lu [Wed, 30 Mar 2022 08:36:10 +0000 (16:36 +0800)]
Remove local copies of remote files created for drag-and-drop
* lisp/dired.el (dired-mouse-drag): Remove last dragged remote
file and save a record of any local copy created.
(dired-remove-last-dragged-local-file): New function.
Po Lu [Wed, 30 Mar 2022 08:24:45 +0000 (08:24 +0000)]
Ignore mouse movement correctly on Haiku during drag and drop
* src/haikuselect.c (haiku_unwind_drag_message): New function.
(Fhaiku_drag_message): Set `haiku_dnd_in_progress' to false.
* src/haikuterm.c (haiku_read_socket): Fix overriding of
need_flush when reading events from multiple frames.
* src/haikuterm.h (haiku_dnd_in_progress): New variable.
* src/xdisp.c (note_mouse_highlight): Ignore if said variable is
true.
* lisp/international/textsec.el (textsec--ipvx-address-p): New
function.
(textsec-domain-suspicious-p): Use it to say that ipv6 addresses
aren't suspicious (bug#54624).
Po Lu [Tue, 29 Mar 2022 10:31:24 +0000 (18:31 +0800)]
Rewrite desktop workarea computation to avoid too many calls to XSync
* src/xfns.c (x_get_net_workarea): Rewrite using XCB without
using long_offset and long_length, since the data transfer is
usually negligible compared to the roundtrip delay.
Juri Linkov [Mon, 28 Mar 2022 18:00:32 +0000 (21:00 +0300)]
Add search function to search within filenames in Dired and WDired (bug#14013)
* lisp/dired-aux.el (dired-isearch-filenames-mode): Use
dired-isearch-search-filenames on isearch-search-fun-function
instead of dired-isearch-filter-filenames on isearch-filter-predicate.
(dired-isearch-filter-filenames): Remove function.
(dired-isearch-search-filenames): Add function.
* lisp/isearch.el (isearch-message-prefix): Add isearch-search-fun-function
to the list of supported advice-functions along with isearch-filter-predicate.
* lisp/replace.el (replace-search): Add comment.
* lisp/wdired.el (wdired-search-replace-filenames): New defcustom.
(wdired-isearch-filter-read-only): Remove function.
(wdired-change-to-wdired-mode, wdired-change-to-dired-mode):
Add and remove dired-isearch-search-filenames on isearch-search-fun-function
instead of wdired-isearch-filter-read-only on isearch-filter-predicate.
Also set/unset replace-search-function and replace-re-search-function.
Remove and restore isearch-mode-hook with dired-isearch-filenames-setup.
The problem is that dired-isearch-filenames-setup adds
dired-isearch-filenames-end to isearch-mode-end-hook that removes
dired-isearch-search-filenames added to isearch-search-fun-function
in wdired-change-to-wdired-mode. Then replace-highlight can't use
dired-isearch-search-filenames.
Stefan Monnier [Mon, 28 Mar 2022 14:53:14 +0000 (10:53 -0400)]
Add OClosures, a cross between functions and structs
We here just add the new type. It is not fully self-contained.
It requires cooperation from `cconv.el` on the one hand, and it
hijacks the docstring info to hold the type of OClosure objects.
This does imply that OClosures can't have docstrings, tho this
limitation will be lifted in subsequent patches.
* lisp/emacs-lisp/oclosure.el: New file.
* test/lisp/emacs-lisp/oclosure-tests.el: New file.
* doc/lispref/functions.texi (OClosures): New section.
* src/eval.c (Ffunction): Accept symbols instead of strings for docstrings.
* src/doc.c (store_function_docstring): Avoid overwriting an OClosure type.
* lisp/emacs-lisp/cconv.el (cconv--convert-function): Tweak ordering of
captured variables.
(cconv-convert): Add case for `oclosure--fix-type`.
Po Lu [Mon, 28 Mar 2022 12:34:03 +0000 (20:34 +0800)]
Fix doc of `gui-get-selection' as to what is really valid as `data'
* doc/lispref/frames.texi (Window System Selections):
* lisp/select.el (gui-set-selection): Don't say `data' can be a
cons or list of two integers, since that's not supported.
Michael Albinus [Mon, 28 Mar 2022 10:02:23 +0000 (12:02 +0200)]
Do not register Tramp file name handlers twice
* lisp/net/tramp.el (tramp-register-autoload-file-name-handlers):
* lisp/net/tramp-archive.el (tramp-register-archive-file-name-handler):
Check, whether the real file name handler is already registered.
Po Lu [Mon, 28 Mar 2022 00:59:50 +0000 (08:59 +0800)]
Clean up some uses of XInternAtom
* src/xfns.c (x_set_undecorated, x_set_no_focus_on_map, x_window)
(set_machine_and_pid_properties): Move calls to XInternAtom for
static string to use previously interned atoms.
(Fx_change_window_property): Use XCB if available to avoid extra
call to XSync.
* src/xterm.c (x_term_init):
* src/xterm.h (struct x_display_info): New atoms _MOTIF_WM_HINTS
and _NET_WM_PID.
Po Lu [Sun, 27 Mar 2022 13:36:45 +0000 (13:36 +0000)]
Store latin-1 content into the Haiku clipboard as well
* lisp/term/haiku-win.el (haiku-normal-selection-encoders): New
variable.
(haiku-select-encode-utf-8-string, haiku-select-encode-xstring):
New functions.
(gui-backend-set-selection): Use new selection encoder functions
instead of hard-coding UTF-8.
(haiku-dnd-handle-drag-n-drop-event): Rename to
`haiku-drag-and-drop'.
* src/haiku_select.cc (be_lock_clipboard_message): Accept new
argument `clear'.
(be_unlock_clipboard): Accept new argument `discard'.
* src/haikuselect.c (Fhaiku_selection_data): Change calls to
`be_lock_clipboard_message' and `be_unlock_clipboard'.
(haiku_unwind_clipboard_lock): New function.
(Fhaiku_selection_put): Accept new meaning of `name' which means
to set the selection message.
Po Lu [Sun, 27 Mar 2022 11:53:49 +0000 (19:53 +0800)]
Clean up PGTK cursor blanking code
* src/pgtkterm.c (XTframe_rehighlight): Rename to
`pgtk_frame_rehighlight_hook'. All callers changed.
(x_toggle_visible_pointer): Rename to
`pgtk_toggle_visible_pointer'. All callers changed.
(x_setup_pointer_blanking, XTtoggle_invisible_pointer): Delete
functions.
(pgtk_create_terminal): Use new names for various hooks.
(pgtk_term_init): Set up blank cursor directly.
Po Lu [Sun, 27 Mar 2022 07:51:41 +0000 (15:51 +0800)]
Don't wait for XdndFinished messages if the target did not send status
* src/xterm.c (x_dnd_send_leave): Return if we should wait for a
XdndFinished message.
(handle_one_xevent): Use that value for
`x_dnd_waiting_for_finish'.
Augusto Stoffel [Fri, 25 Mar 2022 07:46:57 +0000 (08:46 +0100)]
Always run 'isearch-lazy-count-update-hook' with point at match
* lisp/isearch.el (isearch-lazy-highlight-buffer-update): Run
'isearch-lazy-count-update-hook' outside of save-excursion, so point
is at the current match.
Fix reader infinite recursion for circular mixed-type values
Make sure that the value added to the `read_objects_completed` set is
the one we actually return; previously this wasn't the case for conses
because of an optimisation (bug#54501).
Also add a check for vacuous self-references such as #1=#1# instead of
returning a nonsense value from thin air.
* src/lread.c (read1): Treat numbered conses correctly as described
above. Detect vacuous self-references.
* test/src/lread-tests.el (lread-test-read-and-print)
(lread-test-circle-cases, lread-circle): Add tests.
Po Lu [Sat, 26 Mar 2022 12:01:58 +0000 (12:01 +0000)]
Fix crash when timer signals or throws inside a popup menu on Haiku
* src/haikumenu.c (haiku_process_pending_signals_for_menu_1)
(haiku_process_pending_signals_for_menu_2): New functions.
(haiku_process_pending_signals_for_menu): Catch non local exits
around `timer_check'.
Po Lu [Sat, 26 Mar 2022 09:10:42 +0000 (17:10 +0800)]
Also fetch shapes via XCB for drag and drop
* configure.ac: Also look for xcb-shape.
* src/xterm.c (HAVE_XCB_SHAPE_INPUT_RECTS): New define.
(x_dnd_compute_toplevels): Use XCB for input shapes if possible.
Eli Zaretskii [Sat, 26 Mar 2022 08:31:46 +0000 (11:31 +0300)]
Support display of BMP images on MS-Windows
* src/w32image.c (w32_can_use_native_image_api): Support BMP
images.
* src/image.c (syms_of_image) <Qbmp>: New symbol.
[HAVE_NTGUI]: Add 'bmp' to list of supported image types.
* doc/lispref/display.texi (Image Formats): Document built-in
support for BMP images.
Po Lu [Sat, 26 Mar 2022 02:15:53 +0000 (10:15 +0800)]
Avoid ClientMessage overhead when dragging stuff to other frames
* lisp/dired.el (dired-mouse-drag): Handle correctly dragging
from dired buffers in nonselected windows.
* lisp/x-dnd.el (x-dnd-handle-drag-n-drop-event): Understand new
client message type.
* src/xterm.c (x_dnd_send_enter, x_dnd_send_position)
(x_dnd_send_leave): Ignore if window is the top window of a
frame.
(x_dnd_send_drop): Send special DND event in that case.
Po Lu [Sat, 26 Mar 2022 00:45:08 +0000 (08:45 +0800)]
Fix minor issues with dired-mouse-drag-files
* lisp/dired.el (dired-mouse-drag-files): Update doc string and
add setter.
(dired-insert-set-properties): Don't insert misleading tooltip
if feature is not available.
Andrew G Cohen [Fri, 25 Mar 2022 08:06:34 +0000 (16:06 +0800)]
; Restore regexp-quote for gnus subject match
* lisp/gnus/gnus-sum.el (gnus-summary-limit-include-thread): Restore
regexp-quote that was inadvertently dropped in commit 2021-12-21 "Fix
gnus subject matching when subject is empty".
Fix reporting of read error line/columns in the init file
* src/lread.c (invalid_syntax_lisp): The comments here said that
we were supposed to be called with point in the readcharfun
buffer. This was not the case (at least) when reading the Emacs
init file, so the reported line/column was always wrong (1 and 0,
respectively) (bug#54550).
Po Lu [Fri, 25 Mar 2022 08:15:57 +0000 (16:15 +0800)]
Take window shapes into account when processing drag and drop
* configure.ac: Test for the Nonrectangular Window Shape
extension.
* msdos/sed1v2.inp: Update.
* src/xterm.c (struct x_client_list_window): New fields for
shapes.
(x_dnd_free_toplevels): Free shapes.
(x_dnd_compute_toplevels): Populate window shapes.
(x_dnd_get_target_window_2): New function.
(x_dnd_get_target_window_1): Test WM state of window before
taking it into account.
(x_dnd_begin_drag_and_drop): Use outer window as the initial
last seen window.
(x_dnd_update_state): Small fixes to frame tracking.
(handle_one_xevent): Handle ShapeNotify events correctly.
(x_term_init): Test for the Nonrectangular Window Shape
extension.
* src/xterm.h (struct x_display_info): New atom `WM_STATE'.
Po Lu [Fri, 25 Mar 2022 03:09:43 +0000 (11:09 +0800)]
Use _NET_CLIENT_LIST_STACKING to optimize drag and drop window discovery
* src/xterm.c (struct x_client_list_window): New struct.
(x_dnd_free_toplevels, x_dnd_compute_toplevels)
(x_dnd_get_target_window_1): New functions.
(x_dnd_get_target_window): Search in the toplevel list if it
exists.
(x_dnd_cleanup_drag_and_drop): Clean up toplevel list.
(x_dnd_begin_drag_and_drop): Compute toplevel list if the
window manager supports it.
(handle_one_xevent): Update the toplevel list if prudent.