Merge from origin/emacs-29

d0147ff9e5 * lisp/emacs-lisp/shortdoc.el: More and better `substring...
fa06249a9f Fix "C-x RET r" when the new encoding is UTF
679e9d7c56 ; Mention MinGW64 GCC 13.1 problems in PROBLEMS
fdc1a12ed1 Fix "vc-print-log does not erase buffer" and associated p...
d507aa7336 Add selector_expression indentation rule
1f664a0af7 Add "nixd" LSP server to Eglot
e962cf4ba7 Fix building --with-native-compilation=aot from release t...
4ca371e9cc Fix bug#64152 (Minibuffer sometimes goes "modal")
a0ccf1859c Disable target-async by default in gdb-mi.el
2bad5829ff Revert "Fix parsing of dn line if WITHDN is non-nil"
7637e361d3 Don't truncate filenames with "emacs.el" in them
2591eb1190 Improve documentation of 'minibuffer-message'
6f211bc57b Eglot: again fix positions of coinciding inlay hint overl...
a24e9e3fee ; Update ChangeLog.4 and etc/AUTHORS.
This commit is contained in:
Eli Zaretskii 2023-06-24 07:13:42 -04:00
commit 8e8667246a
21 changed files with 2068 additions and 532 deletions

File diff suppressed because it is too large Load diff

View file

@ -2813,13 +2813,23 @@ minibuffer window, it returns @code{nil}.
@vindex minibuffer-message-timeout
@defun minibuffer-message string &rest args
This function displays @var{string} temporarily at the end of the
minibuffer text, for a few seconds, or until the next input event
arrives, whichever comes first. The variable
@code{minibuffer-message-timeout} specifies the number of seconds to
wait in the absence of input. It defaults to 2. If @var{args} is
non-@code{nil}, the actual message is obtained by passing @var{string}
and @var{args} through @code{format-message}. @xref{Formatting Strings}.
This function is like @code{message} (@pxref{Displaying Messages}),
but it displays the messages specially when the user types in the
minibuffer, typically because Emacs prompted the user for some input.
When the minibuffer is the current buffer, this function displays the
message specified by @var{string} temporarily at the end of the
minibuffer text, and thus avoids hiding the minibuffer text by the
echo-area display of the message. It leaves the message on display
for a few seconds, or until the next input event arrives, whichever
comes first. The variable @code{minibuffer-message-timeout} specifies
the number of seconds to wait in the absence of input. It defaults to
2. If @var{args} is non-@code{nil}, the actual message is obtained by
passing @var{string} and @var{args} through @code{format-message}.
@xref{Formatting Strings}.
If called when the minibuffer is not the current buffer, this function
just calls @code{message}, and thus @var{string} will be shown in the
echo-area.
@end defun
@deffn Command minibuffer-inactive-mode

File diff suppressed because it is too large Load diff

View file

@ -3442,6 +3442,39 @@ See
https://lists.gnu.org/r/emacs-devel/2010-07/msg01266.html
*** Building the MS-Windows port with native compilation fails
This is known to happen when using MinGW64 GCC 13.1, and seems to
affect byte-compilation: the built Emacs crashes while byte-compiling
some Lisp files. (This doesn't happen when building a release
tarball, because all the Lisp files are already byte-compiled there,
but then Emacs could crash later when you use it to byte-compile your
or third-party Lisp packages.)
The reason seems to be specific to MS-Windows or the MinGW64 port of
GCC 13.1, and is somehow related to optimizations in this GCC version.
There are several known workarounds:
. Use non-default optimization flags. For example, configuring the
build like this will avoid the problem:
CFLAGS='-O1 -gdwarf-4 -g3' ./configure ...
(replace the ellipsis "..." with the rest of 'configure' options
and arguments).
. Prevent GCC from performing a specific optimization:
CFLAGS='-O2 -gdwarf-4 -g3 -fno-optimize-sibling-calls' ./configure ...
This is actually a variant of the previous workaround, except that
it allows you to have almost the full set of optimizations used by
-O2.
. Downgrade to GCC 12.x.
. Build Emacs without native compilation.
*** Building the native MS-Windows port fails due to unresolved externals
The linker error messages look like this:

View file

@ -437,6 +437,42 @@ ifeq ($(HAVE_NATIVE_COMP),yes)
$(emacs) -l comp -f comp-compile-all-trampolines
endif
.PHONY: compile-eln-targets compile-eln-aot
# ELNDONE is defined by ../src/Makefile, as the list of preloaded
# *.eln files, which are therefore already compiled by the time
# compile-eln-aot is called.
ifeq ($(NATIVE_COMPILATION_AOT),yes)
%.eln: %.el
$(AM_V_ELN)$(emacs) $(BYTE_COMPILE_FLAGS) \
-l comp -f byte-compile-refresh-preloaded \
--eval '(batch-native-compile t)' $<
compile-eln-targets: $(filter-out $(ELNDONE),$(TARGETS))
else
compile-eln-targets:
endif
# This is called from ../src/Makefile when building a release tarball
# configured --with-native-compilation=aot.
compile-eln-aot:
@(cd $(lisp) && \
els=`echo "${SUBDIRS_REL} " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
for el in $$els; do \
test -f $$el || continue; \
test -f $${el}c || continue; \
GREP_OPTIONS= grep '^;.*[^a-zA-Z]no-byte-compile: *t' $$el > /dev/null && \
continue; \
GREP_OPTIONS= grep '^;.*[^a-zA-Z]no-native-compile: *t' $$el > /dev/null && \
continue; \
echo "$${el}n"; \
done | xargs $(XARGS_LIMIT) echo) | \
while read chunk; do \
$(MAKE) compile-eln-targets \
TARGETS="$$chunk" ELNDONE="$(ELNDONE)"; \
done
.PHONY: backup-compiled-files compile-after-backup
# Backup compiled Lisp files in elc.tar.gz. If that file already

View file

@ -407,7 +407,7 @@ The search is done in the source for library LIBRARY."
(setq library (substring library 0 (match-beginning 1))))
;; Strip extension from .emacs.el to make sure symbol is searched in
;; .emacs too.
(when (string-match "\\.emacs\\(.el\\)" library)
(when (string-match "\\.emacs\\(.el\\)\\'" library)
(setq library (substring library 0 (match-beginning 1))))
(let* ((filename (find-library-name library))
(regexp-symbol (cdr (assq type find-function-regexp-alist))))

View file

@ -187,8 +187,10 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:eval (format "This number is %d" 4))
"Manipulating Strings"
(substring
:eval (substring "foobar" 0 3)
:eval (substring "foobar" 3))
:eval (substring "abcde" 1 3)
:eval (substring "abcde" 2)
:eval (substring "abcde" 1 -1)
:eval (substring "abcde" -4 4))
(string-limit
:eval (string-limit "foobar" 3)
:eval (string-limit "foobar" 3 t)

View file

@ -715,11 +715,21 @@ for use at QPOS."
"Text properties added to the text shown by `minibuffer-message'.")
(defun minibuffer-message (message &rest args)
"Temporarily display MESSAGE at the end of the minibuffer.
The text is displayed for `minibuffer-message-timeout' seconds,
or until the next input event arrives, whichever comes first.
Enclose MESSAGE in [...] if this is not yet the case.
If ARGS are provided, then pass MESSAGE through `format-message'."
"Temporarily display MESSAGE at the end of minibuffer text.
This function is designed to be called from the minibuffer, i.e.,
when Emacs prompts the user for some input, and the user types
into the minibuffer. If called when the current buffer is not
the minibuffer, this function just calls `message', and thus
displays MESSAGE in the echo-area.
When called from the minibuffer, this function displays MESSAGE
at the end of minibuffer text for `minibuffer-message-timeout'
seconds, or until the next input event arrives, whichever comes first.
It encloses MESSAGE in [...] if it is not yet enclosed.
The intent is to show the message without hiding what the user typed.
If ARGS are provided, then the function first passes MESSAGE
through `format-message'.
If some of the minibuffer text has the `minibuffer-message' text
property, MESSAGE is shown at that position instead of EOB."
(if (not (minibufferp (current-buffer) t))
(progn
(if args
@ -796,7 +806,7 @@ The minibuffer message functions include `minibuffer-message' and
(next-single-property-change pt 'minibuffer-message nil (point-max)))))
(defun set-minibuffer-message (message)
"Temporarily display MESSAGE at the end of the minibuffer.
"Temporarily display MESSAGE at the end of the active minibuffer window.
If some part of the minibuffer text has the `minibuffer-message' property,
the message will be displayed before the first such character, instead of
at the end of the minibuffer.
@ -954,7 +964,7 @@ is at its default value `grow-only'."
multi-message-separator)))
(defun clear-minibuffer-message ()
"Clear minibuffer message.
"Clear message temporarily shown in the minibuffer.
Intended to be called via `clear-message-function'."
(when (not noninteractive)
(when (timerp minibuffer-message-timer)

View file

@ -2659,7 +2659,7 @@ need for `c-font-lock-extra-types'.")
;; prevent a repeat invocation. See elisp/lispref page "Search-based
;; fontification".
(let (pos)
(while
(while
(and (< (point) limit)
(c-syntactic-re-search-forward c-using-key limit 'end))
(while ; Do one declarator of a comma separated list, each time around.

View file

@ -230,7 +230,7 @@ chosen (interactively or automatically)."
. ,(eglot-alternatives '("digestif" "texlab")))
(erlang-mode . ("erlang_ls" "--transport" "stdio"))
((yaml-ts-mode yaml-mode) . ("yaml-language-server" "--stdio"))
(nix-mode . ,(eglot-alternatives '("nil" "rnix-lsp")))
(nix-mode . ,(eglot-alternatives '("nil" "rnix-lsp" "nixd")))
(nickel-mode . ("nls"))
(gdscript-mode . ("localhost" 6008))
((fortran-mode f90-mode) . ("fortls"))
@ -3769,7 +3769,7 @@ If NOERROR, return predicate, else erroring function."
(if peg-after-p
(make-overlay (point) (1+ (point)) nil t)
(make-overlay (1- (point)) (point) nil nil nil)))
(do-it (label lpad rpad i)
(do-it (label lpad rpad i n)
(let* ((firstp (zerop i))
(tweak-cursor-p (and firstp peg-after-p))
(ov (make-ov))
@ -3782,18 +3782,18 @@ If NOERROR, return predicate, else erroring function."
(1 'eglot-type-hint-face)
(2 'eglot-parameter-hint-face)
(_ 'eglot-inlay-hint-face))))
(overlay-put ov 'priority i)
(overlay-put ov 'priority (if peg-after-p i (- n i)))
(overlay-put ov 'eglot--inlay-hint t)
(overlay-put ov 'evaporate t)
(overlay-put ov 'eglot--overlay t))))
(if (stringp label) (do-it label left-pad right-pad 0)
(if (stringp label) (do-it label left-pad right-pad 0 1)
(cl-loop
for i from 0 for ldetail across label
do (eglot--dbind ((InlayHintLabelPart) value) ldetail
(do-it value
(and (zerop i) left-pad)
(and (= i (1- (length label))) right-pad)
i)))))))))
i (length label))))))))))
(jsonrpc-async-request
(eglot--current-server-or-lose)
:textDocument/inlayHint

View file

@ -453,7 +453,9 @@ valid signal handlers.")
(const :tag "Unlimited" nil))
:version "22.1")
(defcustom gdb-non-stop-setting (not (eq system-type 'windows-nt))
;; This is disabled by default because we don't really support
;; asynchronous execution of the debuggee; see bug#63084. FIXME.
(defcustom gdb-non-stop-setting nil
"If non-nil, GDB sessions are expected to support the non-stop mode.
When in the non-stop mode, stopped threads can be examined while
other threads continue to execute.
@ -468,7 +470,7 @@ don't support the non-stop mode.
GDB session needs to be restarted for this setting to take effect."
:type 'boolean
:group 'gdb-non-stop
:version "26.1")
:version "29.1")
(defcustom gdb-debuginfod-enable-setting
;; debuginfod servers are only for ELF executables, and elfutils, of

View file

@ -80,6 +80,7 @@
((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset)
((parent-is "default_case") parent-bol go-ts-mode-indent-offset)
((parent-is "expression_case") parent-bol go-ts-mode-indent-offset)
((parent-is "selector_expression") parent-bol go-ts-mode-indent-offset)
((parent-is "expression_switch_statement") parent-bol 0)
((parent-is "field_declaration_list") parent-bol go-ts-mode-indent-offset)
((parent-is "import_spec_list") parent-bol go-ts-mode-indent-offset)

View file

@ -1121,10 +1121,15 @@ possible values of STATE are explained in `vc-state', and MODEL in
the returned list.
BEWARE: this function may change the current buffer."
(with-current-buffer (or (buffer-base-buffer) (current-buffer))
(vc-deduce-fileset-1 not-state-changing
allow-unregistered
state-model-only-files)))
(let (new-buf res)
(with-current-buffer (or (buffer-base-buffer) (current-buffer))
(setq res
(vc-deduce-fileset-1 not-state-changing
allow-unregistered
state-model-only-files))
(setq new-buf (current-buffer)))
(set-buffer new-buf)
res))
(defun vc-deduce-fileset-1 (not-state-changing
allow-unregistered

View file

@ -873,6 +873,11 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln)
## native-lisp where the *.eln files will be produced, and the exact
## names of those *.eln files, cannot be known in advance; we must ask
## Emacs to produce them.
## If AOT native compilation is requested, we additionally
## native-compile all the *.el files in ../lisp that need to be
## compiled and haven't yet been compiled. ELDONE holds the list
## of *.el files that were already native-compiled.
NATIVE_COMPILATION_AOT = @NATIVE_COMPILATION_AOT@
../native-lisp: | $(pdmp)
@if test ! -d $@; then \
mkdir $@ && $(MAKE) $(AM_V_NO_PD) $(elnlisp); \
@ -883,6 +888,9 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp:.elc=.eln)
--bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR) \
&& cp -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT) \
&& cp -f $(pdmp) $(bootstrap_pdmp); \
if test $(NATIVE_COMPILATION_AOT) = yes; then \
$(MAKE) $(AM_V_NO_PD) -C ../lisp compile-eln-aot EMACS="../src/emacs$(EXEEXT)" ELNDONE="$(addprefix %,$(notdir $(elnlisp))))"; \
fi; \
fi
endif

View file

@ -4447,6 +4447,8 @@ by calling `format-decode', which see. */)
if (unprocessed > 0)
{
BUF_TEMP_SET_PT (XBUFFER (conversion_buffer),
BUF_Z (XBUFFER (conversion_buffer)));
coding.mode |= CODING_MODE_LAST_BLOCK;
decode_coding_c_string (&coding, (unsigned char *) read_buf,
unprocessed, conversion_buffer);

View file

@ -1442,6 +1442,10 @@ affects all frames on the same terminal device. */)
If FRAME is a switch-frame event `(switch-frame FRAME1)', use
FRAME1 as frame.
If TRACK is non-zero and the frame that currently has the focus
redirects its focus to the selected frame, redirect that focused
frame's focus to FRAME instead.
FOR_DELETION non-zero means that the selected frame is being
deleted, which includes the possibility that the frame's terminal
is dead.
@ -1449,7 +1453,7 @@ affects all frames on the same terminal device. */)
The value of NORECORD is passed as argument to Fselect_window. */
Lisp_Object
do_switch_frame (Lisp_Object frame, int for_deletion, Lisp_Object norecord)
do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object norecord)
{
struct frame *sf = SELECTED_FRAME (), *f;
@ -1471,6 +1475,44 @@ do_switch_frame (Lisp_Object frame, int for_deletion, Lisp_Object norecord)
else if (f == sf)
return frame;
/* If the frame with GUI focus has had it's Emacs focus redirected
toward the currently selected frame, we should change the
redirection to point to the newly selected frame. This means
that if the focus is redirected from a minibufferless frame to a
surrogate minibuffer frame, we can use `other-window' to switch
between all the frames using that minibuffer frame, and the focus
redirection will follow us around. This code is necessary when
we have a minibufferless frame using the MB in another (normal)
frame (bug#64152) (ACM, 2023-06-20). */
#ifdef HAVE_WINDOW_SYSTEM
if (track && FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->get_focus_frame)
{
Lisp_Object gfocus; /* The frame which still has focus on the
current terminal, according to the GUI
system. */
Lisp_Object focus; /* The frame to which Emacs has redirected
the focus from `gfocus'. This might be a
frame with a minibuffer when `gfocus'
doesn't have a MB. */
gfocus = FRAME_TERMINAL (f)->get_focus_frame (f);
if (FRAMEP (gfocus))
{
focus = FRAME_FOCUS_FRAME (XFRAME (gfocus));
if (FRAMEP (focus) && XFRAME (focus) == SELECTED_FRAME ())
/* Redirect frame focus also when FRAME has its minibuffer
window on the selected frame (see Bug#24500).
Don't do that: It causes redirection problem with a
separate minibuffer frame (Bug#24803) and problems
when updating the cursor on such frames.
|| (NILP (focus)
&& EQ (FRAME_MINIBUF_WINDOW (f), sf->selected_window))) */
Fredirect_frame_focus (gfocus, frame);
}
}
#endif /* HAVE_X_WINDOWS */
if (!for_deletion && FRAME_HAS_MINIBUF_P (sf))
resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1);
@ -1572,7 +1614,7 @@ This function returns FRAME, or nil if FRAME has been deleted. */)
/* Do not select a tooltip frame (Bug#47207). */
error ("Cannot select a tooltip frame");
else
return do_switch_frame (frame, 0, norecord);
return do_switch_frame (frame, 1, 0, norecord);
}
DEFUN ("handle-switch-frame", Fhandle_switch_frame,
@ -1588,7 +1630,7 @@ necessarily represent user-visible input focus. */)
kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
run_hook (Qmouse_leave_buffer_hook);
return do_switch_frame (event, 0, Qnil);
return do_switch_frame (event, 0, 0, Qnil);
}
DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
@ -2155,7 +2197,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
Fraise_frame (frame1);
#endif
do_switch_frame (frame1, 1, Qnil);
do_switch_frame (frame1, 0, 1, Qnil);
sf = SELECTED_FRAME ();
}
else

View file

@ -11565,7 +11565,7 @@ quit_throw_to_read_char (bool from_signal)
if (FRAMEP (internal_last_event_frame)
&& !EQ (internal_last_event_frame, selected_frame))
do_switch_frame (make_lispy_switch_frame (internal_last_event_frame),
0, Qnil);
0, 0, Qnil);
sys_longjmp (getcjmp, 1);
}

View file

@ -4881,7 +4881,7 @@ extern void syms_of_indent (void);
/* Defined in frame.c. */
extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object);
extern Lisp_Object do_switch_frame (Lisp_Object, int, Lisp_Object);
extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
extern void frames_discard_buffer (Lisp_Object);
extern void init_frame_once (void);

View file

@ -1125,8 +1125,8 @@ read_minibuf_unwind (void)
found:
if (!EQ (exp_MB_frame, saved_selected_frame)
&& !NILP (exp_MB_frame))
do_switch_frame (exp_MB_frame, 0, Qt); /* This also sets
minibuf_window */
do_switch_frame (exp_MB_frame, 0, 0, Qt); /* This also sets
minibuf_window */
/* To keep things predictable, in case it matters, let's be in the
minibuffer when we reset the relevant variables. Don't depend on
@ -1238,7 +1238,7 @@ read_minibuf_unwind (void)
/* Restore the selected frame. */
if (!EQ (exp_MB_frame, saved_selected_frame)
&& !NILP (exp_MB_frame))
do_switch_frame (saved_selected_frame, 0, Qt);
do_switch_frame (saved_selected_frame, 0, 0, Qt);
}
/* Replace the expired minibuffer in frame exp_MB_frame with the next less

View file

@ -7413,7 +7413,7 @@ the return value is nil. Otherwise the value is t. */)
do_switch_frame (NILP (dont_set_frame)
? data->selected_frame
: old_frame
, 0, Qnil);
, 0, 0, Qnil);
}
FRAME_WINDOW_CHANGE (f) = true;

View file

@ -26145,7 +26145,7 @@ x_try_restore_frame (void)
FOR_EACH_FRAME (tail, frame)
{
if (!NILP (do_switch_frame (frame, 1, Qnil)))
if (!NILP (do_switch_frame (frame, 0, 1, Qnil)))
return;
}
}