kobarity [Sun, 16 Feb 2025 10:07:04 +0000 (19:07 +0900)]
Improve completion in IPython/Python 3.13
IPython/Python 3.13 indirectly imports rlcompleter, and the
completer is set up to reference rlcompleter.__main__.
However, this rlcompleter.__main__ is different from the
__main__ in the REPL execution. Therefore, this completer
cannot correctly complete the REPL globals. To address this
issue, we override rlcompleter.__main__ with __main__ only in
the case of IPython.
Po Lu [Tue, 18 Feb 2025 12:58:32 +0000 (20:58 +0800)]
Don't access overriding-text-conversion-style when unbound
* lisp/replace.el (perform-replace): Don't access
overriding-text-conversion-style when unbound, and also avoid
needlessly polluting this symbol with a binding. (bug#76371)
john muhl [Tue, 5 Nov 2024 16:24:28 +0000 (10:24 -0600)]
Add MPD stats viewer to 'mpc' (Bug#76350)
* lisp/mpc.el (mpc-server-stats): New command.
(mpc-mode-menu): Add menu item.
(mpc--server-stats-date, mpc--server-stats-duration):
New variable.
(mpc--server-stats-date, mpc--server-stats-duration):
(mpc--server-stats-format): New function.
(mpc-song-viewer-value, mpc-song-viewer-tag):
(mpc-song-viewer-empty): Remove face.
(mpc-table-value, mpc-table-key, mpc-table-empty): New face.
(mpc-describe-song): Use new table face names.
* doc/lispref/modes.texi (Search-based Fontification): Fix
indentation of (MATCHER . FACESPEC) example.
* doc/misc/cc-mode.texi (Performance Issues): Index
defun-prompt-regexp under variables, not functions.
* lisp/progmodes/autoconf.el (autoconf--symbol, autoconf--macro):
New rx definitions.
(autoconf-definition-regexp): Use an optional second capture group
to indicate a function rather than variable definition. Detect
AC_DEFINE defining a function-like CPP macro. Skip more shell
syntax such as variable ${} expansion and command `` substitution in
AC_DEFINE_UNQUOTED variable. Match AH_VERBATIM, AM_CONDITIONAL, and
AM_MISSING_PROG as defining variables, and AC_DEFUN, AC_DEFUN_ONCE,
AU_ALIAS, and AU_DEFUN as defining functions. Document first
capture group in docstring.
(autoconf-font-lock-keywords): Use autoconf--macro to match more
Autoconf macros, such as those defined in the Autoconf Archive and
Gnulib. Reserve font-lock-function-name-face for function
definitions as determined by autoconf-definition-regexp, and use
font-lock-variable-name-face for the rest instead. Use Font Lock
face symbols directly in place of their corresponding variable.
Fontify M4 changequote primitive only as a standalone symbol.
(autoconf-imenu-generic-expression): Add commentary mentioning new
submenu possibility.
(autoconf-current-defun-function): Update docstring accuracy.
Replace line-end-position with pos-eol since there are no fields.
(autoconf-mode): Define defun-prompt-regexp in terms of
autoconf--macro to support more toplevel macros, such as those
defined in Autoheader, M4sh, etc. Set
open-paren-in-column-0-is-defun-start to nil to avoid false
positives when an Autoconf quote character is in column zero.
* test/lisp/progmodes/autoconf-resources/configure.ac: New file.
* test/lisp/progmodes/autoconf-tests.el
(autoconf-tests-current-defun-function-define)
(autoconf-tests-current-defun-function-subst): Replace character
motion with search.
(autoconf-tests-autoconf-mode-comment-syntax): Ditto. Test both dnl
and # comments. Use syntax-ppss-context.
(autoconf-tests-font-lock): New test.
Stefan Kangas [Mon, 17 Feb 2025 20:58:53 +0000 (21:58 +0100)]
New functions plusp and minusp
* lisp/emacs-lisp/cl-lib.el (cl-plusp, cl-minusp): Move from here...
* lisp/subr.el (plusp, minusp): ...to here. Make old names into
aliases, documented as deprecated. Add type declarations. Change from
defsubst to regular functions with compiler macros.
* lisp/obsolete/cl.el: Don't alias plusp and minusp.
* doc/lispref/numbers.texi (Predicates on Numbers): Document plusp
and minusp.
* doc/misc/cl.texi (Predicates on Numbers): Delete cl-plusp and
cl-minusp.
* lisp/emacs-lisp/shortdoc.el (number): Document plusp and minusp
instead of cl-plusp and cl-minusp.
Yuan Fu [Mon, 17 Feb 2025 21:27:52 +0000 (13:27 -0800)]
Rename treesit-simple-indent-modify-rules and fix docstring
* lisp/treesit.el (treesit-simple-indent-modify-rules): Rename
and fix docstring. It should be matcher, not anchor. Also
reword a little bit.
* etc/NEWS: Update.
* lisp/textmodes/mhtml-ts-mode.el:
(mhtml-ts-mode--treesit-indent-rules): Update accordingly.
Kévin Le Gouguec [Thu, 13 Feb 2025 22:52:06 +0000 (23:52 +0100)]
Test vc-git-dir-extra-headers directly (bug#76187)
* test/lisp/vc/vc-git-tests.el (vc-git-test--run): Make sure to
log output from failing Git commands.
(vc-git-test--dir-headers): Stop bothering with vc-dir
internals and just invoke the branch-munging and
header-formatting code we mean to test.
(vc-git-test-dir-branch-headers): Stop invoking vc-dir; just set
default-directory to be able to pass it to the backend function.
Pip Cet [Mon, 17 Feb 2025 15:21:16 +0000 (15:21 +0000)]
Fix compilation errors due to insufficient compiler safety (bug#63288)
The default safety level is 1. Restoring the default safety level to
1 after it was temporarily 0 should reset byte-compile-delete-errors
to nil, its default level. Failing to do that resulted in
miscompilation of code in highly-parallel builds.
* lisp/emacs-lisp/cl-macs.el (cl--do-proclaim): Change
'byte-compile-delete-errors' to become t only at 'safety' level 0, not
levels 1 or 2.
Po Lu [Mon, 17 Feb 2025 08:46:48 +0000 (16:46 +0800)]
Adapt query-replace and lazy highlighting to text conversion
* lisp/isearch.el (isearch-lazy-highlight-new-loop): Rather call
redisplay to guarantee a valid window-start than sit-for, to
account for cases where this function is called from an
after-change-function bound to a special input event quickly
followed by another event that does not modify the buffer.
* lisp/progmodes/prog-mode.el (treesit-node-at): Declare
function before references.
* lisp/replace.el (perform-replace): When querying, suppress
text conversion around the input loop.
Martin Rudalics [Mon, 17 Feb 2025 08:29:37 +0000 (09:29 +0100)]
When ignoring parameters let 'split-window' split root window (Bug#76317)
This fixes a behavior introduced by the fix of Bug#73527 that splits the
main window when the caller asks for splitting the root window.
* lisp/window.el (window--make-major-side-window): Bind
'ignore-window-parameters' to t so 'split-window' won't mess
with the WINDOW argument when it specifies the root window.
(split-window): If 'ignore-window-parameters' is non-nil, don't
try to split the main window instead of the root window.
Sean Whitton [Mon, 17 Feb 2025 07:40:38 +0000 (15:40 +0800)]
vc-revert-file: Support reverting directories
* lisp/vc/vc.el (vc-revert-file): Support reverting directories
by calling vc-responsible-backend instead of vc-backend when
FILE is a directory (bug#37310, bug#43464). Based on an
approach by Dmitry Gutov <dmitry@gutov.dev>.
(vc-rename-file): Add a FIXME to support reverting directories.
* etc/NEWS: Document the new functionality.
Vincenzo Pupillo [Fri, 14 Feb 2025 17:38:51 +0000 (18:38 +0100)]
Add mhtml-ts-mode.
New major-mode alternative to mhtml-mode, based on treesitter, for
editing files containing html, javascript and css.
* etc/NEWS: Mention the new mode and new functions.
* lisp/textmodes/mhtml-ts-mode.el: New file.
* lisp/progmodes/js.el
(js--treesit-thing-settings): New variable.
(js--treesit-font-lock-feature-list); New variable.
(js--treesit-simple-imenu-settings): New variable.
(js--treesit-defun-type-regexp): New variable.
(js--treesit-jsdoc-comment-regexp): New variable.
(js-ts-mode): Use of new variables instead of direct assignment of
values.
* lisp/textmodes/css-mode.el
(css-mode--menu): New variable.
(css-mode-map): Use new variable.
(css--treesit-font-lock-feature-list): New variable.
(css--treesit-simple-imenu-settings): New variable.
(css--treesit-defun-type-regexp): New variable.
(cs-ts-mode): Use of new variables instead of direct assignment of
values.
* lisp/textmodes/html-ts-mode.el
(html-ts-mode--treesit-things-settings): New variable.
(html-ts-mode--treesit-font-lock-feature-list): New variable.
(html-ts-mode--treesit-simple-imenu-settings): New variable.
(html-ts-mode--treesit-defun-type-regexp): New variable.
(html-ts-mode): Use of new variables instead of direct assignment of
values.
* lisp/treesit.el
(treesit-merge-font-lock-feature-list): New fuction.
(treesit-replace-font-lock-feature-settings): New fuction.
(treesit-modify-indent-rules): New function.
Stefan Kangas [Sun, 16 Feb 2025 23:52:45 +0000 (00:52 +0100)]
New functions oddp and evenp
* lisp/emacs-lisp/cl-lib.el (cl-oddp, cl-evenp): Move from here...
* lisp/subr.el (oddp, evenp): ...to here. Make old names into
aliases, documented as deprecated. Add type declarations.
* lisp/obsolete/cl.el: Don't alias oddp and evenp.
* test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-test-oddp)
(cl-lib-test-evenp): Move tests from here...
* test/lisp/subr-tests.el (subr-test-oddp, subr-test-evenp): ...to here.
* lisp/emacs-lisp/shortdoc.el (number): Add oddp and evenp.
(map): Prefer oddp and evenp to cl-oddp and cl-evenp.
* doc/lispref/numbers.texi (Predicates on Numbers): Document above new
functions oddp and evenp.
* doc/misc/cl.texi (Predicates on Numbers): Delete cl-oddp and cl-evenp.
(Other Clauses): Prefer oddp to cl-oddp.
Stefan Kangas [Mon, 17 Feb 2025 00:53:55 +0000 (01:53 +0100)]
Remove some details on which files are loaded from cl.texi
* doc/misc/cl.texi (Naming Conventions): Remove section listing
functions that do not cause other files than cl-lib.el to be loaded.
It lacks practical relevance to the user, and is a hostage to changing
implementation details.
David Ponce [Sat, 8 Feb 2025 12:55:16 +0000 (13:55 +0100)]
Fix DOM printing
Fix DOM printing when an attribute value is not a string, which is
often the case in SVG DOM. Don't print attributes without a
value. Refresh the list of HTML boolean attributes.
* lisp/dom.el (dom--html-boolean-attribute-p): New function.
(dom-print): Use it. Convert attribute value to string before to
call `url-insert-entities-in-string'. Don't print attribute
without a value. Compute indentation column outside of loop and
call `indent-line-to' to indent line. (Bug#5928)
* test/lisp/dom-tests.el (dom-tests-print-svg)
(dom-tests-print-html-boolean): New tests.
kobarity [Mon, 13 Jan 2025 13:38:42 +0000 (22:38 +0900)]
Fix string end search in python-nav-end-of-statement
* lisp/progmodes/python.el (python-nav-end-of-statement):
Change to look for string delimiter characters and check
syntax, instead of looking for string-delimiter syntax.
* test/lisp/progmodes/python-tests.el
(python-nav-end-of-statement-5): New test. (Bug#75387)
Eli Zaretskii [Sat, 15 Feb 2025 11:15:36 +0000 (13:15 +0200)]
Prevent buffer overflow in line-numbering code
* src/xdisp.c (maybe_produce_line_number): Limit the value of
'display-line-numbers-width' to what can be shown in the window,
and set dimension of the lnum_buf[] accordingly. (Bug#75969)
* lisp/vc/smerge-mode.el (smerge-refine-regions): Cover each region
with an overlay.
(smerge-refine-exchange-point): Use it to detect more reliably that
we're not inside a refined region.
Stefan Monnier [Sat, 15 Feb 2025 04:28:52 +0000 (23:28 -0500)]
(smerge-refine-exchange-point): New command
* lisp/vc/smerge-mode.el (smerge--refine-highlight-change):
Allow empty region and always create an overlay. Also, remember any
adjustment we applied the overlay's boundaries.
(smerge-refine-regions): Always create two overlays per hunk and "connect"
them via `smerge--refine-other`.
(smerge-refine-exchange-point): New command.
Stefan Kangas [Fri, 14 Feb 2025 21:46:07 +0000 (22:46 +0100)]
Inline important-return-value declarations in cl-lib.el
These declarations are now properly added to 'cl-lib.el' itself, or to
'cl-loaddefs.el'. This means that they will now correctly show up
immediately when loading 'cl-lib.el', instead of only after 'cl-macs.el'
is pulled in by an autoload. C.f. Bug#76247.
I did not considered worth reproducing everywhere the list saying which
functions among the below belong to these two categories:
1. Functions that are side-effect-free except for the behavior of
functions passed as argument.
2. Functions that mutate and return a list.
AFAIU, this is not actionable with our current byte-compiler, i.e. we
can't add any extra declarations based on it. However, if the list
should be needed at some point, for example due to improvements in the
compiler, this commit will be where to find it. In the worst case, and
with more work, it's also deducible from the source code itself.
The docstrings of cl-nintersection and cl-nset-difference have been
inconsistent with their manual entries since the beginning of
emacs.git history (bug#76017). This patch settles on the weaker and
thus backward-compatible requirement that only their first argument
be safe to mutate.
* lisp/emacs-lisp/bytecomp.el: Include only first argument in
mutates-arguments property.
* lisp/emacs-lisp/cl-seq.el (cl-nintersection, cl-nset-difference):
Make docstring consistent with manual in that the second argument is
not modified.
* test/lisp/emacs-lisp/cl-seq-tests.el (cl-nintersection-test)
(cl-nset-difference-test): Simplify.
(cl-nset-difference): Pass fresh list as second argument, otherwise
destructive modifications to it could go undetected.