Sean Whitton [Fri, 23 Dec 2022 03:54:08 +0000 (20:54 -0700)]
vc-git-checkin: Stash other staged changes
* lisp/vc/vc-git.el (vc-git--stash-staged-changes): New function.
(vc-git-checkin): Use new function to avoid needing to unstage changes
unrelated to the patch we want to commit (bug#60126).
Eli Zaretskii [Fri, 23 Dec 2022 14:41:08 +0000 (16:41 +0200)]
Fix "C-h k" in recursive minibuffers
* lisp/subr.el (event--posn-at-point): Leave POSN alone if it
doesn't have at least 6 members. This follows more faithfully
what 'event-start' and 'event-end' did before they started using
this function, see commit c1cead89f5f. Call posn-at-point with
the minibuffer-window when in the minibuffer. (Bug#60252)
Stefan Kangas [Fri, 23 Dec 2022 05:30:12 +0000 (06:30 +0100)]
Merge from origin/emacs-29
0754173c923 ; Fix docstring 014232d3840 Eglot: eglot--servers-by-xrefed-file doesn't need to be v... bbe35c280c2 Prevent stale servers when using eglot-extend-to-xref 9bf13a3fb9e ; * src/alloc.c (Fmemory_info): Doc fix. baa33a5c054 * etc/tutorials/TUTORIAL.cn: Fix typos. (Bug#60221) 98d7f76b451 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... a488a6870ac Add alias for removed font-lock function 02e046566e2 Set beginning/end-of-defun-function in treesit-major-mode... 7dea58b88db Add treesit-defun-at-point and fix c-ts-mode-indent-defun 69123d4aa4e ; Fix treesit--defuns-around 05d8310fb5d Use the new keyword ':repeat' in repeatable keymaps.
Jim Porter [Tue, 20 Dec 2022 21:47:20 +0000 (13:47 -0800)]
Simplify handling of /dev/null redirection in Eshell
This also fixes an issue where "echo hi > foo > /dev/null" didn't
write to the file "foo". (Note that users can still use their
system's null device name when redirecting; Eshell doesn't need to do
anything special to support that.)
* test/lisp/eshell/em-extpipe-tests.el (em-extpipe-tests--deftest):
Skip over the newly-added 'eshell-with-copied-handles' form when
checking the parse results.
Jim Porter [Tue, 20 Dec 2022 06:21:10 +0000 (22:21 -0800)]
Add 'eshell-duplicate-handles' to return a copy of file handles
* lisp/eshell/esh-io.el (eshell-create-handles): Support creating with
multiple targets for stdout and/or stderr. Make the targets for a
handle always be a list, and store whether the targets are the default
in a separate 'default' field.
(eshell-protect-handles, eshell-close-handles)
(eshell-copy-output-handle, eshell-interactive-output-p)
(eshell-output-object): Update for changes in 'eshell-create-handles'.
(eshell-duplicate-handles, eshell-get-targets): New functions.
* lisp/eshell/esh-cmd.el (eshell-copy-handles): Rename and alias to...
(eshell-with-copied-handles): ... this function, and use
'eshell-duplicate-handles'.
(eshell-execute-pipeline): Use 'eshell-duplicate-handles'.
Michael Albinus [Thu, 22 Dec 2022 15:46:00 +0000 (16:46 +0100)]
Update Tramp version (don't merge with master)
* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.6.0.29.1".
(customize-package-emacs-version-alist):
Adapt Tramp version integrated in Emacs 29.1.
João Távora [Thu, 22 Dec 2022 11:29:49 +0000 (11:29 +0000)]
Prevent stale servers when using eglot-extend-to-xref
A weak-valued hash-table is not enough to guarantee that a reference
to a zombie server in eglot--servers-by-xrefed-file variable won't
survive long enough to confuse the next call to eglot--current-server
in some buffers.
So, before this fix it was common to get "Process EGLOT ... not
running" errors if some xref-extended buffers (like system libraries)
were open and M-x eglot-reconnect was issued. This should be
prevented now.
Note however, that even after this the eglot-extend-to-xref logic is
still flawed. For example, if a buffer for the xref-extended buffer
happens to be already visited by the time M-. is issued to navigate to
it, Eglot won't be activated. A half-decent workaround is to kill the
buffer and re-visit it.
* lisp/progmodes/eglot.el (eglot--servers-by-xrefed-file): Move
up.
(eglot--on-shutdown): Make sure to cleanup
eglot--servers-by-xrefed-file.
Stefan Kangas [Thu, 22 Dec 2022 05:30:09 +0000 (06:30 +0100)]
Merge from origin/emacs-29
e59216d3be8 * Invoke spawed Emacs processes with '-Q' when native com... 777b383dd0f Fix Eshell electric slash when used from the root directo... c088cdad9e9 Fix the --without-all build with tree-sitter ec9fbad908d Fix write-region to null device on MS-Windows f35da111990 message: Do not default to eudc-capf-complete yet 98c16a8c883 ; * lisp/tab-bar.el: Remaining renaming of "fixed-width" ... d76d7a3bebf whitespace: Avoid mutating original buffer's markers in c...
Jim Porter [Wed, 21 Dec 2022 00:20:50 +0000 (16:20 -0800)]
When redirecting in Eshell, check for "/dev/null" specifically
This is so that users can type "cmd ... > /dev/null" in Eshell no
matter what their system's null device is called. (Users can still
use their system's null device name when redirecting, too. Eshell
doesn't need to do anything special to support that.) This partially
reverts 67a8bdb90c9b5865b7f17290c7135b1a5458c36d. See bug#59545.
Do not merge to master.
* lisp/eshell/esh-io.el (eshell-set-output-handle): Use "/dev/null"
literally.
Eli Zaretskii [Wed, 21 Dec 2022 19:23:51 +0000 (21:23 +0200)]
Fix write-region to null device on MS-Windows
* src/fileio.c (write_region) [WINDOWSNT]: Ignore EBADF errors
from fsync -- this means fsync is not supported for this file.
Happens, for example, with the null device. (Bug#59545)
Richard Hansen [Tue, 13 Dec 2022 06:33:43 +0000 (01:33 -0500)]
whitespace: Avoid mutating original buffer's markers in clones
* lisp/whitespace.el (whitespace--clone): New hook function that is
run after cloning a buffer that copies `whitespace-bob-marker' and
`whitespace-eob-marker' and changes the copies to point to the new
buffer (Bug#59618).
(whitespace-color-on): Register the hook function.
(whitespace-color-off): Unregister the hook function.
* test/lisp/whitespace-tests.el
(whitespace-tests--with-test-buffer): New macro.
(whitespace-tests--check-markers): New function.
(whitespace-tests--indirect-clone-breaks-base-markers)
(whitespace-tests--indirect-clone-markers)
(whitespace-tests--regular-clone-markers): New tests.
* lisp/net/soap-client.el (soap-validate-xs-basic-type):
`byte[]` is read as the two Lisp values `byte` and `[]` but here the
symbol `byte[]` is intended: the brackets need escaping.
Charl P. Botha [Sat, 10 Dec 2022 17:09:38 +0000 (19:09 +0200)]
Fix empty pairs in js tree-sitter imenu alist (bug#59945)
The current js--treesit-imenu, used by the JavaScript, TypeScript and
TSX tree-sitter modes, would return empty pairs in the imenu alist if
there were none of that type of symbol.
This would break both the built in imenu and also packages like
consult-imenu.
See https://github.com/minad/consult/issues/697 for the discussion
there.
Sean Whitton [Fri, 16 Dec 2022 18:28:20 +0000 (11:28 -0700)]
vc-git-checkin: Offer to unstage conflicting changes
* lisp/vc/vc-git.el (vc-git-checkin): When committing a patch, if
conflicting changes are already staged, offer to clear them, instead
of just immediately failing with "Index not empty" (bug#60126).
Juri Linkov [Tue, 20 Dec 2022 17:22:15 +0000 (19:22 +0200)]
* lisp/repeat.el: Fix repeat-keep-prefix to allow customizing it to non-nil.
* lisp/repeat.el (repeat-keep-prefix): Add or remove
'repeat-pre-hook' depending on the customized value.
(repeat-mode): Add or remove 'repeat-pre-hook' to/from
'pre-command-hook' when 'repeat-keep-prefix' is non-nil.
(repeat-pre-hook): New function.
(repeat-get-map, repeat-check-map): New function refactored from
'repeat-post-hook'.
(repeat-post-hook): Move some code to smaller functions.
(describe-repeat-maps): Set outline-regexp without ^L.
* test/lisp/repeat-tests.el (repeat-tests-keep-prefix):
Uncomment test case that is fixed now in bug#51281 and bug#55986.
Stefan Kangas [Tue, 20 Dec 2022 05:13:23 +0000 (06:13 +0100)]
; Fix typos in some function names
* lisp/cedet/semantic/decorate/include.el
(semantic-decoration-unparsed-include-reference-reset): Rename
from 'semantic-decoration-unparsed-include-refrence-reset'.
* lisp/emacs-lisp/rx.el (rx--normalize-or-arg): Rename from
'rx--normalise-or-arg'.
* lisp/frame.el (frame--current-background-mode): Rename from
'frame--current-backround-mode'.
* lisp/url/url-future.el (url-future-canceled-p): Rename from
'url-future-cancelled-p'. Update all uses. Make old names into
obsolete function aliases.
Sean Whitton [Sat, 17 Dec 2022 05:34:52 +0000 (22:34 -0700)]
vc-prepare-patch: Number the attached patches
* lisp/gnus/mml.el (mml-attach-buffer): New FILENAME argument.
* lisp/vc/vc.el (vc--subject-to-file-name): New function.
(vc-prepare-patch): When vc-prepare-patches-separately is nil,
generate file names for the attached patches.
Call vc--subject-to-file-name, and then prepend numbers indicating the
ordering of the patches (bug#60147).
Dmitry Gutov [Mon, 19 Dec 2022 19:01:27 +0000 (21:01 +0200)]
ruby-method-params-indent: New user option
* lisp/progmodes/ruby-mode.el (ruby-method-params-indent):
New option (bug#60110).
(ruby-smie-rules): Use it.
* etc/NEWS: Mention it.
* test/lisp/progmodes/ruby-mode-resources/ruby.rb:
Ensure the var's value is default.
* test/lisp/progmodes/ruby-mode-resources/ruby-method-params-indent.rb:
New file.
* test/lisp/progmodes/ruby-mode-tests.el (ruby-deftest-indent):
New macro, use it to run the indentation test using the new file.
Disable the :expensive-test tag, because neither runs for "longer
than some few seconds", both take significantly below 1s.
Eli Zaretskii [Mon, 19 Dec 2022 17:01:04 +0000 (19:01 +0200)]
Fix storing email into nnmail by Gnus
* lisp/gnus/nnml.el (nnml--encode-headers): Wrap
'rfc2047-encode-string' calls with 'ignore-errors', to avoid
disrupting email workflows due to possibly-invalid headers.
Reported by Florian Weimer <fweimer@redhat.com>.
* lisp/subr.el (called-interactively-p): Remove attempt to detect
`byte-code` frames; it wasn't done right but also does not seem
to be necessary. Adjust comment that was out of date.
F. Jason Park [Mon, 12 Dec 2022 03:16:07 +0000 (19:16 -0800)]
; Really respect browse-url var in erc-compat
* lisp/erc/erc-compat.el: Do what was supposed to be done by 75f26646d4a569cfb485de4baddcda66ff44b2c3 "; Be nicer when updating
browse-url var in erc-compat". This is the less harmful version of
that patch (from bug#59976#8) but without the cl-lib requirement since
users may not want to load the main ERC library right away.
* lisp/erc/erc.el: Clarify some comments regarding the core API.
Richard Hansen [Mon, 19 Dec 2022 04:04:00 +0000 (23:04 -0500)]
whitespace: Fix unintended change in buffer modification status
* lisp/whitespace.el (whitespace--empty-at-bob-matcher)
whitespace--empty-at-eob-matcher, whitespace--update-bob-eob):
Silently add the `font-lock-multiline' text property when
highlighting beginning-of-buffer and end-of-buffer empty lines
to prevent Emacs from running modification hooks or considering
the buffer to be modified (Bug#60066).
* test/lisp/whitespace-tests.el
(whitespace-tests--empty-bob-eob-modified): Add a regression test.
Vibhav Pant [Mon, 19 Dec 2022 12:34:05 +0000 (18:04 +0530)]
Add support for additional memory checks using AddressSanitizer.
When Emacs is compiled with AddressSanitizer support, enable
poisoning/unpoisoning freed/unused Lisp objects and other internal
memory management structures. If enabled, this will mark freed bytes
that have been put on free lists for future use and initially
allocated memory blocks/chunks as "poisoned", triggering an ASan error
if they are accessed improperly. Structures are unpoisoned when they
have been taken off their respective free lists. Additionally, add
optional macros for performing unaligned loads, which when enabled by
defining USE_SANITIZER_UNALIGNED_LOAD will use ASan provided functions
for loading from unaligned addresses, which may help catch bugs that
AddressSanitizer might otherwise miss.
* configure.ac: Check for the existence of address and common
sanitizer API headers.
* src/lisp.h (UNALIGNED_LOAD_SIZE): New macro. If enabled, and the
necessary sanitizer API is available, define it to
__sanitizer_unaligned_load(64|32) depending on the word size of the
architecture.
* src/fns.c [HAVE_FAST_UNALIGNED_ACCESS] (Fstring_lessp): Use
'UNALIGNED_LOAD_SIZE' to perform unaligned loads from the two strings.
* src/alloc.c (ASAN_POISON_ABLOCK, ASAN_UNPOISON_ABLOCK)
(ASAN_POISON_INTERVAL_BLOCK, ASAN_UNPOISON_INTERVAL_BLOCK)
(ASAN_POISON_INTERVAL, ASAN_UNPOISON_INTERVAL)
(ASAN_PREPARE_DEAD_SDATA, ASAN_PREPARE_LIVE_SDATA)
(ASAN_POISON_SBLOCK_DATA, ASAN_POISON_STRING_BLOCK)
(ASAN_UNPOISON_STRING_BLOCK, ASAN_POISON_STRING)
(ASAN_UNPOISON_STRING, ASAN_POISON_FLOAT_BLOCK)
(ASAN_UNPOISON_FLOAT_BLOCK, ASAN_POISON_FLOAT)
(ASAN_UNPOISON_FLOAT, ASAN_POISON_CONS_BLOCK)
(ASAN_POISON_CONS, ASAN_UNPOISON_CONS)
(ASAN_POISON_VECTOR_CONTENTS, ASAN_UNPOISON_VECTOR_CONTENTS)
(ASAN_UNPOISON_VECTOR_BLOCK, ASAN_POISON_SYMBOL_BLOCK)
(ASAN_UNPOISON_SYMBOL_BLOCK, ASAN_POISON_SYMBOL)
(ASAN_UNPOISON_SYMBOL) [ADDRESS_SANITIZER]: New macros. When
address sanitization is enabled, define them to poison/unpoison
objects.
(lisp_align_malloc): Poison newly allocated blocks on `free_ablock',
unpoison ablocks taken from it respectively.
(lisp_align_free): Poison individual ablocks when they are put on the
free list, unpoison them when an entire `ablocks' chunk is being
freed.
(make_interval): Poison interval blocks on initial allocation,
unpoison individual intervals on allocation and removal from
`interval_free_list'.
(sweep_intervals): Unpoison interval blocks before sweeping, poison
dead/unmarked intervals.
(allocate_string): Poison string blocks on initial allocation,
unpoison Lisp_Strings on removal from the free list.
(allocate_string_data): Poison `sblock' data on initial allocation,
unpoison individual `sdata' contents on allocation or removal from the
free list. Call `ASAN_PREPARE_LIVE_SDATA' on the new `sdata' struct.
(sweep_strings): Unpoison string blocks before sweeping them,
poisoning dead strings and their sdata afterwards.
(compact_small_strings): Call `ASAN_PREPARE_LIVE_DATA' on the `sdata'
to where compacted strings to moved to.
(pin_string): Call `ASAN_PREPARE_DEAD_SDATA' on `old_sdata'.
(make_float): Poison float blocks on allocation, unpoisoning
individual Lisp_Floats on allocation or removal from
`float_free_list'.
(sweep_floats): Unpoison float blocks before sweeping, poison
dead/unmarked floats.
(free_cons): Poison `ptr'.
(Fcons): Poison cons blocks on allocation, unpoisoning individual
Lisp_Cons on allocation or removal from `cons_free_list'.
(sweep_conses): Poison dead/unmarked conses.
(setup_free_list): Poison vectors put on `vector_free_lists'.
(allocate_vector_from_block): Unpoison vectors taken from the free
list, poison excess vector bytes when vectors allocated from the free
list are larger than requested.
(sweep_vectors): Unpoison vector blocks before sweeping them.
(Fmake_symbol): Poison symbol blocks on initial allocation,
unpoisoning individual Lisp_Symbols on allocation or removal from
`symbol_free_list'.
(sweep_symbols): Unpoison symbol blocks before sweeping, poisoning
dead/unmarked symbols.
(live_string_holding, live_cons_holding, live_symbol_holding)
(live_float_holding): When compiling with address sanitization and GC
poisoning enabled, return NULL if the passed address is poisoned, or
if the Lisp object it resides in is poisoned, avoiding a
use-after-poison trigger if these functions are called on a pointer
that might be referring to a now dead/swept object.
* etc/DEBUG: Add information about enabling ASan memory poisoning.
* lisp/cedet/semantic/complete.el (semantic-displayer-show-request):
* lisp/descr-text.el (describe-char-categories):
* lisp/mh-e/mh-identity.el (mh-select-identity):
* lisp/transient.el (transient--delay-post-command)
(transient--post-command):
* lisp/vc/vc-git.el (vc-git-create-tag):
* test/lisp/emacs-lisp/cl-lib-tests.el
(cl-lib-nth-value-test-multiple-values):
* lisp/emulation/viper-cmd.el (viper-preserve-cursor-color):
Use `equal` instead of `eq` and `member` instead of `memq` where
the comparison is with literals without guaranteed identity.
In some cases this change corrects evident bugs, in others it is
mostly cosmetic.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-if):
Remove explicit clauses purposing to simplify
(if X nil t) -> (not X)
(if X t nil) -> (not (not X))
but never did so because of a coding mistake (eq instead of equal),
found by a recently added warning. They weren't actually needed
thanks to the optimiser's fixpoint iteration: we eventually get the
same results through
(if X nil t) -> (if (not X) t nil) -> (if (not X) t) -> (not X)
(if X t nil) -> (if X t) -> (not (not X))
* lisp/emacs-lisp/gv.el (alist-get):
Evaluate TESTFN exactly once (previously up to 3 times).
Reduce the macro-expansion to include a call to either assoc or assq,
not both; this reduces the generated code size in some cases.
Repair setopt test after error demotion to warning
* test/lisp/cus-edit-tests.el (test-setopt):
Check for a warrning instead of an error in attempt to call `setopt`
with a value that does not match the declared type (bug#60162).
Stefan Kangas [Mon, 19 Dec 2022 03:42:19 +0000 (04:42 +0100)]
Merge from origin/emacs-29
12e26cc0c1b ; * admin/git-bisect-start: Add mistakenly ommitted commi... 9a751e0a38b ruby-mode: Support endless singleton method definitions too ce7b7e5af3d Remove comment-start-skip preset in tree-sitter indentati... c1e015ae320 Fix recent change in tramp-smb.el cf1b771864a ; * etc/NEWS: Fix typos. 50d18bb6ea7 Make tramp-archive autoloads robust for older Emacs versions 3941cc29df3 ; Improve documentation of 'setopt' 6f88de109c8 ruby-mode: Support endless methods (bug#54702) 91dd893e343 ; * lisp/progmodes/sql.el (sql-product-interactive): Doc ... 138d9dc4cb0 * lisp/cus-edit.el (setopt--set): Warn instead of rasing ... d1e0542f336 Allow customising windmove user options with an empty prefix c2375e77914 Improve and extend admin/git-bisect-start 7cc2313eb0a Make 'rmail-summary-by-thread' faster 88e59b16cbe ; Improve documentation of installing tree-sitter and gra... 897f33bf316 Fix the MS-DOS build 660e941235d Avoid crashes in PGTK build due to signal in 'note_mouse_... 0fc5fb2d054 Fix MS-Windows build broken by recent treesit.c changes 5b2e6d04ce2 Fix wrong capture in typescript-ts-mode (bug#60167) cb8ccdd2670 Add rust-ts-mode (Bug#60136) 9fcf764dd73 Indentation fixes for jsx/tsx (bug#60169) 69f2c71135f Fix treesit-query-validate problem with view-mode 1fc7535546c Use cursor API in treesit-node-parent 5f0286c0afa Switch to use cursor API in treesit.c a275e436df4 Add treesit_assume_true and treesit_cursor_helper a54c7a8df0c Remove file-exists-in-trash-p 3e02029642c Update to Org 9.6-49-g47d129 4a8ff671b0e Don’t assume make-directory handler returns nil 44c83b239d3 Fix copy-directory bug when dest dir exists bef1edc9cac make-directory now returns t if dir already exists 8a9579ca29d Use make-directory handlers uniformly 627e7e0243d Improve documentation of 'file-exists-p' c9015ef55ff Fix resizing of mini-windows by 'set-minibuffer-message' 5a245bc786e Prevent Abort dialogs from async-compiling jobs on Windows 4d1e4a48938 Fix 'window-max-chars-per-line' when there are no fringes d65beb820cc ; Revert "; * lisp/subr.el (internal--with-narrowing): Si... 1c0b90e5f7d ruby-mode: Recognize instance or global var as first arg ... 3356c0cb163 Fix end-of-defun in ruby-mode
Stefan Kangas [Mon, 19 Dec 2022 03:42:18 +0000 (04:42 +0100)]
; Merge from origin/emacs-29
The following commits were skipped:
f4b430140f0 Use equal and member instead of eq and memq 13aa376e935 Elide broken but unnecessary `if` optimisations 17d65c99cd8 alist-get testfn argument evaluation correction
bs.el: Use the right buffer context to compute the mode name
* lisp/bs.el (bs--get-mode-name): The function is already called
with the correct buffer as current-buffer; and anyway, START-BUFFER
is usually the wrong one to pass to `format-mode-line'. This fixes
a bug introduced in 48d33090d0 and c2699583be (back in 2008-01-04).
Paul Eggert [Sun, 18 Dec 2022 20:57:57 +0000 (12:57 -0800)]
Improve rename-file fix (bug#34069)
* src/fileio.c (Frename_file): No need for a special case to
rename a fifo, since we already tried and failed to rename it.
Also improve symlink handling, in that if readlink fails report an
error rather than trying to treat the link as a regular file.
Paul Eggert [Sun, 18 Dec 2022 19:45:06 +0000 (11:45 -0800)]
Don’t hang when copying FIFOs
* src/fileio.c (Fcopy_file): Open the input file with O_NONBLOCK.
This prevents a hang if the input file is a FIFO.
If it’s a regular file O_NONBLOCK has no effect;
otherwise the file is soon rejected anyway.