Stefan Kangas [Fri, 17 Jun 2022 19:30:34 +0000 (21:30 +0200)]
Delete another library obsolete since 24.1
This file was missed in the last commit to delete libraries obsolete
since Emacs 24.3 or older.
* lisp/obsolete/pc-mode.el: Delete file. This library has been
obsolete since Emacs 24.1. (Bug#50999)
Slightly faster hash-table-keys and hash-table-values
* lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values):
Omit the reversal of the returned list. It is not ordered anyway.
* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x--hash-table-keys-and-values): New test.
* lisp/emacs-lisp/byte-run.el (byte-run--set-obsolete): The `when'
is a string (or nil), so don't quote it (bug#48145).
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form):
Adjust folding.
Warn about misplaced or duplicated function/macro declarations
Doc strings, `declare` and `interactive` forms must appear in that
order and at most once each. Complain if they don't, instead of
silently ignoring the problem (bug#55905).
* lisp/emacs-lisp/byte-run.el (byte-run--parse-body)
(byte-run--parse-declarations): New.
(defmacro, defun): Check for declaration well-formedness as
described above. Clarify doc strings. Refactor some common code.
* test/lisp/emacs-lisp/bytecomp-resources/fun-attr-warn.el:
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-fun-attr-warn):
New test.
Stefan Kangas [Fri, 17 Jun 2022 14:06:10 +0000 (16:06 +0200)]
Rename command to bookmark-edit-annotation-confirm
* lisp/bookmark.el (bookmark-edit-annotation-confirm): Rename from
'bookmark-send-edited-annotation' to be more consistent with
'bookmark-edit-annotation-cancel'. Make the old name into an
obsolete function alias.
Stefan Kangas [Fri, 17 Jun 2022 14:03:52 +0000 (16:03 +0200)]
Improve help-enable-variable-value-editing help
* lisp/help-fns.el (help-enable-variable-value-editing): Expand
docstring to better explain what effect it has.
(help-fns-edit-variable): Use command substitution.
* doc/lispref/os.texi (Time Parsing): Clarify which functions
take/return timestamps and which ones take decoded time structures.
* src/timefns.c (Fdecode_time): Clarify TIME argument (bug#46505).
Dmitry Gutov [Fri, 17 Jun 2022 12:22:29 +0000 (15:22 +0300)]
buffer-match-p: Resolve backward compat concerns
* doc/lispref/buffers.texi (Buffer List): Document 'major-mode'
and 'derived-mode' predicates. Fix some typos.
* lisp/subr.el (buffer-match-p): Use the structure initially
pioneered by project-kill-buffer-conditions as-is (bug#54296).
* lisp/progmodes/project.el (project-kill-buffer-conditions)
(project--buffer-check): Revert the latest change.
(project--buffer-check): Add support for lambda predicates.
* lisp/net/eww.el (eww-update-header-line-format): Use
string-pixel-width (since we don't care about shr-use-fonts here).
* lisp/net/shr.el (shr-string-pixel-width): Use
`string-pixel-width', which should be faster.
Stefan Kangas [Fri, 17 Jun 2022 11:34:36 +0000 (13:34 +0200)]
Cancel editing bookmark annotations with C-c C-k
* lisp/bookmark.el (bookmark-edit-annotation-cancel): New command.
(bookmark-edit-annotation-mode): Document it.
(bookmark-edit-annotation-mode-map): Bind it to 'C-c C-k'.
(bookmark-default-annotation-text): Announce it when editing
annotations.
(bookmark-edit-annotation--maybe-display-list): New macro.
(bookmark-send-edited-annotation): Use above new macro.
Stefan Kangas [Fri, 17 Jun 2022 10:49:57 +0000 (12:49 +0200)]
Use command substitution in bookmark-edit-annotation
* lisp/bookmark.el (bookmark-default-annotation-text): Use command
substitution.
(bookmark-edit-annotation): Enter mode before inserting annotation
to get the correct command substitution.
Po Lu [Fri, 17 Jun 2022 07:29:59 +0000 (15:29 +0800)]
Improve compatibility when receiving drops from early XDND programs
* lisp/x-dnd.el (x-dnd-handle-xdnd): Save version in state.
If version is less than 5, don't put action and success in
XdndFinished events. If less than 2, always use `copy' as
the selected action.
Stefan Kangas [Fri, 17 Jun 2022 04:30:35 +0000 (06:30 +0200)]
Merge from origin/emacs-28
f419de6eca * lisp/textmodes/artist.el: Minor doc fixes. 5ddd0f1a35 * lisp/net/tramp.el (tramp-methods): Fix quoting in docstr... b0c5accb99 Update MS Windows FAQ for MinGW64-w64/MSYS2
Po Lu [Fri, 17 Jun 2022 02:57:42 +0000 (10:57 +0800)]
Improve window manager user time reporting mode switching
* src/xterm.c (x_display_set_last_user_time): Stop periodically
checking for user time window support.
(x_update_frame_user_time_window): New function.
(handle_one_xevent): Call it on toplevel ReparentNotify if the
frame has been visible at least once.
Po Lu [Fri, 17 Jun 2022 02:24:05 +0000 (10:24 +0800)]
Update last event time during DND operations
* lisp/x-dnd.el (x-dnd-handle-xdnd, x-dnd-handle-motif): Set
last user time to provided timestamp.
* src/xfns.c (Fx_display_last_user_time): New function.
(syms_of_xfns): New defsubr.
* src/xterm.c (x_set_last_user_time_from_lisp): New function.
* src/xterm.h: Update prototypes.
Eli Zaretskii [Thu, 16 Jun 2022 16:53:45 +0000 (19:53 +0300)]
Fix disruption of windows' display by shr.el
* src/window.c (struct saved_window): New member 'vscroll'.
(Fset_window_configuration, save_window_save): Save and restore
the window's vscroll value.
* lisp/net/shr.el (shr-insert-document): Restore the original
window's hscroll, in case we are rendering in a window other than
where the document will be eventually displayed. This avoids
resetting hscroll of windows we use temporarily for shr's
rendering job. (Bug#56008)
Stefan Kangas [Thu, 16 Jun 2022 07:48:18 +0000 (09:48 +0200)]
Make artist-version variable obsolete
* lisp/textmodes/artist.el (artist-version): Make obsolete. This has
not been updated in nearly two decades; use the Emacs version instead.
(artist-submit-bug-report): Don't use above obsolete variable.
* lisp/org/oc.el (org-cite-list-citations): Avoid quadratic complexity.
Pre-calculate list of all footnote definitions and cache the footnote
label search hits. Do not make `org-element-map' accumulate unused
result.
Ihor Radchenko [Wed, 15 Jun 2022 17:01:53 +0000 (01:01 +0800)]
org-export-data: Concatenate strings in temporary buffer for performance
* lisp/org/ox.el (org-export-data): Use temporary buffer to collect export
data instead of `mapconcat'. Using buffer puts less load on garbage
collector.
Ihor Radchenko [Wed, 15 Jun 2022 17:03:18 +0000 (01:03 +0800)]
org-export-as: Do not update buffer settings when not modified
* lisp/org/ox.el (org-export-as): Use `buffer-chars-modified-tick' and
avoid extra invocations of `org-set-regexps-and-options' and
`org-update-radio-target-regexp' when the buffer is not changed.
Also, disable folding checks. Folding is irrelevant inside export
buffer.
Ihor Radchenko [Sun, 12 Jun 2022 05:06:47 +0000 (13:06 +0800)]
org-export-resolve-fuzyy-link: Pre-cache all possible search cells
* lisp/org/ox.el (org-export-resolve-fuzzy-link): Before matching LINK,
pre-process and cache all the non-nil search cells in the parse tree.
When matching, use the pre-processed info. Fix the :test function for
the cache hash table.
Ihor Radchenko [Sun, 12 Jun 2022 05:05:16 +0000 (13:05 +0800)]
org-export-get-footnote-definition: Pre-cache references in parse tree
* lisp/org/ox.el (org-export-get-footnote-definition): Pre-process parse
tree once to filter out all non-footnote elements. This speeds up
subsequent footnote definition searches.
Arash Esbati [Wed, 15 Jun 2022 19:35:47 +0000 (21:35 +0200)]
Update MS Windows FAQ for MinGW64-w64/MSYS2
* doc/misc/efaq-w32.texi (Compiling, Debugging): Mention
MinGW64-w64/MSYS2 as the preferred way for building Emacs on
capable systems.
(Attachments with Gnus): Catch up with emacs-mime.texi in the
example given.
(Spell check): Add the availability of GNU Aspell and Hunspell
in MSYS2 distribution.
(Other useful ports): Add an entry for MinGW64-w64/MSYS2.
Fix link for MinGW homepage.
Remove entry for defunct UWIN project. (Bug#55930)
Richard Hansen [Fri, 10 Jun 2022 00:41:50 +0000 (20:41 -0400)]
bindat (strz): Write null terminator after variable length string
* lisp/emacs-lisp/bindat.el (bindat--pack-strz): Explicitly write a
null byte after packing a variable-length string to ensure proper
termination when packing to a pre-allocated string.
* doc/lispref/processes.texi (Bindat Types): Update documentation.
* test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc):
Update tests.
Po Lu [Thu, 16 Jun 2022 06:33:30 +0000 (14:33 +0800)]
Improve handling of fallback drop protocols
* lisp/x-dnd.el (x-dnd-use-offix-drop): New value `files', which
means to only drop files using the OffiX protocol. Make it the
default.
(x-dnd-handle-old-kde): Handle other data types correctly.
(x-dnd-offix-old-kde-to-name): New variable.
(x-dnd-offix-id-to-name): Fix typo in doc string.
(x-dnd-handle-unsupported-drop): Implement new value.
Po Lu [Thu, 16 Jun 2022 05:58:39 +0000 (13:58 +0800)]
Fix Motif DND after atom ownership is lost due to frame destruction
* src/xterm.c (xm_get_drag_atom_1): Record owner.
(x_free_frame_resources): Clear drag atom if owner was freed.
* src/xterm.h (struct x_display_info): New field
`motif_drag_atom_owner'.
Po Lu [Thu, 16 Jun 2022 04:49:07 +0000 (12:49 +0800)]
Improve drag atom computation
* src/xterm.c (xm_get_drag_window): Avoid leak if error occured
creating drag window. Also use StructureNotifyMask instead of
ButtonPressMask.
(xm_get_drag_atom_1): Update. Make EMACS_DRAG_ATOM a list of
atoms and use the first one that isn't currently owned.
(xm_get_drag_atom): Stop owning selection here.
(xm_setup_drag_info): Record chosen atom.
(x_dnd_cleanup_drag_and_drop, x_dnd_begin_drag_and_drop)
(x_dnd_update_state, handle_one_xevent, x_connection_closed):
Use chosen atom.
* src/xterm.h (struct x_display_info): New field
`motif_drag_atom_time'.
Paul Eggert [Thu, 16 Jun 2022 04:08:03 +0000 (23:08 -0500)]
Streamline time decoding and conversion
* src/lisp.h (lisp_h_BASE2_EQ, BASE2_EQ): New macros and functions.
* src/timefns.c (tzlookup, Fdecode_time): Use them.
(Ftime_convert): Convert to symbol once, instead of many times.
Paul Eggert [Thu, 16 Jun 2022 04:08:03 +0000 (23:08 -0500)]
Don’t test time functions for NaNs, INF
* test/src/timefns-tests.el (decode-then-encode-time)
(time-equal-p-NaN-NaN, time-arith-tests):
Don’t test time functions with infinities and NaNs,
which are not Lisp time values.
Paul Eggert [Thu, 16 Jun 2022 04:08:03 +0000 (23:08 -0500)]
Prefer BASE_EQ in time-sensitive ops
* src/timefns.c (tzlookup, lisp_time_hz_ticks)
(decode_time_components, lisp_to_timespec, lispint_arith)
(time_arith, time_cmp, Fdecode_time, Fencode_time)
(Ftime_convert): Prefer BASE_EQ to EQ where either will do.
Paul Eggert [Thu, 16 Jun 2022 04:05:22 +0000 (23:05 -0500)]
icalendar-tests no longer assumes TZ = wall
Do not assume that the TZ environment variable is either unset or
agrees with /etc/localtime. I ran into this test bug while
running ‘TZ=America/Chicago make check’ on a platform where
/etc/localtime was America/Los_Angeles.
* test/lisp/calendar/icalendar-tests.el:
(icalendar-tests--decode-isodatetime): Don’t use
set-time-zone-rule, whose doc string says “Instead of calling this
function, you typically want something else” for a reason.
Instead, pass the zone arg to icalendar-test--format.
Po Lu [Thu, 16 Jun 2022 02:08:12 +0000 (10:08 +0800)]
Comply with the Motif requirement for unique drag atoms
* src/xselect.c (x_handle_selection_request)
(Fx_get_selection_internal, syms_of_xselect): New variable
`x-selection-alias-alist'. Respect that alist of aliases.
* src/xterm.c (x_atom_refs): Intern _EMACS_DRAG_ATOM.
(xm_get_drag_atom_1, xm_get_drag_atom): New functions.
(xm_setup_drag_info, x_dnd_cleanup_drag_and_drop)
(x_dnd_begin_drag_and_drop, x_dnd_update_state, handle_one_xevent)
(x_connection_closed, x_intern_cached_atom): Alias the drag atom
to XdndSelection. Use it instead of XdndSelection to set the
Motif index atom.
(x_get_atom_name): Handle new atoms.
(syms_of_xterm): New defsym.
* src/xterm.h (struct x_display_info): New fields for new atoms
and their names.
Manuel Giraud [Wed, 15 Jun 2022 15:52:38 +0000 (17:52 +0200)]
Do not display 'nil for 0-ary filter qualifier in ibuf
* lisp/ibuf-ext.el (ibuffer-format-qualifier-1): Do not display
nil in header for 0-ary filter qualifier.
* lisp/ibuf-macs.el (define-ibuffer-filter): Also fix the message.
Po Lu [Wed, 15 Jun 2022 13:00:55 +0000 (21:00 +0800)]
Implement using the OffiX protocol for dropping
* lisp/x-dnd.el (x-dnd-use-offix-drop): New user option.
(x-dnd-handle-unsupported-drop): Return t if the OffiX protocol
was used.
(x-treat-local-requests-remotely): New defvar.
(x-dnd-convert-to-offix, x-dnd-do-offix-drop): New functions.
* src/xterm.c: Update commentary.
(x_term_init): Extend number of DND atoms allocated by default.
Miha Rihtaršič [Wed, 15 Jun 2022 12:24:24 +0000 (14:24 +0200)]
whitespace.el: New whitespace style `lines-char'
* lisp/whitespace.el (whitespace-style):
(whitespace-style-value-list):
(whitespace-toggle-option-alist):
(global-whitespace-toggle-options):
(whitespace-help-text):
(whitespace-interactive-char):
(whitespace-style-face-p):
(whitespace-color-on):
(whitespace-lines-regexp): New whitespace style `lines-char', which
highlights only the first character over the whitespace-line-column
limit (bug#55980).
Po Lu [Wed, 15 Jun 2022 12:08:51 +0000 (20:08 +0800)]
Handle receiving new OffiX protocol during drag-and-drop
* lisp/x-dnd.el (x-dnd-types-alist, x-dnd-known-types): Add
DndTypeFile and DndTypeText.
(x-dnd-init-frame): Add _DND_PROTOCOL.
(x-dnd-handle-drag-n-drop-event): Handle _DND_PROTOCOL events.
(x-dnd-handle-old-kde): Drop event if proto is too new.
(x-dnd-offix-id-to-name): New list.
(x-dnd-handle-offix-file, x-dnd-handle-offix): New functions.
Po Lu [Wed, 15 Jun 2022 06:46:21 +0000 (14:46 +0800)]
Handle coordinates for the old KDE drop protocol
* src/xterm.c (x_atom_refs): Add DndProtocol and _DND_PROTOCOL.
(x_coords_from_dnd_message): Handle the old KDE protocol.
* src/xterm.h (struct x_display_info): New atoms.