Merge from origin/emacs-29

3296031ad7 ; Another improvement for documentation of pixelwise scro...
baeb2d71ae Support defun navigation for DEFUN in c-ts-mode (bug#64442)
781ddd7e7d Fix touchpad scrolling on MS-Windows
c125bd060e Fix order in which package-vc dependencies are resolved
500ced133a Fix building of VC package manuals with relative org link...
456ecabe9e Fix the documentation of 'cl-flet'
f6ebd1ef0d ; * src/treesit.c (Ftreesit_node_parent): Improve comment...
fac0e2d533 Avoid false "wrong passphrase" messages in EPA
8f683b51d8 Fix jsx font-lock in older tree-sitter-js grammars
d9af79ae39 Fix cloning 'face-remapping-alist' for indirect buffers
636fb267c4 Improve documentation of case transfer in replacement com...
7856d51436 Fix horizontal scrolling of images with C-f
8cf5659ec2 ; Fix defcustom in completion.el
a8c8a4e368 ; * src/fns.c (Fcopy_sequence): Doc fix.  (Bug#64960)
205d87cdca Fix unpacking ZIP archives on MS-Windows
3712e8bc38 ; Fix typos in lisp/keymap.el doc strings (bug#65329).
21b2ecee66 Fix command example in Eshell manual
26949819df ; lisp/progmodes/csharp-mode.el (treesit-query-capture): ...
221ed70b90 ; Improve documentation of 'define-alternatives'
32280205e2 Add user options mentioned in the Eshell manual to the va...
cf3145a486 * Add missing alias to `native-comp-enable-subr-trampolin...
922b649028 * Add missing alias to `native-comp-enable-subr-trampolin...
6962823c83 ; * etc/PROBLEMS: Fix typo and clarify wording.

# Conflicts:
#	doc/misc/eshell.texi
This commit is contained in:
Jim Porter 2023-08-21 18:23:11 -07:00
commit 357c2fba98
22 changed files with 307 additions and 177 deletions

View file

@ -1659,6 +1659,7 @@ command's first argument. If @code{case-fold-search} is set to
@code{nil}, case is always significant in all searches.
@vindex case-replace
@cindex case preservation in replace commands
In addition, when the second argument of a replace command is all or
partly lower case, replacement commands try to preserve the case
pattern of each occurrence. Thus, the command
@ -1672,7 +1673,27 @@ replaces a lower case @samp{foo} with a lower case @samp{bar}, an
all-caps @samp{FOO} with @samp{BAR}, and a capitalized @samp{Foo} with
@samp{Bar}. (These three alternatives---lower case, all caps, and
capitalized, are the only ones that @code{replace-string} can
distinguish.)
distinguish.) Note that Emacs decides whether to up-case or capitalize
the replacement text by analyzing each word in the text being
replaced, and will preserve the letter-case of the replaced text only
if @emph{all} of its words use the same letter-case. Thus, the
command
@example
M-x replace-string @key{RET} foo bar @key{RET} baz quux @key{RET}
@end example
@noindent
replaces @samp{Foo Bar} with @samp{Baz Quux} because both words in
@samp{Foo Bar} are capitalized. By contrast, the same command
replaces @samp{Foo bar} with @samp{baz quux}, i.e.@: it leaves the
letter-case of the replacement text unchanged, since the two words in
@samp{Foo bar} use different capitalization. What exactly is
considered a ``word'' depends on the syntax tables that are in effect
in the current buffer (@pxref{Syntax Tables,,, elisp, The Emacs Lisp
Reference Manual}); thus, @samp{Foo_Bar} is two words in Text mode,
but could be a single word in some major mode that supports a
programming language.
If upper-case letters are used in the replacement string, they remain
upper case every time that text is inserted. If upper-case letters are
@ -1709,7 +1730,7 @@ This command finds occurrences of @samp{foo} one by one, displays each
occurrence and asks you whether to replace it. Aside from querying,
@code{query-replace} works just like @code{replace-string}
(@pxref{Unconditional Replace}). In particular, it preserves case
provided @code{case-replace} is non-@code{nil}, as it normally is
provided that @code{case-replace} is non-@code{nil}, as it normally is
(@pxref{Replacement and Lax Matches}). A numeric argument means to
consider only occurrences that are bounded by word-delimiter
characters. A negative prefix argument replaces backward.

View file

@ -710,29 +710,77 @@ context.
@node Generic Commands
@subsection Select among Command Alternatives
@cindex generic commands
@cindex alternatives, defining
@cindex alternative commands, defining
The macro @code{define-alternatives} can be used to define
@dfn{generic commands}. These are interactive functions whose
implementation can be selected from several alternatives, as a matter
of user preference.
Sometimes it is useful to define a command that serves as a ``generic
dispatcher'' capable of invoking one of a set of commands according to
the user's needs. For example, imagine that you want to define a
command named @samp{open} that can ``open'' and display several
different types of objects. Or you could have a command named
@samp{mua} (which stands for Mail User Agent) that can read and send
email using one of several email backends, such as Rmail, Gnus, or
MH-E. The macro @code{define-alternatives} can be used to define such
@dfn{generic commands}. A generic command is an interactive function
whose implementation can be selected from several alternatives, as a
matter of user preference.
@defmac define-alternatives command &rest customizations
Define the new command @var{command}, a symbol.
This macro defines the new generic @var{command}, which can have
several alternative implementations. The argument @var{command}
should be an unquoted symbol.
When a user runs @kbd{M-x @var{command} @key{RET}} for the first time,
Emacs prompts for which real form of the command to use, and records
the selection by way of a custom variable. Using a prefix argument
repeats this process of choosing an alternative.
When invoked, the macro creates an interactive Lisp closure
(@pxref{Closures}). When the user runs @w{@kbd{M-x @var{command}
@key{RET}}} for the first time, Emacs asks to select one of the
alternative implementations of @var{command}, offering completion for
the names of these alternatives. These names come from the user
option whose name is @code{@var{command}-alternatives}, which the
macro creates (if it didn't exist before). To be useful, this
variable's value should be an alist whose elements have the form
@w{@code{(@var{alt-name} . @var{alt-func})}}, where @var{alt-name} is
the name of the alternative and @var{alt-func} is the interactive
function to be called if this alternative is selected. When the user
selects an alternative, Emacs remembers the selection, and will
thereafter automatically call that selected alternative without
prompting when the user invokes @kbd{M-x @var{command}} again. To
choose a different alternative, type @w{@kbd{C-u M-x @var{command}
@key{RET}}}--then Emacs will again prompt for one of the alternatives,
and the selection will override the previous one.
The variable @code{@var{command}-alternatives} should contain an alist
with alternative implementations of @var{command}.
Until this variable is set, @code{define-alternatives} has no effect.
The variable @code{@var{command}-alternatives} can be created before
calling @code{define-alternatives}, with the appropriate values;
otherwise the macro creates the variable with a @code{nil} value, and
it should then be populated with the associations describing the
alternatives. Packages that wish to provide their own implementation
of an existing generic command can use @code{autoload} cookies
(@pxref{Autoload}) to add to the alist, for example:
@lisp
;;;###autoload (push '("My name" . my-foo-symbol) foo-alternatives
@end lisp
If the optional argument @var{customizations} is non-@code{nil}, it
should consist of alternating @code{defcustom} keywords (typically
@code{:group} and @code{:version}) and values to add to the definition
of the @code{defcustom} @code{@var{command}-alternatives}.
Here is an example of a simple generic dispatcher command named
@code{open} with 3 alternative implementations:
@example
@group
(define-alternatives open
:group 'files
:version "42.1")
@end group
@group
(setq open-alternatives
'(("file" . find-file)
("directory" . dired)
("hexl" . hexl-find-file)))
@end group
@end example
If @var{customizations} is non-@code{nil}, it should consist of
alternating @code{defcustom} keywords (typically @code{:group} and
@code{:version}) and values to add to the declaration of
@code{@var{command}-alternatives}.
@end defmac
@node Interactive Call
@ -2433,35 +2481,48 @@ mouse cursor when the finger moved off the mouse wheel.
@cindex @code{wheel-down} event
@item (wheel-up @var{position} @var{clicks} @var{lines} @var{pixel-delta})
@itemx (wheel-down @var{position} @var{clicks} @var{lines} @var{pixel-delta})
These kinds of event are generated by moving a mouse wheel. The
These events are generated by moving a mouse wheel. The
@var{position} element is a mouse position list (@pxref{Click
Events}), specifying the position of the mouse cursor when the event
occurred.
@vindex mwheel-coalesce-scroll-events
@var{clicks}, if present, is the number of times that the wheel was
moved in quick succession. @xref{Repeat Events}. @var{lines}, if
present and not @code{nil}, is the number of screen lines that should
be scrolled. @var{pixel-delta}, if present, is a cons cell of the
form @w{@code{(@var{x} . @var{y})}}, where @var{x} and @var{y} are the
numbers of pixels by which to scroll in each axis, a.k.a.@:
@dfn{pixelwise deltas}.
present and not @code{nil}, is the positive number of screen lines
that should be scrolled (either up, when the event is @code{wheel-up},
or down when the event is @code{wheel-down}). @var{pixel-delta}, if
present, is a cons cell of the form @w{@code{(@var{x} . @var{y})}},
where @var{x} and @var{y} are the numbers of pixels by which to scroll
in each axis, a.k.a.@: @dfn{pixelwise deltas}. Usually, only one of
the two will be non-zero, the other will be either zero or very close
to zero; the larger number indicates the axis to scroll the window.
When the variable @code{mwheel-coalesce-scroll-events} is @code{nil},
the scroll commands ignore the @var{lines} element, even if it's
non-@code{nil}, and use the @var{pixel-delta} data instead; in that
case, the direction of scrolling is determined by the sign of the
pixelwise deltas, and the direction (up or down) implied by the event
kind is ignored.
@cindex pixel-resolution wheel events
You can use these @var{x} and @var{y} pixelwise deltas to determine
how much the mouse wheel has actually moved at pixel resolution. For
example, the pixelwise deltas could be used to scroll the display at
pixel resolution, exactly according to the user's turning the mouse
wheel.
wheel. This pixelwise scrolling is possible only when
@code{mwheel-coalesce-scroll-events} is @code{nil}, and in general the
@var{pixel-delta} data is not generated when that variable is
non-@code{nil}.
@vindex mouse-wheel-up-event
@vindex mouse-wheel-down-event
This kind of event is generated only on some kinds of systems. On
some systems, @code{mouse-4} and @code{mouse-5} are used instead. For
portable code, use the variables @code{mouse-wheel-up-event},
@code{mouse-wheel-up-alternate-event}, @code{mouse-wheel-down-event}
and @code{mouse-wheel-down-alternate-event} defined in
@file{mwheel.el} to determine what event types to expect for the mouse
wheel.
The @code{wheel-up} and @code{wheel-down} events are generated only on
some kinds of systems. On other systems, @code{mouse-4} and
@code{mouse-5} are used instead. For portable code, use the variables
@code{mouse-wheel-up-event}, @code{mouse-wheel-up-alternate-event},
@code{mouse-wheel-down-event} and
@code{mouse-wheel-down-alternate-event} defined in @file{mwheel.el} to
determine what event types to expect from the mouse wheel.
@vindex mouse-wheel-left-event
@vindex mouse-wheel-right-event

View file

@ -1238,10 +1238,15 @@ of variables.
@defmac cl-flet (bindings@dots{}) forms@dots{}
This form establishes @code{let}-style bindings for functions rather
than values. Each @var{binding} must be a list of the form
@samp{(@var{name} @var{arglist} @var{body}@dots{})}. Within
@var{forms}, any reference to the function @var{name} uses the local
definition instead of the global one.
than values. Each @var{binding} must be a list of one of two forms:
either @w{@code{(@var{name} @var{expr})}} or @w{@code{(@var{name}
@var{arglist} @var{body}@dots{})}}. The @var{name} is the name of the
function, @var{expr} is an expression which returns the function value
to which the corresponding @var{name} should be bound, and
@var{arglist} and @var{body} are the argument list and the body of the
function to bind to @var{name}. Within @var{forms}, any reference to
the function @var{name} uses the local definition provided by
@var{bindings} instead of the global one.
A ``reference'' to a function name is either a call to that function,
or a use of its name quoted by @code{function} to be passed on to,

View file

@ -4,7 +4,7 @@
@settitle Eshell: The Emacs Shell
@include docstyle.texi
@defindex cm
@synindex vr fn
@syncodeindex vr fn
@c %**end of header
@copying
@ -141,7 +141,7 @@ computer frequently enough, it is more than worthwhile in the long run.
Any tool you use often deserves the time spent learning to master it.
@footnote{For the understandably curious, here is what that command
looks like: But don't let it fool you; once you know what's going on,
it's easier than it looks: @code{ls -lt **/*.doc(Lk+50aM+5)}.}
it's easier than it looks: @code{ls -lt **/*.doc(Lk+100aM+6)}.}
@menu
* Contributors to Eshell:: People who have helped out!
@ -458,6 +458,7 @@ overwriting files. If both settings are non-@code{nil}, the commands
always prompt. If both settings are @code{nil} (the default), the
commands signal an error.
@vindex eshell-default-target-is-dot
Several commands observe the value of
@code{eshell-default-target-is-dot}. If non-@code{nil}, then the
default target for the commands @command{cp}, @command{mv}, and
@ -521,6 +522,8 @@ directory.
With @kbd{cd -42}, you can access the directory stack slots by number.
@item
@vindex eshell-cd-shows-directory
@vindex eshell-list-files-after-cd
If @code{eshell-cd-shows-directory} is non-@code{nil}, @command{cd}
will report the directory it changes to. If
@code{eshell-list-files-after-cd} is non-@code{nil}, then @command{ls}
@ -555,6 +558,8 @@ $*'}.
Copy a file to a new location or copy multiple files to the same
directory.
@vindex eshell-cp-overwrite-files
@vindex eshell-cp-interactive-query
If @code{eshell-cp-overwrite-files} is non-@code{nil}, then
@command{cp} will overwrite files without warning. If
@code{eshell-cp-interactive-query} is non-@code{nil}, then
@ -572,6 +577,7 @@ Compare files using Emacs's internal @code{diff} (not to be confused
with @code{ediff}). @xref{Comparing Files, , , emacs, The GNU Emacs
Manual}.
@vindex eshell-plain-diff-behavior
If @code{eshell-plain-diff-behavior} is non-@code{nil}, then this
command does not use Emacs's internal @code{diff}. This is the same
as using @samp{alias diff '*diff $@@*'}.
@ -599,6 +605,7 @@ Echoes its input. By default, this prints in a Lisp-friendly fashion
prints a list of all the arguments; otherwise, it prints the empty
string.
@vindex eshell-plain-echo-behavior
If @code{eshell-plain-echo-behavior} is non-@code{nil}, @command{echo}
will try to behave more like a plain shell's @command{echo}, printing
each argument as a string, separated by a space.
@ -619,6 +626,7 @@ cmd*}.
@item exit
@cmindex exit
@vindex eshell-kill-on-exit
Exit Eshell and save the history. By default, this command kills the
Eshell buffer, but if @code{eshell-kill-on-exit} is @code{nil}, then
the buffer is merely buried instead.
@ -644,6 +652,7 @@ The @command{grep} commands are compatible with GNU @command{grep},
but use Emacs's internal @code{grep} instead.
@xref{Grep Searching, , , emacs, The GNU Emacs Manual}.
@vindex eshell-plain-grep-behavior
If @code{eshell-plain-grep-behavior} is non-@code{nil}, then these
commands do not use Emacs's internal @code{grep}. This is the same as
using @samp{alias grep '*grep $@@*'}, though this setting applies to
@ -682,6 +691,8 @@ and @code{("foo" "bar")} both evaluate to @code{("foo" "bar")}.
@cmindex ln
Create links to files.
@vindex eshell-ln-overwrite-files
@vindex eshell-ln-interactive-query
If @code{eshell-ln-overwrite-files} is non-@code{nil}, @command{ln}
will overwrite files without warning. If
@code{eshell-ln-interactive-query} is non-@code{nil}, then
@ -693,6 +704,7 @@ Alias to Emacs's @code{locate} function, which simply runs the external
@command{locate} command and parses the results.
@xref{Dired and Find, , , emacs, The GNU Emacs Manual}.
@vindex eshell-plain-locate-behavior
If @code{eshell-plain-locate-behavior} is non-@code{nil}, then Emacs's
internal @code{locate} is not used. This is the same as using
@samp{alias locate '*locate $@@*'}.
@ -701,21 +713,25 @@ internal @code{locate} is not used. This is the same as using
@cmindex ls
Lists the contents of directories.
@vindex eshell-ls-use-colors
If @code{eshell-ls-use-colors} is non-@code{nil}, the contents of a
directory is color-coded according to file type and status. These
colors and the regexps used to identify their corresponding files can
be customized via @w{@kbd{M-x customize-group @key{RET} eshell-ls @key{RET}}}.
@vindex eshell-ls-date-format
The user option @code{eshell-ls-date-format} determines how the date
is displayed when using the @option{-l} option. The date is produced
using the function @code{format-time-string} (@pxref{Time Parsing,,,
elisp, GNU Emacs Lisp Reference Manual}).
@vindex eshell-ls-initial-args
The user option @code{eshell-ls-initial-args} contains a list of
arguments to include with any call to @command{ls}. For example, you
can include the option @option{-h} to always use a more human-readable
format.
@vindex eshell-ls-default-blocksize
The user option @code{eshell-ls-default-blocksize} determines the
default blocksize used when displaying file sizes with the option
@option{-s}.
@ -739,6 +755,8 @@ Make new directories.
@cmindex mv
Move or rename files.
@vindex eshell-mv-overwrite-files
@vindex eshell-mv-interactive-query
If @code{eshell-mv-overwrite-files} is non-@code{nil}, @command{mv}
will overwrite files without warning. If
@code{eshell-mv-interactive-query} is non-@code{nil}, @command{mv}
@ -763,6 +781,8 @@ Print the arguments separated by newlines.
Push the current directory onto the directory stack, then change to
another directory.
@vindex eshell-pushd-dunique
@vindex eshell-pushd-dextract
If @code{eshell-pushd-dunique} is non-@code{nil}, then only unique
directories will be added to the stack. If
@code{eshell-pushd-dextract} is non-@code{nil}, then @samp{pushd
@ -777,6 +797,8 @@ Prints the current working directory.
Removes files, buffers, processes, or Emacs Lisp symbols, depending on
the argument.
@vindex eshell-rm-interactive-query
@vindex eshell-rm-removes-directories
If @code{eshell-rm-interactive-query} is non-@code{nil}, @command{rm}
will prompt before removing anything. If
@code{eshell-rm-removes-directories} is non-@code{nil}, then
@ -1081,6 +1103,7 @@ Tramp, may add extra information to this value.
@section Aliases
@findex eshell-read-aliases-list
@vindex eshell-aliases-file
Aliases are commands that expand to a longer input line. For example,
@command{ll} is a common alias for @code{ls -l}. To define this alias
in Eshell, you can use the command invocation @kbd{alias ll 'ls -l
@ -1161,6 +1184,7 @@ the option @code{eshell-explicit-remote-commands} to @code{nil}.
@node History
@section History
@cmindex history
@vindex eshell-history-size
The @samp{history} command shows all commands kept in the history ring
as numbered list. If the history ring contains
@code{eshell-history-size} commands, those numbers change after every
@ -1180,6 +1204,7 @@ command beginning with @code{foo}, and @samp{!?foo} to the last
command containing @code{foo}. The n-th argument of the last command
beginning with @code{foo} is accessible by @code{!foo:n}.
@vindex eshell-history-file-name
The history ring is loaded from a file at the start of every session,
and written back to the file at the end of every session. The file path
is specified in @code{eshell-history-file-name}. Unlike other shells,
@ -1365,6 +1390,7 @@ to @code{$(@var{lisp})}, this is identical to @code{@{@var{command}@}}
when on its own, but the @code{$} allows it to be used inside double
quotes or as part of a string.
@vindex eshell-convert-numeric-arguments
Normally, the output is split line-by-line, returning a list (or the
first element if there's only one line of output); if
@code{eshell-convert-numeric-arguments} is non-@code{nil} and every
@ -1472,6 +1498,7 @@ Eshell's globbing syntax is very similar to that of Zsh
coming from Bash can still use Bash-style globbing, as there are no
incompatibilities.
@vindex eshell-glob-case-insensitive
@vindex eshell-glob-case-insensitive
Globs are case sensitive by default, except on MS-DOS/MS-Windows
systems. You can control this behavior via the
@ -1836,6 +1863,9 @@ garbage output, since the Eshell buffer is not a terminal emulator.
Eshell solves this problem by running such programs in Emacs's
terminal emulator.
@vindex eshell-visual-commands
@vindex eshell-visual-subcommands
@vindex eshell-visual-options
Programs that need a terminal to display output properly are referred
to in this manual as ``visual commands'', because they are not simply
line-oriented. You must tell Eshell which commands are visual, by
@ -2053,6 +2083,7 @@ modules.@footnote{ERC provides a similar module facility.}
@node Optional modules
@section Optional modules
@vindex eshell-modules-list
In addition to the various modules enabled by default (documented
above), Eshell provides several other modules which are @emph{not}
enabled by default. If you want to enable these, you can add them to
@ -2080,6 +2111,7 @@ For example, it binds @kbd{C-u} to kill the current input text and
enabled, it also binds @kbd{C-p} and @kbd{C-n} to move through the
input history.
@vindex eshell-confine-point-to-input
If @code{eshell-confine-point-to-input} is non-@code{nil}, this module
prevents certain commands from causing the point to leave the input
area, such as @code{backward-word}, @code{previous-line}, etc.

View file

@ -1219,8 +1219,8 @@ And restart Emacs.
This is due to an old bug in the implementation of the X protocol's
XIM transport: when an input method crashes for some reason, Xlib
cannot recover. Emacs cannot do anything about this except wait for
the I-Bux developers to fix their crashes. You can work around these
problems by disabling XIM in your X resources:
input method developers to fix their crashes. You can work around
these problems by disabling XIM in your X resources:
Emacs.useXIM: false

View file

@ -2026,6 +2026,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
(setq p (+ p (point-min)))
(while (string= "PK\001\002" (buffer-substring p (+ p 4)))
(let* ((creator (get-byte (+ p 5)))
(gpflags (archive-l-e (+ p 8) 2))
;; (method (archive-l-e (+ p 10) 2))
(modtime (archive-l-e (+ p 12) 2))
(moddate (archive-l-e (+ p 14) 2))
@ -2037,7 +2038,12 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
(efnname (let ((str (buffer-substring (+ p 46) (+ p 46 fnlen))))
(decode-coding-string
str
(or (if (and w32-fname-encoding
;; Bit 11 of general purpose bit flags (bytes
;; 8-9) of Central Directory: 1 means UTF-8
;; encoded file names.
(or (if (/= 0 (logand gpflags #x0800))
'utf-8-unix)
(if (and w32-fname-encoding
(memq creator
;; This should be just 10 and
;; 14, but InfoZip uses 0 and

View file

@ -322,9 +322,11 @@ This can be time consuming."
:type 'boolean)
(defcustom completion-search-distance 15000
"How far to search in the buffer when looking for completions.
In number of characters. If nil, search the whole buffer."
:type 'integer)
"How far in the buffer to search when looking for completions.
Limit is measured in characters. If nil, search the whole buffer."
:type '(choice
(const :tag "No limit" nil)
(integer :tag "Limit in characters")))
(defcustom completions-merging-modes '(lisp c)
"List of modes {`c' or `lisp'} for automatic completions merging.

View file

@ -395,7 +395,8 @@ otherwise it's assumed to be an Info file."
(with-temp-buffer
(insert-file-contents file)
(setq file (make-temp-file "ox-texinfo-"))
(org-export-to-file 'texinfo file)
(let ((default-directory docs-directory))
(org-export-to-file 'texinfo file))
(setq clean-up t)))
(with-current-buffer (get-buffer-create " *package-vc doc*")
(erase-buffer)
@ -451,13 +452,11 @@ version of that package."
(desc (cadr (assoc package pac))))
(and desc (seq-some
(apply-partially #'depends-on-p target)
(package-desc-reqs desc))))))
(mapcar #'car (package-desc-reqs desc)))))))
(dependent-order (a b)
(let ((desc-a (package-desc-name a))
(desc-b (package-desc-name b)))
(or (not desc-a) (not desc-b)
(not (depends-on-p desc-b desc-a))
(depends-on-p desc-a desc-b)))))
(depends-on-p desc-a desc-b))))
(mapc #'search requirements)
(cl-callf sort to-install #'version-order)
(cl-callf seq-uniq to-install #'duplicate-p)

View file

@ -123,9 +123,16 @@ encryption is used."
(cons "Opening input file" (cdr error))))))
(defun epa--wrong-password-p (context)
"Return whether a wrong password caused the error in CONTEXT."
(let ((error-string (epg-context-error-output context)))
;; Use a strict regexp here that really only matches "wrong
;; passphrase" errors to avoid hiding diagnostic information
;; (bug#65316). Below regexp also can fail to match non-English
;; messages, since at least the "decryption failed" part of it
;; seems to be localized. But since this means false negatives
;; this is probably OK.
(and (string-match
"decryption failed: \\(Bad session key\\|No secret key\\)"
"decryption failed: \\(Bad session key\\|Bad passphrase\\)"
error-string)
(match-string 1 error-string))))

View file

@ -70,21 +70,10 @@
:foreground :background :stipple :overline :strike-through :box
:font :inherit :fontset :distant-foreground :extend :vector])
(defun face-remap--copy-face (val)
"Return a copy of the `face' property value VAL."
;; A `face' property can be either a face name (a symbol), or a face
;; property list like (:foreground "red" :inherit default),
;; or a list of such things.
;; FIXME: This should probably be shared to some extent with
;; `add-face-text-property'.
(if (or (not (listp val)) (keywordp (car val)))
val
(copy-sequence val)))
(defun face-attrs--make-indirect-safe ()
"Deep-copy the buffer's `face-remapping-alist' upon cloning the buffer."
(setq-local face-remapping-alist
(mapcar #'face-remap--copy-face face-remapping-alist)))
(mapcar #'copy-tree face-remapping-alist)))
(add-hook 'clone-indirect-buffer-hook #'face-attrs--make-indirect-safe)

View file

@ -248,8 +248,9 @@ Stop if the right edge of the image is reached."
(image-set-window-hscroll (max 0 (+ (window-hscroll) n))))
(t
(let* ((image (image-get-display-property))
(edges (window-inside-edges))
(win-width (- (nth 2 edges) (nth 0 edges)))
(edges (window-edges nil t nil t))
(win-width (- (/ (nth 2 edges) (frame-char-width))
(/ (nth 0 edges) (frame-char-width))))
(img-width (ceiling (car (image-display-size image)))))
(image-set-window-hscroll (min (max 0 (- img-width win-width))
(+ n (window-hscroll))))))))

View file

@ -78,7 +78,7 @@ called from Lisp, COMMAND can be anything that `keymap-set' accepts
as its DEFINITION argument.
If COMMAND is a string (which can only happen when this function is
callled from Lisp), it must satisfy `key-valid-p'.
called from Lisp), it must satisfy `key-valid-p'.
Note that if KEY has a local binding in the current buffer,
that local binding will continue to shadow any global binding
@ -102,7 +102,7 @@ called from Lisp, COMMAND can be anything that `keymap-set' accepts
as its DEFINITION argument.
If COMMAND is a string (which can only happen when this function is
callled from Lisp), it must satisfy `key-valid-p'.
called from Lisp), it must satisfy `key-valid-p'.
The binding goes in the current buffer's local keymap, which in most
cases is shared with all other buffers in the same major mode."

View file

@ -880,29 +880,36 @@ Return nil if NODE is not a defun node or doesn't have a name."
(defun c-ts-mode--defun-valid-p (node)
"Return non-nil if NODE is a valid defun node.
Ie, NODE is not nested."
(or (c-ts-mode--emacs-defun-p node)
(not (or (and (member (treesit-node-type node)
'("struct_specifier"
"enum_specifier"
"union_specifier"
"declaration"))
;; If NODE's type is one of the above, make sure it is
;; top-level.
(treesit-node-top-level
node (rx (or "function_definition"
"type_definition"
"struct_specifier"
"enum_specifier"
"union_specifier"
"declaration"))))
(and (equal (treesit-node-type node) "declaration")
;; If NODE is a declaration, make sure it is not a
;; function declaration.
(equal (treesit-node-type
(treesit-node-child-by-field-name
node "declarator"))
"function_declarator"))))))
(let ((top-level-p (lambda (node)
(not (treesit-node-top-level
node (rx (or "function_definition"
"type_definition"
"struct_specifier"
"enum_specifier"
"union_specifier"
"declaration")))))))
(pcase (treesit-node-type node)
;; The declaration part of a DEFUN.
("expression_statement" (c-ts-mode--emacs-defun-p node))
;; The body of a DEFUN.
("compound_statement" (c-ts-mode--emacs-defun-body-p node))
;; If NODE's type is one of these three, make sure it is
;; top-level.
((or "struct_specifier"
"enum_specifier"
"union_specifier")
(funcall top-level-p node))
;; If NODE is a declaration, make sure it's not a function
;; declaration (we only want function_definition) and is a
;; top-level declaration.
("declaration"
(and (not (equal (treesit-node-type
(treesit-node-child-by-field-name
node "declarator"))
"function_declarator"))
(funcall top-level-p node)))
;; Other types don't need further verification.
(_ t))))
(defun c-ts-mode--defun-for-class-in-imenu-p (node)
"Check if NODE is a valid entry for the Class subindex.
@ -955,6 +962,11 @@ files using the DEFUN macro."
t)
"DEFUN")))
(defun c-ts-mode--emacs-defun-body-p (node)
"Return non-nil if NODE is the function body of a DEFUN."
(and (equal (treesit-node-type node) "compound_statement")
(c-ts-mode--emacs-defun-p (treesit-node-prev-sibling node))))
(defun c-ts-mode--emacs-defun-at-point (&optional range)
"Return the defun node at point.
@ -969,31 +981,18 @@ function returns the declaration node.
If RANGE is non-nil, return (BEG . END) where BEG end END
encloses the whole defun. This is for when the entire defun
is required, not just the declaration part for DEFUN."
(or (when-let ((node (treesit-defun-at-point)))
(if range
(cons (treesit-node-start node)
(treesit-node-end node))
node))
(and c-ts-mode-emacs-sources-support
(let ((candidate-1 ; For when point is in the DEFUN statement.
(treesit-node-prev-sibling
(treesit-node-top-level
(treesit-node-at (point))
"compound_statement")))
(candidate-2 ; For when point is in the body.
(treesit-node-top-level
(treesit-node-at (point))
"expression_statement")))
(when-let
((node (or (and (c-ts-mode--emacs-defun-p candidate-1)
candidate-1)
(and (c-ts-mode--emacs-defun-p candidate-2)
candidate-2))))
(if range
(cons (treesit-node-start node)
(treesit-node-end
(treesit-node-next-sibling node)))
node))))))
(when-let* ((node (treesit-defun-at-point))
(defun-range (cons (treesit-node-start node)
(treesit-node-end node))))
;; Make some adjustment for DEFUN.
(when c-ts-mode-emacs-sources-support
(cond ((c-ts-mode--emacs-defun-body-p node)
(setq node (treesit-node-prev-sibling node))
(setcar defun-range (treesit-node-start node)))
((c-ts-mode--emacs-defun-p node)
(setcdr defun-range (treesit-node-end
(treesit-node-next-sibling node))))))
(if range defun-range node)))
(defun c-ts-mode-indent-defun ()
"Indent the current top-level declaration syntactically.
@ -1111,13 +1110,19 @@ BEG and END are described in `treesit-range-rules'."
;; Navigation.
(setq-local treesit-defun-type-regexp
(cons (regexp-opt '("function_definition"
"type_definition"
"struct_specifier"
"enum_specifier"
"union_specifier"
"class_specifier"
"namespace_definition"))
(cons (regexp-opt (append
'("function_definition"
"type_definition"
"struct_specifier"
"enum_specifier"
"union_specifier"
"class_specifier"
"namespace_definition")
(and c-ts-mode-emacs-sources-support
'(;; DEFUN.
"expression_statement"
;; DEFUN body.
"compound_statement"))))
#'c-ts-mode--defun-valid-p))
(setq-local treesit-defun-skipper #'c-ts-mode--defun-skipper)
(setq-local treesit-defun-name-function #'c-ts-mode--defun-name)

View file

@ -45,6 +45,7 @@
(declare-function treesit-node-start "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(declare-function treesit-query-capture "treesit.c")
(defgroup csharp nil
"Major mode for editing C# code."

View file

@ -3501,35 +3501,6 @@ Check if a node type is available, then return the right indent rules."
"&&" "||" "!")
"JavaScript operators for tree-sitter font-locking.")
(defun js-jsx--treesit-font-lock-compatibility-bb1f97b ()
"Font lock rules helper, to handle different releases of tree-sitter-javascript.
Check if a node type is available, then return the right font lock rules."
;; handle commit bb1f97b
(condition-case nil
(progn (treesit-query-capture 'javascript '((member_expression) @capture))
'((jsx_opening_element
[(member_expression (identifier)) (identifier)]
@font-lock-function-call-face)
(jsx_closing_element
[(member_expression (identifier)) (identifier)]
@font-lock-function-call-face)
(jsx_self_closing_element
[(member_expression (identifier)) (identifier)]
@font-lock-function-call-face)))
(error '((jsx_opening_element
[(nested_identifier (identifier)) (identifier)]
@font-lock-function-call-face)
(jsx_closing_element
[(nested_identifier (identifier)) (identifier)]
@font-lock-function-call-face)
(jsx_self_closing_element
[(nested_identifier (identifier)) (identifier)]
@font-lock-function-call-face)))))
(defvar js--treesit-font-lock-settings
(treesit-font-lock-rules
@ -3639,8 +3610,10 @@ Check if a node type is available, then return the right font lock rules."
:language 'javascript
:feature 'jsx
(append (js-jsx--treesit-font-lock-compatibility-bb1f97b)
'((jsx_attribute (property_identifier) @font-lock-constant-face)))
'((jsx_opening_element name: (_) @font-lock-function-call-face)
(jsx_closing_element name: (_) @font-lock-function-call-face)
(jsx_self_closing_element name: (_) @font-lock-function-call-face)
(jsx_attribute (property_identifier) @font-lock-constant-face))
:language 'javascript
:feature 'number

View file

@ -417,8 +417,9 @@ Replacement transfers the case pattern of the old text to the
new text, if both `case-fold-search' and `case-replace' are
non-nil and FROM-STRING has no uppercase letters.
\(Transferring the case pattern means that if the old text
matched is all caps, or capitalized, then its replacement is
respectively upcased or capitalized.)
matched is all caps, or all of its words are capitalized, then its
replacement is respectively upcased or capitalized. For more
details about this, see `replace-match'.)
Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
ignore hidden matches if `search-invisible' is nil, and ignore more
@ -492,8 +493,9 @@ there are uppercase letters in REGEXP.
Replacement transfers the case pattern of the old text to the new
text, if both `case-fold-search' and `case-replace' are non-nil
and REGEXP has no uppercase letters. (Transferring the case pattern
means that if the old text matched is all caps, or capitalized,
then its replacement is respectively upcased or capitalized.)
means that if the old text matched is all caps, or all of its words
are capitalized, then its replacement is respectively upcased or
capitalized. For more details about this, see `replace-match'.)
Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
ignore hidden matches if `search-invisible' is nil, and ignore more

View file

@ -10792,10 +10792,13 @@ warning using STRING as the message.")
;;; Generic dispatcher commands
;; Macro `define-alternatives' is used to create generic commands.
;; Generic commands are these (like web, mail, news, encrypt, irc, etc.)
;; that can have different alternative implementations where choosing
;; among them is exclusively a matter of user preference.
;; Macro `define-alternatives' can be used to create generic commands.
;; Generic commands are commands that can have different alternative
;; implementations, and choosing among them is the matter of user
;; preference in each case. For example, you could have a generic
;; command `open' capable of "opening" a text file, a URL, a
;; directory, or a binary file, and each of these alternatives would
;; invoke a different Emacs function.
;; (define-alternatives COMMAND) creates a new interactive command
;; M-x COMMAND and a customizable variable COMMAND-alternatives.
@ -10805,26 +10808,38 @@ warning using STRING as the message.")
;; ;;;###autoload (push '("My impl name" . my-impl-symbol) COMMAND-alternatives
(defmacro define-alternatives (command &rest customizations)
"Define the new command `COMMAND'.
"Define a new generic COMMAND which can have several implementations.
The argument `COMMAND' should be a symbol.
The argument `COMMAND' should be an unquoted symbol.
Running `\\[execute-extended-command] COMMAND RET' for \
the first time prompts for which
alternative to use and records the selected command as a custom
variable.
the first time prompts for the
alternative implementation to use and records the selected alternative.
Thereafter, `\\[execute-extended-command] COMMAND RET' will \
automatically invoke the recorded selection.
Running `\\[universal-argument] \\[execute-extended-command] COMMAND RET' \
prompts again for an alternative
and overwrites the previous choice.
again prompts for an alternative
and overwrites the previous selection.
The variable `COMMAND-alternatives' contains an alist with
alternative implementations of COMMAND. `define-alternatives'
does not have any effect until this variable is set.
The macro creates a `defcustom' named `COMMAND-alternatives'.
CUSTOMIZATIONS, if non-nil, should be pairs of `defcustom'
keywords and values to add to the definition of that `defcustom';
typically, these keywords will be :group and :version with the
appropriate values.
CUSTOMIZATIONS, if non-nil, should be composed of alternating
`defcustom' keywords and values to add to the declaration of
`COMMAND-alternatives' (typically :group and :version)."
To be useful, the value of `COMMAND-alternatives' should be an
alist describing the alternative implementations of COMMAND.
The elements of this alist should be of the form
(ALTERNATIVE-NAME . FUNCTION)
where ALTERNATIVE-NAME is the name of the alternative to be shown
to the user as a selectable alternative, and FUNCTION is the
interactive function to call which implements that alternative.
The variable could be populated with associations describing the
alternatives either before or after invoking `define-alternatives';
if the variable is not defined when `define-alternatives' is invoked,
the macro will create it with a nil value, and your Lisp program
should then populate it."
(declare (indent defun))
(let* ((command-name (symbol-name command))
(varalt-name (concat command-name "-alternatives"))

View file

@ -1993,10 +1993,14 @@ instead; it will indirectly limit the specpdl stack size as well.")
'native-comp-enable-subr-trampolines
"29.1")
(defvaralias 'comp-enable-subr-trampolines 'native-comp-enable-subr-trampolines)
(make-obsolete-variable 'native-comp-deferred-compilation
'native-comp-jit-compilation
"29.1")
(defvaralias 'native-comp-deferred-compilation 'native-comp-jit-compilation)
;;;; Alternate names for functions - these are not being phased out.

View file

@ -746,7 +746,8 @@ usage: (vconcat &rest SEQUENCES) */)
DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0,
doc: /* Return a copy of a list, vector, string, char-table or record.
The elements of a list, vector or record are not copied; they are
shared with the original.
shared with the original. See Info node `(elisp) Sequence Functions'
for more details about this sharing and its effects.
If the original sequence is empty, this function may return
the same empty object instead of its copy. */)
(Lisp_Object arg)

View file

@ -2363,7 +2363,9 @@ the replacement text. Otherwise, maybe capitalize the whole text, or
maybe just word initials, based on the replaced text. If the replaced
text has only capital letters and has at least one multiletter word,
convert NEWTEXT to all caps. Otherwise if all words are capitalized
in the replaced text, capitalize each word in NEWTEXT.
in the replaced text, capitalize each word in NEWTEXT. Note that
what exactly is a word is determined by the syntax tables in effect
in the current buffer.
If optional third arg LITERAL is non-nil, insert NEWTEXT literally.
Otherwise treat `\\' as special:

View file

@ -1900,6 +1900,10 @@ Return nil if NODE has no parent. If NODE is nil, return nil. */)
TSNode treesit_node = XTS_NODE (node)->node;
Lisp_Object parser = XTS_NODE (node)->parser;
TSTreeCursor cursor;
/* See the comments to treesit_cursor_helper about the algorithm for
finding the parent node. The complexity is roughly proportional
to the square root of the current node's depth in the parse tree,
and we punt if the tree is too deep. */
if (!treesit_cursor_helper (&cursor, treesit_node, parser))
return return_value;

View file

@ -3412,7 +3412,7 @@ w32_construct_mouse_wheel (struct input_event *result, W32Msg *msg,
((double)FRAME_LINE_HEIGHT (f) * scroll_unit)
/ ((double)WHEEL_DELTA / delta);
nlines = value_to_report / FRAME_LINE_HEIGHT (f) + 0.5;
result->arg = list3 (make_fixnum (nlines),
result->arg = list3 (make_fixnum (eabs (nlines)),
make_float (0.0),
make_float (value_to_report));
}