Commit graph

176708 commits

Author SHA1 Message Date
Paul Eggert
f809302fe5 Fix unlikely eassert failure in xg_set_widget_bg
* src/gtkutil.c (xg_set_widget_bg): Simplify by using
sprintf with a big-enough buffer.
2025-01-26 23:05:55 -08:00
Paul Eggert
901659bb70 Fix unlikely eassert failure in pgtk_enumerate_devices
* src/pgtkterm.c (pgtk_enumerate_devices): Prefer
make_formatted_string to snprintf + build_string + eassert, as
it’s simpler and won’t crash Emacs if the eassert fails.
2025-01-26 23:05:54 -08:00
Paul Eggert
f8b8dddce9 Minor format_string tuneup
* src/comp.c (format_string): Prefer strcpy to doing things by hand
in a place where strcpy is easier to read, generates
more-efficient code, and similar parts of Emacs do strcpy.
2025-01-26 23:05:54 -08:00
Paul Eggert
8d8272d02e Ignore -fanalyzer-null-argument in pgtkterm.c
* src/pgtkterm.c: Ignore -Wanalyzer-null-dereference.
I don’t have time to look into all the diagnostics,
but the ones I checked seemed to be false alarms with
gcc -std=gnu23 on x86-64, and we are ignoring this
diagnostic in other modules.  This is GCC 14.2.1
20250110 (Red Hat 14.2.1-7).
2025-01-26 23:05:54 -08:00
Paul Eggert
728c7904fe Pacify -fanalyzer-null-argument on pgtk_term_init
* src/pgtkterm.c (pgtk_term_init): Use xstrdup, not g_strdup.
The value is never freed so the allocator shouldn’t matter.
2025-01-26 23:05:53 -08:00
Paul Eggert
2e8ef09104 Protect against GCing of last_mouse_window
* src/window.c (last_mouse_window): New global var.  All static
instances removed, and all their uses replaced with this global
var.  This fixes a very unlikely bug where last_mouse_window was
GC’ed and a new window created in its place.  It also fixes several
places that assumed NIL_IS_ZERO without static_asserting it.
(init_window_once): Initialize the new var.
2025-01-26 23:05:53 -08:00
Paul Eggert
ff65cc9944 Pacify GCC in pgtkselect malloc alignment
* src/pgtkselect.c (pgtk_size_for_format): Remove.
(pgtk_get_window_property): Third arg is now void **, not unsigned
char **.  Omit last arg.  All callers changed.  Simplify
allocation to pacify GCC 14.2.1 complaint about malloc size
mismatching size of array: there’s no need for an extra byte when
converting from ldata to idata.
(selection_data_to_lisp_data): Third arg is now void const *,
not unsigned char const *.  All callers changed.
Omit unnecessary casts.  Make some locals more local.
2025-01-26 23:05:53 -08:00
Paul Eggert
c0d83876f1 Avoid undefined behavior with botched pgtk menu
* src/pgtkmenu.c (pgtk_menu_show): Do not dereference save_wv if
null.  Problem found by gcc 20250110 (Red Hat 14.2.1-7)
-Wanalyzer-null-dereference.
2025-01-26 23:05:53 -08:00
Paul Eggert
06fd3f4e98 Use gtk_disable_setlocale
* src/pgtkterm.c (pgtk_term_init):
* src/xterm.c (x_term_init):
Use gtk_disable_setlocale rather than fixup_locale.
2025-01-26 23:05:52 -08:00
Paul Eggert
a1e4f6a35c Avoid unlikely int overflow.
* src/pgtkterm.c (pgtk_term_init):
* src/xterm.c (x_term_init):
Use a bool, not an int that keeps incrementing,
to record whether initialization has occurred.
2025-01-26 23:05:52 -08:00
Paul Eggert
6ff06ff738 Beware large stack growth in pgtk_menu_show
* src/pgtkmenu.c (pgtk_menu_show): USE_SAFE_ALLOCA instead of alloca.
Problem found with --enable-gcc-warnings.
2025-01-26 23:05:52 -08:00
Paul Eggert
17a8bf53f3 Fix x-show-tip bignum crash
* src/pgtkfns.c (compute_tip_xy): Fix crash if user specifies
bignums.  Bug found with --enable-gcc-warnings.
2025-01-26 23:05:51 -08:00
Paul Eggert
c50e8c2424 Prefer make_formatted_string in svg_load_image
* src/image.c (svg_load_image): Prefer make_formatted_string to
snprintf, as this simplifies the code and does not truncate the
resulting string arbitrarily.
2025-01-26 23:05:51 -08:00
Paul Eggert
028fae9661 Simplify building of color names in image.c
* src/image.c (make_color_name): New function.
(image_background, image_build_heuristic_mask, png_load_body): Use it.
2025-01-26 23:05:51 -08:00
Paul Eggert
f885806fdf Simplify make_formatted_string API
From a suggestion by Pip Cet.
* src/alloc.c (make_formatted_string): Omit first argument,
to simplify the calling convention.  All callers changed.
* src/doprnt.c (doprnt): Also support %u.  Update doc.
2025-01-26 23:05:50 -08:00
Paul Eggert
bcfd4d21b0 Fix unlikely time zone abbreviation bug
* src/timefns.c (Fcurrent_time_zone): Fix double-"-" bug when time
zone name is not known and time zone offset is -3600 or less.
Also, stop assuming that make_formatted_string works with "*"
precisions; this might ease future changes.
2025-01-26 23:05:50 -08:00
Stefan Kangas
b06364f1b6 Don't use obsolete face alias in themes
* etc/themes/leuven-dark-theme.el:
* etc/themes/leuven-theme.el:
* etc/themes/manoj-dark-theme.el:
* etc/themes/tango-dark-theme.el:
* etc/themes/tango-theme.el: Don't use obsolete face alias
'smerge-refined-change', preferring instead 'smerge-refined-changed'.
2025-01-27 07:48:41 +01:00
Stefan Kangas
52c41a66ba Don't use obsolete variable in semantic/grammar.el
* lisp/cedet/semantic/grammar.el
(semantic-grammar-mode-keywords-2):
(semantic-grammar-mode-keywords-3): Don't use obsolete variables.
2025-01-27 06:22:39 +01:00
Stefan Kangas
2b3599bb08 Don't use obsolete variables in semantic/idle.el
* lisp/cedet/semantic/idle.el
(semantic-idle-symbol-maybe-highlight)
(semantic-idle-local-symbol-highlight): Don't use obsolete variable
'semantic-idle-symbol-highlight-face'.
2025-01-27 06:22:23 +01:00
Po Lu
8d11871c63 Fix the Android port
* src/term.c (tty_frame_at) [HAVE_ANDROID]: Always return nil.

* src/terminal.c (cursor_to, raw_cursor_to) [HAVE_ANDROID]:
Don't call root_xy.
2025-01-27 09:11:21 +08:00
Stefan Kangas
5617b07a45 ; Prefer HTTPS to HTTP in docs
* doc/emacs/android.texi (Android Software):
* doc/lispref/frames.texi (X Selections):
* doc/misc/cc-mode.texi (Custom Filling and Breaking):
* doc/misc/efaq.texi (Basic editing):
* doc/misc/gnus.texi (Propagating marks, Spam Statistics Package):
* doc/misc/org.org (External Links, Images in HTML export)
(LaTeX Export, LaTeX math snippets): Prefer HTTPS to HTTP.  Fix or
mark some broken links while we're at it.
2025-01-26 22:45:13 +01:00
Stefan Kangas
fdd23023c8 ; * admin/MAINTAINERS: Sort external packages alphabetically. 2025-01-26 22:45:13 +01:00
Stefan Kangas
74dcfe155a ; * etc/NEWS: Remove temporary documentation markers. 2025-01-26 22:45:13 +01:00
Stefan Kangas
a87c382cab ; * etc/NEWS: Add missing temporary documentation tags. 2025-01-26 22:45:13 +01:00
Stefan Kangas
3c820cd265 Document insert-directory-program as a user option
* doc/lispref/files.texi (Contents of Directories): Document
'insert-directory-program' as a user option.
2025-01-26 22:45:13 +01:00
Stefan Kangas
aec9e66178 Fix compilation warnings in pdumper with !HAVE_NATIVECOMP
* src/pdumper.c [!HAVE_NATIVECOMP] (cold_op, dump_subr): Fix
compilation warnings.
Ref: https://lists.gnu.org/r/emacs-devel/2025-01/msg01003.html
2025-01-26 21:17:31 +01:00
Stefan Kangas
6e2e7265a0 Prefer static switch-case checking in pdumper
* src/pdumper.c (dump_fwd, dump_symbol, dump_drain_cold_data)
(dump_do_fixup, dump_anonymous_allocate_w32)
(dump_anonymous_allocate_posix, dump_map_file_w32, dump_map_file_posix)
(dump_do_emacs_relocation): Remove default clauses to allow static
checking using -Wswitch.
2025-01-26 20:09:08 +01:00
Pip Cet
b07c12ce59 Avoid crashes in Fdocumentation caused by incorrect data types
Note that this can only change things when function-documentation is
defined or overloaded incorrectly.

* src/doc.c (Fdocumentation): Check that the cdr of a docstring cons
is a fixnum.
2025-01-26 17:02:42 +00:00
Eli Zaretskii
8cfb4e35da ; Fix last change
* lisp/disp-table.el (display-table-slot)
(set-display-table-slot):
* etc/NEWS:
* doc/lispref/display.texi (Display Tables): Fix punctuation and
typos.
2025-01-26 17:50:34 +02:00
Gerd Möllmann
4e78a3e117 Display separators on tty menus with display table entries
* src/xdisp.c (display_tty_menu_separator): Lookup separator char in
standard-display-table, make a string, and display that using
display_string.
* src/xdisp.c (display_tty_menu_separator_char): New function.
(display_tty_menu_separator): Use it.
* lisp/disp-table.el (display-table): Increase from 12 to 18.
(box-double-vertical, box-double-horizontal, box-double-down-right)
(box-double-down-left, box-double-up-right, box-double-up-left): New
symbols for extra slots.
(display-table-slot, set-display-table-slot): Change doc string.
(describe-display-table): Describe new slots.
(standard-display-unicode-special-glyphs): Define new slots.
* src/disptab.h (DISP_TABLE_P): Add enumerators.
(DISP_TABLE_EXTRA_SLOTS): Define based on enum box.
* src/dispnew.c (produce_box_glyphs): Add new enumerators to switch to
make it exhaustive.
* src/xdisp.c (display_tty_menu_separator): Use BOX_DOUBLE_HORIZONTAL
for '=' if present.
* doc/lispref/display.texi: Add documentation.
* etc/NEWS: Mention in NEWS.
2025-01-26 16:41:01 +01:00
Tassilo Horn
01d93d56cd Use dired--inhibit-auto-revert for fixing bug#71264
The original fix bound auto-revert-mode to nil which had the side-effect
of disabling auto-revert forever in this buffer because
auto-revert-handler removes the buffer from auto-revert-buffer-list when
it's called but auto-revert-mode is nil.

* lisp/dired.el (dired-internal-do-deletions): Bind
dired--inhibit-auto-revert during deletion (bug#71264).
2025-01-26 09:44:59 +01:00
Gerd Möllmann
35d3927859 Change doc string of frame-visible-p
* src/frame.c (Fframe_visible_p): Don't say it always returns t for tty
frames.
2025-01-25 21:20:55 +01:00
Gerd Möllmann
85aec497c7 Replace is_frame_ancestor with frame_ancestor_p
* src/dispnew.c (is_frame_ancestor): Removed.
(frame_z_order_cmp): Use frame_ancestor_p.
(copy_child_glyphs): Ditto.
* src/dispextern.h: Declaration removed.
* src/term.c (mouse_get_xy): Use frame_ancestor_p.
2025-01-25 20:00:56 +01:00
Juri Linkov
63df216490 Add 'treesit-forward-comment' with 'forward-comment-function'
* lisp/treesit.el (treesit-forward-comment): New function.
(treesit-major-mode-setup): Set 'forward-comment-function' to
'treesit-forward-comment' if the 'comment' thing is defined.

* src/syntax.c (forward-comment-function): New variable.
(Fforward_comment): Call the function from 'forward-comment-function'
when it's non-nil (bug#75609).
2025-01-25 20:14:15 +02:00
Juri Linkov
3bc6b88cc7 * lisp/treesit.el: Display treesit-explore buffer below selected window.
(treesit-explorer-switch-parser, treesit-explore):
Use display-buffer-below-selected for display-buffer (bug#75079).
2025-01-25 19:59:56 +02:00
Stefan Monnier
2c1edf5f62 doc/lispref/modes.texi (Syntactic Font Lock): Update for commit 644c6b414f
Remove outdated `nil` element, as discussed in
https://lists.gnu.org/archive/html/help-gnu-emacs/2025-01/msg00244.html
2025-01-25 10:48:38 -05:00
Stefan Monnier
442d04081b (when-let*): Warn if body is empty
* lisp/subr.el (when-let*): Warn if body is empty.
* lisp/textmodes/tex-mode.el (xref-backend-references): Fix use of
`when-let*`.
2025-01-25 10:40:25 -05:00
Eli Zaretskii
6016967e85 Merge from origin/emacs-30
67903f5909 Restore the old behavior of `bookmark-write-file'
062da7003f ; Improve prompts and error messages in 'info-look'
52dc01f1c8 ; * admin/admin.el (set-version): Note about Android.
fb282da2a0 Avoid double spaces around abbrevations in Texinfo
bc1ab8ac3d ; * doc/emacs/custom.texi (Init Rebinding): Fix spacing.
b41ef43af1 ; Fix previous change
5638b1d6bd Ispell: Use "personal dictionary" terminology consistently
cc791e7499 ; Check man pages for mistakes less frequently
4ed4792e3b ; * admin/release-process: Minor copy-edits.
4a867c823b Add language server "ruff server" for Python
9e687c2871 Fix go-ts-mode type declaration indentation (Bug#75785)
f751b3afa4 ; Minor improvements for doc strings in map.el
cda78edc7d ; Fix typos
ce50a1d3c1 ; * src/w32.c (w32_memory_info): Fix coding style of last...
58d3d4820a Fix bug in w32_memory_info
7738641205 Avoid crashes in redisplay due to problematic font setups
0e3687e600 Improve 'key-valid-p' docstring
9878092d2b Minor copyedits in internals.texi
4726900fdc Better document side-effect free and pure C functions
04c475a39f ; Fix documentation about faces of tool-tip text

# Conflicts:
#	admin/codespell/codespell.exclude
2025-01-25 10:06:19 -05:00
Eli Zaretskii
e8f173f0ba ; * src/term.c (handle_one_term_event): Fix last change. 2025-01-25 16:59:40 +02:00
Zhengyi Fu
67903f5909 Restore the old behavior of `bookmark-write-file'
* lisp/bookmark.el (bookmark-write-file): Use 'pp-28' to avoid
filling the bookmarks.  (Bug#75775)

Copyright-paperwork-exempt: yes
2025-01-25 15:57:09 +02:00
Gerd Möllmann
1d08644116 Fix the mistake that led to the reverts
* src/terminal.c (raw_cursor_to): Fix reversed arguments.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
20f2672377 Reapply "Multi-tty: selected frame can be a GUI frame"
This reverts commit d93d822285.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
ccf3f8d21e Reapply "Fix mouse position handling for nested tty child frames"
This reverts commit e2cc52dbcd.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
e839b83c82 Reapply "Fix tty-frame-at for nested tty child frames"
This reverts commit 9ad28959d6.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
26b144f241 Reapply "Fix cursor positioning of nested tty child frames"
This reverts commit 65036323fc.
2025-01-25 14:46:05 +01:00
Gerd Möllmann
945ed044cd Reapply "Simplify absolute (x, y) computation on ttys"
This reverts commit 13fdcd730f.
2025-01-25 14:46:05 +01:00
Mauro Aranda
d4220a17c4 Delete all overlays that belong to an editable-field
* lisp/wid-edit.el (widget-specify-field): Store the end overlay
that we sometimes create for an editable-field widget.
(widget-field-value-delete): Make sure we delete all overlays
that belong to the widget.  (Bug#75646)

* test/lisp/wid-edit-tests.el (widget-test-delete-field-overlays): New
test.
2025-01-25 15:40:01 +02:00
Konstantin Kharlamov
0514619b2c python-mode: add 'exit' and 'quit' to the list of block-enders
'exit()' and 'quit()' end the current codeflow, there can't be
any code past it, similarly to 'return', 'continue', etc.  So
when calculating indentation for the line next to 'exit()',
'os.exit()', 'os._exit()', 'sys.exit()' and 'quit()', decrease
the indentation level.
* /lisp/progmodes/python.el (python-rx): Add 'exit()', 'os.exit()',
'os._exit()', 'sys.exit()', 'quit' to the list of block-enders.
(Bug#75729)
2025-01-25 12:51:27 +02:00
Maxim Cournoyer
192355e54a lisp: Introduce a `lisp-fill-paragraph-as-displayed' variable.
Starting with Emacs 28, filling strings now happens in a
narrowed scope, and looses the leading indentation and can cause
the string to extend past the fill-column value.  Introduce
`lisp-fill-paragraph-as-displayed' as a new variable allowing
opting out of this new behavior in specific scenarios (such as
when using the Scheme major mode, say).

* lisp/emacs-lisp/lisp-mode.el
(lisp-fill-paragraph-as-displayed): New variable.
(lisp-fill-paragraph): Honor it, by avoiding the logic narrow to
strings before applying fill-paragraph.
* test/lisp/emacs-lisp/lisp-mode-tests.el
(lisp-fill-paragraph-respects-fill-column): Test it.
(lisp-fill-paragraph-docstring-boundaries): New test, as a
safeguard to avoid regressions.

Fixes: bug#56197
2025-01-25 12:17:32 +02:00
Mauro Aranda
d4ca688abe Avoid error with empty search string in Customize
* lisp/cus-edit.el (custom-buffer-create-internal): Only call
customize-apropos if the string is not empty.  (Bug#75714)
2025-01-25 12:14:44 +02:00