]> git.eshelyaron.com Git - emacs.git/log
emacs.git
16 months agoEnsure proper mode of *Compile-Log* buffer (bug#67920)
Mattias Engdegård [Thu, 21 Dec 2023 17:56:04 +0000 (18:56 +0100)]
Ensure proper mode of *Compile-Log* buffer (bug#67920)

Reported by OGAWA Hirofumi.

* lisp/emacs-lisp/bytecomp.el (displaying-byte-compile-warnings):
Move most of the innards to...
(bytecomp--displaying-warnings): ...this new function, for ease
of maintenance.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
Wrap early warning about missing lexbind declaration in
`displaying-byte-compile-warnings` so that it doesn't cause the
creation of a compile-log buffer with the wrong mode.

(cherry picked from commit c638a40d88f6ca105babbf9078b086491b649797)

16 months agoEncapsulate byte-compile-form-stack maintenance
Mattias Engdegård [Thu, 21 Dec 2023 12:33:27 +0000 (13:33 +0100)]
Encapsulate byte-compile-form-stack maintenance

* lisp/emacs-lisp/bytecomp.el (byte-compile-toplevel-file-form)
(byte-compile-form):
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all):
Use `macroexp--with-extended-form-stack` instead of explicit
push and pop.

(cherry picked from commit 9db1fe638ecfdd2d8dd32e3ee47f97c5ed3312c1)

16 months ago; * admin/cherry.el: New file.
Eshel Yaron [Fri, 22 Dec 2023 18:08:49 +0000 (19:08 +0100)]
; * admin/cherry.el: New file.

Add helper command 'cherry-pick-new-commits' for interactively
cherry-picking new commits from the upstream master branch.

16 months agoProperly instruct compound glyphs with compound components
Po Lu [Fri, 22 Dec 2023 02:25:36 +0000 (10:25 +0800)]
Properly instruct compound glyphs with compound components

* src/sfnt.c (sfnt_interpret_compound_glyph_2): Don't grow the
compound decomposition context for saving compound points into,
since the space for them already exists.

(cherry picked from commit f34f474e386b662114e6ee4ebd8c37f4cb66db71)

16 months agoJsonrpc: overhaul logging mechanics
João Távora [Thu, 21 Dec 2023 20:49:02 +0000 (14:49 -0600)]
Jsonrpc: overhaul logging mechanics

* lisp/jsonrpc.el (jsonrpc-connection): Rework.
(initialize-instance :after jsonrpc-connection): New method.
(slot-missing jsonrpc-connection :events-buffer-scrollback-size oset):
New hack.
(jsonrpc-connection-receive): Rework.
(initialize-instance :after jsonrpc-process-connection): Rework
from non-after version.
(jsonrpc-connection-send)
(jsonrpc--call-deferred)
(jsonrpc--process-sentinel)
(jsonrpc--async-request-1, jsonrpc--debug, jsonrpc--log-event)
(jsonrpc--forwarding-buffer): Rework.
(jsonrpc--run-event-hook): New helper.
(jsonrpc-event-hook): New hook.

* lisp/progmodes/eglot.el (eglot-lsp-server): Fix project slot
initform.
(eglot--connect): Use new jsonrpc-connection initarg.

* test/lisp/progmodes/eglot-tests.el (eglot--sniffing): Use
jsonrpc-event-hook.
(eglot-test-basic-completions): Fix test.

(cherry picked from commit e0b9944b69ff72923c29756fcfcea9528a3f5069)

16 months agoJsonrpc: fix destructuring bug
João Távora [Thu, 21 Dec 2023 15:08:13 +0000 (09:08 -0600)]
Jsonrpc: fix destructuring bug

* lisp/jsonrpc.el (jsonrpc--process-sentinel): Fix destructuring bug.
(Version): Bump to 1.0.22

(cherry picked from commit 4adc67c59dedcea89116aae0e054ea1212dcca7a)

16 months ago* test/lisp/ls-lisp-tests.el (ls-lisp-unload): Delete test
Stefan Monnier [Thu, 21 Dec 2023 14:27:53 +0000 (09:27 -0500)]
* test/lisp/ls-lisp-tests.el (ls-lisp-unload): Delete test

We don't use such advice any more.

(cherry picked from commit ec898e94b3d364d58a3a833c413da005fea2867a)

16 months ago; * etc/NEWS: Fix markings (bug#67249).
Eli Zaretskii [Thu, 21 Dec 2023 13:21:21 +0000 (15:21 +0200)]
; * etc/NEWS: Fix markings (bug#67249).

(cherry picked from commit 843cbb9a15a93c5f20368d6bc6baa97e65ff27ac)

16 months ago; * lisp/emacs-lisp/cconv.el (cconv-convert): Reindent.
Mattias Engdegård [Wed, 20 Dec 2023 16:08:41 +0000 (17:08 +0100)]
; * lisp/emacs-lisp/cconv.el (cconv-convert): Reindent.

(cherry picked from commit 25dc93c5c1bc7df82a9e16dd080667ccb4ba4f45)

16 months agoMaintain byte-compile-form-stack in cconv-convert (bug#67483)
Mattias Engdegård [Wed, 20 Dec 2023 12:21:36 +0000 (13:21 +0100)]
Maintain byte-compile-form-stack in cconv-convert (bug#67483)

* lisp/emacs-lisp/macroexp.el (macroexp--with-extended-form-stack):
New.
* lisp/emacs-lisp/cconv.el (cconv-closure-convert, cconv-convert):
Push forms onto byte-compile-form-stack.

(cherry picked from commit 57fd0f47f6955505195f77a55d29334ded88889c)

16 months agoNon-delayed warning for malformed function (bug#67483)
Mattias Engdegård [Wed, 20 Dec 2023 13:15:59 +0000 (14:15 +0100)]
Non-delayed warning for malformed function (bug#67483)

* lisp/emacs-lisp/cconv.el (cconv-convert): Use an immediate warning;
a delayed one made little sense as it's a matter of well-formedness.

(cherry picked from commit 14ecc377ab43e4c33506c2a8b65bf1e75fb262d3)

16 months ago; * lisp/progmodes/gdb-mi.el (gdb-load-history): Add doc string.
Eli Zaretskii [Thu, 21 Dec 2023 11:57:00 +0000 (13:57 +0200)]
; * lisp/progmodes/gdb-mi.el (gdb-load-history): Add doc string.

(cherry picked from commit ff3965795fb80681111708e104f1edd32bdb6199)

16 months agoFunction to load GDB history
Manuel Giraud [Wed, 20 Dec 2023 11:08:30 +0000 (12:08 +0100)]
Function to load GDB history

* lisp/progmodes/gdb-mi.el (gud-gdb-load-history): New function to
load GDB history, code factored out of 'gdb'.
(gdb): Call it.  (Bug#67928)

(cherry picked from commit 63a38fd2921269b6fbacf8a8bbd31b91df8f31a1)

16 months agoImplement an undocumented TrueType "feature"
Po Lu [Thu, 21 Dec 2023 08:31:30 +0000 (16:31 +0800)]
Implement an undocumented TrueType "feature"

* src/sfnt.c (sfnt_move): Correct commentary.
(sfnt_interpret_control_value_program): Reset dual projection,
freedom and projection vectors, in addition to the reference
points, zone pointers and loop counter.

(cherry picked from commit 04883c36a634c7405e88c1092b694228daf9a199)

16 months ago* src/sfnt.c (GETINFO): Implement undocumented selector bit 5.
Po Lu [Thu, 21 Dec 2023 06:35:18 +0000 (14:35 +0800)]
* src/sfnt.c (GETINFO): Implement undocumented selector bit 5.

(cherry picked from commit e6d8e23ede6d45727c4a0968ec356ac5f9792ba7)

16 months agoAccept empty contours in glyphs
Po Lu [Thu, 21 Dec 2023 05:34:54 +0000 (13:34 +0800)]
Accept empty contours in glyphs

* src/sfnt.c (sfnt_decompose_glyph_1, sfnt_decompose_glyph_2):
Accept empty contours, for they are not invalid, just redundant.

(cherry picked from commit 22da40a5e5057c2cdea2f54f1ac590ddc9d831cb)

16 months agoJsonrpc: deal with nested synchronous jsonrpc-request
João Távora [Wed, 20 Dec 2023 22:25:28 +0000 (16:25 -0600)]
Jsonrpc: deal with nested synchronous jsonrpc-request

See bug#67945

* lisp/jsonrpc.el (jsonrpc-connection): Add -sync-request-alist
(jsonrpc-connection-receive): Rework.
(jsonrpc-request): Rework.  Pass SYNC-REQUEST to
jsonrpc-async-request-1.
(jsonrpc--process-sentinel): Simplify.
(jsonrpc--schedule): New helper.
(jsonrpc--continue): New helper.
(jsonrpc--async-request-1): Rework.
(jsonrpc--process-sentinel): Also cancel deferred action timers.
(Version): Bump to 1.0.21

(cherry picked from commit 02b99db661861905162a6638349936e784df3189)

16 months agoJsonrpc: rework implementation of continuations
João Távora [Wed, 20 Dec 2023 16:28:52 +0000 (10:28 -0600)]
Jsonrpc: rework implementation of continuations

Preparatory work for fix of bug#67945

* lisp/jsonrpc.el (jsonrpc-connection): Change slots.
(jsonrpc--remove): New helper
(jsonrpc-forget-pending-continuations)
(jsonrpc-connection-receive)
(jsonrpc-request)
(jsonrpc--process-sentinel)
(jsonrpc--async-request-1)
(jsonrpc--async-request-1): Rework.
(jsonrpc-continuation-count): New convenience helper.

* lisp/progmodes/eglot.el (eglot--mode-line-format): Stop using
jsonrpc--request-continuations.

(cherry picked from commit 222f563f136c5cb106df1fb94c177fe24c83683f)

16 months agotrace.el: use cl-print
João Távora [Wed, 20 Dec 2023 18:11:53 +0000 (12:11 -0600)]
trace.el: use cl-print

Any non-trivial EIEO object in particular is impossible to read in the
*trace-output* buffer without this.  Functions, hash-tables, etc now
print as they do in backtrace buffers.

* lisp/emacs-lisp/trace.el (cl-print): Require it
(trace-entry-message, trace-exit-message): Use cl-prin1-to-string

(cherry picked from commit 018cf86605b0ab1976c01ed5f1b511280c31887d)

16 months ago* lisp/cedet/semantic/db.el (semanticdb-create-database): Remove obsolete arg
Stefan Monnier [Wed, 20 Dec 2023 22:50:48 +0000 (17:50 -0500)]
* lisp/cedet/semantic/db.el (semanticdb-create-database): Remove obsolete arg

(cherry picked from commit 7275cecdf95d805adc4676462f2d924883be0047)

16 months ago* lisp/org/org-src.el (org-src-font-lock-fontify-block): Fix point-min /= 1
Stefan Monnier [Wed, 20 Dec 2023 22:50:09 +0000 (17:50 -0500)]
* lisp/org/org-src.el (org-src-font-lock-fontify-block): Fix point-min /= 1

(cherry picked from commit 40dafa9af0ae3b1826409ebed80cb65f56591ffb)

16 months ago(bibtex-font-lock-keywords): Expose a lambda to the compiler
Stefan Monnier [Wed, 20 Dec 2023 22:49:21 +0000 (17:49 -0500)]
(bibtex-font-lock-keywords): Expose a lambda to the compiler

Also use #' to quote function names.

* lisp/textmodes/bibtex.el (bibtex-font-lock-keywords): Expose a
lambda to the compiler.

(cherry picked from commit c9021c62f287c3fe0f9d7ea216a6f1da10e36e72)

16 months agoSpecific rcirc log file time stamp format
Matto Fransen [Tue, 19 Dec 2023 12:14:33 +0000 (13:14 +0100)]
Specific rcirc log file time stamp format

The time stamp format in the chat buffer may now
differ from the format in the log files.
* doc/misc/rcirc.texi: Document new variable
* lisp/net/rcirc.el (rcirc-log-time-format):
Custom variable for the format.  (bug#67597)

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

16 months agoproject--read-file-cpd-relative: Don't abbreviate at all
Dmitry Gutov [Wed, 20 Dec 2023 15:34:12 +0000 (17:34 +0200)]
project--read-file-cpd-relative: Don't abbreviate at all

* lisp/progmodes/project.el (project--read-file-cpd-relative):
Don't abbreviate at all, only suffixes are shown anyway.
And expand-file-name is slightly faster.

(cherry picked from commit 0d518b78d785613967fb1b375aa7932385991891)

16 months agoFix project-find-file history (with project--read-file-cpd-relative)
Dmitry Gutov [Wed, 20 Dec 2023 15:20:26 +0000 (17:20 +0200)]
Fix project-find-file history (with project--read-file-cpd-relative)

* lisp/progmodes/project.el (project--transplant-file-name):
Don't abbreviate here (bug#67901, bug#63829).
(project--read-file-cpd-relative): Do it here instead.  The reader
functions should decide on the preferred format themselves.

(cherry picked from commit 338409c1f19e1d3a97d12edaf5ac36f1a781d08a)

16 months agoAdd "back" button on top of the pre-rename vc-print-log buffer
Dmitry Gutov [Tue, 19 Dec 2023 22:22:47 +0000 (00:22 +0200)]
Add "back" button on top of the pre-rename vc-print-log buffer

* lisp/vc/vc.el (log-view-vc-prev-revision)
(log-view-vc-prev-fileset): New dynamic variables (bug#55871).
(vc-print-log-renamed-add-button): Extract from
'vc-print-log-setup-buttons'.  Bind the above variables to convey
the current revision and fileset to 'vc-print-log-internal'.
(vc-print-log-internal): Use it also here, to print a "back"
button above the log when 'log-view-vc-prev-fileset' is set.

(cherry picked from commit f248960c71444a92cb91646e64d57b44523af884)

16 months agoCalc: speed up math-read-preprocess-string (bug#67536)
Mattias Engdegård [Tue, 19 Dec 2023 16:10:42 +0000 (17:10 +0100)]
Calc: speed up math-read-preprocess-string (bug#67536)

`math-read-preprocess-string` is one of the bottlenecks of `calc-eval`
and was unnecessarily slow even with no substitutions made.
This affected org-mode in particular, where `calc-eval` is called
repeatedly to recalculate tables.

Reported by Raffael Stocker who also wrote the unit tests here.

* lisp/calc/calc-aent.el (math--read-preprocess-re-cache): New.
(math-read-preprocess-string):
Use math--read-preprocess-re-cache, first computing it if necessary.
* test/lisp/calc/calc-tests.el (calc-math-read-preprocess-string):
New test.

(cherry picked from commit 7c1c2519167d51931a5d17f27529c8c8358c7c61)

16 months ago; * lisp/progmodes/rust-ts-mode.el: Escape asterisks in regexp.
Mattias Engdegård [Tue, 19 Dec 2023 16:07:24 +0000 (17:07 +0100)]
; * lisp/progmodes/rust-ts-mode.el: Escape asterisks in regexp.

(cherry picked from commit ade814a2268285475675872760e3c358ec24a130)

16 months ago; * src/eval.c (syms_of_eval) <debugger>: Doc fix.
Eli Zaretskii [Tue, 19 Dec 2023 12:20:24 +0000 (14:20 +0200)]
; * src/eval.c (syms_of_eval) <debugger>: Doc fix.

(cherry picked from commit 281be72422f42fcc84d43f50723a3e91b7d03cbc)

16 months agoFido-mode: don't error if case-fold-search is globally nil
João Távora [Tue, 19 Dec 2023 10:06:45 +0000 (04:06 -0600)]
Fido-mode: don't error if case-fold-search is globally nil

bug#67884

To prevent errors, the same case-fold-search setting used for
originally selecting the candidate should be used when scoring it.

* lisp/minibuffer.el (completion--flex-score): Fix

(cherry picked from commit c0c79b0b4602d7c3505c41e08596386f725c2afd)

16 months agoImprove efficiency of operations involving font interpreter scale
Po Lu [Tue, 19 Dec 2023 08:42:38 +0000 (16:42 +0800)]
Improve efficiency of operations involving font interpreter scale

* src/sfnt.c (sfnt_mul_f26dot6_fixed): Correct rounding
constant.
(sfnt_make_interpreter, SSW, WCVTF, sfnt_compute_phantom_points)
(sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_1)
(sfnt_vary_interpreter, sfnt_check_ssw): Account for the
fractional bits in a f26dot6 when computing the interpreter
scale factor.

(cherry picked from commit 0a57e1cd2c97db3a990f88043dc4a53619390228)

16 months agoProperly sign-extend freedom and projection vector values
Po Lu [Tue, 19 Dec 2023 06:39:28 +0000 (14:39 +0800)]
Properly sign-extend freedom and projection vector values

* src/sfnt.c (GPV, GFV): Cast versors to int32_t.

(cherry picked from commit d0e3dfa764cdb5c15c2a525b455df495097a86bb)

16 months agoFurther corrections to font scaling
Po Lu [Tue, 19 Dec 2023 05:41:16 +0000 (13:41 +0800)]
Further corrections to font scaling

* src/sfnt.c (sfnt_dot_fix_14): Correct typo in final division.
(sfnt_compute_phantom_points): New parameters S1 and S2, into
which unrounded phantom point coordinates are saved.
(sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_2)
(sfnt_interpret_compound_glyph_1): Adjust correspondingly.

* src/sfntfont.c (sfntfont_get_glyph_outline): Delete redundant
branch.

(cherry picked from commit f2693751dd20caa790aa8f0216d50499653f61d4)

16 months ago; Small copyedits to doc/misc/eglot.texi
João Távora [Mon, 18 Dec 2023 23:59:29 +0000 (17:59 -0600)]
; Small copyedits to doc/misc/eglot.texi

Motivated in part by bug#67870 and bug#67609.

* doc/misc/eglot.texi (Quick Start): Reword
(Eglot Features): Reword.
(Eglot Commands): Fix typo.

(cherry picked from commit 20e39a12e491ce82ee581b6d99a4e2770218e0c6)

16 months agodebug.el: Straighten the code that find the "base" of the backtrace
Stefan Monnier [Mon, 18 Dec 2023 22:42:37 +0000 (17:42 -0500)]
debug.el: Straighten the code that find the "base" of the backtrace

Let the caller tell us clearly where is the base of the backtrace,
if it's not `debug`.  This is done by passing a new `:backtrace-base`
keyword argument to `debug`.

Then use this info systematically in all the places where we access
the real C-level backtrace, to try and avoid inconsistencies and brittle
code that tries to enumerate the expected frames we're in.

* src/eval.c (get_backtrace_starting_at): Add support for offsets in the
`base` argument.
(Fbacktrace_debug): Add optional `base` argument.

* lisp/emacs-lisp/debug.el (debug, debugger-frame, debugger-frame-clear):
Use `debugger--backtrace-base` when calling `backtrace-debug`.
(debugger-setup-buffer): Use `debugger--backtrace-base`
when calling `backtrace-get-frames`.
(debugger-frame-number): Drop `skip-base` arg, assume it's never nil.
Add sanity check.
(debugger--backtrace-base): Use the `:backtrace-base` info
in `debugger-args`.
(debugger-eval-expression): Adjust call to `debugger-frame-number`.
(debug--implement-debug-on-entry): Pass appropriate `:backtrace-base`.

(cherry picked from commit 6937182a0e7735e83377c757ae13292692b0cb85)

16 months agoFurther fixes for problems uncovered by the previous fix
Po Lu [Mon, 18 Dec 2023 14:14:22 +0000 (22:14 +0800)]
Further fixes for problems uncovered by the previous fix

* src/sfnt.c (sfnt_deltap): Enable deltap instructions again,
since they now serve a purpose.
(sfnt_compute_phantom_points): Round phantom points to match the
behavior of other TrueType scalers.

(cherry picked from commit 1d5d2f16c330e98a42c94fbea3728802f7535918)

16 months ago; * src/sfnt.c: Fix typo.
Po Lu [Mon, 18 Dec 2023 12:58:53 +0000 (20:58 +0800)]
; * src/sfnt.c: Fix typo.

(cherry picked from commit 1abba7bfa4518923109ae95055ca268909f0ae98)

16 months ago* src/sfnt.c (sfnt_interpret_mdap): Correct MDAP opcode.
Po Lu [Mon, 18 Dec 2023 12:57:24 +0000 (20:57 +0800)]
* src/sfnt.c (sfnt_interpret_mdap): Correct MDAP opcode.

(cherry picked from commit a54bec26c44b44bd10936bbeb93b1018c7270a23)

16 months agoFix typo in earlier changes
Po Lu [Mon, 18 Dec 2023 05:32:56 +0000 (13:32 +0800)]
Fix typo in earlier changes

* src/sfnt.c (sfnt_poly_edges_exact): Don't overwrite the
remainder of an ascending edge with its covered height.
(main): Adjust tests.

(cherry picked from commit 14504fca8b5589c5c80a69dcab6e02681b196fa1)

16 months agoAdd erc-track integration to erc-nicks
F. Jason Park [Tue, 12 Dec 2023 04:24:17 +0000 (20:24 -0800)]
Add erc-track integration to erc-nicks

* lisp/erc/erc-button.el (erc-button--nick): Add `face-cache' slot.
(erc-button-add-nickname-buttons): Pass `erc-button--nick' object, if
created', as the boolean NICK-P parameter when calling
`erc-button-add-button'.  Keeping the latter function ignorant of
`erc-button--nick' is of course preferable, but some coordination is
now required to convey and use the "face cache".  We can introduce an
abstraction, like a local variable, if this becomes an issue.
(erc-button-add-button): Use `erc--merge-prop' instead of
`erc-button-add-face' to apply button faces.  Hold off on deprecating
the latter because it provides unique functionality for nesting faces.
Also, consult NICK-P if it's an `erc-button--nick' object for the
various overriding faces it knows about.
* lisp/erc/erc-nicks.el (erc-nicks-track-faces): New option.
(erc-nicks--get-face): Make generated face `:inherit' from
`erc-nicks-backing-face'.
(erc-nicks--highlight): Just return the generated face instead of
combining it with `erc-nicks-backing-face'.
(erc-nicks--highlight-button): Set the `face-cache' slot of the
`erc-button--nick' object when `track' is loaded and initialized.
(erc-nicks-mode, erc-nicks-enable, erc-nicks-disable): Add and remove
`track' integration.
(erc-nicks--reject-uninterned-faces): New function to remove faces
created by `nicks' from buttonized speakers and mentions.  Conform
to `erc-track--face-reject-function' interface.
(erc-nicks--ourps, erc-nicks--check-normals): New function and helper
for `erc-track--alt-normals-function' interface.
(erc-nicks--setup-track-integration): New function.
(erc-nicks--remember-face-for-track): New function to cache
nick faces owned by this module.
* lisp/erc/erc.el (erc--merge-prop): Add new optional parameter
`cache-fn', and when non-nil, call it, assigning the returned value to
that of the merged property.
* test/lisp/erc/erc-nicks-tests.el (erc-nicks-list-faces): Skip
the "Inherit: " button.  (Bug#67767)

(cherry picked from commit 8e06f224a9e275776d422ce3dbc30defdb563867)

16 months agoCache shortened channel names in erc-track
F. Jason Park [Mon, 13 Jun 2022 07:26:22 +0000 (00:26 -0700)]
Cache shortened channel names in erc-track

* lisp/erc/erc-track.el (erc-track--shortened-names): New variable to
stash both the latest inputs and most recent result of
`erc-track-shorten-function'.
(erc-track--shortened-names-current-hash,
erc-track--shortened-names-set, erc-track--shortened-names-get): New
pair of generalized-variable functions and helper variable for
accessing and mutating `erc-track--shorten-prefixes'.
(erc-modified-channels-display): Avoid redundant calls to
`erc-track-shorten-function'.  Mainly for use during batch processing.
* test/lisp/erc/erc-track-tests.el (erc-track--shortened-names): New
test.  (Bug#67767)

(cherry picked from commit 0f058244ab7c4c2e5cb3fa5e4775c0f3cbe78e19)

16 months agoPromote "normal" faces in erc-track
F. Jason Park [Sun, 10 Dec 2023 13:33:48 +0000 (05:33 -0800)]
Promote "normal" faces in erc-track

* etc/ERC-NEWS: Add entry for new behavior involving the option
`erc-track-faces-normal-list'.
* lisp/erc/erc-button.el (erc-button-nick-default-face): New face to
serve as default for `erc-button-nickname-face'.
(erc-button-nickname-face): Change default value to
`erc-button-nick-default-face'.
* lisp/erc/erc-track.el (erc-track--massage-nick-button-faces): New
function to serve as Custom :set function for priority and "normal"
face-list options.
(erc-track-faces-normal-list): Fix Custom :type by loading
`erc-button' during validation so Customize chooses the correct UI
instead of a generic form field with "(mismatch)" printed alongside
the "STATE" button.
(erc-track-faces-priority-list, erc-track-faces-normal-list): Remove
values for "buttonized" `match' module faces that, if retained, would
need updating to feature `erc-button-nick-default-face' instead of
`erc-nick-default-face'.  However, as noted in the NEWS entry, this
ordering of button face atop match face is not possible.  Use :set
function to massage saved user values.
(erc-track-ignore-normal-contenders-p): New compatibility switch to
access pre-5.6 behavior, in which faces in
`erc-track-faces-normal-list' were only considered for promotion to
the mode line if the current face occupying that pole position wasn't
present.
(erc-track-mode, erc-track-enable, erc-track-disable): Add comments
regarding perceived futility of hooking on `erc-server-001-functions'
and likely unneeded hook removal.  Run common buffer-local setup and
teardown.
(erc-track--normal-faces): New local variable, a snapshot of
`erc-track-faces-normal-list'.
(erc-track--setup): New function to stash
`erc-track-faces-normal-list' on init.
(erc-track-select-mode-line-face): Offer alternate explanation of
certain particulars in doc string.
(erc-track--alt-normals-function): New function-valued variable to
allow other modules to intervene in deciding whether to pursue and
promote a "normal" contending face.
(erc-track--select-mode-line-face): New function similar to its public
namesake except that it considers other viable candidates among the
"normal" alternatives.
(erc-track-modified-channels): Only run face selection portion when
faces are actually found.  Use `erc-track--select-mode-line-face'
instead of `erc-track-select-mode-line-face'.
* test/lisp/erc/erc-track-tests.el
(erc-track-select-mode-line-face): New test.
(erc-track-tests--select-mode-line-face): New fixture function.
(erc-track--select-mode-line-face): New test.  (Bug#67767)

(cherry picked from commit 9d889af0d68a73aa45d112cbad9577f897b6e3c3)

16 months agoForgo excess nick buttonizing on JOINs and QUITs
F. Jason Park [Wed, 13 Dec 2023 03:06:52 +0000 (19:06 -0800)]
Forgo excess nick buttonizing on JOINs and QUITs

* etc/ERC-NEWS: Mention nick-button deduping.
* lisp/erc/erc-button.el (erc-button-highlight-nick-once): New
variable to specify commands and numerics for messages that ERC should
forgo redundant buttonizing atop, assuming the presence of a
"userhost".
(erc-button--fallback-cmem-function): Change default value to
`erc-button--get-user-from-spkr-prop'.
(erc-button--get-user-from-spkr-prop): New function to derive user
object from `erc--spkr' "msg prop".  The point is to allow
`erc-speaker-from-channel-member-function' to return a display name
that differs from the speaker's actual nick as recorded by its
`erc-server-user' object.
(erc-button--get-phantom-cmem): Add `count' parameter.
(erc-button-add-nickname-buttons): Stop after first turn if the
current command appears in `erc-button-highlight-nick-once'.  Pass
iteration count to `erc-button--fallback-cmem-function'.  (Bug#67677)

(cherry picked from commit 741bce84890013e0452a4d8d70579ec731ba1cb5)

16 months agoRename erc-channel-users to erc-channel-members
F. Jason Park [Sun, 30 Apr 2023 15:09:29 +0000 (08:09 -0700)]
Rename erc-channel-users to erc-channel-members

* etc/ERC-NEWS: Mention name change.
* lisp/erc/erc-backend.el (erc-process-sentinel): Don't create an
empty `erc-channel-users' hash table in server buffers.  This is
arguably a bug fix as well as a minor breaking change.
* lisp/erc/erc-common.el (erc-get-channel-user,
erc-get-channel-member): Rename and alias former to latter.
* lisp/erc/erc.el (erc-channel-users, erc-channel-members): Rename
former to latter.  The old name invited much confusion because the
table's values are not mere `erc-channel-user' instances but cons
cells that include them and their corresponding server users.

(cherry picked from commit 08ec3e89793646787698cb5edd1681f498c266cf)

16 months agoConsolidate status-prefix slots of erc-channel-user
F. Jason Park [Sun, 30 Apr 2023 14:45:01 +0000 (07:45 -0700)]
Consolidate status-prefix slots of erc-channel-user

* etc/ERC-NEWS: Mention change even though the API remains
undisturbed.
* lisp/erc/erc-common.el (erc-channel-user): "Encode" status prefix
slots `voice', `halfop', `op', `admin', and `owner' as single `status'
slot.  Add backward-compatible constructor.  Although the old layout
was overly sparse, since the vast majority of users have no membership
status at all, the point here is not to trade time for space but
rather to improve human readability of ERC buffer substrings
containing text props that reference `erc-channel-user' objects.
* lisp/erc/erc.el (erc--define-channel-user-status-compat-getter):
Helper macro for declaring compat-oriented "getters" for status-prefix
slots of `erc-channel-user'.
(erc-channel-user-voice, erc-channel-user-halfop, erc-channel-user-op,
erc-channel-user-admin, erc-channel-user-owner): Add compat getters.
These are not new functions.  They were previously defined by the
`erc-channel-user' `cl-defstruct' in erc-common.el.
(erc--update-cusr-status-if-changed): New helper macro to make
`erc-update-current-channel-member' more readable.
(erc-update-current-channel-member): Collapse some overly verbose
"unrolled" forms using helper macro and more compact expressions.
* test/lisp/erc/erc-tests.el (erc-channel-user): New test.

(cherry picked from commit 6e4417eaa7e8554ce54960180e938e3f5ac560dc)

16 months agoDemote erc-fill-line-spacing to a normal variable
F. Jason Park [Thu, 14 Dec 2023 06:45:06 +0000 (22:45 -0800)]
Demote erc-fill-line-spacing to a normal variable

* etc/ERC-NEWS: Remove section from 5.6 announcing user option
`erc-fill-line-spacing'.
* lisp/erc/erc-fill.el (erc-fill-line-spacing): Change from an option
to a variable and note unfortunate UX hiccups.
(erc-fill-wrap-merge, erc-fill-wrap-merge-indicator, fill-wrap):
Remove mention of the option, now variable, `erc-fill-line-spacing'.
(Bug#60936)

(cherry picked from commit 9d961b31070cf34bf63c7dde9f54864b11ef80ea)

16 months agoUse templates for formatting chat messages in ERC
F. Jason Park [Mon, 27 Nov 2023 02:24:48 +0000 (18:24 -0800)]
Use templates for formatting chat messages in ERC

* doc/misc/erc.texi: Replace option `erc-format-nick-function' with
`erc-show-speaker-membership-status'.
* etc/ERC-NEWS: Mention shift to template-based speaker formatting.
Also mention in-buffer STATUSMSG support and various name changes and
new formatting-related options.
* lisp/erc/erc-backend.el (erc-format-privmessage): Remove forward
declaration.
(erc--determine-speaker-message-format-args): Add forward declaration.
(erc--statusmsg-target): New utility function for detecting whether
the current target is status-prefixed.
(erc-current-message-catalog): Move here from lisp/erc/erc.el.
(erc--message-speaker-catalog): New variable.
(erc--speaker-status-prefix-wanted-p): New variable specifically for
the function `erc-format-@nick' to signal it wants status-prefixes
prepended to the displayed nick.
(erc-server-PRIVMSG): Initialize `let'-bound value of
`erc--msg-prop-overrides' to a dummy `erc--tmp' property with a null
value that `erc-display-message' will "strip" before calling its
hooks.  Move away from the rather blunt symbol `msg' as a useful value
for `erc--msg'.  Instead, allow `erc-display-message' to assign the
most appropriate value based on context.  Also, bind the variable
`erc-current-message-catalog' to whatever the buffer's
`erc--message-speaker-catalog' happens to be.  Future internal modules
can set this to alternative catalogs as needed.  Additionally, detect
STATUSMSG prefixes on targets and inform the formatting logic of the
verdict.  Lastly, and most importantly, use the function
`erc--determine-speaker-message-format-args' instead of
`erc-format-privmessage' for message formatting.  Pass along the
returned "catalog key" and spec parameters to `erc-display-message'.
However, for NOTICEs, continue to render the string, as before, for
the two "echo notice" hooks.
* lisp/erc/erc-common.el (erc--ctcp-response): New "subsclass" of
`erc-response' for smuggling extra information to CTCP query handlers
in a mostly backwards-compatible way.  The same approach could be
taken with the "echo notice" hooks mentioned above.
* lisp/erc/erc-dcc.el (erc-dcc-chat-filter): Add `erc--spkr' and
`erc--speaker' properties even though these chat buffers are not
`erc-mode' buffers.
* lisp/erc/erc-fill.el (erc-fill--wrap-last-msg,
erc-fill--wrap-max-lull): Add doc strings.
(erc-fill--wrap-continued-message-p): Rework to look for `erc--spkr'-
`erc--msg' combinations as indicators of speaker continuity.
(erc-fill--wrap-rejigger-region): Remove reference to the no longer
relevant `erc-stamp-type'.  Instead, use the `erc--msg' property
combined with the `erc-timestamp' field to detect date stamps because
all are currently left-sided.
* lisp/erc/erc-stamp.el (erc-stamp--propertize-left-date-stamp): Don't
add superfluous `erc-stamp-type' property.
* lisp/erc/erc.el (erc--msg-props): Revise purpose and meaning of
`erc--msg' by removing possible value `msg', which was previously
meant to indicate that a message had a "speaker".  Instead, rely on
the separate `erc--spkr' property to convey this information, with
`erc--msg' now expressing a "type" or "role".
(erc--use-language-catalog-for-ctcp-action-p): New variable, a
compatibility switch to help transition from the `ACTION' entry of the
language catalog to the `ctcp-action' family of entries in the new
`-speaker' catalog.
(erc--ensure-spkr-prop): Update to include any passed-in environmental
overrides.
(erc--send-action-display): Restore pre-5.6 behavior when
compatibility flag enabled.  Otherwise, use new `-speaker' catalog for
formatting inserted message.
(erc--send-message-external): Overhaul to behave more faithfully in
mimicking a line submitted at the prompt of the current target buffer.
(erc--own-property-names): Remove `erc-stamp-type'.
(erc-ensure-target-buffer-on-privmsg): Add new choice variant for old
default behavior and change meaning of default to mean "except for
STATUSMSGs".  This option is newly revived for ERC 5.6.
(erc--message-speaker-statusmsg, erc--message-speaker-statusmsg-input,
erc--message-speaker-input, erc--message-speaker-input-chan-privmsg,
erc--message-speaker-input-chan-notice,
erc--message-speaker-input-query-privmsg,
erc--message-speaker-input-query-notice,
erc--message-speaker-chan-privmsg, erc--message-speaker-query-privmsg,
erc--message-speaker-chan-notice, erc--message-speaker-query-notice,
erc--message-speaker-ctcp-action,
erc--message-speaker-ctcp-action-input,
erc--message-speaker-ctcp-action-statusmsg,
erc--message-speaker-ctcp-action-statusmsg-input): New variables for
new `speaker' format-template catalog.
(erc--speakerize-nick): New helper function.
(erc--determine-speaker-message-format-args): New function to find the
appropriate format key from various contextual parameters.  Could
become the default of a function-valued variable for internal use.
(erc-show-speaker-membership-status): New option.
(erc-format-nick-function, erc-speaker-from-channel-member-function):
Declare former as an obsolete alias for the latter, and redefine
purpose slightly.
(erc-format-nick-function, erc-determine-speaker-from-user): Rename
former to latter and obsolete the old name.
(erc-format-nick, erc-determine-speaker-from-user): Rename former to
latter and obsolete old name.
(erc-format-@nick): Deprecate and adapt for use with new
template-based formatting paradigm.
(erc-format-my-nick): Move `erc-speaker' text prop toward head of
list, meaning it will end up beneath `font-lock-face' in the final
output.
(erc--format-speaker-input-message): New function to replace
`erc-format-my-nick' in-tree.
(erc-process-ctcp-query): Don't bind `erc--msg' to `msg'.  Instead,
rely on `erc-display-message' to set it to the current template key.
(erc-ctcp-query-ACTION): Prefer using formatting template, but attempt
to simulate pre-5.6 behavior when compatibility flag enabled.
(erc-display-msg): Use `erc--format-speaker-input-message' instead of
`erc-format-my-nick'.  Ignore `erc--msg-prop-overrides' with null
values.
(erc-current-message-catalog): Move to erc-backend.el.
* test/lisp/erc/erc-scenarios-base-statusmsg.el: New file.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--left/display-margin-mode): Expect format catalog
key instead of unhelpful `msg' as value of `erc--msg' prop.
* test/lisp/erc/erc-tests.el (erc-message): Render format template in
mock function and expect string in assertions.
(erc-tests--format-privmessage): New function, a helper for the
following test.
(erc-format-privmessage, erc--determine-speaker-message-format-args):
Rename former to latter and suppress deprecation warning.
(erc--determine-speaker-message-format-args/queries,
erc--determine-speaker-message-format-args/queries-as-channel): New
tests.
(erc-tests--format-my-nick): New helper function for the following
test.
(erc--format-speaker-input-message): New test.
* test/lisp/erc/resources/base/display-message/statusmsg.eld: New
file.  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Update.

(cherry picked from commit 49bfea4386fd8d1a0885ebfd1f81cc8fee6ef136)

16 months agoAdd erc--spkr text property to chat messages
F. Jason Park [Tue, 5 Dec 2023 06:13:02 +0000 (22:13 -0800)]
Add erc--spkr text property to chat messages

* etc/ERC-NEWS: Mention combined face ordering for "/me" messages.
* lisp/erc/erc-backend.el (erc-server-PRIVMSG): Bind
`erc--msg-prop-overrides' for the extent of this function's execution,
which means a large amount of code will see this variable as being
non-nil.  However, no calls to `erc-display-message' or
`erc-display-msg' should occur other than the one handling the final
insertion.  Code needing to influence the current message's "msg
props" can push new pairs onto this value, which will override any
existing collisions.
* lisp/erc/erc-fill.el (erc-fill): Switch to `erc--spkr' as sentinel
property.
(erc-fill--wrap-continued-message-p): Look for `erc--spkr' property
instead of `erc-speaker'.
* lisp/erc/erc.el (erc--msg-props): Mention `erc--spkr' in doc.
(erc--send-action-perform-ctcp): Add `erc--spkr' property.  Fix bug in
which `erc-my-nick-face' appeared below `erc-input-face' in the
speaker portion.
(erc--ensure-spkr-prop): New helper function to propagate speaker
metadata.
(erc--ranked-properties): Add `erc--spkr', `erc--ctcp', and
`erc--ephemeral'.
(erc-display-message): Use default hash table size when initializing.
Remove unnecessary assignment of `msg' to `erc--msg' for PRIVMSG and
NOTICE commands.  Bind `string' below `erc--msg-props' so that
implementers of the function form of the `erc-format-message'
templating interface can read and write the current context's "msg
props".
(erc--own-property-names): Add all `erc--msg-props' props by
subsumation.
(erc--get-speaker-bounds): Use `erc--spkr' instead of `erc--msg' as a
sentinel to detect a chat message guaranteed to have an `erc--speaker'
text-property interval.
(erc-format-privmessage, erc-format-my-nick, erc-ctcp-query-ACTION):
Add `erc--spkr' to `erc--msg-prop-overrides' when available.
* test/lisp/erc/erc-fill-tests.el: (erc-fill-tests--insert-privmsg):
Bind `erc--msg-prop-overrides'.
(erc-fill-tests--compare): Require environment variable value to match
current test name exactly when saving snapshots.  Add `erc--msg-props'
individually to white list.
* test/lisp/erc/erc-tests.el (erc--order-text-properties-from-hash):
Include `erc--spkr'.  (Bug#60936)  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld: Update.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld: Update.

(cherry picked from commit 236a416be76cbb0b79ad46c06652f6cbf8788fcb)

16 months agoSkip erc-ignored-user-p when erc-ignore-list is empty
F. Jason Park [Tue, 12 Sep 2023 04:21:42 +0000 (21:21 -0700)]
Skip erc-ignored-user-p when erc-ignore-list is empty

* lisp/erc/erc-backend.el (erc-server-PRIVMSG): Don't bother running
`erc-ignored-user-p' and `erc-ignored-reply-p' when their associated
options are null.  The option `erc-ignore-list' is buffer-local when
set, and `erc-ignored-user-p' looks for it in the server buffer.
Moreover, all functions that set it, like `erc-cmd-IGNORE' and
`erc-cmd-UNIGNORE', do so in the server buffer.  And the response
handler in question only runs in server buffers, so this shouldn't
break anything.  Also, remove stray call to reassign trailing response
contents.
* lisp/erc/erc-common.el (erc-get-server-user): Rearrange so
`erc-with-server-buffer' doesn't have to switch to the server buffer
because `erc-downcase' can run in channels as well.
* lisp/erc/erc.el (erc-ignored-user-p): Add comment.  (Bug#67677)

(cherry picked from commit c1befaf0a8b19fdd3b22e824f4bfc10f8882db67)

16 months agoMake erc-get-user-mode-prefix more flexible
F. Jason Park [Tue, 28 Nov 2023 06:53:00 +0000 (22:53 -0800)]
Make erc-get-user-mode-prefix more flexible

* etc/ERC-NEWS: Mention renaming of `erc-get-user-mode-prefix'.
* lisp/erc/erc-speedbar.el (erc-speedbar-insert-user): Use
`erc-get-channel-membership-prefix' so that nicks in the nickbar can
have prefixes beyond just those for "voice" and "op".
* lisp/erc/erc.el (erc-get-user-mode-prefix,
erc-get-channel-membership-prefix): Rename former to latter because
"user mode" suggests the function somehow involves user modes, but it
exclusively concerns channel modes.  Also, overload the only parameter
in order to avoid redundantly looking up `erc-channel-user' object
with every predicate call.  In the near future, ERC will likely need
to offer an alternate version of this function that returns multiple
prefixes instead of just one.
(erc-format-@nick): Actually use the `channel-data' parameter.
(erc-format-my-nick, erc--format-channel-status-prefix): Use new name
for function `erc-get-user-mode-prefix'.  (Bug#63595)  (Bug#67677)

(cherry picked from commit 7db500b50be5f59ce65785a2cc35a8587e7e6cd1)

16 months agoClarify warning for process-dependent input in ERC
F. Jason Park [Tue, 28 Nov 2023 03:41:09 +0000 (19:41 -0800)]
Clarify warning for process-dependent input in ERC

* lisp/erc/erc.el (erc--check-prompt-input-for-running-process):
Resolve dissonance between content of ancient `user-error' message and
condition that triggered it by favoring the former because it's
supported by the underlying mechanism, which revolves around the
`process-not-needed' symbol property.
* test/lisp/erc/erc-tests.el (erc--check-prompt-input-functions):
Revise expected output for error assertion.  (Bug#66073, originally
from bug#54536, and included for discussion in bug#67677)

(cherry picked from commit 11bae96d23b0e3c726be55c34a0493d49d57d2e8)

16 months agoAdd erc-server-396 response handler
F. Jason Park [Sat, 19 Aug 2023 01:04:22 +0000 (18:04 -0700)]
Add erc-server-396 response handler

* lisp/erc/erc-backend.el (erc-server-396, erc-server-396-functions):
Define response handler for 396 numeric.  For now, always display the
message in the active buffer rather than bother with something like
`erc-once-with-server-event' to try and suss out when this is a
response to something client-initiated, like a /VHOST.  Do this
despite most users probably wanting the message to appear in the
server buffer alone when the response is server-initiated.  The
`labeled-response' extension will hopefully make dealing with such
matters less of a crapshoot.
* lisp/erc/erc.el (erc--parse-user-regexp-pedantic): Tweak slightly to
allow null groups and favor host.
(erc--parse-user-regexp-legacy, erc--parse-user-regexp): Remove the
first variable but preserve its value as that of the second.
(erc--parse-nuh): New function.  The behavior is nuanced and complex
and so not easily described in a doc string.
(erc-message-english-396): Define format template for 396 response.
* test/lisp/erc/erc-scenarios-misc-commands.el
(erc-scenarios-misc-commands--VHOST): New test.
* test/lisp/erc/erc-tests.el (erc-parse-user): Move "pedantic" section
to new test.
(erc--parse-nuh): New test.
* test/lisp/erc/resources/commands/vhost.eld: New test data file.
(Bug#67677)

(cherry picked from commit 4ee4865ce208c423afc8c2718922272509a4c1ae)

16 months agoMake erc-input's refoldp slot conditionally available
F. Jason Park [Fri, 1 Dec 2023 21:54:12 +0000 (13:54 -0800)]
Make erc-input's refoldp slot conditionally available

* etc/ERC-NEWS: Fix entry regarding `erc-input-refoldp'.
* lisp/erc/erc-common.el (erc-input): Remove `refoldp' slot, which was
to be new in 5.6, in order to reduce churn in the extremely unlikely
event that third-party code uses the read-syntax of these objects or
ones subclassed from it for some other purpose, outside of
`erc-pre-send-functions'.
(erc--input-split) Add `refoldp' slot here instead.
* lisp/erc/erc.el (erc-pre-send-functions): Amend doc string to stress
that `refoldp' is not a real slot.
(erc--input-ensure-hook-context, erc-input-refoldp): New function, an
impostor accessor for the nonexistent `refoldp' slot of `erc-input',
and a helper function for asserting a valid context at runtime.
(erc--run-send-hooks): Don't copy over `refoldp' from the
`erc--input-lines' object to the working `erc-insert' object.  Check
the insertion context's `erc--input-split' object instead of the
hook's `erc-insert' object when deciding whether to resplit.
* test/lisp/erc/erc-tests.el: Adjust test environment to satisfy
assertion.  (Bug#62947)

(cherry picked from commit 951b115c2ac9b60007eef6a13a25c618a69c7e0f)

16 months agoAdd utility for iterating over arrays in ERC
F. Jason Park [Mon, 4 Dec 2023 03:19:37 +0000 (19:19 -0800)]
Add utility for iterating over arrays in ERC

* lisp/erc/erc-common.el (erc--doarray): Add macro for mapping over
arrays.  ERC has the uncommon requirement of having to repeatedly
traverse strings that contain flags for advertised server features.
It doesn't make sense to translate these meanings into enums or
dynamically generate variables for each flag.  Hash tables and lists
require additional setup and aren't as compact to inspect.
* lisp/erc/erc-dcc.el (erc-dcc-handle-ctcp-send): Use `string-search'
instead of `seq-contains-p' even though performance doesn't matter
here.
* lisp/erc/erc.el (erc--channel-mode-types): Use `erc--doarray'
instead of `dolist'.
(erc--process-channel-modes): Use `erc--doarray' instead of `dolist',
and don't create a string from current char until needed.
(erc--parse-user-modes): Use `erc--doarray' instead of `dolist'.
* test/lisp/erc/erc-tests.el (erc--doarray): New test.  (Bug#67677)

(cherry picked from commit 69ca2cc1138b0fe722d601c2113c83f2a6f791ed)

16 months agoDouble hyphenate internal ERC 5.6 text props
F. Jason Park [Sat, 2 Dec 2023 06:30:04 +0000 (22:30 -0800)]
Double hyphenate internal ERC 5.6 text props

* lisp/erc/erc-fill.el (erc-fill, erc-fill-static,
erc-fill--wrap-continued-message-p, erc-fill-wrap,
erc-fill--wrap-rejigger-region): Add second hyphen to "msg prop" text
properties.  Rename `erc-speaker' to `erc--speaker'.
* lisp/erc/erc-goodies.el (erc--command-indicator-display): Rename
`erc-msg' to `erc--msg'.
* lisp/erc/erc-stamp.el (erc-stamp--current-time, erc-add-timestamp,
erc-stamp-prefix-log-filter, erc-stamp--lr-date-on-pre-modify,
erc-munge-invisibility-spec, erc-stamp--add-csf-on-post-modify,
erc-stamp--on-clear-message, erc-echo-timestamp, erc--echo-ts-csf):
Rename "msg props" with second hyphen.
* lisp/erc/erc-track.el (erc-track--skipped-msgs,
erc-track-modified-channels): Rename "msg prop" text properties with
second hyphen.
* lisp/erc/erc.el (erc--msg-props): Update doc with double-hyphenated
"msg prop" names.
(erc--send-action-display erc--get-inserted-msg-bounds,
erc--traverse-inserted, erc-insert-line, erc-display-line,
erc--ranked-properties, erc-display-message, erc--get-speaker-bounds,
erc-process-ctcp-query, erc-display-msg): Update all "msg prop" names
to have two hyphens.
(erc--send-action-display, erc--own-property-names,
erc--get-speaker-bounds, erc-format-privmessage, erc-format-my-nick,
erc-ctcp-query-ACTION): Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-scenarios-display-message.el
(erc-scenarios-display-message--multibuf): Double hyphenate "msg prop"
text properties.
* test/lisp/erc/erc-scenarios-match.el
(erc-scenarios-match--hide-fools/stamp-both/fill-wrap,
erc-scenarios-match--hide-fools/stamp-both/fill-wrap/speak,
erc-scenarios-match--stamp-both-invisible-fill-static): Update "msg
prop" names.
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify,
erc-scenarios-stamp--left/display-margin-mode,
erc-scenarios-stamp--legacy-date-stamps,
erc-scenarios-stamp--on-insert-modify,
erc-scenarios-stamp--date-mode/left-and-right): Add second hyphen to
all "msg props". Rename `erc-speaker' to `erc--speaker'.
* test/lisp/erc/erc-stamp-tests.el (erc-echo-timestamp): Rename "msg
prop".
* test/lisp/erc/erc-tests.el (erc--get-inserted-msg-bounds,
erc--delete-inserted-message, erc--order-text-properties-from-hash,
erc--route-insertion): Rename "msg props" with second hyphen.
(erc-format-privmessage): Rename `erc-speaker' to `erc--speaker'.
(Bug#60936)  (Bug#67677)
; * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-post-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/merge-wrap-indicator-pre-01.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-01-start.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-02-right.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-03-left.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/monospace-04-reset.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/spacing-01-mono.eld:
; Add second hyphen to msg props.
; * test/lisp/erc/resources/fill/snapshots/stamps-left-01.eld:
; Add second hyphen to msg props.

(cherry picked from commit 1e2b156f040bae9a35c1cdf72f0ab0f6036a593f)

16 months agoSequester some special-variable declarations in ERC
F. Jason Park [Mon, 27 Nov 2023 02:24:48 +0000 (18:24 -0800)]
Sequester some special-variable declarations in ERC

* lisp/erc/erc-backend.el (erc-log-p): Remove declaration entirely.
(erc-server-reconnect): Move declaration for `erc-reuse-buffers' here.
(erc-process-sentinel-1): Move `erc-kill-server-buffer-on-quit'
declaration here.
(erc--conceal-prompt): Move `erc-prompt-hidden' declaration here.
(erc-server-INVITE): Move `erc-invitation' declaration here.
(erc-server-PART): Move `erc-kill-buffer-on-part' declaration here.
(erc-server-PRIVMSG): Move declarations for `erc-minibuffer-ignored',
`erc-receive-query-display', `erc-receive-query-display-defer',
`erc--cmem-from-nick-function', `erc-format-nick-function', and
`erc-format-query-as-channel-p' here.
(erc-server-401): Move `erc-whowas-on-nosuchnick' declaration here.
(erc-server-475): Move `erc--called-as-input-p' and
`erc-prompt-for-channel-key' declarations here.
* lisp/erc/erc-common.el (erc-log-p): Remove declaration for
`erc-log-p' and replace with actual definition.
(erc-log-aux): Move `erc-dbuf' declaration from top level into
function body.
* lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Note in
the doc string that this function produces side effects.
* lisp/erc/erc-networks.el (erc-determine-network,
erc-networks--copy-server-buffer-functions): Move some variable
declarations to function body.
(erc-settings, erc-get): Deprecate for now and explain why in doc
strings.  We could deprecate them unconditionally, but they never
provided usable code, and their names are short and valuable.
* lisp/erc/erc.el (tabbar--local-hlf, motif-version-string,
gtk-version-string): Prefer moving these single-serving declarations
to function bodies, if only to make closures from this library less
cluttered when debugging.  This should also help avoid stray
declarations.
(erc-hooks, erc-timer-hook): Revise doc strings.
(erc-log-p): Move definition to erc-common.el.
(erc-cmd-SV): Mimic `emacs-version' and stick with `featurep', here in
combination with special-variable declarations, instead of `boundp' or
similar.
(erc-header-line-uses-tabbar-p): Explain that this has nothing to do
with `tab-bar'.
(erc-update-mode-line-buffer): Only assign when bound.  This has been
verified to work with version 2.0 on EmacsWiki.
* test/lisp/erc/erc-scenarios-base-reconnect.el: Timeouts.
* test/lisp/erc/erc-scenarios-base-renick.el: Timeouts.
* test/lisp/erc/resources/join/network-id/foonet-again.eld: Timeouts.

(cherry picked from commit 61b22ae9f37e8af31dc322df37663476af2adb74)

16 months agoDefine ERC message-formatting templates with defvar
F. Jason Park [Wed, 29 Nov 2023 00:51:36 +0000 (16:51 -0800)]
Define ERC message-formatting templates with defvar

* etc/ERC-NEWS: Mention convenience macro being preferred means of
defining message templates.  Mention renaming of `notify' formatting
templates.
* lisp/erc/erc-common.el (erc--define-catalog,
erc-define-message-format-catalog): New macro and internal variant to
replace `erc-define-catalog-entry'.  The internal variant allows us to
defer reindenting existing definitions until meaningfully edited.
* lisp/erc/erc-dcc.el (erc-message-english-dcc-chat-discarded,
erc-message-english-dcc-chat-ended,
erc-message-english-dcc-chat-no-request,
erc-message-english-dcc-chat-offered,
erc-message-english-dcc-chat-offer,
erc-message-english-dcc-chat-accept,
erc-message-english-dcc-chat-privmsg, erc-message-english-dcc-closed,
erc-message-english-dcc-command-undefined,
erc-message-english-dcc-ctcp-errmsg,
erc-message-english-dcc-ctcp-unknown,
erc-message-english-dcc-get-bytes-received,
erc-message-english-dcc-get-complete,
erc-message-english-dcc-get-failed,
erc-message-english-dcc-get-cmd-aborted,
erc-message-english-dcc-get-file-too-long,
erc-message-english-dcc-get-notfound,
erc-message-english-dcc-list-head, erc-message-english-dcc-list-line,
erc-message-english-dcc-list-item, erc-message-english-dcc-list-end,
erc-message-english-dcc-malformed,
erc-message-english-dcc-privileged-port,
erc-message-english-dcc-request-bogus,
erc-message-english-dcc-send-finished,
erc-message-english-dcc-send-offered,
erc-message-english-dcc-send-offer): Define at top level using
`defvar'.
* lisp/erc/erc-netsplit.el (erc-netsplit-mode, erc-netsplit-enable):
Don't call `erc-netsplit-install-message-catalogs'.
(erc-netsplit-install-message-catalogs): Deprecate function.
(erc-message-english-netsplit, erc-message-english-netjoin,
erc-message-english-netjoin-done, erc-message-english-netsplit-none,
erc-message-english-netsplit-wholeft): Define at top level using
`defvar'.
* lisp/erc/erc-notify.el (erc-notify-install-message-catalogs):
Deprecate, and rename all format templates with hyphens instead of
underscores.
(erc-notify-timer, erc-notify-JOIN, erc-notify-NICK, erc-notify-QUIT):
Use hyphenated template names.
(erc-cmd-NOTIFY): Use hyphenated template names.  Load the module when
necessary and emit a warning.  Otherwise, people who discover this
autoloaded command without being aware of the module's existence may
think it's "broken".
(pcomplete/erc-mode/NOTIFY): Replace top-level autoload with `require'
in function body.  Include `erc-notify-list' in list of completions,
which makes removal easier if you don't share any channels with a
person, and they're not in `erc-server-users'.  A better long-term
solution might be to WHOIS folks we're unsure about when they're
listed in a 303.
(erc-message-english-notify_current, erc-message-english-notify_list,
erc-message-english-notify_on, erc-message-english-notify_off): Define
at top level using `defvar'.  Replace nonstandard underscores with
hyphens.  Alias obsolete names.
* lisp/erc/erc-page.el (erc-message-english-CTCP-PAGE): Define at top
level using `defvar'.
* lisp/erc/erc-sasl.el (erc-message-english-s902,
erc-message-english-s904, erc-message-english-s905,
erc-message-english-s906, erc-message-english-s907,
erc-message-english-s908): Define at top level using `defvar'.
* lisp/erc/erc-sound.el (erc-message-english-CTCP-SOUND): Define using
`defvar'.
* lisp/erc/erc.el (erc--make-message-variable-name): New function to
replace `erc-make-message-variable-name' internally, where most uses
previously checked whether the returned variable was bound.  This
helper now does that conditionally, when asked.
(erc-make-message-variable-name): Defer to internal variant,
`erc--make-message-variable-name'.
(erc-define-catalog-entry, erc-define-catalog): Deprecate.
(erc-retrieve-catalog-entry): Refactor to favor
`default-toplevel-value' of `erc-current-message-catalog' before
falling back to `english'.  Not doing this was arguably a bug.
(erc-message-english-bad-ping-response,
erc-message-english-bad-syntax, erc-message-english-incorrect-args,
erc-message-english-cannot-find-file,
erc-message-english-cannot-read-file, erc-message-english-connect,
erc-message-english-country, erc-message-english-country-unknown,
erc-message-english-ctcp-empty, erc-message-english-ctcp-request,
erc-message-english-ctcp-request-to,
erc-message-english-ctcp-too-many, erc-message-english-flood-ctcp-off,
erc-message-english-flood-strict-mode,
erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect,
erc-message-english-reconnecting,
erc-message-english-reconnect-canceled, erc-message-english-finished,
erc-message-english-terminated, erc-message-english-login,
erc-message-english-nick-in-use, erc-message-english-nick-too-long,
erc-message-english-no-default-channel,
erc-message-english-no-invitation, erc-message-english-no-target,
erc-message-english-ops, erc-message-english-ops-none,
erc-message-english-undefined-ctcp,
erc-message-english-user-mode-redundant-add,
erc-message-english-user-mode-redundant-drop,
erc-message-english-variable-not-bound, erc-message-english-ACTION,
erc-message-english-CTCP-CLIENTINFO, erc-message-english-CTCP-ECHO,
erc-message-english-CTCP-FINGER, erc-message-english-CTCP-PING,
erc-message-english-CTCP-TIME, erc-message-english-CTCP-UNKNOWN,
erc-message-english-CTCP-VERSION, erc-message-english-ERROR,
erc-message-english-INVITE, erc-message-english-JOIN,
erc-message-english-JOIN-you, erc-message-english-KICK,
erc-message-english-KICK-you, erc-message-english-KICK-by-you,
erc-message-english-MODE, erc-message-english-MODE-nick,
erc-message-english-NICK, erc-message-english-NICK-you,
erc-message-english-PART, erc-message-english-PING,
erc-message-english-PONG, erc-message-english-QUIT,
erc-message-english-TOPIC, erc-message-english-WALLOPS,
erc-message-english-s004, erc-message-english-s221,
erc-message-english-s252, erc-message-english-s253,
erc-message-english-s254, erc-message-english-s275,
erc-message-english-s301, erc-message-english-s303,
erc-message-english-s305, erc-message-english-s306,
erc-message-english-s307, erc-message-english-s311,
erc-message-english-s312, erc-message-english-s313,
erc-message-english-s314, erc-message-english-s317,
erc-message-english-s317-on-since, erc-message-english-s319,
erc-message-english-s320, erc-message-english-s321,
erc-message-english-s322, erc-message-english-s324,
erc-message-english-s328, erc-message-english-s329,
erc-message-english-s330, erc-message-english-s331,
erc-message-english-s332, erc-message-english-s333,
erc-message-english-s341, erc-message-english-s352,
erc-message-english-s353, erc-message-english-s367,
erc-message-english-s367-set-by, erc-message-english-s368,
erc-message-english-s379, erc-message-english-s391,
erc-message-english-s396, erc-message-english-s401,
erc-message-english-s402, erc-message-english-s403,
erc-message-english-s404, erc-message-english-s405,
erc-message-english-s406, erc-message-english-s412,
erc-message-english-s421, erc-message-english-s431,
erc-message-english-s432, erc-message-english-s442,
erc-message-english-s445, erc-message-english-s446,
erc-message-english-s451, erc-message-english-s461,
erc-message-english-s462, erc-message-english-s463,
erc-message-english-s464, erc-message-english-s465,
erc-message-english-s471, erc-message-english-s473,
erc-message-english-s474, erc-message-english-s475,
erc-message-english-s481, erc-message-english-s482,
erc-message-english-s483, erc-message-english-s484,
erc-message-english-s485, erc-message-english-s491,
erc-message-english-s501, erc-message-english-s502,
erc-message-english-s671): Define at top level using `defvar'.
* test/lisp/erc/erc-tests.el (erc-tests--string-to-propertized-parts,
erc-tests-pp-propertized-parts, erc--make-message-variable-name,
erc-retrieve-catalog-entry): New tests along with utility functions
and a convenience command for manipulating catalogs.  (Bug#67677)

(cherry picked from commit b5da8ba80709286284a4ba7a0c7806e3169e76a6)

16 months agoRemove module from suggested lineup in ERC's manual
F. Jason Park [Sat, 9 Dec 2023 15:15:32 +0000 (07:15 -0800)]
Remove module from suggested lineup in ERC's manual

* doc/misc/erc.texi (Sample Configuration): Remove `irccontrols' from
`erc-modules' because it's already enabled by default.  Add
`erc-scrolltobottom-all'.

(cherry picked from commit 7c2e02e6d797f2a61e8de951975cba3e27f229da)

16 months agoEnable the new font scaler
Po Lu [Mon, 18 Dec 2023 03:10:40 +0000 (11:10 +0800)]
Enable the new font scaler

* src/sfnt.c (sfnt_curve_is_flat): Tighten threshold for flat
curves.
(sfnt_insert_raster_step): Rewrite loop for clarity.
(sfnt_poly_set_steps): New function; fill small spans with a
plain unexceptional loop rather than memset.
(sfnt_poly_steps): Call that function.
(sfnt_verbose, main): Adjust tests such that the scaler can be
selected at runtime.

* src/sfnt.h: Update prototypes.

* src/sfntfont.c (sfntfont_get_glyph_raster)
(syms_of_sfntfont) <sfnt_raster_glyphs_exactly>: New variable.

(cherry picked from commit 103f36cced37eed1bb51cd704b0a64b42f7b8144)

16 months ago; Improve a recent NEWS entry
Dmitry Gutov [Mon, 18 Dec 2023 02:43:21 +0000 (04:43 +0200)]
; Improve a recent NEWS entry

(cherry picked from commit 5ab82229bdad1519e8642c9348577f5ef0f2cd85)

16 months ago; Document sending extra HTTP headers in NEWS
Stefan Kangas [Sun, 17 Dec 2023 17:59:38 +0000 (18:59 +0100)]
; Document sending extra HTTP headers in NEWS

* etc/NEWS: Note how to send email address in HTTP requests.
This change was requested in:
https://lists.gnu.org/r/emacs-devel/2023-12/msg00500.html

(cherry picked from commit 4fc2fcb37d62748ef5fbaeddde91447de69bf2a6)

16 months ago* src/sfnt.h (sfnt_coerce_fixed): New macro.
Po Lu [Sun, 17 Dec 2023 12:55:23 +0000 (20:55 +0800)]
* src/sfnt.h (sfnt_coerce_fixed): New macro.

(cherry picked from commit 678a594f4f3ddd24a46253d77237580fe4db9fc1)

16 months ago; * src/sfnt.c: Fix typos.
Po Lu [Sun, 17 Dec 2023 12:54:56 +0000 (20:54 +0800)]
; * src/sfnt.c: Fix typos.

(cherry picked from commit 8e10aad3ab4f28d3ff99e04f352d561089d6f8f9)

16 months agoIntroduce the rudiments of a new font rasterizer
Po Lu [Sun, 17 Dec 2023 12:51:54 +0000 (20:51 +0800)]
Introduce the rudiments of a new font rasterizer

* src/sfnt.c (xzalloc): New function.
(sfnt_poly_edges): Remove redundant statement.
(sfnt_add, sfnt_sub, sfnt_mul): Move macro definitions above the
new scaler.
(sfnt_build_outline_fedges, sfnt_insert_raster_step)
(sfnt_fedge_sort, sfnt_poly_edges_exact, sfnt_compute_fill)
(sfnt_poly_steps, sfnt_raster_steps, sfnt_raster_edges_exact)
(sfnt_raster_glyph_outline_exact): New functions, presently
disabled.
(sfnt_x_raster, main): Introduce new tests.

(cherry picked from commit 6f14fc5f3d4f6de489de3079f3dc3ff486b270c6)

16 months agoAdd slashes to 'thing-at-point-email-regexp'
Philip Kaludercic [Sun, 3 Dec 2023 12:49:07 +0000 (13:49 +0100)]
Add slashes to 'thing-at-point-email-regexp'

* lisp/thingatpt.el (thing-at-point-email-regexp): Allow for
a (thing-at-point 'email) query to match addresses with slashes, as
used by Sourcehut.  (Bug#67600)

(cherry picked from commit ff20898dad8825fb39883ca3f09f829528291943)

16 months ago; Move NEWS item to "Incomatible Changes" section
Stefan Kangas [Sun, 17 Dec 2023 11:14:04 +0000 (12:14 +0100)]
; Move NEWS item to "Incomatible Changes" section

(cherry picked from commit 7b46b24d3902dc43d920daf670e8c2b560a6ee45)

16 months agoSilence warning in print.c
Stefan Kangas [Sun, 17 Dec 2023 10:58:24 +0000 (11:58 +0100)]
Silence warning in print.c

* src/print.c (print_bool_vector): Silence warning.

(cherry picked from commit 8c448c6b4f75bb1cb1c560d7a674bd349147d2c8)

16 months agoNever send user email address in HTTP requests
Stefan Kangas [Sun, 17 Dec 2023 08:45:05 +0000 (09:45 +0100)]
Never send user email address in HTTP requests

It used to be possible to customize 'url-privacy-level' so that the
user's email address was sent along in HTTP requests.  Since
'url-privacy-level' is also a blocklist, rather than an allowlist,
this meant that a mere misconfiguration of Emacs risked exposing the
user's email address.  This is a serious privacy risk, and it is thus
better if we remove this dangerous feature altogether.

* lisp/url/url-http.el (url-http-create-request): Never send the
user email address.
* lisp/url/url-vars.el (url-personal-mail-address): Make obsolete.
* lisp/url/url-privacy.el (url-setup-privacy-info): Don't set
above obsolete variable.
* doc/misc/url.texi (Customization):
* lisp/url/url-vars.el (url-privacy-level): Update documentation
to reflect the above changes.

(cherry picked from commit 346e5712304e66bb1b52387115b89d1966cf184b)

16 months ago; Remove out-of-date documentation about Gnus delayed articles
Eric Abrahamsen [Fri, 15 Dec 2023 14:59:38 +0000 (06:59 -0800)]
; Remove out-of-date documentation about Gnus delayed articles

* doc/misc/gnus.texi (Delayed Articles): As of commit 7725fbc5b this
paragraph is no longer true; the "Date" header is not included in
`message-draft-headers' by default.

(cherry picked from commit 68565c0e90f0da375123e1283caf13c2309f8c46)

16 months ago; Fix typo
Stefan Kangas [Sat, 16 Dec 2023 23:14:43 +0000 (00:14 +0100)]
; Fix typo

* java/org/gnu/emacs/EmacsSafThread.java
(cacheDirectoryFromCursor): Fix typo.

(cherry picked from commit 2b08cc2d5f17327f54d3b2c7b790ef34dd015925)

16 months agoUsing remap for binding of log-edit-beginning-of-line.
Jared Finder [Sat, 16 Dec 2023 17:06:22 +0000 (09:06 -0800)]
Using remap for binding of log-edit-beginning-of-line.

* lisp/vc/log-edit.el (log-edit-mode-map): Change binding.

(cherry picked from commit 059ae68087bf4498a0529d07319f5c5c2671cad7)

16 months agojs-ts-mode: Fix font-lock rules conflict
Dmitry Gutov [Tue, 12 Dec 2023 22:00:38 +0000 (00:00 +0200)]
js-ts-mode: Fix font-lock rules conflict

* lisp/progmodes/js.el (js--treesit-font-lock-settings): Move
'property' to after 'jsx'.  Stop using predicate (bug#67684).
(js--treesit-property-not-function-p): Delete.

(cherry picked from commit 400ef15bdc373b05e877cf0914f0fd5eda56cf1d)

16 months agoAdd indentation rules for bracketless statements in js-ts-mode
Noah Peart [Sun, 10 Dec 2023 22:58:31 +0000 (14:58 -0800)]
Add indentation rules for bracketless statements in js-ts-mode

* lisp/progmodes/js.el (js--treesit-indent-rules): Add indentation
rules to handle bracketless statements (bug#67758).
* test/lisp/progmodes/js-tests.el (js-ts-mode-test-indentation):
New test for js-ts-mode indentation.
* test/lisp/progmodes/js-resources/js-ts-indents.erts: New file
with indentation tests for js-ts-mode.

(cherry picked from commit c165247c3009adec912abdf74d6d7d73c8c76c33)

16 months agoFix c-ts-mode bracketless indentation for BSD style (bug#66152)
Yuan Fu [Mon, 11 Dec 2023 02:24:27 +0000 (18:24 -0800)]
Fix c-ts-mode bracketless indentation for BSD style (bug#66152)

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--indent-styles): Make sure the BSD rules only apply to
opening bracket (compound_statement), then bracketless statements will
fallback to common rules.
* test/lisp/progmodes/c-ts-mode-resources/indent-bsd.erts: Copy the
bracketless test from indent.erts to here.

(cherry picked from commit 7f1bd69cd19504f2bd47e13c530a55ffca08e27d)

16 months agoAdd missing indent rules in c-ts-mode (bug#66152)
Augustin Chéneau [Wed, 20 Sep 2023 10:23:06 +0000 (12:23 +0200)]
Add missing indent rules in c-ts-mode (bug#66152)

Example:

    static myttype *
    variable_name;

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add rules.

(cherry picked from commit e23068cb9a1692fc3c50b0b386237a56cae201f4)

16 months agoFix treesit-default-defun-skipper (bug#66711)
Yuan Fu [Mon, 11 Dec 2023 01:40:39 +0000 (17:40 -0800)]
Fix treesit-default-defun-skipper (bug#66711)

* lisp/treesit.el:
(treesit-default-defun-skipper): Add bol to the rx pattern.

(cherry picked from commit d2c4b926ac20de6f7d9f3576b22272bc560bd0f7)

16 months agoFix treesit-node-field-name and friends (bug#66674)
Yuan Fu [Mon, 11 Dec 2023 00:23:44 +0000 (16:23 -0800)]
Fix treesit-node-field-name and friends (bug#66674)

So turns out ts_node_field_name_for_child takes a named node index,
but we were passing it normal index that counts both named and
anonymous nodes.  That's what makes the field name all wrong in
treesit explorer.

* doc/lispref/parsing.texi:
(Accessing Node Information): Update docstring.
* lisp/treesit.el (treesit-node-index): Add some unrelated comment.
(treesit-node-field-name): Get named node index rather than all node
index.
* src/treesit.c (Ftreesit_node_field_name_for_child): Update
docstring, use ts_node_named_child_count.

(cherry picked from commit 9874561f39e62c1c9fada6c2e013f93d9ea65729)

16 months agopython-ts-mode: Highlight default parameters
Maciej Kalandyk [Sun, 10 Dec 2023 23:15:34 +0000 (01:15 +0200)]
python-ts-mode: Highlight default parameters

* lisp/progmodes/python.el (python--treesit-settings):
Highlight default parameters (bug#67703).

(cherry picked from commit eace9e1122601bdc2f7f03228816198ce726f8fc)

16 months agoUpdate to Org 9.6.13
Kyle Meyer [Sun, 10 Dec 2023 16:16:58 +0000 (11:16 -0500)]
Update to Org 9.6.13

(cherry picked from commit 23c06c7c3080d83ae0eee70c70fb50587339a63e)

16 months ago(dired): Remove `ls-lisp` advice
Stefan Monnier [Sun, 10 Dec 2023 04:57:35 +0000 (23:57 -0500)]
(dired): Remove `ls-lisp` advice

`ls-lisp` used to advise `dired` because `dired-insert-directory`
blindly used `insert-directory-program` (together with a shell)
in order to implement the "directory wildcard" expansion.

* lisp/dired.el (dired-insert-directory): Make the "directory wildcard"
code obey `files--use-insert-directory-program-p`, using
`file-expand-wildcards`.

* lisp/ls-lisp.el (ls-lisp--dired, ls-lisp-unload-function): Delete funs.
(dired): Don't advise any more.

(cherry picked from commit fe67c36cd9bb2967e0c2eca3d4a31c0950130eb7)

16 months ago(insert-directory): Remove `ls-lisp` advice
Stefan Monnier [Sun, 10 Dec 2023 04:45:56 +0000 (23:45 -0500)]
(insert-directory): Remove `ls-lisp` advice

Rather than have `ls-lisp` advise `insert-directory`, make
`insert-directory` call `ls-lisp.el` code directly when needed.

* lisp/files.el (files--use-insert-directory-program-p): New function.
(insert-directory): Use it to delegate to `ls-lisp--insert-directory`
when applicable.

* lisp/ls-lisp.el (ls-lisp--insert-directory): Remove `orig-fun` arg.
Don't test `ls-lisp-use-insert-directory-program` or check for a magic
file name handler; it is now the caller's responsibility.
(insert-directory): Don't add advice any more.

* lisp/dired.el (ls-lisp-use-insert-directory-program): Don't declare it.
(dired-insert-directory): Use `files--use-insert-directory-program-p` instead.
(dired-use-ls-dired): Adjust docstring to refer to
`insert-directory-program` rather than "ls".

(cherry picked from commit 29957969e5199bdab5612af68e33b3989e4bbbd2)

16 months ago(dired-insert-directory): Obey `file-list` and `wildcard`
Stefan Monnier [Sun, 10 Dec 2023 03:55:32 +0000 (22:55 -0500)]
(dired-insert-directory): Obey `file-list` and `wildcard`

Commit 6f6639d6ed6c's support for wildcards in directories failed
to obey `file-list` and `wildcard` arguments.  Fix it.

* lisp/dired.el (dired-insert-directory): Expand directory wildcards
only if `file-list` is nil and `wildcard` is non-nil.
Also, refer back to `dir-wildcard` instead of recomputing it.
(dired-readin-insert): Pass a non-nil `wildcard` when wildcard
expansion might be needed to preserve former behavior.

(cherry picked from commit f7cf85c3879c6857e8478bef41cce25a94759fb8)

16 months ago(file-expand-wildcards): Handle patterns ending in "/"
Stefan Monnier [Sun, 10 Dec 2023 00:46:07 +0000 (19:46 -0500)]
(file-expand-wildcards): Handle patterns ending in "/"

The bug was encountered via the ls-lisp advice on Dired but
it actually affects all uses of `file-expand-wildcards`,
so better fix it there.

* lisp/files.el (file-expand-wildcards): Fix bug#60819.
* lisp/ls-lisp.el (ls-lisp--dired): Undo commit b365a7cc32e2.
* test/lisp/files-tests.el (files-tests--expand-wildcards): New test.

(cherry picked from commit 6cc1418fc3e8107cab2c9824c367ba7762235aef)

16 months ago* lisp/files.el (file-expand-wildcards): Fix sorting of subdirs
Stefan Monnier [Sat, 9 Dec 2023 23:42:36 +0000 (18:42 -0500)]
* lisp/files.el (file-expand-wildcards): Fix sorting of subdirs

E.g. (file-expand-wildcards "/u*/*m*")
returned ("/usr/games" "/u/dummy" "/u/monnier" "/u/omnibook-disk")
instead of ("/u/dummy" "/u/monnier" "/u/omnibook-disk" "/usr/games").

(cherry picked from commit 1da0fccc646d1921782dd6d701bc86004cfb3732)

16 months agoSupport narrowing (restricting) minibuffer completions
Eshel Yaron [Thu, 21 Dec 2023 19:43:59 +0000 (20:43 +0100)]
Support narrowing (restricting) minibuffer completions

Add new minibuffer commands for restricting the list of possible
completion candidates.

* lisp/minibuffer.el (completion-fail-discreetly): Fix docstring typo.
(minibuffer-narrow-completions-function): New variable.
(completion--fail, minibuffer-narrow-completions-p)
(minibuffer-narrow-completions-by-regexp)
(minibuffer--completion-predicate-description)
(minibuffer--add-completions-predicate): New functions.
(minibuffer-narrow-completions-to-current)
(minibuffer-narrow-completions)
(minibuffer-widen-completions): New commands.
(minibuffer-narrow-completions-map): New prefix keymap.  Bind new
commands to 'n', 'm' and 'w', respectively.
(minibuffer-local-completion-map): Bind new prefix keymap to 'C-x n'.
(completions-header-format, completion--do-completion)
(display-completion-list, minibuffer-completion-help): Update.

* lisp/simple.el (completions-narrow-mode): New minor mode.
(completion-setup-function): Enable it in *Completions* buffer when
there are completions restrictions in place.

* lisp/menu-bar.el (minibuffer-local-completion-map): Add completions
narrowing commands to "Minibuf" menu.

* lisp/help-fns.el (help--symbol-completion-table): Provide bespoke
'narrow-completions-function' that keeps only symbols with a given
symbol property.

* doc/emacs/emacs.texi (Top)
* doc/emacs/mini.texi (Completion): Update menu.
(Narrow Completions): New subsection.
(Completion Commands, Completion Styles)
(Completion Options)
* doc/emacs/help.texi (Name Help)
* doc/lispref/minibuf.texi (Completion Commands):
(Programmed Completion): Update documenation.

* etc/NEWS: Announce new feature.

16 months ago(display-buffer): New `pop-up-frames` action alist entry
Stefan Monnier [Sat, 9 Dec 2023 23:38:35 +0000 (18:38 -0500)]
(display-buffer): New `pop-up-frames` action alist entry

Allow overriding the `pop-up-frames` variable from `display-buffer-alist`
so as to provide a worthy replacement for the old `same-frame`
parameter of `special-display-*` (bug#67249).

* lisp/window.el (special-display-popup-frame): Declare obsolete;
that was apparently forgotten back when `special-display-*` variables
were declared obsolete.
Use the new `pop-up-frames` action alist entry instead of the variable.
(display-buffer): Document new alist entry.
(window--pop-up-frames): New function.
(display-buffer--maybe-pop-up-frame, display-buffer-in-previous-window)
(display-buffer-reuse-window, display-buffer-reuse-mode-window): Use it.

* doc/lispref/windows.texi (Choosing Window Options): Mention that
`pop-up-frames` is also an action alist entry.
(Buffer Display Action Alists): Add `pop-up-frames` entry.

(cherry picked from commit 3eb421bda38981dbb08c3342833b1c7156156469)

16 months ago* lisp/subr.el (derived-mode-p): Disable warnings for old convention
Stefan Monnier [Sat, 16 Dec 2023 18:03:46 +0000 (13:03 -0500)]
* lisp/subr.el (derived-mode-p): Disable warnings for old convention

(cherry picked from commit d1341ef3f0d7f2e64d26791ea41c752feef3fd3c)

16 months ago; * lisp/startup.el (normal-top-level): Avoid byte-compiler warning.
Eli Zaretskii [Sat, 16 Dec 2023 14:26:26 +0000 (16:26 +0200)]
; * lisp/startup.el (normal-top-level): Avoid byte-compiler warning.

(cherry picked from commit 2a591b228aaa8c66c27cc5b7cb3033aa6625bc0b)

16 months ago; * lisp/term.el (term--xterm-paste): Fix last change.
Eli Zaretskii [Sat, 16 Dec 2023 14:08:52 +0000 (16:08 +0200)]
; * lisp/term.el (term--xterm-paste): Fix last change.

(cherry picked from commit bf4ccb0be076d8b65498c56dedf0eee17cb3c24c)

16 months ago; * doc/lispref/functions.texi (Function Documentation): Fix @itemize.
Eli Zaretskii [Sat, 16 Dec 2023 14:06:29 +0000 (16:06 +0200)]
; * doc/lispref/functions.texi (Function Documentation): Fix @itemize.

(cherry picked from commit 0d9e2e448d9ef3efae3111503a0947fa0159e03c)

16 months agoFix shaping of Sinhala text
Eli Zaretskii [Sat, 16 Dec 2023 13:33:02 +0000 (15:33 +0200)]
Fix shaping of Sinhala text

* lisp/language/sinhala.el (composition-function-table): Allow
U+200D U+0DCA as well as U+0DCA U+200D between consonants.
Suggested by Richard Wordingham <richard.wordingham@ntlworld.com>.
(Bug#67828)

(cherry picked from commit 791cc5065da2bfac47f8c7485bc870880548eb9d)

16 months ago; Move preload of rmc to a more appropriate place
Jens Schmidt [Thu, 14 Dec 2023 19:47:22 +0000 (20:47 +0100)]
; Move preload of rmc to a more appropriate place

See discussion on
https://lists.gnu.org/archive/html/emacs-devel/2023-12/msg00309.html.

* lisp/loadup.el ("emacs-lisp/rmc"): Move preload to a more
appropriate place.

(cherry picked from commit 47b10d062df643da6ecc6fc3b6b1cbb668eebb39)

16 months agoAdd use cases of (fn) documentation facility.
Jeremy Bryant [Sun, 3 Dec 2023 21:32:01 +0000 (21:32 +0000)]
Add use cases of (fn) documentation facility.

* doc/lispref/functions.texi (Function Documentation):  Add examples.
(Bug#67499)

Co-authored-by: Eli Zaretskii <eliz@gnu.org>
(cherry picked from commit efcbf0b5abfed8bbf767209a913b5e25270596a4)

16 months ago; * lisp/net/shr.el (shr-put-image): No more need to test for nil ALT.
Eli Zaretskii [Sat, 16 Dec 2023 12:52:36 +0000 (14:52 +0200)]
; * lisp/net/shr.el (shr-put-image): No more need to test for nil ALT.

(cherry picked from commit 75add076ba507f49092f260572f6762403db5389)

16 months agoFix 'shr-put-image' with nil value for ALT
Visuwesh [Mon, 11 Dec 2023 11:39:03 +0000 (17:09 +0530)]
Fix 'shr-put-image' with nil value for ALT

* lisp/net/shr.el (shr-put-image): Account for nil value for ALT.
(Bug#67764)

(cherry picked from commit 745ec75677b3768f9adc436303f3886b88f6f569)

16 months agoFix pasting into terminal-mode on term.el
Eli Zaretskii [Sat, 16 Dec 2023 12:44:32 +0000 (14:44 +0200)]
Fix pasting into terminal-mode on term.el

* lisp/term.el (term--xterm-paste): Read pasted text from the
input event.  Suggested by Jared Finder <jared@finder.org>.
(Bug#49253)

(cherry picked from commit c3331cb3659ffca0b04e0b789e9826b53777a70a)

16 months ago; * doc/emacs/android.texi (Android Environment): Fix node name.
Eli Zaretskii [Sat, 16 Dec 2023 12:38:21 +0000 (14:38 +0200)]
; * doc/emacs/android.texi (Android Environment): Fix node name.

(cherry picked from commit 6f181a0ef7a0152fb6d52133b492d3cb74e4cd8d)

16 months agoOffer to show diff against auto-save in recover-file
Visuwesh [Wed, 6 Dec 2023 08:15:03 +0000 (13:45 +0530)]
Offer to show diff against auto-save in recover-file

* lisp/files.el (recover-file): Show diff against the selected auto
save file.  (Bug#52242)

* doc/emacs/files.texi (Recover): Document the new feature.

* etc/NEWS: Announce the new feature.

(cherry picked from commit c4541a35770fe7925f733fcdaa9e4e3348a3c85c)

16 months agoFix opening directory trees from Filesets menu
Eli Zaretskii [Sat, 16 Dec 2023 11:25:58 +0000 (13:25 +0200)]
Fix opening directory trees from Filesets menu

In bug#976, the code was fixed, but the cautious condition in
the original author's code, which catered to invoking
'filelists-open' from the menu-bar menu, was omitted, which made
that invocation, which did work before, broken.
* lisp/filesets.el (filesets-get-filelist): Fix opening directory
trees from the Filesets menu-bar menu.  (Bug#67658)

(cherry picked from commit 5be94e2bce53f9826b64d3566a0d5524aeccbccd)

16 months agoEglot: Add ruff-lsp as an alternative Python server
Niall Dooley [Fri, 24 Nov 2023 15:52:36 +0000 (16:52 +0100)]
Eglot: Add ruff-lsp as an alternative Python server

ruff-lsp [1] is an LSP server for Ruff [2], [3], a fast Python linter
and code formatter.

It supports surfacing Ruff diagnostics and providing Code Actions to
fix them, but is intended to be used alongside another Python LSP in
order to support features like navigation and autocompletion.

[1]: https://github.com/astral-sh/ruff-lsp
[2]: https://github.com/astral-sh/ruff
[3]: https://docs.astral.sh/ruff/

* lisp/progmodes/eglot.el (eglot-server-programs): Add ruff-lsp.

Copyright-paperwork-exempt: yes
(cherry picked from commit 6b6e770a1f55da0580706c7ec21a409437d19ab4)