Merge from origin/emacs-29

bf7034048c ; * doc/emacs/custom.texi (Changing a Variable): Update e...
466d1c98a9 Fix icons.el when icon does not exist as a file
2a861124e8 ; Improve documentation of 'buffer-match-p'
dc9d02f8a0 * lisp/isearch.el (isearch-search-and-update): Let-bind '...
9308d9a74a * src/comp.c (Fcomp__compile_ctxt_to_file): Fix hash tabl...
a2a6619b28 Provide decent documentation for 'help-quick'
ab66b749a2 ; * src/window.c (Fset_window_margins): Doc fix.
1a677d1429 treesit--pre-syntax-ppss: Fix args-out-of-range in intern...
This commit is contained in:
Eli Zaretskii 2024-01-06 08:20:19 -05:00
commit 5256b8dd4e
10 changed files with 64 additions and 25 deletions

View file

@ -188,14 +188,15 @@ find with @kbd{M-x customize-browse}.
the customization buffer:
@smallexample
[Hide] Kill Ring Max: 60
[Hide] Kill Ring Max: Integer (positive or zero): 120
[State]: STANDARD.
Maximum length of kill ring before oldest elements are thrown away.
@end smallexample
The first line shows that the variable is named
@code{kill-ring-max}, formatted as @samp{Kill Ring Max} for easier
viewing. Its value is @samp{120}. The button labeled @samp{[Hide]},
viewing, and also shows its expected type: a positive integer or zero.
The default value is @samp{120}. The button labeled @samp{[Hide]},
if activated, hides the variable's value and state; this is useful to
avoid cluttering up the customization buffer with very long values
(for this reason, variables that have very long values may start out

View file

@ -115,6 +115,9 @@ Display a list of commands whose names match @var{topics}
Display all active key bindings; minor mode bindings first, then those
of the major mode, then global bindings (@code{describe-bindings}).
@xref{Misc Help}.
@item C-h C-q
Toggle display of a window showing popular commands and their key
bindings. @xref{Misc Help}.
@item C-h c @var{key}
Show the name of the command that the key sequence @var{key} is bound
to (@code{describe-key-briefly}). Here @kbd{c} stands for
@ -710,6 +713,18 @@ displays the contents of the syntax table, with explanations of each
character's syntax (@pxref{Syntax Tables,, Syntax Tables, elisp, The
Emacs Lisp Reference Manual}).
@kindex C-h C-q
@findex help-quick-toggle
@findex help-quick
@cindex cheat sheet of popular Emacs commands
@kbd{C-h C-q} (@code{help-quick-toggle}) toggles on and off the
display of a buffer showing the most popular Emacs commands and their
respective key bindings (a.k.a.@: ``cheat sheet''). The contents of
that buffer are created by the command @code{help-quick}. Each key
binding shown in this buffer is a button: click on it with
@kbd{mouse-1} or @kbd{mouse-2} to show the documentation of the
command bound to that key sequence.
@findex describe-prefix-bindings
You can get a list of subcommands for a particular prefix key by
typing @kbd{C-h}, @kbd{?}, or @key{F1}

View file

@ -959,8 +959,8 @@ infinite recursion.
@defun buffer-match-p condition buffer-or-name &rest args
This function checks if a buffer designated by @code{buffer-or-name}
satisfies the specified @code{condition}. Optional arguments
@var{args} are passed to the predicate function in @var{condition}. A
satisfies the specified @var{condition}. Optional third argument
@var{arg} is passed to the predicate function in @var{condition}. A
valid @var{condition} can be one of the following:
@itemize @bullet{}
@item
@ -985,10 +985,15 @@ Satisfied if @emph{any} condition in @var{conds} satisfies
Satisfied if @emph{all} the conditions in @var{conds} satisfy
@code{buffer-match-p}, with the same buffer and @code{args}.
@item derived-mode
Satisfied if the buffer's major mode derives from @var{expr}.
Satisfied if the buffer's major mode derives from @var{expr}. Note
that this condition might fail to report a match if
@code{buffer-match-p} is invoked before the major mode of the buffer
has been established.
@item major-mode
Satisfied if the buffer's major mode is equal to @var{expr}. Prefer
using @code{derived-mode} instead, when both can work.
using @code{derived-mode} instead, when both can work. Note that this
condition might fail to report a match if @code{buffer-match-p} is
invoked before the major mode of the buffer has been established.
@end table
@item t
Satisfied by any buffer. A convenient alternative to @code{""} (empty
@ -998,7 +1003,7 @@ string) or @code{(and)} (empty conjunction).
@defun match-buffers condition &optional buffer-list &rest args
This function returns a list of all buffers that satisfy the
@code{condition}. If no buffers match, the function returns
@var{condition}. If no buffers match, the function returns
@code{nil}. The argument @var{condition} is as defined in
@code{buffer-match-p} above. By default, all the buffers are
considered, but this can be restricted via the optional argument

View file

@ -2629,11 +2629,15 @@ default value is an empty display action, i.e., @w{@code{(nil . nil)}}.
@defopt display-buffer-alist
The value of this option is an alist mapping conditions to display
actions. Each condition is passed to @code{buffer-match-p}, along
with the buffer name and the @var{action} argument passed to
@code{display-buffer}. If it returns a non-@code{nil} value, then
@code{display-buffer} uses the corresponding display action to display
the buffer.
actions. Each condition is passed to @code{buffer-match-p}
(@pxref{Buffer List}), along with the buffer name and the @var{action}
argument passed to @code{display-buffer}. If it returns a
non-@code{nil} value, then @code{display-buffer} uses the
corresponding display action to display the buffer. Caveat: if you
use @code{derived-mode} or @code{major-mode} as condition,
@code{buffer-match-p} could fail to report a match if
@code{display-buffer} is called before the major mode of the buffer is
set.
@end defopt
@defopt display-buffer-base-action

View file

@ -187,11 +187,13 @@ present if the icon is represented by an image."
merged)
(cl-defmethod icons--create ((_type (eql 'image)) icon keywords)
(let ((file (if (file-name-absolute-p icon)
icon
(and (fboundp 'image-search-load-path)
(image-search-load-path icon)))))
(and (display-images-p)
(let* ((file (if (file-name-absolute-p icon)
icon
(and (fboundp 'image-search-load-path)
(image-search-load-path icon))))
(file-exists (and (stringp file) (file-readable-p file))))
(and file-exists
(display-images-p)
(fboundp 'image-supported-file-p)
(image-supported-file-p file)
(propertize

View file

@ -171,7 +171,10 @@ buffer.")
;; Inspired by a mg fork (https://github.com/troglobit/mg)
(defun help-quick ()
"Display a quick-help buffer."
"Display a quick-help buffer showing popular commands and their bindings.
The window showing quick-help can be toggled using \\[help-quick-toggle].
You can click on a key binding shown in the quick-help buffer to display
the documentation of the command bound to that key sequence."
(interactive)
(with-current-buffer (get-buffer-create "*Quick Help*")
(let ((inhibit-read-only t) (padding 2) blocks)
@ -246,10 +249,14 @@ buffer.")
;; ... and shrink it immediately.
(fit-window-to-buffer))
(message
(substitute-command-keys "Toggle the quick help buffer using \\[help-quick-toggle]."))))
(substitute-command-keys "Toggle display of quick-help buffer using \\[help-quick-toggle]."))))
(defun help-quick-toggle ()
"Toggle the quick-help window."
"Toggle display of a window showing popular commands and their bindings.
This toggles on and off the display of the quick-help buffer, which shows
popular commands and their bindings as produced by `help-quick'.
You can click on a key binding shown in the quick-help buffer to display
the documentation of the command bound to that key sequence."
(interactive)
(if (and-let* ((window (get-buffer-window "*Quick Help*")))
(quit-window t window))

View file

@ -2875,7 +2875,8 @@ The command accepts Unicode names like \"smiling face\" or
(isearch-search)
(when (and (memq isearch-wrap-pause '(no no-ding))
(not isearch-success))
(isearch-repeat (if isearch-forward 'forward 'backward)))))
(let ((isearch-cmds isearch-cmds))
(isearch-repeat (if isearch-forward 'forward 'backward))))))
(isearch-push-state)
(if isearch-op-fun (funcall isearch-op-fun))
(isearch-update))

View file

@ -1393,7 +1393,7 @@ START and END mark the current to-be-propertized region."
(if (and new-start (< new-start start))
(progn
(setq treesit--syntax-propertize-start nil)
(cons new-start end))
(cons (max new-start (point-min)) end))
nil)))
;;; Indent

View file

@ -4966,12 +4966,12 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
struct Lisp_Hash_Table *func_h =
XHASH_TABLE (CALL1I (comp-ctxt-funcs-h, Vcomp_ctxt));
for (ptrdiff_t i = 0; i < HASH_TABLE_SIZE (func_h); i++)
if (!BASE_EQ (HASH_VALUE (func_h, i), Qunbound))
if (!BASE_EQ (HASH_KEY (func_h, i), Qunbound))
declare_function (HASH_VALUE (func_h, i));
/* Compile all functions. Can't be done before because the
relocation structs has to be already defined. */
for (ptrdiff_t i = 0; i < HASH_TABLE_SIZE (func_h); i++)
if (!BASE_EQ (HASH_VALUE (func_h, i), Qunbound))
if (!BASE_EQ (HASH_KEY (func_h, i), Qunbound))
compile_function (HASH_VALUE (func_h, i));
/* Work around bug#46495 (GCC PR99126). */

View file

@ -7826,7 +7826,11 @@ means no margin.
Leave margins unchanged if WINDOW is not large enough to accommodate
margins of the desired width. Return t if any margin was actually
changed and nil otherwise. */)
changed and nil otherwise.
The margins specified by calling this function may be later overridden
by invoking `set-window-buffer' for the same WINDOW, with its
KEEP-MARGINS argument nil or omitted. */)
(Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width)
{
struct window *w = set_window_margins (decode_live_window (window),