Commit graph

97574 commits

Author SHA1 Message Date
Eshel Yaron
2f67352d7a
; Fix warnings in 'auth-source-search' (bug#77612)
* lisp/auth-source.el (auth-source-search): When calling
'slot-value', specify slots by name, not by ':initarg'.
2025-04-18 08:30:53 +02:00
Yuan Fu
f728aa72c0
Add guard in treesit-language-at-point-default (bug#77870)
* lisp/treesit.el (treesit-language-at-point-default): Return
nil if there's no parser in the buffer.
(treesit-parsers-at): Add docstring for parser order.
2025-04-17 16:56:07 -07:00
Yuan Fu
4f80a116f5
Add missing OFFSET arg to treesit--update-ranges-local (bug#77848)
* lisp/treesit.el (treesit--update-ranges-local):
(treesit--update-range-1): Add missing OFFSET arg.
2025-04-17 16:42:07 -07:00
Yuan Fu
b75c18f3c6
Make sure prog-fill-reindent-defun work for strings too
My previous commit foolishly excluded strings from the
condition, now add them back.

* lisp/progmodes/prog-mode.el (prog-fill-reindent-defun):
Include strings.
2025-04-17 16:18:19 -07:00
Juri Linkov
9f4347e00c Don't switch to another frame if window is not on the selected frame.
* lisp/window.el (window--quit-restore-select-window):
Add optional arg 'frame'.  Don't switch to another frame
if window is not on the selected frame (bug#71386).
(quit-restore-window): Provide the 'frame' arg
to 'window--quit-restore-select-window' calls.
Patch by martin rudalics <rudalics@gmx.at>.

* test/lisp/tab-bar-tests.el (tab-bar-tests-quit-restore-window):
No need to reselect the frame after 'quit-window'.
2025-04-17 21:21:29 +03:00
Juri Linkov
2808bef252 * lisp/treesit.el (treesit-parsers-at): Fix for 'with-host' arg.
Don't add the primary parser or the first of treesit-parser-list
when non-nil 'with-host' is provided since there is no host
for the primary parser (bug#76788).
2025-04-17 20:21:16 +03:00
kobarity
4c5c20ddc2 Disable echo back instead of setting tty to raw in Inferior Python
* lisp/progmodes/python.el (python-shell-setup-code): Change the
Python setup code.  (Bug#76943)
2025-04-17 14:56:49 +02:00
Juri Linkov
ee46b6c4e6 Use the first parser from 'treesit-parser-list' to fix tests.
* lisp/treesit.el (treesit-parsers-at): Add treesit-primary-parser
only when it's non-nil.  When the result list is still empty,
add the first parser from 'treesit-parser-list'.
https://lists.gnu.org/archive/html/emacs-devel/2025-04/msg00627.html

* test/src/treesit-tests.el (treesit-node-supplemental)
(treesit-node-at, treesit-node-check)
(treesit-search-subtree-forward-1)
(treesit-search-subtree-backward-1): Wrap test body in 'with-temp-buffer'.
2025-04-17 09:49:04 +03:00
Eli Zaretskii
2925ff6c53 Don't override 'revert-buffer-function' globally in 'eww-buffers-mode'
* lisp/net/eww.el (eww-buffers-mode): Set 'revert-buffer-function'
buffer-locally.  (Bug#77854)
2025-04-17 09:25:09 +03:00
Yuan Fu
79814379d6
Remove treesit.el dependency from prog-mode.el
prog-mode.el doens't need treesit.el dependency.  And it
shouldn't depend on it.  In principle, treesit.el should
integrate into various parts of Emacs through standard hooks and
variables.

* lisp/progmodes/prog-mode.el:
(prog-fill-reindent-defun): Remove treesit.el functions.  Use
generic functions to check whether the current line has
comments, and make the test more comprehensive.
2025-04-16 22:54:40 -07:00
Yuan Fu
9d43715baa
Fix c-ts-common--fill-paragraph for non-rust modes (bug#77727)
* lisp/progmodes/c-ts-common.el:
(c-ts-common--comment-regexp): Add // and /* to regexp for Rust.
(c-ts-common--line-comment-p): Extract out into new function,
add a check that the parent node is a comment node.
(c-ts-common--fill-paragraph): Extract some code out.
2025-04-16 22:54:17 -07:00
Stefan Monnier
ae1d01328f (eieio-backward-compatibility): Set to warn (bug#77612)
* lisp/emacs-lisp/eieio-base.el (make-instance) <eieio-named>:
Really skip backward compatibility when `eieio-backward-compatibility`
is nil and emit message if it's `warn`.
(eieio-persistent-make-instance): Warn when an obsolete name is used.

* lisp/emacs-lisp/eieio-core.el (eieio-backward-compatibility):
Change default to `warn`.
(eieio-defclass-internal): Warn when the *-list-p function is called
(eieio--slot-name-index): Warn when a initarg is used to access a slot.

* lisp/emacs-lisp/eieio.el (defclass): Warn when a class-slot is
accessed via the obsolete method.
(make-instance, clone) <eieio-default-superclass>: Really skip backward
compatibility when `eieio-backward-compatibility` is nil and emit
message if it's `warn`.
2025-04-17 00:04:04 -04:00
F. Jason Park
c0cb59578b Don't round-trip auto-reconnect probe in ERC
* lisp/erc/erc-backend.el (erc-server--reconnect-opened)
(erc--server-reconnect-opened): Rename former to latter.  Restore
original buffer-local value of session connector for Emacs 29 and below.
(erc--server-reconnect-timeout-check)
(erc--server-reconnect-timeout-scale-function): Change from buffer-local
to normal variables, which they should have been originally.
(erc--recon-probe-reschedule): Ensure `erc-server-reconnect-timeout' is
always non-nil to avoid seeing format specifier in admin message.  Use
current buffer when `proc' argument is nil.  Perform cleanup when `proc'
and `erc-server-process' differ.
(erc-server-delayed-check-reconnect-reuse-process-p): New variable.
(erc--recon-probe-sentinel): Run `erc--server-reconnect-opened'
immediately because sending a speculative PING doesn't work on all
servers and proxies, most crucially on ZNC, which replies with an error
only after an extended timeout.
(erc--recon-probe-filter): Remove unused function.
(erc--recon-probe-check) Rework to not use fixed periodic timer, change
second parameter to a Lisp time object.
(erc-server-delayed-check-reconnect): Use realistic name when reusing
process so that the session's process isn't "*erc-connectivity-check*".
Set filter to `ignore'.  Always run `erc--recon-probe-sentinel' when
status is `open' or something other than `connect', but don't bother
spawning a `erc--recon-probe-check' task as well because any problems
creating the process should already be known.  Handle quits during
connect functions that perform blocking I/O, such as
`socks-open-network-stream'.
(erc-schedule-reconnect): Don't bother setting filter to nil.
* test/lisp/erc/erc-scenarios-base-auto-recon.el
(erc-scenarios-base-auto-recon-unavailable)
(erc-scenarios-base-auto-recon-check/no-reuse): Rename former to latter.
(erc-scenarios-base-auto-recon-no-proto)
(erc-scenarios-base-auto-recon-check/reuse): Rename former to latter and
rewrite not to expect a PING.
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--forget-process): New
function.
(erc-d--process-sentinel): Stop serving when all dialogs have been
exhausted.  (Bug#62044)
2025-04-16 17:30:13 -07:00
João Távora
c5b97b7b32 Eglot: be aware of LSP version of contextual diagnostics
In certain situations, Eglot has to report to the server parts
of the diagnostics that it itself sent us.  The server may use
this as context to compute code actions, for example.  Eglot
selects diagnostics by asking Flymake, looking for the ones that
contain Eglot-specific cookies.

But when doing so, it is important to also be aware of the LSP
document version these each of these diagnostics pertain to,
since if a diagonstic in the buffer pertains to an older version
of the LSP document (because Flymake fired or the server hasn't
pushed a new set), that diagnostics 'eglot-lsp-data' cookie is
invalid and possibly harmful.

An example is when a diagnostic extends all the way to the end
of the buffer.  If we attempt to fix by shortening the buffer,
an Eldoc-started code actions request may be sent to the server
considering the soon-to-be-deleted Flymake diagnostic as
context.  But that diagnostic's 'eglot-lsp-data' cookie is no
longer valid and when processing that context we try to go past
point-max and burp an annoying error.

Best to check the version of the diagnostic (if we have it) and
ignore the ones that don't match the document version.

* lisp/progmodes/eglot.el (eglot--versioned-identifier): Move up.
(eglot--flymake-diagnostics, eglot--diag-to-lsp-diag): New helpers.
(eglot-handle-notification): Record LSP doc version in diagnostics.
(eglot--code-action-bounds)
(eglot--code-action-params): Use eglot--flymake-diagnostics.
2025-04-17 00:31:38 +01:00
Stefan Monnier
2330e7b6d6 lisp/savehist.el (savehist--reload): Don't accidentally set nil
Reported by Michael Heerdegen <michael_heerdegen@web.de>.
2025-04-16 17:05:04 -04:00
Juri Linkov
f68482cbc0 * lisp/textmodes/markdown-ts-mode.el: More ts-modes for code blocks.
(markdown-ts--code-block-language-map): Add more aliases.
(markdown-ts-code-block-source-mode-map): Add more mappings
for existing core ts-modes.
(markdown-ts--convert-code-block-language):
Check 'lang-string' with 'symbolp'.  Check 'mode' with 'fboundp'.
2025-04-16 21:45:40 +03:00
Juri Linkov
a6d746400c Change the default navigation sexp-type in 'elixir-ts-mode'.
* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode):
Call 'treesit-cycle-sexp-type' at the end to enable navigation across
nodes defined by the tree-sitter thing 'sexp' by default (bug#76788).
2025-04-16 20:32:54 +03:00
Juri Linkov
7574eb82c5 New hook 'outline-after-change-functions' (bug#77256).
* lisp/outline.el (outline-after-change-functions): New variable.
(outline--fix-buttons-after-change):
Run hook 'outline-after-change-functions'.

* lisp/treesit.el (treesit--after-change): Improve docstring.
(treesit-major-mode-setup): Simplify to just add
'treesit--after-change' to 'outline-after-change-functions' hook.

* lisp/progmodes/rust-ts-mode.el (rust-ts-mode): Add explicit
'treesit-outline-predicate' that is like
'treesit-simple-imenu-settings', but also adds "trait_item".
2025-04-16 20:11:34 +03:00
Juri Linkov
77bf9d33ee Add 'treesit-language-at-point-default' (bug#77256).
* lisp/treesit.el (treesit-language-at-point-function):
Change the default value from nil to 'treesit-language-at-point-default'.
(treesit-language-at): Funcall 'treesit-language-at-point-function'
unconditionally.
(treesit-language-at-point-default): New function with body from
'treesit-language-at'.
(treesit-node-at): Simplify by replacing duplicate code
with the call to 'treesit-parsers-at'.
2025-04-16 20:00:56 +03:00
Eli Zaretskii
bf737dc42a ; Improve documentation of 'help-fns-edit-variable'
* lisp/help-fns.el (help-fns-edit-variable)
(help-enable-variable-value-editing): Doc fixes.
2025-04-16 11:13:41 +03:00
Eli Zaretskii
179c6931c5 ; Fix documentation of a recent commit
* lisp/textmodes/markdown-ts-mode.el (markdown-ts-delimiter)
(markdown-ts-heading-1, markdown-ts-setext-heading)
(markdown-ts-heading-2, markdown-ts-heading-3)
(markdown-ts-heading-4, markdown-ts-heading-5)
(markdown-ts-heading-6, markdown-ts-list-marker)
(markdown-ts-block-quote, markdown-ts-language-keyword)
(markdown-ts--configured-languages): Doc fixes.
2025-04-16 10:17:30 +03:00
Yuan Fu
6f1e317764
Expand markdown-ts-mode and add code block support for javascript
- Define new faces and use them in place of font-lock faces
- Add more fontification, add a new feature for headings.
- Remove fontification for code blocks, so embedeed parser can
  fontify them
- Add experimental code block support for javascript by using
  tree-sitter setup from js-ts-mode.
- Correctly setup markdown_inline with range settings.

* lisp/textmodes/markdown-ts-mode.el:
(markdown-ts--code-block-language-map):
(markdown-ts-code-block-source-mode-map): New variables.
(markdown-ts-faces): New group.
(markdown-ts-delimiter):
(markdown-ts-heading-1):
(markdown-ts-setext-heading):
(markdown-ts-heading-2):
(markdown-ts-heading-3):
(markdown-ts-heading-4):
(markdown-ts-heading-5):
(markdown-ts-heading-6):
(markdown-ts-list-marker):
(markdown-ts-block-quote):
(markdown-ts-language-keyword): New faces.
(markdown-ts--treesit-settings):
(markdown-ts--configured-languages): New variables.
(markdown-ts--harvest-treesit-configs):
(markdown-ts--add-config-for-mode):
(markdown-ts--convert-code-block-language): New functions.
(markdown-ts--range-settings): New variable.
(markdown-ts-setup): Setup range configuration.
(markdown-ts-mode): Add heading feature.
2025-04-15 16:14:01 -07:00
Stefan Kangas
23b957e128 ; Add missing :group to new defcustom
* lisp/dired-aux.el (dired-create-empty-file-in-current-directory):
Add missing :group.
2025-04-15 22:22:16 +02:00
Jared Finder
8528249ee2 Show drag cursor on all window lines (mode, tab, header)
* lisp/ruler-mode.el (ruler-mode-map): Remove down-mouse-1
binding that conflicts with dragging header line.
* src/xdisp.c (note_mode_line_or_margin_highlight): Renamed
to...
(note_line_or_margin_highlight): ...new name since it applies to
any window line (mode, tab, header).  Set drag cursor for window
top lines.
(note_mouse_highlight): Update call to new name (bug#76084).
2025-04-15 21:52:47 +03:00
Jens Schmidt
f67e64028e Better handle errors after sync man invocations
* lisp/man.el (Man-start-calling): Declare as debuggable.
(Man-getpage-in-background): Call `Man-bgproc-sentinel' with a
cons (BUFFER . EXIT-STATUS) as PROCESS argument for synchronous calls.
(Man-bgproc-sentinel): Use that information to handle those more
similarly to asynchronous calls.  Do not employ window selection hacks
for synchronous calls.  (Bug#77755)
2025-04-15 21:20:55 +03:00
Juri Linkov
aa24b9c849 * lisp/treesit.el (treesit-up-list): Signal an error.
Signal 'scan-error' when called noninteractively (bug#77744).
2025-04-15 20:33:14 +03:00
Stephen Berman
0ac12aed09 Optionally add new empty file to Dired subdirectory
Suggested by Kasper Gałkowski <kpg@posteo.net> (bug#77668)

* etc/NEWS: Announce new Dired user option.

* lisp/dired-aux.el (dired-create-empty-file-in-current-directory):
New user option.
(dired-create-empty-file): Use it.  Update and clarify doc string.
2025-04-15 19:01:19 +02:00
Elías Gabriel Pérez
74842b4cb2 Add block-comment variables to cc-mode.
* lisp/progmodes/cc-cmds.el (c-indent-new-comment-line):
Add block-comment-start and block-comment-end
* lisp/progmodes/cc-mode.el (c-basic-common-init):
Declare block-comment-start and block-comment-end buffer-local.
* lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables): Move
block-comment variables ...
(lisp-mode): ... to here.  (Bug#77424)
2025-04-15 16:16:34 +03:00
Visuwesh
3f73b29875 Don't warn about lexbind cookies when loading calc settings
* lisp/calc/calc-mode.el (calc-settings-file-name):
* lisp/calc/calc.el (calc-mode): Bind 'warning-inhibit-types' to
avoid lexbind cookie missing warning.
2025-04-15 12:18:27 +03:00
Dmitry Gutov
f7e34d52dc Fix help-customize in describe-symbol buffers
* lisp/help-fns.el (describe-symbol):
Protect help-mode--current-data from being modified inside the
help-setup-xref call (bug#77510).
2025-04-14 03:35:37 +03:00
Stefan Monnier
19913b1567 (cl-generic-define-method): Try and fix bug#77464
* lisp/emacs-lisp/cl-generic.el (cl-generic-define-method): Don't set
the function to `dummy`, even temporarily.
2025-04-13 12:45:54 -04:00
Stefan Monnier
1dee377bad lisp/gnus/gnus-start.el (gnus-dribble-eval-file): Ignore lexbind warning 2025-04-13 10:59:47 -04:00
Stefan Monnier
9dfd4c6bd3 (calc-save-modes): Add a lexical-binding cookie
* lisp/calc/calc-mode.el (calc-save-modes): Add a `lexical-binding`
cookie when it is safe.  Use `pcase-dolist` and `pp`.
2025-04-13 10:33:47 -04:00
Eli Zaretskii
e0c7b6e31e Fix warning messages about lexbind cookie in subdirs.el
* lisp/files.el (internal--get-default-lexical-binding): Don't log
a warning message when lexbind warning is disabled, and
'display-warning' is unavailable or signals an error.
2025-04-13 16:35:49 +03:00
Eli Zaretskii
f5b59a8a73 ; Fix last change
* lisp/progmodes/elisp-mode.el (elisp-eldoc-docstring-length-limit):
* etc/NEWS: Fix documentation of last change.  (Bug#77628)
2025-04-13 13:03:03 +03:00
Elías Gabriel Pérez
53bd9f54c6 Add variable for control docstring length in elisp eldoc functions
* etc/NEWS: Announce new variable.
* lisp/progmodes/elisp-mode.el (elisp-eldoc-docstring-length-limit):
New user option.
(elisp-eldoc-funcall-with-docstring): Add "Undocumented" as
docstring if the function has no docstring.
(elisp-eldoc-var-docstring-with-value): Use
`elisp-eldoc-docstring-length-limit'.  (Bug#77628)
2025-04-13 13:02:41 +03:00
Eli Zaretskii
3a13fb2069 ; Fix a typo in proced.el
* lisp/proced.el (proced-filter): Fix a typo.  Reported by Armin
Darvish <armindarvish@gmail.com>.  (Bug#77713)
2025-04-13 12:38:04 +03:00
Sebastián Monía
fec6e16f14 Special treatment for file:// URIs on Windows
* lisp/url/url-parse.el (url-generic-parse-url): Remove prefix /
when a file URI's filename starts with a single letter followed
by a colon and a slash or backslash.
(url-recreate-url): Mirror the change applied when parsing, so
the URL is recreated properly on MS-Windows.
* test/lisp/url/url-parse-tests.el
(url-generic-parse-url/ms-windows-file-uri-hanlding): New test.
(Bug#76982)
2025-04-13 11:59:24 +03:00
Pengji Zhang
6f494d74f6 New user option to hide minor mode lighters (bug#77361)
* lisp/bindings.el (mode-line-collapse-minor-modes): New user
option.
(mode-line-minor-modes): New variable to hold mode line
constructs for minor modes.
(mode-line--make-lighter-menu): New helper function to generate
the menu for hidden minor modes.
(mode-line--minor-modes): New helper function to computer mode
line constructs for minor mode lighters.
(mode-line-modes): Use the new variable 'mode-line-minor-modes',
and adjust the order of elements so the indicator for hidden
minor modes is shown towards the end.

* doc/lispref/modes.texi (Mode Line Basics): Move the paragraph
for 'mode-line-compact' from here...
* doc/emacs/display.texi (Optional Mode Line): ...to here, and
document the new user option.
* etc/NEWS: Annouce the new user option.
2025-04-13 11:43:33 +03:00
Asher Copeland
5665b446b7 Fix 'backward-delete-char-untabify'
* lisp/simple.el (backward-delete-char-untabify): Fix
behavior when there's an active region.  (Bug#75042)

Copyright-paperwork-exempt: yes
2025-04-13 11:24:31 +03:00
Eli Zaretskii
d9ad0c953b ; Fix a typo in last change. 2025-04-13 11:13:36 +03:00
Elías Gabriel Pérez
4c6b1712a4 Add block-comment-start and block-comment-end to supported modes
* lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables):
Add block-comment-start and block-comment-end from here...
* lisp/newcomment.el (block-comment-start, block-comment-end):...
* lisp/nxml/nxml-mode.el (nxml-mode):...
* lisp/progmodes/c-ts-common.el (c-ts-common-comment-setup):...
* lisp/progmodes/go-ts-mode.el (go-work-ts-mode):...
* lisp/progmodes/js.el (js--mode-setup):...
* lisp/progmodes/json-ts-mode.el (json-ts-mode):...
* lisp/progmodes/lua-ts-mode.el (lua-ts-mode):...
* lisp/progmodes/opascal.el (opascal-mode):...
* lisp/progmodes/pascal.el (pascal-mode):...
* lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode):...
* lisp/textmodes/css-mode.el (css-base-mode, scss-mode):...
* lisp/textmodes/sgml-mode.el (sgml-mode): ... to here.
(Bug#77424)
2025-04-13 11:12:59 +03:00
Stephane Zermatten
158cf528c4 Fix term.el bug with very short multibyte character chunk
Before this change, a chunk containing only a part
of a multibyte character would be discarded and
displayed undecoded on the terminal.
* lisp/term.el (term-emulate-terminal): Fix handling chunks
with part of a multibyte character.  (Bug#77410)

* test/lisp/term-tests.el (term-decode-partial)
(term-undecodable-input): Fix and enhance tests.

Copyright-paperwork-exempt: yes
2025-04-13 11:05:25 +03:00
Sean Whitton
9f6eb6cebb ; Fix replacements of old vc-annotate-parent-file
* lisp/vc/vc-annotate.el (vc-annotate-working-revision)
(vc-annotate-extract-revision-at-line)
(vc-annotate-revision-at-line, vc-annotate-warp-revision)
(vc-annotate-goto-line): Fix extracting the file name from
vc-buffer-overriding-fileset.
2025-04-13 14:39:12 +08:00
Stefan Monnier
f3e0bdf1b9 lisp/subr.el (setq-local): Make local after evaluating the new value
In case the evaluation needs to look at the variable's value,
make sure we make it buffer-local afterwards.
2025-04-12 23:00:08 -04:00
Stefan Monnier
b99893af1e (replace-buffer-contents): Mark as obsolete, again.
* lisp/subr.el (replace-buffer-contents): Mark as obsolete, again.
* src/editfns.c (Freplace_region_contents): Add interactive form.
2025-04-12 22:58:22 -04:00
Stefan Monnier
356178c8e7 savehist.el: Unbreak tests
* lisp/savehist.el (savehist-loaded): Fix typo.
(savehist--reload): Add compatibility with test case.
2025-04-12 22:49:48 -04:00
Stefan Monnier
bfeb755e03 savehist.el: Handle concurrent access to savehist-file
* lisp/savehist.el (savehist--manage-timer): Minor simplification.
(savehist-coding-system): Use `utf-8-emacs-unix` so it works even if
some history entries contain chars that aren't in Unicode.
(savehist-loaded): Mark it obsolete.
(savehist--file-sync-modtime): New var to replace it.
(savehist--file-modtime, savehist--merge): New functions.
(savehist--reload): New function, extracted from `savehist-mode`.
Make it merge the old history and the newly loaded one.
Remember the time of sync in `savehist--file-sync-modtime`.
(savehist-mode): Use it.
(savehist-save): Use it as well, and set `savehist--file-sync-modtime`.
(savehist--last-autosave): New var.
(savehist-autosave): Use it to skip saves when not enough time has passed.
2025-04-12 22:43:20 -04:00
Eli Zaretskii
2b3763e955 Merge from origin/emacs-30
d3c39fb522 Fix display of keys in 'help-form' buffers (bug#77118)
6509cc20a9 Improve documentation of 'user-emacs-directory'
3f06059730 Update remarks on name prefixes in coding conventions
e966ff9759 ; * doc/emacs/files.texi (Image Mode): Fix a typo (bug#77...
378bea99b1 ; Fix doc strings of a few Dired commands
30fb2ac07a ; * CONTRIBUTE: Clarify single-line commit should end wit...
417d14a95e ; * admin/MAINTAINERS: Complete the handover of VC
bb756b195a ; Fix typo in Tramp
2025-04-12 08:57:38 -04:00
Visuwesh
bf7bcbaa3d Limit fontification of "customize" in setopt suggestion
* lisp/help-fns.el (help-fns--customize-variable): Limit the
fontification to newly inserted text to avoid spurious
fontification of other instances of the word "customize."
2025-04-12 14:22:55 +03:00