1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-28 00:01:33 -08:00
Commit graph

177938 commits

Author SHA1 Message Date
Jens Schmidt
e82989757f Use a pristine copy of argv to restart Emacs
argv as left after main has proccessed the command-line can differ
both in order and contents of the original command-line arguments,
which can lead to surprising results when restarting emacs on the
cooked argv through `kill-emacs'.

Starting from that observation, consistenly use variables
'initial_cmdline' on Windows, 'initial_argc', 'initial_argv' on
non-Windows, and 'initial_argv0' in all ports.

* src/lisp.h: Declare 'initial_argv0', limit declaration of
'initial_argv' and 'initial_argc' to non-Windows ports.
* src/emacs.c: Likewise, but for the definitions.
(init_cmdargs): Move initialization of 'initial_argv' and
'initial_argc' ...
(copy_args) [!WINDOWSNT]: ... to this new function ...
(main): ... and call that in 'main', also initializing
'initial_argv0' before the command-line processing.
* src/emacs.c (Fkill_emacs):
* src/pgtkterm.c (pgtk_term_init):
* src/sysdep.c (emacs_perror):
* src/xterm.c (x_term_init): Use 'initial_argv0' where only that
is required.  (Bug#77389)
2025-04-13 11:33:30 +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
Eli Zaretskii
b0d6fe1449 Disable clearing echo-area when 'inhibit-message' is non-nil
* src/xdisp.c (clear_message): Don't clear echo-area if
'inhibit-message' is non-nil.

* etc/NEWS:
* doc/lispref/display.texi (Displaying Messages): Document the
above change.  (Bug#77257)
2025-04-13 10:44:55 +03:00
Eli Zaretskii
7b36d7295e ; * src/editfns.c (Freplace_region_contents): Doc fix (bug#76313). 2025-04-13 10:34:46 +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
Paul Eggert
3169aeb421 ; Fix typo in comment. 2025-04-12 12:30:58 -07: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
Eli Zaretskii
6221e9a66d ; Merge from origin/emacs-30
The following commit was skipped:

684adc07c2 ; Fix a recent backport
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
Eli Zaretskii
50531a00b5 ; * etc/NEWS: Fix wording and punctuation in last added entry. 2025-04-12 14:12:05 +03:00
Spencer Baugh
861e7f8b60 flymake: fall back to margins on text terminals
Previously, flymake-indicator-type defaulted to either fringes
or margins.  But fringes should be used on graphical frames, and
margins on TTY frames.  So default to fringes instead, and
simply fall back to margins automatically on text frames.

* lisp/progmodes/flymake.el (flymake-indicator-type): Set to
fringes.  (bug#77313)
(flymake-mode): Fallback to margins if there's no fringes.
* doc/misc/flymake.texi (Customizable variables): Mention
fallback behavior.
* etc/NEWS: Announce fallback behavior.
2025-04-12 14:10:19 +03:00
Stephen Berman
d3c39fb522 Fix display of keys in 'help-form' buffers (bug#77118)
* lisp/help.el (help-form-show): Use 'insert' instead of 'princ'
so that keys in 'help-form' are displayed with 'help-key-binding' face.
2025-04-12 12:01:50 +02:00
Eli Zaretskii
6509cc20a9 Improve documentation of 'user-emacs-directory'
* doc/emacs/custom.texi (Find Init): Document the effect of
'user-emacs-directory' on native compilation.  Advise against
changing the value of 'user-emacs-directory' in init files.
(Bug#77745)
2025-04-12 09:52:04 +03:00
Sean Whitton
3f06059730 Update remarks on name prefixes in coding conventions
* doc/lispref/tips.texi (Coding Conventions): Say that it's okay
to put the name prefix later for defining constructs, rather
than explicitly instructing the reader to do so.  Condense the
recommendation to err on the side of prepending the name prefix.
2025-04-12 11:05:45 +08:00
Sean Whitton
3b841700a8 vc-do-async-command: Ellipse later lines in multiline arguments
* lisp/emacs-lisp/cl-print.el (cl-print-expand-ellipsis): Bind
inhibit-read-only to t.
* lisp/vc/vc-dispatcher.el (require): Require cl-print at
compile time.
(vc-do-async-command): When printing command arguments that
contain multiple lines, use cl-prin1 with cl-print-string-length
bound in order to ellipse lines other than the first.
Switch the outer quotation marks to single quotation marks.
2025-04-12 10:05:57 +08:00
Sean Whitton
cc232bd7a1 ; * etc/NEWS: Move new variables only for Lisp programmers downwards. 2025-04-12 10:05:29 +08:00
Juri Linkov
695edc5b55 Rename treesit-toggle-sexp-type to treesit-cycle-sexp-type.
* lisp/treesit.el (treesit-cycle-sexp-type):
Rename from 'treesit-toggle-sexp-type'.  Fix docstring.
https://lists.gnu.org/archive/html/emacs-devel/2025-04/msg00291.html
2025-04-11 19:34:29 +03:00
Sean Whitton
53058e15c3 ; * etc/NEWS: Expand description of vc-buffer-overriding-fileset. 2025-04-11 18:46:37 +08:00
Michael Albinus
1be9007c0d ; * etc/NEWS: Fix typos. 2025-04-11 11:58:40 +02:00
Eli Zaretskii
e966ff9759 ; * doc/emacs/files.texi (Image Mode): Fix a typo (bug#77723). 2025-04-11 11:33:26 +03:00
Sean Whitton
95675b4db0 ; Delete FIXME in vc-print-log
This isn't a state-changing operation, indeed, and passing t
here is relevant to dired-vc-deduce-fileset.
2025-04-11 11:47:32 +08:00
Sean Whitton
60530889c3 New buffer-local vc-buffer-overriding-fileset and vc-buffer-revision
* lisp/vc/vc.el (vc-buffer-overriding-fileset)
(vc-buffer-revision): New variables (bug#77529).
(vc-find-revision-save, vc-find-revision-no-save): Set them.
(vc-deduce-fileset): Respect vc-buffer-overriding-fileset.
(vc-print-log): Use vc-buffer-revision as a default working
revision.

* lisp/vc/vc-annotate.el (vc-annotate-parent-file)
(vc-annotate-parent-rev): Delete.
(vc-annotate): Respect vc-buffer-overriding-fileset and
vc-buffer-revision.  This makes 'C-x v g' work from buffers
generated by 'C-x v ~' (bug#5424).
Set the two variables in the newly prepared buffer.
(vc-annotate-working-revision)
(vc-annotate-extract-revision-at-line)
(vc-annotate-revision-at-line, vc-annotate-warp-revision)
(vc-annotate-goto-line):
* lisp/vc/vc-svn.el (vc-svn-annotate-current-time): Use
vc-buffer-overriding-fileset instead of vc-annotate-parent-file,
vc-buffer-revision instead of vc-annotate-parent-rev.
(vc-annotate-parent-rev): Delete declaration.

* etc/NEWS: Announce the new variables.
2025-04-11 11:46:05 +08:00
Sean Whitton
37164032f6 ; Normalize spacing in last change 2025-04-11 10:02:54 +08:00
Stefan Monnier
c0ea954d0f Add lexical-binding cookie to generated files
Side-companion to commits bb0f84bc0b and 50947fd512.
While in there, couldn't resist adding a few minor cleanups
I had lying around.

* lisp/savehist.el (savehist-save): Add `lexical-binding:t` cookie.

* lisp/url/url-cookie.el: Remove redundant `:group` arguments.
(url-cookie-write-file): Add `lexical-binding:t` cookie.

* lisp/abbrev.el: Prefer #' to quote function names.
(write-abbrev-file): Add a `lexical-binding:t` cookie.
(unexpand-abbrev): Use `replace-region-contents` and 3-args `<=`.
(define-abbrev-table): Use `defvar-1`.

* lisp/filesets.el (filesets-menu-cache-file-save-maybe):
Add `lexical-binding:t` cookie.
(filesets-ingroup-patterns): Don't quote lambdas.
(filesets-spawn-external-viewer): Remove redundant "" arg to `mapconcat`.

* lisp/recentf.el: Prefer #' to quote function names.
(recentf-save-file-header): Add `lexical-binding:t` cookie and change
mode to match the actual content.
2025-04-10 16:31:30 -04:00
Juri Linkov
ec62674cb9 Fix treesit-forward-sexp/list navigation in the middle of a node.
* lisp/treesit.el (treesit--forward-list-with-default):
Check the thing 'sexp-default' (bug#76791).

* lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode):
* lisp/progmodes/go-ts-mode.el (go-ts-mode):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
* lisp/progmodes/sh-script.el (bash-ts-mode):
Add the thing 'sexp-default' to 'treesit-thing-settings'.
2025-04-10 19:20:35 +03:00
Juri Linkov
addcab6891 Rename treesit-toggle-sexp-mode to treesit-toggle-sexp-type.
* lisp/treesit.el (treesit-toggle-sexp-type):
Rename from 'treesit-toggle-sexp-mode'.  Fix docstring.
https://lists.gnu.org/archive/html/emacs-devel/2025-04/msg00273.html
2025-04-10 19:04:12 +03:00
Eli Zaretskii
cb9aded6d9 ; Fix an error in 'package-quickstart-refresh'
* lisp/emacs-lisp/package.el (package-quickstart-refresh): Fix a
thinko.  (Bug#77701)
2025-04-10 16:46:00 +03:00
Eli Zaretskii
aa8a5090ec ; Update ldefs-boot.el 2025-04-10 08:04:08 -04:00
Eli Zaretskii
bb0f84bc0b Fix one more case of unnecessary lexbind warnings
* lisp/filesets.el (filesets-menu-cache-file-load): Bind
'warning-inhibit-types' to avoid warning about missing lexbind
cookie when loading the file.
2025-04-10 15:01:04 +03:00
Eli Zaretskii
50947fd512 Avoid warnings about lexbind cookies where they aren't needed
* lisp/emacs-lisp/warnings.el (warning-inhibit-types): New variable.
(display-warning): If TYPE matches 'warning-inhibit-types', don't
display the warning, even if it's emitted during startup.
* lisp/startup.el (normal-top-level):
* lisp/savehist.el (savehist-mode):
* lisp/url/url-cookie.el (url-cookie-parse-file):
* lisp/recentf.el (recentf-load-list):
* lisp/abbrev.el (read-abbrev-file): Bind 'warning-inhibit-types'
to avoid warning about missing lexbind cookie when loading files
that Emacs itself generates.
2025-04-10 14:36:43 +03:00
Po Lu
426a016d61 ; * test/infra/android/test-controller.el (ats-eval): Correct punctuation. 2025-04-10 18:19:28 +08:00
Po Lu
ddcc87514c ; * etc/NEWS: Document previous change. 2025-04-10 15:25:38 +08:00
Po Lu
884ede7c95 Respond to display configuration updates on Android
* java/org/gnu/emacs/EmacsNative.java
(sendConfigurationChanged): Declare function.

* java/org/gnu/emacs/EmacsSdk7FontDriver.java (Sdk7FontEntity)
(Sdk7FontObject): Do not access `metrics' field deleted from
`EmacsService'.

* java/org/gnu/emacs/EmacsService.java (EmacsService)
<metrics, resources>: Delete fields.
<dpiX, dpiY, dpiScaled>: New fields.
(onCreate): Adjust accordingly.  Record current display metrics
for subsequent comparison.
(onConfigurationChanged): New function.

* lisp/dynamic-setting.el (font-setting-change-default-font):
Enable on systems where font-get-system-font is not defined if
invoked with SET-FONT nil.

* src/android.c (sendConfigurationChanged): New function.

* src/androidgui.h (ANDROID_CONFIGURATION_CHANGED): New enumerator.
(struct android_configuration_changed): New structure.
(union android_event): Add `config' member.

* src/androidterm.c (handle_one_android_event): Handle
ANDROID_CONFIGURATION_CHANGED events.
(syms_of_androidterm): Define Qfont_render, and
Qdynamic_setting.  Provide the latter.
2025-04-10 15:25:38 +08:00
Eli Zaretskii
cb339ad8f4 ; * lisp/minibuffer.el (read-file-name): Fix a typo in the doc string. 2025-04-10 09:36:17 +03:00
Eli Zaretskii
b205d7b59d ; Fix recently-added documentation
* etc/NEWS:
* lisp/treesit.el (treesit-toggle-sexp-mode): Fix wording of
recently-added documentation.
2025-04-10 09:26:32 +03:00
Juri Linkov
99a2cb05a4 New command 'treesit-toggle-sexp-mode' (bug#76676).
* lisp/treesit.el (treesit-forward-sexp): Don't use
'treesit-sexp-type-regexp' reserved for list commands
to override their default 'list' thing.
(treesit-down-list, treesit-up-list): Use
'treesit-sexp-type-regexp' instead of 'list'
when it's non-nil.
(treesit-toggle-sexp-mode): New command.

* lisp/progmodes/c-ts-mode.el (c-ts-mode--thing-settings):
Improve 'sexp' thing settings to exclude the top-level
"translation_unit" that just moves to EOF and also "comment".

* lisp/progmodes/elixir-ts-mode.el (elixir-ts--sexp-regexp): Remove.
(elixir-ts--forward-sexp): Remove to use the default 'sexp' navigation.
(elixir-ts--with-parens-0-p, elixir-ts--with-parens-1-p):
New internal functions.
(elixir-ts-mode): Add 'treesit-thing-settings'
instead of 'forward-sexp-function' (bug#76788).

* lisp/progmodes/heex-ts-mode.el (heex-ts--sexp-regexp): Remove.
(heex-ts--forward-sexp): Remove to use the default 'sexp' navigation.
(heex-ts--thing-settings): New variable.
(heex-ts-mode): Use 'heex-ts--thing-settings'
instead of 'forward-sexp-function'.

* lisp/progmodes/java-ts-mode.el (java-ts-mode):
Improve 'sexp' thing to use settings like in c-ts-mode.

* lisp/progmodes/php-ts-mode.el (php-ts-mode):
Improve 'sexp' thing settings to exclude the top-level
"program" that just moves to EOF and also "comment".

* lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode):
Improve 'sexp' thing to use settings like in c-ts-mode.

* lisp/textmodes/css-mode.el (css--treesit-thing-settings):
Add 'sexp' thing.  Add "string_value" to 'text' thing.

* lisp/textmodes/html-ts-mode.el (html-ts-mode--treesit-things-settings):
Improve 'sexp' thing to use settings like in c-ts-mode.
Add "doctype" to the 'list' thing.
2025-04-09 21:21:53 +03:00
Juri Linkov
fa247a24a5 Improve 'treesit-outline-search'.
* lisp/treesit.el (treesit-outline-search): Remove
temporary arg 'recursive'.  Use iteration to visit
more ranges until the next outline heading is found.

* lisp/progmodes/php-ts-mode.el (php-ts-mode):
Set 'treesit-outline-predicate' explicitly.
2025-04-09 20:40:09 +03:00
Juri Linkov
4b9d571a55 * lisp/subr.el (defvar-local): Change 'indent' to 'defun' (bug#77256). 2025-04-09 20:24:42 +03:00
Eli Zaretskii
378bea99b1 ; Fix doc strings of a few Dired commands
* lisp/dired-aux.el (dired-do-chown, dired-do-touch)
(dired-do-chgrp, dired-do-chmod): Doc fix.  (Bug#77650)
2025-04-09 14:25:29 +03:00
Sean Whitton
09887a2d41 Rename some of the new window layout commands
* lisp/window-x.el (rotate-window-layout-counterclockwise):
Rename to window-layout-rotate-anticlockwise.
(rotate-window-layout-clockwise):
Rename to window-layout-rotate-clockwise.
(flip-window-layout-horizontally):
Rename to window-layout-flip-leftright.
(flip-window-layout-vertically):
Rename to window-layout-flip-topdown.
(transpose-window-layout): Rename to window-layout-transpose.

* doc/lispref/windows.texi (Changing Window Layouts):
* etc/NEWS:
* lisp/ldefs-boot.el (rotate-window-layout-counterclockwise)
(rotate-window-layout-clockwise, flip-window-layout-horizontally)
(flip-window-layout-vertically, transpose-window-layout):
Update for the renames.
2025-04-09 13:34:55 +08:00
Sean Whitton
253364e2c7 VC-Dir: Offer to register files before checking in
* lisp/vc/vc.el (vc-only-files-state-and-model): Rewrite
checking that all files are in compatible VC states.  In
particular, consistently return 'edited' when all files are
either added, removed or edited, instead of allowing the return
value to depend on the order of the files in VC-Dir, and offer
to registered unregistered files if doing so would allow the
operation to proceed.
(vc-compatible-state): Delete.
(vc-next-action): Replace call to vc-compatible-state.
Document, in this command's docstring, the new feature
implemented in vc-only-files-state-and-model.
* etc/NEWS: Announce the new feature.
2025-04-09 12:37:32 +08:00
Sean Whitton
2310c12658 ; vc-setup-buffer: Don't pass a string to buffer-live-p. 2025-04-09 11:04:26 +08:00
Sean Whitton
686032ddaf ; * src/minibuf.c (syms_of_minibuf): Improve some wording. 2025-04-09 10:35:38 +08:00