Tony Zorman [Thu, 21 Dec 2023 16:51:09 +0000 (17:51 +0100)]
Add use-package-vc-prefer-newest user option
* lisp/use-package/use-package-core.el (use-package-vc-prefer-newest):
User option to prefer the latest commit (as opposed to the latest
release) of a package.
(use-package-normalize--vc-arg): Check for
use-package-vc-prefer-newest.
Eli Zaretskii [Mon, 25 Mar 2024 13:12:42 +0000 (15:12 +0200)]
Fix documentation of 'other-window-for-scrolling'
* src/window.c (Fother_window_for_scrolling): More accurate
documentation of how "the other" window is looked for. Suggested
by Karthik Chikmagalur <karthikchikmagalur@gmail.com>.
Ihor Radchenko [Tue, 20 Feb 2024 09:47:24 +0000 (12:47 +0300)]
org-latex-preview: Add protection when `untrusted-content' is non-nil
* lisp/org/org.el (org--latex-preview-when-risky): New variable
controlling how to handle LaTeX previews in Org files from untrusted
origin.
(org-latex-preview): Consult `org--latex-preview-when-risky' before
generating previews.
This patch adds a layer of protection when LaTeX preview is requested
for an email attachment, where `untrusted-content' is set to non-nil.
Ihor Radchenko [Tue, 20 Feb 2024 09:19:46 +0000 (12:19 +0300)]
org-macro--set-templates: Prevent code evaluation
* lisp/org/org-macro.el (org-macro--set-templates): Get rid of any
risk to evaluate code when `org-macro--set-templates' is called as a
part of major mode initialization. This way, no code evaluation is
ever triggered when user merely opens the file or when
`mm-display-org-inline' invokes Org major mode to fontify mime part
preview in email messages.
* lisp/emacs-lisp/bytecomp.el (byte-compile-form)
(bytecomp--actually-important-return-value-p):
Special handling of `sort` that takes into account that it may return
an important value depending on the :in-place keyword argument.
* lisp/sort.el (sort-on):
* doc/lispref/sequences.texi (Sequence Functions):
* etc/NEWS:
Remove the `sort-on` function which is now completely superseded by
the extended `sort` in features, ease of use, and performance.
Add back timsort key function handling (bug#69709)
The original timsort code did provide for a key (accessor) function
along with the necessary storage management, but we dropped it because
our `sort` function didn't need it.
Now it's been put back since it seems that it will come in handy after all.
* src/fns.c (sort_list, sort_vector, Fsort): Pass Qnil as key function
to tim_sort.
* src/sort.c (reverse_slice, sortslice_copy)
(sortslice_copy_incr, sortslice_copy_decr, sortslice_memcpy)
(sortslice_memmove, sortslice_advance): New functions.
(sortslice): New type.
(struct stretch, struct reloc, merge_state)
(binarysort, merge_init, merge_markmem, cleanup_mem)
(merge_register_cleanup, merge_getmem, merge_lo, merge_hi, merge_at)
(found_new_run, reverse_sortslice, resolve_fun, tim_sort):
Merge back previously discarded parts from the upstreams timsort code
that dealt with key functions, and adapt them to fit in.
Po Lu [Thu, 28 Mar 2024 11:56:31 +0000 (19:56 +0800)]
Prevent Android OS task trimming from deleting Emacs frames
* doc/emacs/android.texi (Android Windowing): Document proviso
on Android 7.0 and later.
* java/org/gnu/emacs/EmacsActivity.java (EmacsActivity)
<timeOfLastInteraction>: New field.
(onStop, onResume): Set and clear timeOfLastInteraction.
(isReallyFinishing): New function.
(onDestroy): Don't delete frame even in the event isFinishing
returns true if more than 4 hours have elapsed since the
activity last moved into the background.
Rahguzar [Fri, 15 Mar 2024 17:46:46 +0000 (18:46 +0100)]
Allow for auto updating only visible proced buffers (bug#69784)
* lisp/proced.el (proced-auto-update-flag): Document 'visible'
value and add it to the custom type.
(proced-auto-update-timer, proced-toggle-auto-update): Take
'visible' value into account.
Fail on files with no assertions, parser now accepts multiple
carets per line and face lists:
* lisp/emacs-lisp/ert-font-lock.el: Assertion parser fix.
* test/lisp/emacs-lisp/ert-font-lock-resources/no-asserts.js:
* test/lisp/emacs-lisp/ert-font-lock-tests.el
(test-parse-comments--no-assertion-error)
(test-syntax-highlight-inline--caret-negated-wrong-face)
(test-macro-test--file-no-asserts): New test cases.
* doc/misc/ert.texi (Syntax Highlighting Tests): More syntax examples.
Stefan Monnier [Thu, 28 Mar 2024 04:06:00 +0000 (00:06 -0400)]
(pcase-mutually-exclusive): Use auto-generated table
The `pcase-mutually-exclusive-predicates` table was not very
efficient since it grew like O(N²) with the number of
predicates. Replace it with an O(N) table that's auto-generated
from the `built-in-class` objects.
* lisp/emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
Delete variable.
(pcase--subtype-bitsets): New function and constant.
(pcase--mutually-exclusive-p): Use them.
* lisp/emacs-lisp/cl-preloaded.el (built-in-class): Don't inline.
Spencer Baugh [Tue, 26 Mar 2024 12:44:25 +0000 (08:44 -0400)]
Correctly check buffer mtime when displaying xref matches
This was just a typo: we were checking the modification time of
current-buffer instead of checking the modification time of the
passed-in buffer.
This caused matches to not be shown if they weren't present in
the current in-Emacs state of the buffer.
This was easily reproduced by writing a string to a file outside
Emacs, then searching for that string with
e.g. project-find-regexp. The string would seemingly not be
found, although in reality it was found, just not displayed.
* lisp/progmodes/xref.el (xref--find-file-buffer):
Check buf, not current-buffer (bug#70008).
Po Lu [Wed, 27 Mar 2024 02:03:15 +0000 (10:03 +0800)]
Remove IME_FLAG_FORCE_ASCII from password input IME flags
* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Passwords might also be non-ASCII, and this flag apparently
requests an IME limited to ASCII characters, rather than just
capable of ASCII input.
Stefan Monnier [Tue, 26 Mar 2024 21:27:29 +0000 (17:27 -0400)]
cl-preloaded.el: Partly revert last change
The change caused type-check errors in auth-source where they use
`:type function` constraints on object slots and expect those to
be able to hold symbols.
* lisp/emacs-lisp/cl-preloaded.el (function): Revert last change.
* test/src/data-tests.el (data-tests--cl-type-of): Use `cl-functionp`
rather than `functionp` to test `function`.
Stefan Monnier [Tue, 26 Mar 2024 17:14:15 +0000 (13:14 -0400)]
cl-preloaded.el: Fix the type lattice
We generally want types to form not just a DAG but a lattice.
If objects can be both `keyword` and `symbol-with-pos`, this
means there should be a more precise type describing this intersection.
If we ever find the need for such a refinement, we could add
such a `keyword-with-pos` type, but here I took the simpler
route of treating `keyword` not as a proper built-in type but
as a second-class type like `natnum`.
While fixing this problem, also fix the problem we had where
`functionp` was not quite adequate to characterize objects of type
`function`, by introducing a new predicate `cl-functionp` for that.
* lisp/emacs-lisp/cl-preloaded.el (cl-functionp): New function.
(function): Use it.
(keyword): Don't declare it as a built-in type.
(user-ptrp): Remove redundant declaration.
* lisp/emacs-lisp/cl-macs.el (cl-deftype-satisfies): Add entry for
`keyword` type.
* lisp/emacs-lisp/comp.el (comp-known-predicates): Fix type for
negative result of `characterp`. Remove duplicate `numberp` entry.
Fix types for `keywordp` now that `keyword` is not a built-in type any more.
* test/src/data-tests.el (data-tests--cl-type-of): Add a few cases.
Remove workaround for `function`.
Andrea Corallo [Tue, 26 Mar 2024 10:14:08 +0000 (11:14 +0100)]
Fix native comp prediction on null functionp tested objects
* lisp/emacs-lisp/comp.el (comp-known-predicates)
(comp-known-predicates-h): Update.
(comp--pred-to-pos-cstr, comp--pred-to-neg-cstr): New functions.
(comp--add-cond-cstrs): Make use of them.
* test/src/comp-tests.el (comp-tests-type-spec-tests): Add a test.
Po Lu [Tue, 26 Mar 2024 02:54:39 +0000 (10:54 +0800)]
Prevent focus "stalemates" on Android
* java/org/gnu/emacs/EmacsActivity.java (invalidateFocus1): New
argument resetWhenChildless.
(invalidateFocus): If a toplevel window has no focus window,
transfer focus to the toplevel itself.
Eli Zaretskii [Mon, 25 Mar 2024 13:51:07 +0000 (15:51 +0200)]
Fix removal of bookmark's fringe mark in Info and Dired
* lisp/bookmark.el (bookmark-buffer-file-name): Support Info
buffers.
(bookmark--remove-fringe-mark): Call 'bookmark-buffer-file-name'
instead of using 'buffer-file-name', which could be nil.
(Bug#69974)
Juri Linkov [Mon, 25 Mar 2024 07:45:08 +0000 (09:45 +0200)]
* lisp/vc/diff-mode.el (diff-setup-buffer-type): Remove "\n" from regexp.
Remove extra "\n" from the end of the "diff --git.*" part
of 'diff-outline-regexp' because "\n" is not used in outline-regexp
and causes problems in such cases like when killing hunks
in the diff buffer with outline-minor-mode that loses
the outline icons because outline--fix-buttons-after-change and
outline--fix-up-all-buttons are limited to the single line and
can't match an outline line with a regexp that ends with "\n".
Po Lu [Sun, 24 Mar 2024 02:59:54 +0000 (10:59 +0800)]
Improve consistency of content file name handling
* java/org/gnu/emacs/EmacsService.java (getDisplayNameHash):
Always encode file names as modified UTF-8, as insurance against
future changes to undocumented behavior of the JVM.
Stefan Monnier [Sat, 23 Mar 2024 23:21:26 +0000 (19:21 -0400)]
edebug.el: Better strip instrumentation from backtraces
Rework the code that "cleans" the backtrace for `edebug-pop-to-backtrace`.
The main changes are the following:
- Strip instrumentation from "everywhere" rather than trying to limit the
effect to "code" and leave "data" untouched. This is a worthy
goal, but it is quite difficult to do since code contains data
(so we ended up touching data anyway) and data can also
contain code.
The risk of accidentally removing something because it happens
to look like instrumentation is very low, whereas it was very common
for instrumentation to remain in the backtrace.
- Use a global hash-table to remember the work done, instead of
using separate hash-table for each element. By using a weak
hash-table we avoid the risk of leaks, and save a lot of work
since there's often a lot of subexpressions that appear
several times in the backtrace.
* lisp/emacs-lisp/edebug.el (edebug-make-enter-wrapper): Tweak code
layout so the comments are more clear.
(edebug-unwrap): Remove redundant patterns for `closure` and `lambda`.
Add `:closure-dont-trim-context` to the `edebug-enter` pattern,
so it also gets removed (this should have been done in commit 750bc57cbb8d).
(edebug--unwrap-cache): New var.
(edebug-unwrap*): Use it.
(edebug--unwrap1): Delete function. Merged into `edebug-unwrap*`.
Also apply unwrapping to the contents of byte-code functions since they
can refer to lambda expressions captured by the closure.
(edebug--symbol-prefixed-p): Rename from
`edebug--symbol-not-prefixed-p` and adjust meaning accordingly.
(edebug--strip-instrumentation): Adjust accordingly and simplify
a bit by unifying the "lambda" case and the "everything else" case.
(edebug--unwrap-frame): Use `cl-callf` and unwrap arguments even if
they've already been evaluated.
F. Jason Park [Mon, 11 Mar 2024 06:09:59 +0000 (23:09 -0700)]
Reuse command-indicator code for script lines in ERC
* lisp/erc/erc-goodies.el (erc-load-irc-script-lines): Move here from
main file and rework to always use `command-indicator' instead of only
partially, when available. Also use internal "send-action" and
"send-message" interfaces to defer command-handler output until
command lines have been inserted.
* lisp/erc/erc.el (erc-process-input-line): Redo doc string.
(erc-process-script-line): Fold exceptionally overlong line.
(erc-load-irc-script-lines): Move to erc-goodies.el. (Bug#67032)
F. Jason Park [Mon, 11 Mar 2024 06:09:59 +0000 (23:09 -0700)]
Restore leading space to right-margin stamps in ERC
* lisp/erc/erc-stamp.el (erc-insert-timestamp-right): Insert a single
space character immediately before right-side stamps managed by
`erc-stamp--display-margin-mode'. Include it as part of the
`timestamp' field. This behavior was originally present in an earlier
draft of the changes for bug#60936, mainly to favor symmetry between
hard-wrapped fill styles and fill-wrap with regard to stamps. It was
subsequently removed to simplify management, so that the `field' and
`display' intervals aligned.
* test/lisp/erc/erc-stamp-tests.el
(erc-stamp--display-margin-mode--right): Update expected output.
Partially revert those portions of 7b4ca9e609e "Leverage inverse-video
for erc-inverse-face" that introduced and managed explicit faces for
the "default" 99 color code.
* lisp/erc/erc-goodies.el (erc-control-default-fg)
(erc-control-default-bg): Remove unused faces originally meant to be
new in ERC 5.6.
(erc-get-fg-color-face, erc-get-bg-color-face): Return nil for n=99.
(erc-controls-interpret, erc-controls-highlight): Preserve an
interval's existing background so "if only the foreground color is
set, the background color stays the same," as explained by
https://modern.ircdocs.horse/formatting#color. (Bug#69860)
F. Jason Park [Wed, 20 Mar 2024 06:51:46 +0000 (23:51 -0700)]
Remove unused faces from various erc-goodies tests
; A note to anyone running ERC's test suite while bisecting and
; unlucky enough to land on this commit: apologies for the
; inconvenience. It fails because it includes adjustments for fixes
; only introduced by the subsequent commit. This is obviously
; objectionable but was done knowingly in order to duck the
; copyright-exemption threshold for new contributors.
* test/lisp/erc/erc-goodies-tests.el
(erc-controls-highlight--spoilers)
(erc-controls-highlight--inverse): Remove all mention of stricken
faces `erc-control-default-fg' and `erc-control-default-bg'.
(erc-controls-highlight/default-foreground)
(erc-controls-highlight/default-background): New tests.
(Bug#69860)
Joseph Turner [Fri, 8 Mar 2024 05:55:00 +0000 (21:55 -0800)]
Recompute :map when image :scale, :rotation, or :flip changes
Now, when transforming an image, its :map is recomputed to fit.
Image map coordinates are integers, so when computing :map,
coordinates are rounded. To prevent an image from drifting from
its map after repeated transformations, 'create-image' now adds
a new image property :original-map, which is combined with the
image's transformation parameters to recompute :map.
* lisp/image.el (image-recompute-map-p): Add user option to
control whether :map is recomputed when an image is transformed.
(create-image): Create :map from :original-map and vice versa.
(image--delayed-change-size): Fix comment.
(image--change-size, image-rotate, image-flip-horizontally,
image-flip-vertically): Recompute image map after transformation
and mention 'image-recompute-map-p' in docstring.
(image--compute-map): Add function to compute a map from original
map.
(image--compute-original-map): Add function to compute an
original map from map.
(image--scale-map): Add function to scale a map based on :scale.
(image--rotate-map): Add function to rotate a map based on
:rotation.
(image--rotate-coord): Add function to rotate a map coordinate
pair.
(image--flip-map): Add function to flip a map based on :flip.
(image-increase-size, image-decrease-size, image-mouse-increase-size)
(image-mouse-decrease-size): Mention 'image-recompute-map-p' in
docstrings.
* etc/NEWS: Add NEWS entry.
* doc/lispref/display.texi (Image Descriptors): Document :original-map
and new user option 'image-recompute-map-p'.
* test/lisp/image-tests.el (image--compute-map-and-original-map):
Test 'image--compute-map' and 'image--compute-original-map'.
(image-tests--map-equal): Add equality predicate to compare image maps.
(image-create-image-with-map): Test that 'create-image' adds :map
and/or :original-map as appropriate.
(image-transform-map): Test functions related to transforming maps.
(Bug#69602)
Jim Porter [Sun, 17 Mar 2024 19:01:59 +0000 (12:01 -0700)]
Allow toggling "readable" mode in EWW
Additionally, add an option to prevent adding a new history entry for
each call of 'eww-readable' (bug#68254).
* lisp/net/eww.el (eww-retrieve):
* lisp/net/eww.el (eww-readable-adds-to-history): New option.
(eww-retrieve): Make sure we call CALLBACK in all configurations.
(eww-render): Simplify how to pass encoding.
(eww--parse-html-region, eww-display-document): New functions, extracted
from...
(eww-display-html): ... here.
(eww-document-base): New function.
(eww-readable): Toggle "readable" mode interactively, like with a minor
mode. Consult 'eww-readable-adds-to-history'.
(eww-reload): Use 'eshell-display-document'.
* test/lisp/net/eww-tests.el (eww-test--with-mock-retrieve): Fix indent.
(eww-test/display/html, eww-test/readable/toggle-display): New tests.
* doc/misc/eww.texi (Basics): Describe the new behavior.