]> git.eshelyaron.com Git - emacs.git/log
emacs.git
13 months agoorg-file-contents: Consider all remote files unsafe
Ihor Radchenko [Tue, 20 Feb 2024 11:59:20 +0000 (14:59 +0300)]
org-file-contents: Consider all remote files unsafe

* lisp/org/org.el (org-file-contents): When loading files, consider all
remote files (like TRAMP-fetched files) unsafe, in addition to URLs.

(cherry picked from commit 2bc865ace050ff118db43f01457f95f95112b877)

13 months agoorg-latex-preview: Add protection when `untrusted-content' is non-nil
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.

(cherry picked from commit 6f9ea396f49cbe38c2173e0a72ba6af3e03b271c)

13 months ago* lisp/gnus/mm-view.el (mm-display-inline-fontify): Mark contents untrusted.
Ihor Radchenko [Tue, 20 Feb 2024 09:44:30 +0000 (12:44 +0300)]
* lisp/gnus/mm-view.el (mm-display-inline-fontify): Mark contents untrusted.

(cherry picked from commit 937b9042ad7426acdcca33e3d931d8f495bdd804)

13 months ago* lisp/files.el (untrusted-content): New variable.
Ihor Radchenko [Tue, 20 Feb 2024 09:43:51 +0000 (12:43 +0300)]
* lisp/files.el (untrusted-content): New variable.

The new variable is to be used when buffer contents comes from untrusted
source.

(cherry picked from commit ccc188fcf98ad9166ee551fac9d94b2603c3a51b)

13 months agoorg-macro--set-templates: Prevent code evaluation
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.

(cherry picked from commit befa9fcaae29a6c9a283ba371c3c5234c7f644eb)

13 months ago* admin/authors.el (authors-aliases): Add ignored authors.
Eli Zaretskii [Sun, 24 Mar 2024 12:36:44 +0000 (08:36 -0400)]
* admin/authors.el (authors-aliases): Add ignored authors.

(cherry picked from commit 3221d8d46116fdefb19742be916d0e352dfab761)

13 months ago; Skip commit 8d8253f89915f1d9b45791d46cf974c6bdcc1457
Eshel Yaron [Sat, 30 Mar 2024 19:30:07 +0000 (20:30 +0100)]
; Skip commit 8d8253f89915f1d9b45791d46cf974c6bdcc1457

13 months ago; Simplify many 'sort' invocations using new interface
Eshel Yaron [Sat, 30 Mar 2024 09:08:07 +0000 (10:08 +0100)]
; Simplify many 'sort' invocations using new interface

13 months ago; Make 'value<' consider cons cell greater than all other objects
Eshel Yaron [Fri, 29 Mar 2024 20:37:27 +0000 (21:37 +0100)]
; Make 'value<' consider cons cell greater than all other objects

13 months ago; * lisp/shell.el (w32-application-type): Fix 'declare-function'.
Eli Zaretskii [Fri, 29 Mar 2024 15:26:38 +0000 (18:26 +0300)]
; * lisp/shell.el (w32-application-type): Fix 'declare-function'.

(cherry picked from commit 42322257ba9abdb8bcc2aceb34a27f261df070aa)

13 months ago`value<` manual entry adjustments (bug#69709)
Mattias Engdegård [Fri, 29 Mar 2024 14:25:22 +0000 (15:25 +0100)]
`value<` manual entry adjustments (bug#69709)

* doc/lispref/sequences.texi (Sequence Functions):
Explain lexicographical ordering.  Note the dual nature of `nil`.
Mention the depth limit.

(cherry picked from commit f04bd5568708f96dfad0e8240c7f8f23c90b6813)

13 months ago* src/fns.c (Fvaluelt): More generous depth limit (20 -> 200).
Mattias Engdegård [Fri, 29 Mar 2024 14:23:56 +0000 (15:23 +0100)]
* src/fns.c (Fvaluelt): More generous depth limit (20 -> 200).

This gives `value<` the same limit as `equal` which seems about right.

(cherry picked from commit d2d5e514397c453bbaa6e7fc3441af2d538eb3cf)

13 months agoSupport `shell-resync-dirs' on msys bash (Bug#70012)
Sam Steingold [Fri, 29 Mar 2024 14:36:43 +0000 (10:36 -0400)]
Support `shell-resync-dirs' on msys bash (Bug#70012)

* lisp/shell.el (w32-application-type): Declare.
(shell-mode): Set `shell-dirstack-query' to `pwd -W` when using msys bash.

(cherry picked from commit 6f7cb96543285dc8e37135abaec87d0b9a40e2e2)

13 months agoSimplify some sorting functions using the new 'sort' interface
Eshel Yaron [Fri, 29 Mar 2024 19:14:11 +0000 (20:14 +0100)]
Simplify some sorting functions using the new 'sort' interface

13 months ago; * doc/lispref/sequences.texi (Sequence Functions): Fix markup and examples.
Eli Zaretskii [Fri, 29 Mar 2024 12:03:44 +0000 (15:03 +0300)]
; * doc/lispref/sequences.texi (Sequence Functions): Fix markup and examples.

(cherry picked from commit 1f19ddec5b06720086c67d5d8b7d2184e9eef288)

13 months ago; * test/lisp/vc/vc-git-tests.el: bend doc string quote
Mattias Engdegård [Fri, 29 Mar 2024 10:53:56 +0000 (11:53 +0100)]
; * test/lisp/vc/vc-git-tests.el: bend doc string quote

(cherry picked from commit 2f0df93d8ca0a8d4d6b040458661b8eb21fc39e9)

13 months agoBetter `sort` ignored-return-value warning
Mattias Engdegård [Sun, 24 Mar 2024 17:18:41 +0000 (18:18 +0100)]
Better `sort` ignored-return-value warning

* 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.

(cherry picked from commit b20866c4b3aa1446efda252bd5c3fa54f68c5d7f)

13 months agoRemove `sort-on` (bug#69709)
Mattias Engdegård [Fri, 22 Mar 2024 14:06:27 +0000 (15:06 +0100)]
Remove `sort-on` (bug#69709)

* 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.

(cherry picked from commit cbd862865ff0a08d1214ac33590e7af80d10a0ac)

13 months agoUse new-style `sort` signature in Lisp manual examples
Mattias Engdegård [Fri, 22 Mar 2024 14:08:50 +0000 (15:08 +0100)]
Use new-style `sort` signature in Lisp manual examples

* doc/lispref/help.texi (Accessing Documentation):
* doc/lispref/strings.texi (Text Comparison):
Use the new sort calling convention (bug#69709).

(cherry picked from commit 92d659ce6cd2e79231f1011202abb39606d6f06b)

13 months agoFaster non-destructive list sorting
Mattias Engdegård [Fri, 22 Mar 2024 10:54:09 +0000 (11:54 +0100)]
Faster non-destructive list sorting

Postpone the creation of a new list to after sorting which turns out to
be a lot faster (1.1x - 1.5x speedup).

* src/fns.c (sort_list, sort_vector, Fsort):
Create the new list when moving the data out from the temporary array.

(cherry picked from commit 45941a62c799f9685fae296079304ae0898920cc)

13 months agoSpeed up `sort` by special-casing the `value<` ordering
Mattias Engdegård [Thu, 21 Mar 2024 18:35:15 +0000 (19:35 +0100)]
Speed up `sort` by special-casing the `value<` ordering

This gives a 1.5x-2x speed-up when using the default :lessp value,
by eliminating the Ffuncall overhead.

* src/sort.c (order_pred_lisp, order_pred_valuelt): New.
(merge_state, inorder, binarysort, count_run, gallop_left, gallop_right)
(merge_init, merge_lo, merge_hi, tim_sort):
* src/fns.c (Fsort):
When using value<, call it directly.

(cherry picked from commit deae311281522864ebabaf56adafbe37032cc8a9)

13 months agoNew `sort` keyword arguments (bug#69709)
Mattias Engdegård [Tue, 19 Mar 2024 12:03:47 +0000 (13:03 +0100)]
New `sort` keyword arguments (bug#69709)

Add the :key, :lessp, :reverse and :in-place keyword arguments.
The old calling style remains available and is unchanged.

* src/fns.c (sort_list, sort_vector, Fsort):
* src/sort.c (tim_sort):
Add keyword arguments with associated new features.
All callers of Fsort adapted.
* test/src/fns-tests.el (fns-tests--shuffle-vector, fns-tests-sort-kw):
New test.
* doc/lispref/sequences.texi (Sequence Functions): Update manual.
* etc/NEWS: Announce.

(cherry picked from commit ae5f2c02bd2fc269e2cc32c8039d95fbf4225e69)

13 months agoAdd back timsort key function handling (bug#69709)
Mattias Engdegård [Mon, 18 Mar 2024 18:56:20 +0000 (19:56 +0100)]
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.

(cherry picked from commit a52f1121a3589af8f89828e04d66f1215c361bcf)

13 months agoAdd `value<` (bug#69709)
Mattias Engdegård [Sun, 10 Mar 2024 12:18:22 +0000 (13:18 +0100)]
Add `value<` (bug#69709)

It's a general-purpose polymorphic ordering function, like `<` but
for any two values of the same type.

* src/data.c (syms_of_data): Add the `type-mismatch` error.
(bits_word_to_host_endian): Move...
* src/lisp.h (bits_word_to_host_endian): ...here, and declare inline.
* src/fns.c (Fstring_lessp): Extract the bulk of this function to...
(string_cmp): ...this 3-way comparison function, for use elsewhere.
(bool_vector_cmp, value_cmp, Fvaluelt): New.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Add `value<`, which is pure and side-effect-free.
* test/src/fns-tests.el (fns-value<-ordered, fns-value<-unordered)
(fns-value<-type-mismatch, fns-value<-symbol-with-pos)
(fns-value<-circle, ert-deftest fns-value<-bool-vector): New tests.
* doc/lispref/sequences.texi (Sequence Functions):
* doc/lispref/numbers.texi (Comparison of Numbers):
* doc/lispref/strings.texi (Text Comparison):
Document the new value< function.
* etc/NEWS: Announce.

(cherry picked from commit 1232ab31c656b8564984a758957466f90ac10501)

13 months ago; Update 'read-multiple-choice' documentation
Eshel Yaron [Fri, 29 Mar 2024 12:32:41 +0000 (13:32 +0100)]
; Update 'read-multiple-choice' documentation

13 months ago; * java/org/gnu/emacs/EmacsActivity.java (isReallyFinishing): Fix typo.
Po Lu [Thu, 28 Mar 2024 11:57:22 +0000 (19:57 +0800)]
; * java/org/gnu/emacs/EmacsActivity.java (isReallyFinishing): Fix typo.

(cherry picked from commit c3684b97885c5a1f4d0713ff45c7395e9a4c6e8a)

13 months agoPrevent Android OS task trimming from deleting Emacs frames
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.

(cherry picked from commit 755665d95adbba07335f400f1090e53b66c41ff5)

13 months agopp.el: Try and fix bug#70039
Stefan Monnier [Thu, 28 Mar 2024 19:31:04 +0000 (15:31 -0400)]
pp.el: Try and fix bug#70039

* lisp/emacs-lisp/pp.el (pp-fill): Avoid splitting `#N#` or `#[`.
* test/lisp/emacs-lisp/pp-tests.el (pp-tests--sanity): New test.

(cherry picked from commit 4cee95815b9d7d56f6f77abb1cc17e346c038685)

13 months ago* lisp/emacs-lisp/cl-macs.el (list): Predefine predicate by hand
Stefan Monnier [Thu, 28 Mar 2024 16:27:54 +0000 (12:27 -0400)]
* lisp/emacs-lisp/cl-macs.el (list): Predefine predicate by hand

(cherry picked from commit de9e913f9e2a1e01e5d091a553e98d75404a2246)

13 months agoAdd 'minibuffer-hint-mode'
Eshel Yaron [Thu, 28 Mar 2024 21:16:40 +0000 (22:16 +0100)]
Add 'minibuffer-hint-mode'

13 months agoAdd command 'register-toggle-volatility'
Eshel Yaron [Thu, 28 Mar 2024 20:29:14 +0000 (21:29 +0100)]
Add command 'register-toggle-volatility'

13 months agoImprove 'help--symbol-completion-table-affixation'
Eshel Yaron [Thu, 28 Mar 2024 18:46:43 +0000 (19:46 +0100)]
Improve 'help--symbol-completion-table-affixation'

13 months agoSupport choosing between multiple narrow-completions-functions
Eshel Yaron [Thu, 28 Mar 2024 18:24:02 +0000 (19:24 +0100)]
Support choosing between multiple narrow-completions-functions

13 months ago; Adjust 'read-multiple-choice' test
Eshel Yaron [Thu, 28 Mar 2024 17:11:15 +0000 (18:11 +0100)]
; Adjust 'read-multiple-choice' test

13 months agoFix a typo in flymake.el
Eli Zaretskii [Thu, 28 Mar 2024 10:15:13 +0000 (12:15 +0200)]
Fix a typo in flymake.el

* lisp/progmodes/flymake.el (flymake--update-eol-overlays): Use
'save-restriction', not 'save-excursion'.  (Bug#69984)

(cherry picked from commit 6c1a11078b194ed536db17381aad9e159e486fee)

13 months agocopy-tree just image map, not entire image
Joseph Turner [Sat, 23 Mar 2024 20:29:17 +0000 (13:29 -0700)]
copy-tree just image map, not entire image

* lisp/image.el (image--compute-original-map): Copy only
the image map.  (Bug#69602)

(cherry picked from commit a4da3971f2580c90fb3c6957eea2d0dbfb695879)

13 months ago; * etc/NEWS: Announce new feature of Proced. (Bug#69784)
Eli Zaretskii [Thu, 28 Mar 2024 09:50:22 +0000 (11:50 +0200)]
; * etc/NEWS: Announce new feature of Proced.  (Bug#69784)

(cherry picked from commit f021c3dbcd08eb1b0e3215ba6fd4e56364e6915f)

13 months agoAllow for auto updating only visible proced buffers (bug#69784)
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.

(cherry picked from commit b2793febcaa31bf21caff2d6461fd328f0892ad2)

13 months agoImprove ert-font-lock assertion parser (Bug#69714)
Vladimir Kazanov [Tue, 12 Mar 2024 11:14:54 +0000 (11:14 +0000)]
Improve ert-font-lock assertion parser (Bug#69714)

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.

(cherry picked from commit cdd7093e17a33a6efc4721af461af180e5af602d)

13 months ago; * lisp/emacs-lisp/pcase.el (pcase--subtype-bitsets): Doc fix.
Eli Zaretskii [Thu, 28 Mar 2024 09:34:25 +0000 (11:34 +0200)]
; * lisp/emacs-lisp/pcase.el (pcase--subtype-bitsets): Doc fix.

(cherry picked from commit 35ae2c576b8570da7b2e791991ad852c648be896)

13 months ago(pcase-mutually-exclusive): Use auto-generated table
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.

(cherry picked from commit f1fe13ea057237f5426c93876488cb95be86156c)

13 months ago(project-current): Add binding for 'non-essential'
Dmitry Gutov [Thu, 28 Mar 2024 03:41:52 +0000 (05:41 +0200)]
(project-current): Add binding for 'non-essential'

* lisp/progmodes/project.el (project-current):
Add binding for 'non-essential' (bug#69584).

(cherry picked from commit 1552f8345d8cbea282d171bffe5a22e330eeed37)

13 months agoCorrectly check buffer mtime when displaying xref matches
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).

(cherry picked from commit 5efa2ddf62d4876fb62f23b571f4cc0af5885639)

13 months agoImprove 'read-multiple-choice--long-answers' annotations
Eshel Yaron [Wed, 27 Mar 2024 20:46:04 +0000 (21:46 +0100)]
Improve 'read-multiple-choice--long-answers' annotations

13 months agoRemove IME_FLAG_FORCE_ASCII from password input IME flags
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.

(cherry picked from commit 5a7c46355be1b5a9a8dbfb36ba44969963a3f558)

13 months ago* lisp/help.el (help-function-arglist): Don't `substitute-command-keys`
Stefan Monnier [Tue, 26 Mar 2024 21:41:42 +0000 (17:41 -0400)]
* lisp/help.el (help-function-arglist): Don't `substitute-command-keys`

(cherry picked from commit 48b6e6bd80f2783c6320db1f7e8fb0b3f44e2e9d)

13 months agocl-preloaded.el: Partly revert last change
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`.

(cherry picked from commit e5d824b632a68430535f6e94d911871eb0f3f772)

13 months agoCC Mode: Handle C++20's if consteval
Alan Mackenzie [Tue, 26 Mar 2024 20:59:43 +0000 (20:59 +0000)]
CC Mode: Handle C++20's if consteval

* lisp/progmodes/cc-engine.el (c-after-conditional): Handle the
new keyword in place of a paren sexp after `if'.

* lisp/progmodes/cc-langs.el (c-negation-op-re)
(c-paren-clause-kwds, c-paren-clause-key)
(c-block-stmt-with-kwds, c-block-stmt-with-key): New
lang-consts/vars.

* if-11.cc, if-11.res: New test files.

(cherry picked from commit ed85132740b39c147647be1831abb64a3f514d57)

13 months agocl-preloaded.el: Fix the type lattice
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-generic.el (cl--generic--unreachable-types):
Delete constant.
(cl-generic-generalizers): Remove corresponding test.

* 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`.

(cherry picked from commit 004f2493a542dd0b804a30e97fc612884ca440f4)

13 months ago; Fix recently-changed documentation
Eli Zaretskii [Tue, 26 Mar 2024 12:24:16 +0000 (14:24 +0200)]
; Fix recently-changed documentation

* src/buffer.c (syms_of_buffer) <text-conversion-style>:
* doc/lispref/commands.texi (Misc Events): Fix wording and
punctuation of the documentation.

(cherry picked from commit 351d98535dc10f8338b8a418e331cc0af488087b)

13 months agoFix native comp prediction on null functionp tested objects
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.

(cherry picked from commit 8cc67dbcec0753c5579e63bf82bfe247debe222c)

13 months agoPrevent focus "stalemates" on Android
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.

(cherry picked from commit b7b9a0a5c1afae07b8168e85dcf1fc37d29e98ef)

13 months agoPrevent passwords from being recorded during text conversion
Po Lu [Tue, 26 Mar 2024 02:11:26 +0000 (10:11 +0800)]
Prevent passwords from being recorded during text conversion

* doc/lispref/commands.texi (Misc Events): Document new value of
text-conversion-style.

* java/org/gnu/emacs/EmacsService.java (EmacsService)
<IC_MODE_PASSWORD>: New constant.

* java/org/gnu/emacs/EmacsView.java (onCreateInputConnection):
Set TYPE_TEXT_VARIATION_PASSWORD and IME_FLAG_FORCE_ASII if mode
is IC_MODE_PASSWORD.

* lisp/subr.el (read-passwd): Set text-conversion-style to
`password'.

* src/androidgui.h (enum android_ic_mode): New value
ANDROID_IC_MODE_PASSWORD.

* src/androidterm.c (android_reset_conversion): Handle
`password'.

* src/buffer.c (syms_of_buffer)
<&BVAR (current_buffer, text_conversion_style)>: Update doc
string.

* src/textconv.c (syms_of_textconv) <Qpassword>: New DEFSYM.
<Vtext_conversion_edits>: Fix typos in doc string.

(cherry picked from commit 728bf2c9e5353e68b16808ae455223549c16efc6)

13 months agoFix removal of bookmark's fringe mark in Info and Dired
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)

(cherry picked from commit 7fba25cf5344f5c3507aedf59e6ae099e7662508)

13 months agoDocument the 'I' command in buffer-menu
Eli Zaretskii [Mon, 25 Mar 2024 12:53:23 +0000 (14:53 +0200)]
Document the 'I' command in buffer-menu

* doc/emacs/buffers.texi (Several Buffers): Document 'I'.  Fix
indexing.
(List Buffers): Mention 'I'.  (Bug#69987)

* etc/NEWS: Mark 'I' as documented.

(cherry picked from commit a79b424f7fdecf577e46c5fea6ee3d921e606596)

13 months ago* lisp/vc/diff-mode.el (diff-setup-buffer-type): Remove "\n" from regexp.
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".

(cherry picked from commit f54b1d9f7b7a977ee4856c778a309c900ce9e8fa)

13 months agoPort restart-emacs to Android 4.3 and earlier
Po Lu [Mon, 25 Mar 2024 07:42:23 +0000 (15:42 +0800)]
Port restart-emacs to Android 4.3 and earlier

* java/org/gnu/emacs/EmacsService.java (restartEmacs): Run Emacs
from an alarm if required.

(cherry picked from commit ba96c4ec56a9978fce155c0af34a0412aee817b2)

13 months ago(byte-optimize-form-code-walker): Simplify a bit
Stefan Monnier [Mon, 25 Mar 2024 02:13:44 +0000 (22:13 -0400)]
(byte-optimize-form-code-walker): Simplify a bit

Eliminate a case that matches very rarely and where the default
handling works just as well anyway.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Remove
redundant case.

(cherry picked from commit 83a6e80d66a4c6333e2bbb21d0428c432ddca881)

13 months ago; * lisp/simple.el (kill-buffer--possibly-save): Simplify.
Eshel Yaron [Wed, 27 Mar 2024 07:22:07 +0000 (08:22 +0100)]
; * lisp/simple.el (kill-buffer--possibly-save): Simplify.

13 months agoImprove 'read-multiple-choice'
Eshel Yaron [Tue, 26 Mar 2024 22:03:43 +0000 (23:03 +0100)]
Improve 'read-multiple-choice'

Crucially, make it more suitable for dynamic sets of choices.

13 months agoAdd global minor mode 'global-completion-preview-mode'
Eshel Yaron [Tue, 26 Mar 2024 21:34:51 +0000 (22:34 +0100)]
Add global minor mode 'global-completion-preview-mode'

This is a global variant of 'completion-preview-mode'.

* lisp/completion-preview.el (global-completion-preview-mode): New
global minor mode.

* doc/emacs/programs.texi (Symbol Completion): Document it.

* etc/NEWS: Announce it.  (Bug#70010)

13 months agoFix native compilation for circular immediates (bug#67883)
Andrea Corallo [Sun, 24 Mar 2024 10:29:37 +0000 (11:29 +0100)]
Fix native compilation for circular immediates (bug#67883)

* test/src/comp-resources/comp-test-funcs.el
(comp-test-67883-1-f): New function.

* lisp/emacs-lisp/comp.el (comp--collect-rhs)
(comp--ssa-rename-insn): Handle setimm aside to avoid unnecessary
immediate manipulation.
(comp--copy-insn-rec): Rename.
(comp--copy-insn): New function.
(comp--dead-assignments-func): Handle setimm aside to avoid
unnecessary.

(cherry picked from commit c5de73a95a6ecefe46fe1ac07da8e83032be7f5b)

13 months ago; * lisp/emacs-lisp/cl-preloaded.el (user-ptr): Fix typo.
Po Lu [Sun, 24 Mar 2024 03:05:31 +0000 (11:05 +0800)]
; * lisp/emacs-lisp/cl-preloaded.el (user-ptr): Fix typo.

Author:
(cherry picked from commit 30b1b0d7cd8e4d46a601e9737350cda970f6bab0)

13 months agoDon't define user-ptr type when user-ptrp is not present
Po Lu [Sun, 24 Mar 2024 03:02:34 +0000 (11:02 +0800)]
Don't define user-ptr type when user-ptrp is not present

* lisp/emacs-lisp/cl-preloaded.el (user-ptr): Condition on
presence of predicate function.

(cherry picked from commit 7206a620af2de7281d9c9299582241a10e79e1a3)

13 months agoImprove consistency of content file name handling
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.

(cherry picked from commit 2be41da38ef5432b6038058fcb0c284164fcb370)

13 months agocl-preloaded.el: Improve docstrings of "kinds"
Stefan Monnier [Sun, 24 Mar 2024 02:48:17 +0000 (22:48 -0400)]
cl-preloaded.el: Improve docstrings of "kinds"

* lisp/emacs-lisp/cl-preloaded.el (cl--class): Improve the docstring.
(built-in-class): Add a docstring.

(cherry picked from commit a496378c94176930583e63ef5c95477f092a872b)

13 months ago* doc/emacs/help.texi (Name Help): Mention buttons (bug#69935)
Stefan Monnier [Sun, 24 Mar 2024 02:27:34 +0000 (22:27 -0400)]
* doc/emacs/help.texi (Name Help): Mention buttons (bug#69935)

(cherry picked from commit 044558766a77b1c9b8a7e6d757ca65730a88b88d)

13 months agoedebug.el: Better strip instrumentation from backtraces
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.

(cherry picked from commit ef859d8b1b285fd22b083955a0e878a74d72ff41)

13 months agoReuse command-indicator code for script lines in ERC
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)

(cherry picked from commit a46789b56af05e4cd31ab90495c9f2a4492a9b19)

13 months agoRestore leading space to right-margin stamps in ERC
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.

; test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Add space.
; test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Add space.
; test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Add space.
; test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add space.
; test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add space.
; test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Add space.
; test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Add space.
; test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Add space.
; test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Add space.
; test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Add space.

(cherry picked from commit b9bd78f78d62383f2ff84ceecf8e490193594f17)

13 months agoRemove mishandled erc-control-default-{fg,bg} faces
F. Moukayed [Sun, 17 Mar 2024 16:43:36 +0000 (16:43 +0000)]
Remove mishandled erc-control-default-{fg,bg} faces

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)

Copyright-paperwork-exempt: yes
(cherry picked from commit 525bc083155030b58de08c8716fec9db1496aa9d)

13 months agoRemove unused faces from various erc-goodies tests
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)

(cherry picked from commit 44be4fa8e652f08cad0cd6a85abcd54c691a7c27)

13 months ago(describe-package-1): Fix bug#69712
Stefan Monnier [Sat, 23 Mar 2024 20:11:07 +0000 (16:11 -0400)]
(describe-package-1): Fix bug#69712

* lisp/emacs-lisp/package.el (describe-package-1): Improve the test to
determine if `maintainers` contains a single cons or a list of conses.

(cherry picked from commit 0f04aa06a69cb82eb66d5ffd46700ffdbd58b8f3)

13 months ago; Fix markup in recent change to dired-x.texi.
Basil L. Contovounesios [Sat, 23 Mar 2024 19:15:40 +0000 (20:15 +0100)]
; Fix markup in recent change to dired-x.texi.

(cherry picked from commit 8578652b5b0958aaa92c99667a9ccd72cc412bd6)

13 months agoRecompute :map when image :scale, :rotation, or :flip changes
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)

(cherry picked from commit 79c758187cef7fc1f93fd525b9d81be81ee2b2cc)

13 months agoAdd 'eww-readable-urls'
Jim Porter [Mon, 18 Mar 2024 23:52:34 +0000 (16:52 -0700)]
Add 'eww-readable-urls'

* lisp/net/eww.el (eww-readable-urls): New option.
(eww-default-readable-p): New function...
(eww-display-html): ... use it.

* test/lisp/net/eww-tests.el (eww-test/readable/default-readable): New
test.

* doc/misc/eww.texi (Basics): Document 'eww-readable-urls'.

* etc/NEWS: Announce this change (bug#68254).

(cherry picked from commit 4b0f5cdb01fbd05c8184a89fa8543eb5600fb4f8)

13 months agoAllow toggling "readable" mode in EWW
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.

* etc/NEWS: Announce this change.

(cherry picked from commit 72972118e6f5831f200108cd7b80bf86538c265e)

13 months ago; * doc/misc/dired-x.texi (Omitting Variables): Fix markup.
Eli Zaretskii [Sat, 23 Mar 2024 17:10:17 +0000 (19:10 +0200)]
; * doc/misc/dired-x.texi (Omitting Variables): Fix markup.

(cherry picked from commit af1e36d0c66350113869df9e840e5f21b750ce9d)

13 months agoUse 'regexp-opt' in 'dired-omit-regexp'
Spencer Baugh [Sat, 16 Mar 2024 17:11:24 +0000 (17:11 +0000)]
Use 'regexp-opt' in 'dired-omit-regexp'

In my benchmarking, for large dired buffers, using 'regexp-opt'
provides around a 3x speedup in omitting.

'regexp-opt' takes around 5 milliseconds, so to avoid slowing
down omitting in small dired buffers we cache the return value.

Since omitting is now 3x faster, increase 'dired-omit-size-limit'
by 3x.  Also, document 'dired-omit-size-limit' better.

* doc/misc/dired-x.texi (Omitting Variables): Document
'dired-omit-size-limit'.
* etc/NEWS: Announce increase of 'dired-omit-size-limit'.
* lisp/dired-x.el (dired-omit--extension-regexp-cache): Add.
(dired-omit-regexp): Use 'regexp-opt'.  (Bug#69775)
(dired-omit-size-limit): Increase and improve docs.

(cherry picked from commit abc2d39e0102f8bb554d89da3c0ffe57188220ff)

13 months ago* src/coding.c (produce_chars): Fix a thinko (bug#69966).
Eli Zaretskii [Sat, 23 Mar 2024 16:54:39 +0000 (18:54 +0200)]
* src/coding.c (produce_chars): Fix a thinko (bug#69966).

(cherry picked from commit 8d7a3ed3495968fd3e95a6126e7c23e25b7c495f)

13 months agoEnable calling decode_coding_object with both SRC and DST_OBJECT Qnil
Po Lu [Sat, 23 Mar 2024 10:14:12 +0000 (18:14 +0800)]
Enable calling decode_coding_object with both SRC and DST_OBJECT Qnil

* src/coding.c (growable_destination): A C destination is also
reallocable.
(produce_chars): Don't consider source and destination identical
if they are EQ but Qnil.

(cherry picked from commit 0e83cbd90ecdf793b2422d9219886d91ea4c385a)

13 months agoMinor adjustments to last change
Po Lu [Sat, 23 Mar 2024 10:12:56 +0000 (18:12 +0800)]
Minor adjustments to last change

* src/androidvfs.c (android_vfs_convert_name): Simplify.
(android_saf_tree_readdir, android_root_name): Remove redundant
statements.

(cherry picked from commit 023a5fe5a3bd2f20eb168bc4763fa98e14201fff)

13 months ago; Fix doc strings of some treesit-related functions
Eli Zaretskii [Sat, 23 Mar 2024 09:50:55 +0000 (11:50 +0200)]
; Fix doc strings of some treesit-related functions

* lisp/treesit.el (treesit-defun-tactic)
(treesit-defun-name-function, treesit-thing-at-point)
(treesit-defun-at-point):
* lisp/progmodes/c-ts-common.el (c-ts-common-statement-offset):
* lisp/progmodes/c-ts-mode.el (c-ts-mode-toggle-comment-style)
(c-ts-mode-indent-style, c-ts-mode-emacs-sources-support)
(c-ts-mode--syntax-propertize, c-ts-mode--anchor-prev-sibling)
(c-ts-mode--standalone-parent-skip-preproc)
(c-ts-mode--standalone-grandparent, c-ts-mode--else-heuristic)
(c-ts-mode--declarator-identifier)
(c-ts-mode--fontify-declarator, c-ts-mode--fontify-variable)
(c-ts-mode--defun-valid-p)
(c-ts-mode--defun-for-class-in-imenu-p)
(c-ts-mode--defun-skipper, c-ts-mode--emacs-defun-p)
(c-ts-mode--emacs-defun-at-point)
(c-ts-mode--emacs-current-defun-name, c-ts-mode--reverse-ranges)
(c-ts-mode, c++-ts-mode, c-or-c++-ts-mode): Doc fixes.

(cherry picked from commit 5769a1053087a278d48836e1f366e0bd87c95809)

13 months agoImprove support for preprocessor macros in 'c/c++-ts-mode'
Eli Zaretskii [Sat, 23 Mar 2024 09:09:57 +0000 (11:09 +0200)]
Improve support for preprocessor macros in 'c/c++-ts-mode'

* lisp/progmodes/c-ts-mode.el (c-ts-mode--defun-name)
(c-ts-base-mode): Support preprocessor macros as defuns.  This
fixes both navigation by defuns and add-log when cpp macros are at
point.

(cherry picked from commit 2fb6f252bfe2cd06a49975bc97a794fb70392538)

13 months agoAvoid infinite recursion in 'image-mode--display'
Eli Zaretskii [Sat, 23 Mar 2024 07:51:47 +0000 (09:51 +0200)]
Avoid infinite recursion in 'image-mode--display'

* lisp/image-mode.el (image-mode): Suspend major mode only if it
is not already 'image-mode'.  (Bug#69785)

(cherry picked from commit e52bc9ef6f7942b15d876566aca52340210ac27c)

13 months agoAdd BasedPyright LSP server alternative for Eglot's 'python-mode'
Dionisio E Alonso [Wed, 20 Mar 2024 15:06:30 +0000 (17:06 +0200)]
Add BasedPyright LSP server alternative for Eglot's 'python-mode'

* lisp/progmodes/eglot.el (eglot-server-programs): Add
BasedPyright, a new server for python, forked from the
unmaintained 'pyright' LSP server.  (Bug#69925)

Copyright-paperwork-exempt: yes
(cherry picked from commit 6235212d736ca4f0b0a1900c42c30d82747d7798)

13 months agoCorrectly handle non-BMP characters in Android content file names
Po Lu [Sat, 23 Mar 2024 07:37:43 +0000 (15:37 +0800)]
Correctly handle non-BMP characters in Android content file names

* lisp/term/android-win.el (android-encode-jni)
(android-decode-jni, android-jni): New coding system, for
Android file names and runtime data.

* src/androidterm.h (syms_of_androidvfs): New function.

* src/androidvfs.c (struct android_special_vnode): New field
special_coding_system.
(android_saf_tree_readdir): Decode the file name using the
android-jni coding system.
(special_vnodes): <contents>: Specify a file name coding system.
(android_vfs_convert_name): New function.
(android_root_name): If a special coding system be specified for
a special vnode, convert components to it before invoking its
name function.
(syms_of_androidvfs): New symbol Qandroid_jni.

* src/emacs.c (android_emacs_init): Call syms_of_androidvfs.

(cherry picked from commit e39cb515a108682b520e499c334a600ee634fbf6)

13 months ago; Remove unneeded group in lua-ts-mode defcustoms
john muhl [Tue, 12 Mar 2024 16:17:15 +0000 (11:17 -0500)]
; Remove unneeded group in lua-ts-mode defcustoms

* lisp/progmodes/lua-ts-mode.el (lua-ts-mode-hook):
(lua-ts-indent-offset):
(lua-ts-luacheck-program):
(lua-ts-inferior-buffer):
(lua-ts-inferior-program):
(lua-ts-inferior-options):
(lua-ts-inferior-startfile):
(lua-ts-inferior-prompt):
(lua-ts-inferior-prompt-continue):
(lua-ts-inferior-history):
(lua-ts-indent-continuation-lines): Remove :group.  (bug#69910)

(cherry picked from commit f412892b79dae531ace081f61ec6f3874f9270bc)

13 months ago; Open inferior Lua buffer in a window, not a frame
john muhl [Wed, 20 Mar 2024 00:46:12 +0000 (19:46 -0500)]
; Open inferior Lua buffer in a window, not a frame

* lisp/progmodes/lua-ts-mode.el (lua-ts-inferior-lua): Replace
'display-buffer-pop-up-window' with
'display-buffer-pop-up-frame'.  (bug#69909)

(cherry picked from commit d3ca7c68c7e4c4c86341427fc34dd1af74f1a593)

13 months agoFix recent test regressions
Stefan Monnier [Fri, 22 Mar 2024 22:44:54 +0000 (18:44 -0400)]
Fix recent test regressions

* lisp/emacs-lisp/pp.el (pp-fill): Don't cut between `#` and `(`.

* test/lisp/help-fns-tests.el (help-fns-test-built-in)
(help-fns-test-interactive-built-in, help-fns-test-lisp-defun)
(help-fns-test-lisp-defsubst):
* test/src/emacs-module-tests.el (module/describe-function-1):
Adjust tests to new wording in `describe-function`.

(cherry picked from commit 7e32e8392ab77f9df08a1f11831cbba2242d721f)

13 months agoetc/NEWS: Document the new behavior of `describe-function`
Stefan Monnier [Fri, 22 Mar 2024 21:03:15 +0000 (17:03 -0400)]
etc/NEWS: Document the new behavior of `describe-function`

I pushed commit accd79c93935 by accident.
Related to bug#69935

(cherry picked from commit 3197d7015b854944e326d68c5307b38f0a0d2d53)

13 months ago(pp-fill): Cut before parens and dots
Stefan Monnier [Fri, 22 Mar 2024 20:46:28 +0000 (16:46 -0400)]
(pp-fill): Cut before parens and dots

The `pp-fill` code sometimes end up generating things like:

    (foo .
         bar)

instead of

    (foo
     .  bar)

so make sure we cut before rather than after the dot (and open
parens while we're at it).

* lisp/emacs-lisp/pp.el (pp-fill): Cut before parens and dots.

* test/lisp/emacs-lisp/pp-tests.el (pp-tests--dimensions): New function.
(pp-tests--cut-before): New test.

(cherry picked from commit 7269a2f1586733bd03b569608bd77112b2e6487f)

13 months ago(help-fns-function-description-header): Print functions' type
Stefan Monnier [Fri, 22 Mar 2024 01:08:58 +0000 (21:08 -0400)]
(help-fns-function-description-header): Print functions' type

Instead of choosing English words to describe the kind of function,
use the actual type of the function object (from `cl-type-of`)
directly, and make it a button to display info about that type.

* lisp/help-fns.el (help-fns-function-description-header): Use the
function's type name in the description instead of "prose".
Use `insert` instead of `princ`, so as to preserve the text-properties
of the button.

* lisp/emacs-lisp/cl-extra.el (cl-help-type): Move to `help-mode.el`
and rename to `help-type`.
(cl--describe-class): Adjust accordingly.

* lisp/help-mode.el (help-type): New type, moved and renamed from
`cl-extra.el`.

(cherry picked from commit accd79c93935b50dddfcd6fe7fb6912c80bcddb1)

13 months ago; * lisp/help-fns.el (help-fns-function-name): Doc fix.
Eli Zaretskii [Fri, 22 Mar 2024 07:54:37 +0000 (09:54 +0200)]
; * lisp/help-fns.el (help-fns-function-name): Doc fix.

(cherry picked from commit c1530a2e4973005633ebe00d447f1f3aa1200301)

13 months agoFix display of custom menus after putative cosmetic change
Po Lu [Fri, 22 Mar 2024 07:24:28 +0000 (15:24 +0800)]
Fix display of custom menus after putative cosmetic change

* lisp/wid-edit.el (widget-setup): Restore version from before
the previous commit.

(cherry picked from commit 0c321ddbd3afcc821567fcb584e18e9f0dd49790)

13 months ago* lisp/help.el (help--analyze-key): Use `help-fns-function-name`
Stefan Monnier [Fri, 22 Mar 2024 01:43:38 +0000 (21:43 -0400)]
* lisp/help.el (help--analyze-key): Use `help-fns-function-name`

(cherry picked from commit 60c9702972f3cef9e6dbbce5eaad8cc90ea7f8e8)

13 months ago(help-fns-function-name): New function
Stefan Monnier [Thu, 21 Mar 2024 23:40:20 +0000 (19:40 -0400)]
(help-fns-function-name): New function

Consolidate code used in profiler and help--describe-command,
and improve it while we're at it.
Also use #' to quote a few function names along the way.

* lisp/help-fns.el (help-fns--function-numbers, help-fns--function-names):
New vars.
(help-fns--display-function): New aux function.
(help-fns-function-name): New function, inspired from
`help--describe-command`.

* lisp/help.el (help--describe-command): Use `help-fns-function-name`.
(help--for-help-make-sections): Remove redundant "" arg to `mapconcat`.

* lisp/profiler.el (profiler-format-entry, profiler-fixup-entry):
Delete functions.
(profiler-report-make-entry-part): Use `help-fns-function-name` instead.
(profiler-report-find-entry): Use `push-button`.

* lisp/transient.el (transient--debug): Use `help-fns-function-name`
when available.

(cherry picked from commit a1f8702e8345254e6898d35e554bdc06ab09c3ca)

13 months ago(make-help-screen): Move most of the code out to a function
Stefan Monnier [Thu, 21 Mar 2024 23:26:33 +0000 (19:26 -0400)]
(make-help-screen): Move most of the code out to a function

This avoids problems like variable-name capture and lets compiler messages
point to the actual source code.

* lisp/help-macro.el (help--help-screen): New function, extracted from
`make-help-screen`.
(make-help-screen): Use it.

(cherry picked from commit 946280365d40104dffd5329eebefc02329f72041)

13 months agoUpdate to Transient v0.6.0-1-gcaef3347
Jonas Bernoulli [Thu, 21 Mar 2024 22:55:38 +0000 (23:55 +0100)]
Update to Transient v0.6.0-1-gcaef3347

(cherry picked from commit c214fc9626c8b37e4d155a6d3caebe2e09fd0ab2)

13 months ago(describe-symbol-backends): Fix addition of the "type" backend
Stefan Monnier [Thu, 21 Mar 2024 22:27:03 +0000 (18:27 -0400)]
(describe-symbol-backends): Fix addition of the "type" backend

That backend was added from `cl-extra.el` with no autoload, so
(describe-symbol `advice) failed to show the info about
the `advice` type unless `cl-extra.el` had been loaded beforehand.
`C-h o RET advice RET` worked by accident because the completion
table uses `cl-some` which is autoloaded from `cl-extra.el`.

* lisp/help-mode.el (describe-symbol-backends): Add the "type" backend.
* lisp/emacs-lisp/cl-extra.el (describe-symbol-backends): Don't add the
"type" backend here.

(cherry picked from commit 2000d6e0f27f9f34f343016f4aa93e09c29c8695)