Paul Eggert [Thu, 25 Jul 2024 06:32:24 +0000 (23:32 -0700)]
Fix process-attributes rss and pmem on GNU/Linux
Problem reported by Rahguzar <https://bugs.gnu.org/72278>.
* src/sysdep.c (system_process_attributes):
[GNU_LINUX || CYGWIN || __ANDROID__]: When computing rss and pmem,
don’t assume pagesize is 4096; it could be greater.
Manuel Giraud [Tue, 23 Jul 2024 14:32:30 +0000 (16:32 +0200)]
bug#72241: 31.0.50; [PATCH] Use a dedicated buffer for `doc-view-open-text'
Here is an updated version of this patch. WDYT?
From 6e32534012cafeda1d7e67aab23a8206bc887c9f Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Sun, 21 Jul 2024 18:52:52 +0200
Subject: [PATCH] Use a dedicated buffer for `doc-view-open-text'
* lisp/doc-view.el (doc-view-open-text): Create a new "text
contents" buffer and switch to it.
(doc-view-toggle-display): Switch back to the document buffer
and kill the "text contents" one.
* etc/NEWS: Mention the change.
Andrea Corallo [Wed, 24 Jul 2024 12:08:31 +0000 (14:08 +0200)]
Add some basic checking for function type declarations
* lisp/emacs-lisp/byte-run.el (byte-run--anonymize-arg-list): New function.
(byte-run--set-function-type): Add some basic checking for
the function type being declared.
Michael Albinus [Wed, 24 Jul 2024 13:27:58 +0000 (15:27 +0200)]
Adapt Tramp tests
* test/lisp/net/tramp-archive-tests.el (ert-resource-directory-format)
(ert-resource-directory-trim-left-regexp)
(ert-resource-directory-trim-right-regexp, ert-resource-directory)
(ert-resource-file): Don't define.
(tramp-archive--test-emacs28-p): Remove.
(top): Remove unneeded skips. Use original objects instead of
their `tramp-compat-' counterparts when possible.
* test/lisp/net/tramp-tests.el (seq): Don't require.
(lock-file-name-transforms, process-file-return-signal-string)
(remote-file-name-inhibit-locks, dired-copy-dereference): Don't declare.
(ert-resource-directory-format)
(ert-resource-directory-trim-left-regexp)
(ert-resource-directory-trim-right-regexp, ert-resource-directory)
(ert-resource-file): Don't define.
(tramp--test-emacs28-p): Remove.
(top): Remove unneeded skips. Use original objects instead of
their `tramp-compat-' counterparts when possible.
Po Lu [Wed, 24 Jul 2024 03:38:54 +0000 (11:38 +0800)]
Fix bug#72255
* src/image.c (struct image_type): Minor grammatical
corrections.
(image_destroy_x_image): [HAVE_NS]: Do not release
Emacs_Pix_Containers, which are identical to Emacs_Pixmaps and
consequently always released with the `struct image'.
(bug#72255)
Juri Linkov [Tue, 23 Jul 2024 17:51:43 +0000 (20:51 +0300)]
* lisp/isearch.el: Preserve original value of overriding-terminal-local-map.
(isearch--saved-local-map): New variable (bug#72229).
(isearch-mode): Set isearch--saved-local-map to
overriding-terminal-local-map.
(isearch-done): Set overriding-terminal-local-map back to
isearch--saved-local-map.
(isearch-mouse-2): Let-bind overriding-terminal-local-map to
isearch--saved-local-map.
(isearch-done): Move comment intended to be docstring to docstring.
Stefan Kangas [Mon, 22 Jul 2024 16:04:30 +0000 (18:04 +0200)]
; Fix typo in use-package.texi
* doc/misc/use-package.texi (Getting Started): Fix typo.
Problem reported by GitHub user Paul Jensen (psnj) in:
https://github.com/jwiegley/use-package/pull/1070/
Alan Mackenzie [Mon, 22 Jul 2024 12:24:43 +0000 (12:24 +0000)]
FIx spurious fontification of variable in Java Mode
This fixes bug#72126.
* lisp/progmodes/cc-engine.el (c-forward-<>-arglist): Remove
tentative type identifier from c-record-type-identifiers should
it turn out not to be a type.
Stefan Kangas [Sun, 21 Jul 2024 15:46:12 +0000 (17:46 +0200)]
Fix punctuation and doc style in treesit.c
* src/treesit.c (Ftreesit_parser_included_ranges)
(Ftreesit_query_capture, treesit_traverse_sibling_helper)
(treesit_traverse_match_predicate): Fix punctiation and documentation
style in comments and docstrings.
Don't highlight matches in dired query-replace commands
* lisp/dired-aux.el (dired-do-query-replace-regexp)
(dired-do-replace-regexp-as-diff)
(dired-do-find-regexp-and-replace): Turn off lazy highlighting
when reading the regexp from the user to avoid highlighting
regexp matches in the dired buffer. (bug#72147)
*
lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules,
tsx-ts-mode--font-lock-compatibility-bb1f97b,
tsx-ts-mode--font-lock-compatibility-function-expression,
tsx-ts-mode--font-lock-compatibility-function-expression,
typescript-ts-mode--font-lock-settings): Use the new helper.
Paul Eggert [Sat, 20 Jul 2024 22:52:05 +0000 (15:52 -0700)]
Fix bool vector length overflow
* src/alloc.c (make_clear_bool_vector): It’s now the caller’s
responsibility to make sure the bool vector length is in range.
Add an eassert to double-check this. This lets some locals be
ptrdiff_t not EMACS_INT.
(Fmake_bool_vector, Fbool_vector):
Check that bool vector lengths are in range.
* src/lisp.h (BOOL_VECTOR_LENGTH_MAX): New macro.
(bool_vector_words, bool_vector_bytes): Avoid undefined
behavior if size == EMACS_INT_MAX - (BITS_PER_BITS_WORD - 1).
This is mostly theoretical but it’s easy to do it right.
* src/lread.c (read_bool_vector): Use EMACS_INT, not just ptrdiff_t.
Check that length doesn’t exceed BOOL_VECTOR_LENGTH_MAX.
This fixes an unlikely integer overflow where the calculated size
went negative.
Paul Eggert [Sat, 20 Jul 2024 16:03:24 +0000 (09:03 -0700)]
Change list-length intptr_t to ptrdiff_t
* src/fns.c (list_length, Fsafe_length, Fproper_list_p):
Use ptrdiff_t not intptr_t for accumulator, since result is ptrdiff_t.
This fixes a minor glitch in 2019-01-11T05:35:31!eggert@cs.ucla.edu
where I removed unnecessary overflow checks but forgot to change types.
This change should alter generated code only on oddball platforms where
ptrdiff_t is narrower than intptr_t, e.g., CheriBSD.
Yuan Fu [Sat, 20 Jul 2024 20:56:32 +0000 (13:56 -0700)]
Support dumping tree-sitter query (bug#69952)
Previous commit allows Emacs to dump tree-sitter queries by simply
dumping the query string and language symbol, and left the query object
and cursor object as NULL. This commit makes sure Emacs doesn't crash
when loading the dumped query, by make sure Emacs can handle the case
where the cursor is NULL.
* src/treesit.c (make_treesit_query): Initialize query with null cursor.
(treesit_ensure_query_cursor): New function.
(treesit_initialize_query): Ensure cursor is non-null.
* src/treesit.h (Lisp_TS_Query): Update documentation.
Paul Eggert [Sat, 20 Jul 2024 15:52:55 +0000 (08:52 -0700)]
SAFE_ALLOCA fixes
* src/comp.c (declare_imported_func, emit_simple_limple_call)
(declare_lex_function, compile_function):
* src/emacs-module.c (funcall_module):
* src/fns.c (Fstring_distance):
* src/font.c (font_sort_entities):
* src/haikumenu.c (digest_menu_items, haiku_menu_show):
* src/pgtkselect.c (Fpgtk_register_dnd_targets):
* src/xfns.c (Fx_begin_drag):
* src/xmenu.c (x_menu_show):
* src/xterm.c (x_dnd_compute_toplevels, handle_one_xevent)
(x_term_init):
Prefer SAFE_NALLOCA to doing size multiplication by hand, to catch
unlikely integer overflows.
* src/comp.c (emit_simple_limple_call): Fix bug where
SAFE_FREE was called too early, leading to unlikely
use of freed storage.
* src/xterm.c (handle_one_xevent): Remove side effects
from SAFE_ALLOCA args, as the args are evaluated twice.
James Thomas [Tue, 16 Jul 2024 01:34:23 +0000 (07:04 +0530)]
; * doc/misc/gnus.texi (Agent Caveats): Fix doc
* doc/misc/gnus.texi (Agent Caveats): Change doc due to commit
2020-10-16 "Add a new variable to control Gnus Agent caching"
(41d220dc6085, bug#43356). (Bug#72134)
Paul Eggert [Sat, 20 Jul 2024 07:17:14 +0000 (00:17 -0700)]
Avoid accessing uninitialized bool_vector words
Although loading uninitialized works from memory and then ignoring
the result works fine on conventional architectures, it
technically has undefined behavior in C, so redo bool_vector
allocation so that the code never does that. This can improve
performance when allocating large vectors of nil, since calloc can
clear the memory lazily.
* src/alloc.c (make_clear_bool_vector): New function,
a generalization of make_uninit_bool_vector.
(make_uninit_bool_vector): Use it.
(Fmake_bool_vector): If !INIT, rely on make_clear_bool_vector.
* src/alloc.c (Fbool_vector):
* src/fns.c (Freverse): Don’t access uninitialized bool_vector words.
* src/xdisp.c (Fremember_mouse_glyph) [CONVERT_TO_EMACS_RECT]:
Expand CONVERT_TO_EMACS_RECT to convert native rectangles into
a readable format if required. Reported by Stefan Kangas
<stefankangas@gmail.com>.
Po Lu [Sat, 20 Jul 2024 03:28:47 +0000 (11:28 +0800)]
Respect mouse-fine-graned-tracking in touch screen simple translation
* lisp/touch-screen.el (touch-screen-current-tool): Expand doc
string.
(touch-screen-handle-point-update): Record extents of glyph
beneath the mouse as computed by `remember_mouse_glyph' if
necessary, and defer generation of mouse-movement events till
the mouse exit it.
* src/xdisp.c (Fremember_mouse_glyph): New function.
(syms_of_xdisp): Define new subr.
Paul Eggert [Fri, 19 Jul 2024 20:39:21 +0000 (13:39 -0700)]
Work around GCC bug 58416 on 32-bit x86
* configure.ac (C_SWITCH_MATCHINE): On 32-bit x86 with GCC 4+,
append -mfpmath=sse (if SSE2 is known to work) or -fno-tree-sra
(otherwise) to work around GCC bug 58416.
* etc/NEWS: Mention this.
Paul Eggert [Fri, 19 Jul 2024 19:44:35 +0000 (12:44 -0700)]
In ‘INSTALL’ put configure vars in one section
* INSTALL: Move description of CFLAGS etc. into the section headed
“Here is a complete list of the variables you may want to set”
since they are also variables one might want to set.
Jim Porter [Fri, 19 Jul 2024 16:34:03 +0000 (09:34 -0700)]
Don't set exit info in Eshell if the command is being piped elsewhere
Previously, the exit info in Eshell was that of the last command that
finished, rather than the last command in a pipeline.
* lisp/eshell/esh-cmd.el (eshell-exec-lisp)
(eshell-lisp-command): Check whether the command is being piped.
* lisp/eshell/esh-proc.el (eshell-gather-process-output): Record whether
the command is being piped...
(eshell-sentinel): ... and do the right thing with that info.
* test/lisp/eshell/esh-proc-tests.el
(esh-proc-test/sigpipe-exits-process): Check the exit status to ensure
we don't report the first process's SIGPIPE exit.
Jim Porter [Tue, 24 Jan 2023 01:21:57 +0000 (17:21 -0800)]
Split out exit code parts of 'eshell-close-handles' into a new function
* lisp/eshell/esh-cmd.el (eshell-last-command-status)
(eshell-last-command-result): Move here from esh-io.el.
(eshell-set-exit-info): New function, extracted from
'eshell-close-handles'.
* lisp/eshell/esh-io.el (eshell-close-handles): Make old calling
convention obsolete. Update callers to use 'eshell-set-exit-info' as
needed.
* lisp/play/gamegrid.el (gamegrid-add-score-insecure): Move point to
the score just added, or end of buffer if the new score did not make
the list. This makes it easier to see where the last game
ranked. (Bug#72185)