Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-07-09 08:40:38 +08:00
commit f812d92f67
40 changed files with 537 additions and 343 deletions

View file

@ -383,18 +383,27 @@ used with the completion list:
@table @kbd
@vindex minibuffer-completion-auto-choose
@kindex M-DOWN
@kindex M-UP
@kindex M-RET
@findex minibuffer-next-completion
@findex minibuffer-previous-completion
@findex minibuffer-choose-completion
@item M-@key{DOWN}
@itemx M-@key{UP}
While in the minibuffer, these keys navigate through the completions
displayed in the completions buffer. When
While in the minibuffer or in the completion list buffer, @kbd{M-@key{DOWN}}
(@code{minibuffer-next-completion} and @kbd{M-@key{UP}}
(@code{minibuffer-previous-completion}) navigate through the
completions and displayed in the completions buffer. When
@code{minibuffer-completion-auto-choose} is non-@code{nil} (which is
the default), using these commands also inserts the current completion
candidate into the minibuffer. If
@code{minibuffer-completion-auto-choose} is @code{nil}, you can use
the @kbd{M-@key{RET}} command to insert the completion candidates into
the minibuffer. By default, that exits the minibuffer, but with a
prefix argument, @kbd{C-u M-@key{RET}} inserts the currently active
candidate without exiting the minibuffer.
the @kbd{M-@key{RET}} command (@code{minibuffer-choose-completion}) to
insert the completion candidates into the minibuffer. By default,
that exits the minibuffer, but with a prefix argument, @kbd{C-u
M-@key{RET}} inserts the currently active candidate without exiting
the minibuffer.
@findex switch-to-completions
@item M-v
@ -402,7 +411,7 @@ candidate without exiting the minibuffer.
@itemx @key{prior}
Typing @kbd{M-v}, while in the minibuffer, selects the window showing
the completion list (@code{switch-to-completions}). This paves the
way for using the commands below. @key{PageUp}, @key{prior} and
way for also using the commands below. @key{PageUp}, @key{prior} and
@kbd{M-g M-c} does the same. You can also select the window in other
ways (@pxref{Windows}).

View file

@ -1102,9 +1102,9 @@ functions written in Lisp, it cannot profile Emacs primitives.
You can measure the time it takes to evaluate individual Emacs Lisp
forms using the @file{benchmark} library. See the function
@code{benchmark-call} as well as the macros @code{benchmark-run},
@code{benchmark-run-compiled}, @code{benchmark-progn} and
@code{benchmark-call} in @file{benchmark.el}. You can also use the
@code{benchmark} command for timing forms interactively.
@code{benchmark-run-compiled}, and @code{benchmark-progn} in
@file{benchmark.el}. You can also use the @code{benchmark} command
for timing forms interactively.
@c Not worth putting in the printed manual.
@ifnottex

View file

@ -1338,7 +1338,7 @@ Used in keymaps to undefine keys. It calls @code{ding}, but does
not cause an error.
@end deffn
@defun keymap-local-binding key &optional accept-defaults
@defun keymap-local-lookup key &optional accept-defaults
This function returns the binding for @var{key} in the current
local keymap, or @code{nil} if it is undefined there.
@ -1346,7 +1346,7 @@ The argument @var{accept-defaults} controls checking for default bindings,
as in @code{keymap-lookup} (above).
@end defun
@defun keymap-global-binding key &optional accept-defaults
@defun keymap-global-lookup key &optional accept-defaults
This function returns the binding for command @var{key} in the
current global keymap, or @code{nil} if it is undefined there.
@ -2070,7 +2070,16 @@ problematic suffixes/prefixes are @kbd{@key{ESC}}, @kbd{M-O} (which is really
@section Commands for Binding Keys
This section describes some convenient interactive interfaces for
changing key bindings. They work by calling @code{keymap-set}.
changing key bindings. They work by calling @code{keymap-set}
(@pxref{Changing Key Bindings}). In interactive use, these commands
prompt for the argument @var{key} and expect the user to type a valid
key sequence; they also prompt for the @var{binding} of the key
sequence, and expect the name of a command (i.e., a symbol that
satisfies @code{commandp}, @pxref{Interactive Call}). When called
from Lisp, these commands expect @var{key} to be a string that
satisfies @code{key-valid-p} (@pxref{Key Sequences}), and
@var{binding} to be any Lisp object that is meaningful in a keymap
(@pxref{Key Lookup}).
People often use @code{keymap-global-set} in their init files
(@pxref{Init File}) for simple customization. For example,

View file

@ -1052,6 +1052,12 @@ This is a list of regular expressions. The completion functions only
consider a completion acceptable if it matches all regular expressions
in this list, with @code{case-fold-search} (@pxref{Searching and Case})
bound to the value of @code{completion-ignore-case}.
Do not set this variable to a non-@code{nil} value globally, as that
is not safe and will probably cause errors in completion commands.
This variable should be only let-bound to non-@code{nil} values around
calls to basic completion functions: @code{try-completion},
@code{test-completion}, and @code{all-completions}.
@end defvar
@defmac lazy-completion-table var fun

View file

@ -560,16 +560,23 @@ improve the performance of your code. @xref{Truncation, cache-long-scans}.
@defun vertical-motion count &optional window cur-col
This function moves point to the start of the screen line @var{count}
screen lines down from the screen line containing point. If @var{count}
is negative, it moves up instead.
is negative, it moves up instead. If @var{count} is zero, point moves
to the visual start of the current screen line.
The @var{count} argument can be a cons cell, @code{(@var{cols}
. @var{lines})}, instead of an integer. Then the function moves by
@var{lines} screen lines, and puts point @var{cols} columns from the
visual start of that screen line. Note that @var{cols} are counted
from the @emph{visual} start of the line; if the window is scrolled
horizontally (@pxref{Horizontal Scrolling}), the column on which point
will end is in addition to the number of columns by which the text is
scrolled.
The @var{count} argument can be a cons cell, @w{@code{(@var{cols}
. @var{lines})}}, instead of an integer. Then the function moves by
@var{lines} screen lines, as described for @var{count} above, and puts
point @var{cols} columns from the visual start of that screen line.
The value of @var{cols} can be a float, and is interpreted in units of
the frame's canonical character width (@pxref{Frame Font}); this
allows specifying accurate horizontal position of point when the
target screen line uses variable fonts. Note that @var{cols} are
counted from the @emph{visual} start of the line; if the window is
scrolled horizontally (@pxref{Horizontal Scrolling}), the column where
point will end is in addition to the number of columns by which the
text is scrolled, and if the target line is a continuation line, its
leftmost column is considered column zero (unlike column-oriented
functions, @pxref{Columns}).
The return value is the number of screen lines over which point was
moved. The value may be less in absolute value than @var{count} if

View file

@ -3424,7 +3424,7 @@ If @var{not-current} is non-@code{nil}, then if point is already in a
region where we have a property match, skip past that region and find
the next region instead.
The @code{prop-match} structure has the following accessor functionss:
The @code{prop-match} structure has the following accessor functions:
@code{prop-match-beginning} (the start of the match),
@code{prop-match-end} (the end of the match), and
@code{prop-match-value} (the value of @var{property} at the start of

View file

@ -65,10 +65,10 @@ modify this GNU manual.''
Eshell is a shell-like command interpreter implemented in Emacs Lisp.
It invokes no external processes except for those requested by the
user. It is intended to be an alternative to the IELM (@pxref{Lisp
Interaction, Emacs Lisp Interaction, , emacs, The Emacs Editor})
REPL@footnote{Short for ``Read-Eval-Print Loop''.} for Emacs
@emph{and} with an interface similar to command shells such as
@command{bash}, @command{zsh}, @command{rc}, or @command{4dos}.
Interaction, , , emacs, The Emacs Editor}) REPL@footnote{Short for
``Read-Eval-Print Loop''.} for Emacs @emph{and} with an interface
similar to command shells such as @command{bash}, @command{zsh},
@command{rc}, or @command{4dos}.
@c This manual is updated to release 2.4 of Eshell.
@insertcopying
@ -217,7 +217,7 @@ that will be invoked, type this as the Eshell prompt:
@section Invocation
Eshell is both a command shell and an Emacs Lisp @acronym{REPL}. As a
result, you can invoke commands in two different ways: in @dfn{command
form} or in @dfn{lisp form}.
form} or in @dfn{Lisp form}.
You can use the semicolon (@code{;}) to separate multiple command
invocations on a single line, executing each in turn. You can also
@ -313,9 +313,9 @@ specify an argument of some other data type, you can use a Lisp form
(1 2 3)
@end example
Additionally, many built-in Eshell commands (@pxref{Built-ins, Eshell
commands}) will flatten the arguments they receive, so passing a list
as an argument will ``spread'' the elements into multiple arguments:
Additionally, many built-in Eshell commands (@pxref{Built-ins}) will
flatten the arguments they receive, so passing a list as an argument
will ``spread'' the elements into multiple arguments:
@example
~ $ printnl (list 1 2) 3
@ -338,7 +338,7 @@ example, @code{\$10} means the literal string @code{$10}.
Inside of double quotes, most characters have no special meaning.
However, @samp{\}, @samp{"}, and @samp{$} are still special; to escape
them, use backslash as above. Thus, if the value of the variable
@var{answer} is @code{42}, then @code{"The answer is: \"$answer\""}
@var{answer} is @code{42}, then @code{"The answer is: \"$@var{answer}\""}
returns the string @code{The answer is: "42"}. However, when escaping
characters with no special meaning, the result is the full
@code{\@var{c}} sequence. For example, @code{"foo\bar"} means the
@ -393,17 +393,20 @@ elisp, The Emacs Lisp Reference Manual}).
@item #<process @var{name}>
Return the process named @var{name}. This is equivalent to
@samp{$(get-process "@var{name}")} (@pxref{Process Information, , ,
@samp{$(get-process "@var{name}")} (@pxref{Process Information, , ,
elisp, The Emacs Lisp Reference Manual}).
@end table
@node Built-ins
@section Built-in commands
Several commands are built-in in Eshell. In order to call the
external variant of a built-in command @code{foo}, you could call
@code{*foo}. Usually, this should not be necessary. You can check
what will be applied by the @code{which} command:
Eshell provides a number of built-in commands, many of them
implementing common command-line utilities, but enhanced for Eshell.
(These built-in commands are just ordinary Lisp functions whose names
begin with @code{eshell/}.) In order to call the external variant of
a built-in command @code{foo}, you could call @code{*foo}. Usually,
this should not be necessary. You can check what will be applied by
the @code{which} command:
@example
~ $ which ls
@ -575,6 +578,14 @@ Prints the current environment variables. Unlike in Bash, this
command does not yet support running commands with a modified
environment.
@item eshell-debug
@cmindex eshell-debug
Toggle debugging information for Eshell itself. You can pass this
command the argument @code{errors} to enable/disable Eshell trapping
errors when evaluating commands, or the argument @code{commands} to
show/hide command execution progress in the buffer @code{*eshell last
cmd*}.
@item exit
@cmindex exit
Exit Eshell and save the history. By default, this command kills the
@ -982,6 +993,13 @@ variable is connection-aware, so when the current directory is remote,
its value will be @acronym{UID} for the user associated with that
remote connection.
@vindex $GID
@item $GID
This returns the effective @acronym{GID} for the current user. Like
@code{$UID}, this variable is connection-aware, so when the current
directory is remote, its value will be @acronym{GID} for the user
associated with that remote connection.
@vindex $_
@item $_
This refers to the last argument of the last command. With a
@ -1019,7 +1037,9 @@ Eshell can consult them to do the right thing.
@item $INSIDE_EMACS
This variable indicates to external commands that they are being
invoked from within Emacs so they can adjust their behavior if
necessary. Its value is @code{@var{emacs-version},eshell}.
necessary. By default, its value is
@code{@var{emacs-version},eshell}. Other parts of Emacs, such as
Tramp, may add extra information to this value.
@end table
@ -1124,11 +1144,11 @@ be directories @emph{and} files. Eshell provides predefined completions
for the built-in functions and some common external commands, and you
can define your own for any command.
Eshell completion also works for lisp forms and glob patterns. If the point is
on a lisp form, then @key{TAB} will behave similarly to completion in
@code{elisp-mode} and @code{lisp-interaction-mode}. For glob patterns, the
pattern will be removed from the input line, and replaced by the
completion.
Eshell completion also works for Lisp forms and glob patterns. If the
point is on a Lisp form, then @key{TAB} will behave similarly to
completion in @code{elisp-mode} and @code{lisp-interaction-mode}. For
glob patterns, the pattern will be removed from the input line, and
replaced by the completion.
If you want to see the entire list of possible completions (e.g. when it's
below the @code{completion-cycle-threshold}), press @kbd{M-?}.
@ -1147,7 +1167,7 @@ for a specific major mode.
@node Control Flow
@section Control Flow
Because Eshell commands can not (easily) be combined with lisp forms,
Because Eshell commands can not (easily) be combined with Lisp forms,
Eshell provides command-oriented control flow statements for
convenience.
@ -1299,9 +1319,9 @@ index. The exact behavior depends on the type of @var{expr}'s value:
@item a sequence
Expands to the element at the (zero-based) index @var{i} of the
sequence (@pxref{Sequences Arrays Vectors, Sequences, , elisp, The
Emacs Lisp Reference Manual}). If @var{i} is negative, @var{i} counts
from the end, so -1 refers to the last element of the sequence.
sequence (@pxref{Sequences Arrays Vectors, , , elisp, The Emacs Lisp
Reference Manual}). If @var{i} is negative, @var{i} counts from the
end, so -1 refers to the last element of the sequence.
If @var{i} is a range like @code{@var{start}..@var{end}}, this expands
to a subsequence from the indices @var{start} to @var{end}, where
@ -1389,8 +1409,8 @@ By default, globs are case sensitive, except on MS-DOS/MS-Windows
systems. You can control this behavior via the
@code{eshell-glob-case-insensitive} option. You can further customize
the syntax and behavior of globbing in Eshell via the Customize group
``eshell-glob'' (@pxref{Easy Customization, , , emacs, The GNU Emacs
Manual}).
@code{eshell-glob} (@pxref{Easy Customization, , , emacs, The GNU
Emacs Manual}).
@table @samp
@ -1488,7 +1508,7 @@ the following pairs of delimiters: @code{"@dots{}"}, @code{'@dots{}'},
@code{[@dots{}]}, @code{<@dots{}>}, or @code{@{@dots{}@}}.
You can customize the syntax and behavior of predicates and modifiers
in Eshell via the Customize group ``eshell-pred'' (@pxref{Easy
in Eshell via the Customize group @code{eshell-pred} (@pxref{Easy
Customization, , , emacs, The GNU Emacs Manual}).
@menu
@ -1784,26 +1804,26 @@ output.
Redirect output to @var{dest}, appending it to the existing contents
of @var{dest}.
@item >>> @var{buffer}
@itemx @var{fd}>>> @var{buffer}
@item >>> @var{dest}
@itemx @var{fd}>>> @var{dest}
Redirect output to @var{dest}, inserting it at the current mark if
@var{dest} is a buffer, at the beginning of the file if @var{dest} is
a file, or otherwise behaving the same as @code{>>}.
@item &> @var{file}
@itemx >& @var{file}
@item &> @var{dest}
@itemx >& @var{dest}
Redirect both standard output and standard error to @var{dest},
overwriting its contents with the new output.
@item &>> @var{file}
@itemx >>& @var{file}
@item &>> @var{dest}
@itemx >>& @var{dest}
Redirect both standard output and standard error to @var{dest},
appending it to the existing contents of @var{dest}.
@item &>>> @var{file}
@itemx >>>& @var{file}
@item &>>> @var{dest}
@itemx >>>& @var{dest}
Redirect both standard output and standard error to @var{dest},
inserting it like with @code{>>> @var{file}}.
inserting it like with @code{>>> @var{dest}}.
@item >&@var{other-fd}
@itemx @var{fd}>&@var{other-fd}
@ -2118,11 +2138,27 @@ add @code{eshell-xtra} to @code{eshell-modules-list}.
@table @code
@item count
@cmindex count
A wrapper around the function @code{cl-count} (@pxref{Searching
Sequences,,, cl, GNU Emacs Common Lisp Emulation}). This command can
be used for comparing lists of strings.
@item expr
@cmindex expr
An implementation of @command{expr} using the Calc package.
@xref{Top,,, calc, The GNU Emacs Calculator}.
@item ff
@cmindex ff
Shorthand for the the function @code{find-name-dired} (@pxref{Dired
and Find, , , emacs, The Emacs Editor}).
@item gf
@cmindex gf
Shorthand for the the function @code{find-grep-dired} (@pxref{Dired
and Find, , , emacs, The Emacs Editor}).
@item intersection
@cmindex intersection
A wrapper around the function @code{cl-intersection} (@pxref{Lists as
@ -2406,10 +2442,6 @@ A special associate array, which can take references of the form
@item Support zsh's ``Parameter Expansion'' syntax, i.e., @samp{$@{@var{name}:-@var{val}@}}
@item Write an @command{info} alias that can take arguments
So that the user can enter @samp{info chmod}, for example.
@item Create a mode @code{eshell-browse}
It would treat the Eshell buffer as an outline. Collapsing the outline

View file

@ -224,6 +224,11 @@ or get a sublist of elements 2 through 4 with '$my-list[2..5]'. For
more information, see the "(eshell) Dollars Expansion" node in the
Eshell manual.
+++
*** Eshell's '$UID' and '$GID' variables are now connection-aware.
Now, when expanding '$UID' or '$GID' in a remote directory, the value
is the user or group ID associated with the remote connection.
---
*** Eshell now uses 'field' properties in its output.
In particular, this means that pressing the '<home>' key moves the
@ -578,6 +583,21 @@ assertion only (which is useless). For historical compatibility, an
operator character following '^' or '\`' becomes literal, but we
advise against relying on this.
---
** Mode-line mnemonics for some coding-systems have changed.
The mode-line mnemonic for 'utf-7' is now the lowercase 'u', to be
consistent with the other encodings of this family.
The mode-line mnemonic for 'koi8-u' is now 'У', U+0423 CYRILLIC
CAPITAL LETTER U, to distinguish between this encoding and the
UTF-8/UTF-16 family.
If your terminal cannot display 'У', or if you want to get the old
behavior back for any other reason, you can do that using the
'coding-system-put' function. For example, the following restores the
previous behavior of showing 'U' in the mode line for 'koi8-u':
(coding-system-put 'koi8-u :mnemonic ?U)
* Lisp Changes in Emacs 30.1

View file

@ -3892,13 +3892,20 @@ or \"* [3 files]\"."
(format "%c [%d files]" dired-marker-char count)))))
(defcustom dired-no-confirm nil
"A list of symbols for commands Dired should not confirm, or t.
Command symbols are `byte-compile', `chgrp', `chmod', `chown', `compress',
`copy', `delete', `hardlink', `load', `move', `print', `shell', `symlink',
`touch' and `uncompress'.
If t, confirmation is never needed."
"Dired commands for which Dired should not popup list of affected files, or t.
If non-nil, Dired will not pop up the list of files to be affected by
some Dired commands, when asking for confirmation. (Dired will still
ask for confirmation, just without showing the affected files.)
If the value is t, the list of affected files is never popped up.
The value can also be a list of command symbols: then the list of the
affected files will not be popped up only for the corresponding Dired
commands. Recognized command symbols are `byte-compile', `chgrp',
`chmod', `chown', `compress', `copy', `delete', `hardlink', `load',
`move', `print', `shell', `symlink', `touch' and `uncompress'."
:group 'dired
:type '(choice (const :tag "Confirmation never needed" t)
:type '(choice (const :tag "Affected files never shown" t)
(set (const byte-compile) (const chgrp)
(const chmod) (const chown) (const compress)
(const copy) (const delete) (const hardlink)

View file

@ -66,8 +66,7 @@ delimiters."
(if (and cl-print--depth (natnump print-level)
(> cl-print--depth print-level))
(cl-print-insert-ellipsis object 0 stream)
(let ((car (pop object))
(count 1))
(let ((car (pop object)))
(if (and print-quoted
(memq car '(\, quote function \` \,@ \,.))
(consp object)
@ -80,26 +79,12 @@ delimiters."
stream)
(cl-print-object (car object) stream))
(princ "(" stream)
(cl-print-object car stream)
(while (and (consp object)
(not (cond
(cl-print--number-table
(numberp (gethash object cl-print--number-table)))
((memq object cl-print--currently-printing))
(t (push object cl-print--currently-printing)
nil))))
(princ " " stream)
(if (or (not (natnump print-length)) (> print-length count))
(cl-print-object (pop object) stream)
(cl-print-insert-ellipsis object print-length stream)
(setq object nil))
(cl-incf count))
(when object
(princ " . " stream) (cl-print-object object stream))
(cl-print--cons-tail car object stream)
(princ ")" stream)))))
(cl-defmethod cl-print-object-contents ((object cons) _start stream)
(let ((count 0))
(defun cl-print--cons-tail (car object stream)
(let ((count 1))
(cl-print-object car stream)
(while (and (consp object)
(not (cond
(cl-print--number-table
@ -107,33 +92,27 @@ delimiters."
((memq object cl-print--currently-printing))
(t (push object cl-print--currently-printing)
nil))))
(unless (zerop count)
(princ " " stream))
(princ " " stream)
(if (or (not (natnump print-length)) (> print-length count))
(cl-print-object (pop object) stream)
(cl-print-insert-ellipsis object print-length stream)
(cl-print-insert-ellipsis object t stream)
(setq object nil))
(cl-incf count))
(when object
(princ " . " stream) (cl-print-object object stream))))
(cl-defmethod cl-print-object-contents ((object cons) _start stream)
(cl-print--cons-tail (car object) (cdr object) stream))
(cl-defmethod cl-print-object ((object vector) stream)
(if (and cl-print--depth (natnump print-level)
(> cl-print--depth print-level))
(cl-print-insert-ellipsis object 0 stream)
(princ "[" stream)
(let* ((len (length object))
(limit (if (natnump print-length)
(min print-length len) len)))
(dotimes (i limit)
(unless (zerop i) (princ " " stream))
(cl-print-object (aref object i) stream))
(when (< limit len)
(princ " " stream)
(cl-print-insert-ellipsis object limit stream)))
(cl-print--vector-contents object 0 stream)
(princ "]" stream)))
(cl-defmethod cl-print-object-contents ((object vector) start stream)
(defun cl-print--vector-contents (object start stream)
(let* ((len (length object))
(limit (if (natnump print-length)
(min (+ start print-length) len) len))
@ -146,6 +125,9 @@ delimiters."
(princ " " stream)
(cl-print-insert-ellipsis object limit stream))))
(cl-defmethod cl-print-object-contents ((object vector) start stream)
(cl-print--vector-contents object start stream)) ;FIXME: η-redex!
(cl-defmethod cl-print-object ((object hash-table) stream)
(princ "#<hash-table " stream)
(princ (hash-table-test object) stream)
@ -232,24 +214,11 @@ into a button whose action shows the function's disassembly.")
(> cl-print--depth print-level))
(cl-print-insert-ellipsis object 0 stream)
(princ "#s(" stream)
(let* ((class (cl-find-class (type-of object)))
(slots (cl--struct-class-slots class))
(len (length slots))
(limit (if (natnump print-length)
(min print-length len) len)))
(princ (cl--struct-class-name class) stream)
(dotimes (i limit)
(let ((slot (aref slots i)))
(princ " :" stream)
(princ (cl--slot-descriptor-name slot) stream)
(princ " " stream)
(cl-print-object (aref object (1+ i)) stream)))
(when (< limit len)
(princ " " stream)
(cl-print-insert-ellipsis object limit stream)))
(princ (cl--struct-class-name (cl-find-class (type-of object))) stream)
(cl-print--struct-contents object 0 stream)
(princ ")" stream)))
(cl-defmethod cl-print-object-contents ((object cl-structure-object) start stream)
(defun cl-print--struct-contents (object start stream)
(let* ((class (cl-find-class (type-of object)))
(slots (cl--struct-class-slots class))
(len (length slots))
@ -258,7 +227,7 @@ into a button whose action shows the function's disassembly.")
(i start))
(while (< i limit)
(let ((slot (aref slots i)))
(unless (= i start) (princ " " stream))
(unless (and (= i start) (> i 0)) (princ " " stream))
(princ ":" stream)
(princ (cl--slot-descriptor-name slot) stream)
(princ " " stream)
@ -268,6 +237,9 @@ into a button whose action shows the function's disassembly.")
(princ " " stream)
(cl-print-insert-ellipsis object limit stream))))
(cl-defmethod cl-print-object-contents ((object cl-structure-object) start stream)
(cl-print--struct-contents object start stream)) ;FIXME: η-redex!
(cl-defmethod cl-print-object ((object string) stream)
(unless stream (setq stream standard-output))
(let* ((has-properties (or (text-properties-at 0 object)
@ -294,28 +266,36 @@ into a button whose action shows the function's disassembly.")
(- (point) 1) stream)))))
;; Print the property list.
(when has-properties
(let* ((interval-limit (and (natnump print-length)
(max 1 (/ print-length 3))))
(interval-count 0)
(start-pos (if (text-properties-at 0 object)
0 (next-property-change 0 object)))
(end-pos (next-property-change start-pos object len)))
(while (and (or (null interval-limit)
(< interval-count interval-limit))
(< start-pos len))
(let ((props (text-properties-at start-pos object)))
(when props
(princ " " stream) (princ start-pos stream)
(princ " " stream) (princ end-pos stream)
(princ " " stream) (cl-print-object props stream)
(cl-incf interval-count))
(setq start-pos end-pos
end-pos (next-property-change start-pos object len))))
(when (< start-pos len)
(princ " " stream)
(cl-print-insert-ellipsis object (list start-pos) stream)))
(cl-print--string-props object 0 stream)
(princ ")" stream)))))
(defun cl-print--string-props (object start stream)
(let* ((first (not (eq start 0)))
(len (length object))
(interval-limit (and (natnump print-length)
(max 1 (/ print-length 3))))
(interval-count 0)
(start-pos (if (text-properties-at start object)
start (next-property-change start object)))
(end-pos (next-property-change start-pos object len)))
(while (and (or (null interval-limit)
(< interval-count interval-limit))
(< start-pos len))
(let ((props (text-properties-at start-pos object)))
(when props
(if first
(setq first nil)
(princ " " stream))
(princ start-pos stream)
(princ " " stream) (princ end-pos stream)
(princ " " stream) (cl-print-object props stream)
(cl-incf interval-count))
(setq start-pos end-pos
end-pos (next-property-change start-pos object len))))
(when (< start-pos len)
(princ " " stream)
(cl-print-insert-ellipsis object (list start-pos) stream))))
(cl-defmethod cl-print-object-contents ((object string) start stream)
;; If START is an integer, it is an index into the string, and the
;; ellipsis that needs to be expanded is part of the string. If
@ -328,35 +308,13 @@ into a button whose action shows the function's disassembly.")
(min (+ start print-length) len) len))
(substr (substring-no-properties object start limit))
(printed (prin1-to-string substr))
(trimmed (substring printed 1 (1- (length printed)))))
(princ trimmed)
(trimmed (substring printed 1 -1)))
(princ trimmed stream)
(when (< limit len)
(cl-print-insert-ellipsis object limit stream)))
;; Print part of the property list.
(let* ((first t)
(interval-limit (and (natnump print-length)
(max 1 (/ print-length 3))))
(interval-count 0)
(start-pos (car start))
(end-pos (next-property-change start-pos object len)))
(while (and (or (null interval-limit)
(< interval-count interval-limit))
(< start-pos len))
(let ((props (text-properties-at start-pos object)))
(when props
(if first
(setq first nil)
(princ " " stream))
(princ start-pos stream)
(princ " " stream) (princ end-pos stream)
(princ " " stream) (cl-print-object props stream)
(cl-incf interval-count))
(setq start-pos end-pos
end-pos (next-property-change start-pos object len))))
(when (< start-pos len)
(princ " " stream)
(cl-print-insert-ellipsis object (list start-pos) stream))))))
(cl-print--string-props object (car start) stream))))
;;; Circularity and sharing.

View file

@ -177,8 +177,9 @@ it inserts and pretty-prints that arg at point."
(< (point) end))
(let ((beg (point))
;; Whether we're in front of an element with paired delimiters.
;; Can be something funky like #'(lambda ..) or ,'#s(...).
(paired (when (looking-at "['`,#]*[[:alpha:]]*\\([({[\"]\\)")
;; Can be something funky like #'(lambda ..) or ,'#s(...)
;; Or also #^[..].
(paired (when (looking-at "['`,#]*[[:alpha:]^]*\\([({[\"]\\)")
(match-beginning 1))))
;; Go to the end of the sexp.
(goto-char (or (scan-sexps (or paired (point)) 1) end))
@ -238,7 +239,15 @@ it inserts and pretty-prints that arg at point."
(defun pp-buffer ()
"Prettify the current buffer with printed representation of a Lisp object."
(interactive)
(funcall pp-default-function (point-min) (point-max))
;; The old code used `indent-sexp' which mostly works "anywhere",
;; so let's make sure we also work right in buffers that aren't
;; setup specifically for Lisp.
(if (and (eq (syntax-table) emacs-lisp-mode-syntax-table)
(eq indent-line-function #'lisp-indent-line))
(funcall pp-default-function (point-min) (point-max))
(with-syntax-table emacs-lisp-mode-syntax-table
(let ((indent-line-function #'lisp-indent-line))
(funcall pp-default-function (point-min) (point-max)))))
;; Preserve old behavior of (usually) finishing with a newline and
;; with point at BOB.
(goto-char (point-max))

View file

@ -1251,6 +1251,10 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:eval (>= 3 2 2 1))
(zerop
:eval (zerop 0))
(natnump
:eval (natnump -1)
:eval (natnump 0)
:eval (natnump 23))
(cl-plusp
:eval (cl-plusp 0)
:eval (cl-plusp 1))
@ -1261,9 +1265,6 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
:eval (cl-oddp 3))
(cl-evenp
:eval (cl-evenp 6))
(natnump
:eval (natnump -1)
:eval (natnump 23))
(bignump
:eval (bignump 4)
:eval (bignump (expt 2 90)))

View file

@ -163,6 +163,7 @@ if they are quoted with a backslash."
("LINES" ,(lambda () (window-body-height nil 'remap)) t t)
("INSIDE_EMACS" eshell-inside-emacs t)
("UID" ,(lambda () (file-user-uid)) nil t)
("GID" ,(lambda () (file-group-gid)) nil t)
;; for esh-ext.el
("PATH" (,(lambda () (string-join (eshell-get-path t) (path-separator)))

View file

@ -1600,7 +1600,7 @@ for decoding and encoding files, process I/O, etc."
(define-coding-system 'utf-7
"UTF-7 encoding of Unicode (RFC 2152)."
:coding-type 'utf-8
:mnemonic ?U
:mnemonic ?u
:mime-charset 'utf-7
:charset-list '(unicode)
:pre-write-conversion 'utf-7-pre-write-conversion

View file

@ -40,11 +40,12 @@
(defun keymap-set (keymap key definition)
"Set KEY to DEFINITION in KEYMAP.
KEY is a string that satisfies `key-valid-p'.
If DEFINITION is a string, it must also satisfy `key-valid-p'.
DEFINITION is anything that can be a key's definition:
nil (means key is undefined in this keymap),
a command (a Lisp function suitable for interactive calling),
a string (treated as a keyboard macro),
a string (treated as a keyboard macro or a sequence of input events),
a keymap (to define a prefix key),
a symbol (when the key is looked up, the symbol will stand for its
function definition, which should at that time be one of the above,
@ -67,10 +68,17 @@ DEFINITION is anything that can be a key's definition:
(defun keymap-global-set (key command &optional interactive)
"Give KEY a global binding as COMMAND.
COMMAND is the command definition to use; usually it is
a symbol naming an interactively-callable function.
When called interactively, KEY is a key sequence. When called from
Lisp, KEY is a string that must satisfy `key-valid-p'.
KEY is a string that satisfies `key-valid-p'.
COMMAND is the command definition to use. When called interactively,
this function prompts for COMMAND and accepts only names of known
commands, i.e., symbols that satisfy the `commandp' predicate. When
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'.
Note that if KEY has a local binding in the current buffer,
that local binding will continue to shadow any global binding
@ -84,12 +92,19 @@ that you make with this function."
(defun keymap-local-set (key command &optional interactive)
"Give KEY a local binding as COMMAND.
COMMAND is the command definition to use; usually it is
a symbol naming an interactively-callable function.
When called interactively, KEY is a key sequence. When called from
Lisp, KEY is a string that must satisfy `key-valid-p'.
KEY is a string that satisfies `key-valid-p'.
COMMAND is the command definition to use. When called interactively,
this function prompts for COMMAND and accepts only names of known
commands, i.e., symbols that satisfy the `commandp' predicate. When
called from Lisp, COMMAND can be anything that `keymap-set' accepts
as its DEFINITION argument.
The binding goes in the current buffer's local map, which in most
If COMMAND is a string (which can only happen when this function is
callled 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."
(declare (compiler-macro (lambda (form) (keymap--compile-check key) form))
(advertised-calling-convention (key command) "29.1"))
@ -103,10 +118,11 @@ cases is shared with all other buffers in the same major mode."
(defun keymap-global-unset (key &optional remove)
"Remove global binding of KEY (if any).
KEY is a string that satisfies `key-valid-p'.
When called interactively, KEY is a key sequence. When called from
Lisp, KEY is a string that satisfies `key-valid-p'.
If REMOVE (interactively, the prefix arg), remove the binding
instead of unsetting it. See `keymap-unset' for details."
If REMOVE is non-nil (interactively, the prefix arg), remove the
binding instead of unsetting it. See `keymap-unset' for details."
(declare (compiler-macro (lambda (form) (keymap--compile-check key) form)))
(interactive
(list (key-description (read-key-sequence "Unset key globally: "))
@ -115,10 +131,11 @@ instead of unsetting it. See `keymap-unset' for details."
(defun keymap-local-unset (key &optional remove)
"Remove local binding of KEY (if any).
KEY is a string that satisfies `key-valid-p'.
When called interactively, KEY is a key sequence. When called from
Lisp, KEY is a string that satisfies `key-valid-p'.
If REMOVE (interactively, the prefix arg), remove the binding
instead of unsetting it. See `keymap-unset' for details."
If REMOVE is non-nil (interactively, the prefix arg), remove the
binding instead of unsetting it. See `keymap-unset' for details."
(declare (compiler-macro (lambda (form) (keymap--compile-check key) form)))
(interactive
(list (key-description (read-key-sequence "Unset key locally: "))
@ -130,11 +147,11 @@ instead of unsetting it. See `keymap-unset' for details."
"Remove key sequence KEY from KEYMAP.
KEY is a string that satisfies `key-valid-p'.
If REMOVE, remove the binding instead of unsetting it. This only
makes a difference when there's a parent keymap. When unsetting
a key in a child map, it will still shadow the same key in the
parent keymap. Removing the binding will allow the key in the
parent keymap to be used."
If REMOVE is non-nil, remove the binding instead of unsetting it.
This only makes a difference when there's a parent keymap. When
unsetting a key in a child map, it will still shadow the same key
in the parent keymap. Removing the binding will allow the key in
the parent keymap to be used."
(declare (compiler-macro (lambda (form) (keymap--compile-check key) form)))
(keymap--check key)
(define-key keymap (key-parse key) nil remove))
@ -201,7 +218,8 @@ a menu, so this function is not useful for non-menu keymaps."
(defun key-parse (keys)
"Convert KEYS to the internal Emacs key representation.
See `kbd' for a descripion of KEYS."
KEYS should be a string describing a key sequence in the format
returned by \\[describe-key] (`describe-key')."
(declare (pure t) (side-effect-free t))
;; A pure function is expected to preserve the match data.
(save-match-data

View file

@ -126,7 +126,8 @@ Support for Russian using koi8-r and the russian-computer input method.")
(define-coding-system 'koi8-u
"KOI8-U 8-bit encoding for Cyrillic (MIME: KOI8-U)"
:coding-type 'charset
:mnemonic ?U
;; This used to be ?U which collided with UTF-8.
:mnemonic ?У ; CYRILLIC CAPITAL LETTER U
:charset-list '(koi8-u)
:mime-charset 'koi8-u)

View file

@ -1477,30 +1477,30 @@ mail status in mode line"))
(word-search-regexp "Whole Words" "Whole word")))
(bindings--define-key menu (vector (nth 0 x))
`(menu-item ,(nth 1 x)
(lambda ()
(interactive)
(setq search-default-mode #',(nth 0 x))
(message ,(format "%s search enabled" (nth 2 x))))
,(lambda ()
(interactive)
(setq search-default-mode (nth 0 x))
(message "%s search enabled" (nth 2 x)))
:help ,(format "Enable %s search" (downcase (nth 2 x)))
:button (:radio . (eq search-default-mode #',(nth 0 x))))))
(bindings--define-key menu [regexp-search]
'(menu-item "Regular Expression"
(lambda ()
(interactive)
(setq search-default-mode t)
(message "Regular-expression search enabled"))
`(menu-item "Regular Expression"
,(lambda ()
(interactive)
(setq search-default-mode t)
(message "Regular-expression search enabled"))
:help "Enable regular-expression search"
:button (:radio . (eq search-default-mode t))))
(bindings--define-key menu [regular-search]
'(menu-item "Literal Search"
(lambda ()
(interactive)
(when search-default-mode
(setq search-default-mode nil)
(when (symbolp search-default-mode)
(message "Literal search enabled"))))
`(menu-item "Literal Search"
,(lambda ()
(interactive)
(when search-default-mode
(setq search-default-mode nil)
(when (symbolp search-default-mode)
(message "Literal search enabled"))))
:help "Disable special search modes"
:button (:radio . (not search-default-mode))))

View file

@ -4030,7 +4030,8 @@ the same set of elements."
(setq ccs (nreverse ccs))
(let* ((prefix (try-completion fixed comps))
(unique (or (and (eq prefix t) (setq prefix fixed))
(eq t (try-completion prefix comps)))))
(and (stringp prefix)
(eq t (try-completion prefix comps))))))
(unless (or (eq elem 'prefix)
(equal prefix ""))
(push prefix res))

View file

@ -1966,7 +1966,11 @@ file names."
(t2 (tramp-tramp-file-p newname))
(length (file-attribute-size
(file-attributes (file-truename filename))))
(msg-operation (if (eq op 'copy) "Copying" "Renaming")))
(file-times (file-attribute-modification-time
(file-attributes filename)))
(file-modes (tramp-default-file-modes filename))
(msg-operation (if (eq op 'copy) "Copying" "Renaming"))
copy-keep-date)
(with-parsed-tramp-file-name (if t1 filename newname) nil
(unless length
@ -1991,6 +1995,8 @@ file names."
;; both files, we invoke `cp' or `mv' on the remote
;; host directly.
((tramp-equal-remote filename newname)
(setq copy-keep-date
(or (eq op 'rename) keep-date preserve-uid-gid))
(tramp-do-copy-or-rename-file-directly
op filename newname
ok-if-already-exists keep-date preserve-uid-gid))
@ -1999,6 +2005,8 @@ file names."
((and
(tramp-method-out-of-band-p v1 length)
(tramp-method-out-of-band-p v2 length))
(setq copy-keep-date
(tramp-get-method-parameter v 'tramp-copy-keep-date))
(tramp-do-copy-or-rename-file-out-of-band
op filename newname ok-if-already-exists keep-date))
@ -2020,6 +2028,8 @@ file names."
(cond
;; Fast track on local machine.
((tramp-local-host-p v)
(setq copy-keep-date
(or (eq op 'rename) keep-date preserve-uid-gid))
(tramp-do-copy-or-rename-file-directly
op filename newname
ok-if-already-exists keep-date preserve-uid-gid))
@ -2027,6 +2037,8 @@ file names."
;; If the Tramp file has an out-of-band method, the
;; corresponding copy-program can be invoked.
((tramp-method-out-of-band-p v length)
(setq copy-keep-date
(tramp-get-method-parameter v 'tramp-copy-keep-date))
(tramp-do-copy-or-rename-file-out-of-band
op filename newname ok-if-already-exists keep-date))
@ -2054,10 +2066,19 @@ file names."
;; When newname did exist, we have wrong cached values.
(when t2
(with-parsed-tramp-file-name newname v2
(tramp-flush-file-properties v2 v2-localname)))))))))
(tramp-flush-file-properties v2 v2-localname)))
;; KEEP-DATE handling.
(when (and keep-date (not copy-keep-date))
(tramp-compat-set-file-times
newname file-times (unless ok-if-already-exists 'nofollow)))
;; Set the mode.
(unless (and keep-date copy-keep-date)
(set-file-modes newname file-modes))))))))
(defun tramp-do-copy-or-rename-file-via-buffer
(op filename newname ok-if-already-exists keep-date)
(op filename newname _ok-if-already-exists _keep-date)
"Use an Emacs buffer to copy or rename a file.
First arg OP is either `copy' or `rename' and indicates the operation.
FILENAME is the source file, NEWNAME the target file.
@ -2084,14 +2105,7 @@ KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
(with-temp-file newname
(set-buffer-multibyte nil)
(insert-file-contents-literally filename)))
;; KEEP-DATE handling.
(when keep-date
(tramp-compat-set-file-times
newname
(file-attribute-modification-time (file-attributes filename))
(unless ok-if-already-exists 'nofollow)))
;; Set the mode.
(set-file-modes newname (tramp-default-file-modes filename))
;; If the operation was `rename', delete the original file.
(unless (eq op 'copy) (delete-file filename)))
@ -2107,12 +2121,10 @@ as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
the uid and gid from FILENAME."
;; FILENAME and NEWNAME are already expanded.
(let ((t1 (tramp-tramp-file-p filename))
(t2 (tramp-tramp-file-p newname))
(file-times (file-attribute-modification-time
(file-attributes filename)))
(file-modes (tramp-default-file-modes filename)))
(t2 (tramp-tramp-file-p newname)))
(with-parsed-tramp-file-name (if t1 filename newname) nil
(let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -p")
(let* ((cmd (cond ((and (eq op 'copy) (or keep-date preserve-uid-gid))
"cp -f -p")
((eq op 'copy) "cp -f")
((eq op 'rename) "mv -f")
(t (tramp-error
@ -2241,14 +2253,7 @@ the uid and gid from FILENAME."
(list tmpfile localname2 ok-if-already-exists)))))
;; Save exit.
(ignore-errors (delete-file tmpfile)))))))))
;; Set the time and mode. Mask possible errors.
(ignore-errors
(when keep-date
(tramp-compat-set-file-times
newname file-times (unless ok-if-already-exists 'nofollow))
(set-file-modes newname file-modes))))))
(ignore-errors (delete-file tmpfile))))))))))))
(defun tramp-do-copy-or-rename-file-out-of-band
(op filename newname ok-if-already-exists keep-date)
@ -2260,7 +2265,7 @@ The method used must be an out-of-band method."
(v2 (and (tramp-tramp-file-p newname)
(tramp-dissect-file-name newname)))
(v (or v1 v2))
copy-program copy-args copy-env copy-keep-date listener spec
copy-program copy-args copy-env listener spec
options source target remote-copy-program remote-copy-args p)
(if (and v1 v2 (string-empty-p (tramp-scp-direct-remote-copying v1 v2)))
@ -2332,8 +2337,6 @@ The method used must be an out-of-band method."
?y (tramp-scp-force-scp-protocol v)
?z (tramp-scp-direct-remote-copying v1 v2))
copy-program (tramp-get-method-parameter v 'tramp-copy-program)
copy-keep-date (tramp-get-method-parameter
v 'tramp-copy-keep-date)
copy-args
;; " " has either been a replacement of "%k" (when
;; keep-date argument is non-nil), or a replacement for
@ -2441,19 +2444,7 @@ The method used must be an out-of-band method."
;; Houston, we have a problem! Likely, the listener is
;; still running, so let's clear everything (but the
;; cached password).
(tramp-cleanup-connection v 'keep-debug 'keep-password))))
;; Handle KEEP-DATE argument.
(when (and keep-date (not copy-keep-date))
(tramp-compat-set-file-times
newname
(file-attribute-modification-time (file-attributes filename))
(unless ok-if-already-exists 'nofollow)))
;; Set the mode.
(unless (and keep-date copy-keep-date)
(ignore-errors
(set-file-modes newname (tramp-default-file-modes filename)))))
(tramp-cleanup-connection v 'keep-debug 'keep-password)))))
;; If the operation was `rename', delete the original file.
(unless (eq op 'copy)

View file

@ -2308,7 +2308,7 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'."
(c-forward-syntactic-ws))
(goto-char (match-end ,type-match))))))))
;; Fontify special declarations that lacks a type.
;; Fontify special declarations that lack a type.
,@(when (c-lang-const c-typeless-decl-kwds)
`((,(c-make-font-lock-search-function
(concat "\\<\\("

View file

@ -2616,6 +2616,7 @@ will be handled."
;; {...}").
t (append (c-lang-const c-class-decl-kwds)
(c-lang-const c-brace-list-decl-kwds))
c nil
;; Note: "manages" for CORBA CIDL clashes with its presence on
;; `c-type-list-kwds' for IDL.
idl (append (c-lang-const c-typeless-decl-kwds)

View file

@ -1592,6 +1592,12 @@ TYPE is usually keyword `:error', `:warning' or `:note'."
,(format "%d" count)
face ,face
mouse-face mode-line-highlight
help-echo ,(format "Number of %s; scroll mouse to view."
(cond
((eq type :error) "errors")
((eq type :warning) "warnings")
((eq type :note) "notes")
(t (format "%s diagnostics" type))))
keymap
,(let ((map (make-sparse-keymap)))
(define-key map (vector 'mode-line

View file

@ -1302,9 +1302,10 @@ to specify a command to run.
If CONFIRM is non-nil, the user will be given an opportunity to edit the
command before it's run.
Interactively, the user can use the \\`M-c' command while entering
the regexp to indicate whether the grep should be case sensitive
or not."
Interactively, the user can use \
\\<read-regexp-map>\\[read-regexp-toggle-case-fold] \
while entering the regexp
to indicate whether the grep should be case sensitive or not."
(interactive
(progn
(grep-compute-defaults)

View file

@ -126,7 +126,7 @@ See the documentation of the variable `register-alist' for possible VALUEs."
(defvar register-preview-function #'register-preview-default
"Function to format a register for previewing.
Called with one argument, a cons (NAME . CONTENTS) as found in `register-alist'.
The function should return a string, the description of teh argument.")
The function should return a string, the description of the argument.")
(defun register-preview (buffer &optional show-empty)
"Pop up a window showing the registers preview in BUFFER.
@ -380,9 +380,7 @@ Interactively, prompt for REGISTER using `register-read-with-preview'."
(cl-defgeneric register-val-describe (val verbose)
"Print description of register value VAL to `standard-output'.
Second argument VERBOSE is ignored, unless VAL is not one of the
supported kinds of register contents, in which case it is displayed
using `prin1'."
Second argument VERBOSE means produce a more detailed description."
(princ "Garbage:\n")
(if verbose (prin1 val)))

View file

@ -346,10 +346,10 @@ undefined commands."
"List of directories saved by pushd in this buffer's shell.
Thus, this does not include the shell's current directory.")
(defvaralias 'shell-dirtrack-mode 'shell-dirtrackp)
(defvar shell-dirtrackp t
"Non-nil in a shell buffer means directory tracking is enabled.")
(defvaralias 'shell-dirtrackp 'shell-dirtrack-mode
"Non-nil in a shell buffer means directory tracking is enabled.
Directory tracking (`shell-dirtrack-mode') is automatically enabled
when `shell-mode' is activated.")
(defvar shell-last-dir nil
"Keep track of last directory for ksh `cd -' command.")
@ -997,6 +997,21 @@ Make the shell buffer the current buffer, and return it.
;; replace it with a process filter that watches for and strips out
;; these messages.
(define-minor-mode shell-dirtrack-mode
"Toggle directory tracking in this shell buffer (Shell Dirtrack mode).
This assigns a buffer-local non-nil value to `shell-dirtrackp'.
The `dirtrack' package provides an alternative implementation of
this feature; see the function `dirtrack-mode'. Also see
`comint-osc-directory-tracker' for an escape-sequence based
solution."
:lighter nil
:interactive (shell-mode)
(setq list-buffers-directory (if shell-dirtrack-mode default-directory))
(if shell-dirtrack-mode
(add-hook 'comint-input-filter-functions #'shell-directory-tracker nil t)
(remove-hook 'comint-input-filter-functions #'shell-directory-tracker t)))
(defun shell-directory-tracker (str)
"Tracks cd, pushd and popd commands issued to the shell.
This function is called on each input passed to the shell.
@ -1013,7 +1028,7 @@ and `shell-popd-regexp', while `shell-pushd-tohome', `shell-pushd-dextract',
and `shell-pushd-dunique' control the behavior of the relevant command.
Environment variables are expanded, see function `substitute-in-file-name'."
(if shell-dirtrackp
(if shell-dirtrack-mode
;; We fail gracefully if we think the command will fail in the shell.
;;; (with-demoted-errors "Directory tracker failure: %s"
;; This fails so often that it seems better to just ignore errors (?).
@ -1167,23 +1182,10 @@ Environment variables are expanded, see function `substitute-in-file-name'."
(and (string-match "^\\+[1-9][0-9]*$" str)
(string-to-number str)))
(define-minor-mode shell-dirtrack-mode
"Toggle directory tracking in this shell buffer (Shell Dirtrack mode).
The `dirtrack' package provides an alternative implementation of
this feature; see the function `dirtrack-mode'. Also see
`comint-osc-directory-tracker' for an escape-sequence based
solution."
:lighter nil
(setq list-buffers-directory (if shell-dirtrack-mode default-directory))
(if shell-dirtrack-mode
(add-hook 'comint-input-filter-functions #'shell-directory-tracker nil t)
(remove-hook 'comint-input-filter-functions #'shell-directory-tracker t)))
(defun shell-cd (dir)
"Do normal `cd' to DIR, and set `list-buffers-directory'."
(cd dir)
(if shell-dirtrackp
(if shell-dirtrack-mode
(setq list-buffers-directory default-directory)))
(defun shell-resync-dirs ()

View file

@ -9805,6 +9805,9 @@ makes it easier to edit it."
(define-key map [right] 'next-completion)
(define-key map [?\t] 'next-completion)
(define-key map [backtab] 'previous-completion)
(define-key map [M-up] 'minibuffer-previous-completion)
(define-key map [M-down] 'minibuffer-next-completion)
(define-key map "\M-\r" 'minibuffer-choose-completion)
(define-key map "z" 'kill-current-buffer)
(define-key map "n" 'next-completion)
(define-key map "p" 'previous-completion)
@ -10199,11 +10202,13 @@ Called from `temp-buffer-show-hook'."
;; Maybe insert help string.
(when completion-show-help
(goto-char (point-min))
(if (display-mouse-p)
(insert "Click on a completion to select it.\n"))
(insert (substitute-command-keys
"In this buffer, type \\[choose-completion] to \
select the completion near point.\n\n"))))))
(insert (substitute-command-keys
(if (display-mouse-p)
"Click or type \\[minibuffer-choose-completion] on a completion to select it.\n"
"Type \\[minibuffer-choose-completion] on a completion to select it.\n")))
(insert (substitute-command-keys
"Type \\[minibuffer-next-completion] or \\[minibuffer-previous-completion] \
to move point between completions.\n\n"))))))
(add-hook 'completion-setup-hook #'completion-setup-function)

View file

@ -5025,9 +5025,12 @@ even if this catches the signal."
`(condition-case ,var
,bodyform
,@(mapcar (lambda (handler)
`((debug ,@(if (listp (car handler)) (car handler)
(list (car handler))))
,@(cdr handler)))
(let ((condition (car handler)))
(if (eq condition :success)
handler
`((debug ,@(if (listp condition) condition
(list condition)))
,@(cdr handler)))))
handlers)))
(defmacro with-demoted-errors (format &rest body)

View file

@ -894,13 +894,12 @@ signals the `treesit-font-lock-error' error if that happens."
(start end face override &optional bound-start bound-end)
"Apply FACE to the region between START and END.
OVERRIDE can be nil, t, `append', `prepend', or `keep'.
See `treesit-font-lock-rules' for their semantic.
See `treesit-font-lock-rules' for their semantics.
If BOUND-START and BOUND-END are non-nil, only fontify the region
in between them."
(when (or (null bound-start) (null bound-end)
(and bound-start bound-end
(<= bound-start end)
(and (<= bound-start end)
(>= bound-end start)))
(when (and bound-start bound-end)
(setq start (max bound-start start)

View file

@ -6178,7 +6178,14 @@ value can be also stored on disk and read back in a new session."
(let* ((horizontal (eq type 'hc))
(total (window-size window horizontal pixelwise))
(first t)
(window-combination-limit (cdr (assq 'combination-limit state)))
;; Make sure to make a new parent window for a horizontal
;; or vertical combination embedded in one of the same type
;; (see Bug#50867 and Bug#64405).
(window-combination-limit
(and (or (eq (cdr (assq 'combination-limit state)) t)
(and horizontal (window-combined-p window t))
(and (not horizontal) (window-combined-p window)))
t))
size new)
(dolist (item state)
;; Find the next child window. WINDOW always points to the
@ -6418,7 +6425,10 @@ windows can get as small as `window-safe-min-height' and
head)))
(min-width (cdr (assq
(if pixelwise 'min-pixel-width 'min-weight)
head))))
head)))
;; Bind the following two variables. `window--state-put-1' has
;; to fully control them (see Bug#50867 and Bug#64405).
window-combination-limit window-combination-resize)
(if (and (not totals)
(or (> min-height (window-size window nil pixelwise))
(> min-width (window-size window t pixelwise)))

View file

@ -11473,7 +11473,18 @@ usage: (define-coding-system-internal ...) */)
DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
3, 3, 0,
doc: /* Change value in CODING-SYSTEM's property list PROP to VAL. */)
doc: /* Change value of CODING-SYSTEM's property PROP to VAL.
The following properties, if set by this function, override the values
of the corresponding attributes set by `define-coding-system':
`:mnemonic', `:default-char', `:ascii-compatible-p'
`:decode-translation-table', `:encode-translation-table',
`:post-read-conversion', `:pre-write-conversion'
See `define-coding-system' for the description of these properties.
See `coding-system-get' and `coding-system-plist' for accessing the
property list of a coding-system. */)
(Lisp_Object coding_system, Lisp_Object prop, Lisp_Object val)
{
Lisp_Object spec, attrs;

View file

@ -269,10 +269,11 @@ for example, (type-of 1) returns `integer'. */)
return Qtreesit_compiled_query;
case PVEC_SQLITE:
return Qsqlite;
case PVEC_SUB_CHAR_TABLE:
return Qsub_char_table;
/* "Impossible" cases. */
case PVEC_MISC_PTR:
case PVEC_OTHER:
case PVEC_SUB_CHAR_TABLE:
case PVEC_FREE: ;
}
emacs_abort ();
@ -4215,6 +4216,7 @@ syms_of_data (void)
DEFSYM (Qvector, "vector");
DEFSYM (Qrecord, "record");
DEFSYM (Qchar_table, "char-table");
DEFSYM (Qsub_char_table, "sub-char-table");
DEFSYM (Qbool_vector, "bool-vector");
DEFSYM (Qhash_table, "hash-table");
DEFSYM (Qthread, "thread");

View file

@ -2149,21 +2149,33 @@ If LINES is negative, this means moving up.
This function is an ordinary cursor motion function
which calculates the new position based on how text would be displayed.
The new position may be the start of a line,
or just the start of a continuation line.
or the start of a continuation line,
or the start of the visible portion of a horizontally-scrolled line.
The function returns number of screen lines moved over;
that usually equals LINES, but may be closer to zero
if beginning or end of buffer was reached.
that usually equals LINES, but may be closer to zero if
beginning or end of buffer was reached.
The optional second argument WINDOW specifies the window to use for
parameters such as width, horizontal scrolling, and so on.
The default is to use the selected window's parameters.
If LINES is zero, point will move to the first visible character on
the current screen line.
LINES can optionally take the form (COLS . LINES), in which case the
motion will not stop at the start of a screen line but COLS column
from the visual start of the line (if such exists on that line, that
is). If the line is scrolled horizontally, COLS is interpreted
visually, i.e., as addition to the columns of text beyond the left
edge of the window.
motion will stop at the COLSth column from the visual start of the
line (if such column exists on that line, that is). If the line is
scrolled horizontally, COLS is interpreted visually, i.e., as addition
to the columns of text beyond the left edge of the window.
If LINES is a cons cell, its car COLS can be a float, which allows
specifying an accurate position of point on a screen line that mixes
fonts or uses variable-pitch font: COLS is interpreted in units of the
canonical character width, and is internally converted to pixel units;
point will then stop at the position closest to that pixel coordinate.
The cdr of the cons, LINES, must be an integer; if it is zero, this
function moves point horizontally in the current screen line, to the
position specified by COLS.
The optional third argument CUR-COL specifies the horizontal
window-relative coordinate of point, in units of frame's canonical
@ -2171,11 +2183,10 @@ character width, where the function is invoked. If this argument is
omitted or nil, the function will determine the point coordinate by
going back to the beginning of the line.
`vertical-motion' always uses the current buffer,
regardless of which buffer is displayed in WINDOW.
This is consistent with other cursor motion functions
and makes it possible to use `vertical-motion' in any buffer,
whether or not it is currently displayed in some window. */)
`vertical-motion' always uses the current buffer, regardless of which
buffer is displayed in WINDOW. This is consistent with other cursor
motion functions and makes it possible to use `vertical-motion' in any
buffer, whether or not it is currently displayed in some window. */)
(Lisp_Object lines, Lisp_Object window, Lisp_Object cur_col)
{
struct it it;

View file

@ -2016,9 +2016,7 @@ ASCII_CHAR_P (intmax_t c)
range of characters. A sub-char-table is like a vector, but with
two integer fields between the header and Lisp data, which means
that it has to be marked with some precautions (see mark_char_table
in alloc.c). A sub-char-table appears only in an element of a
char-table, and there's no way to access it directly from a Lisp
program. */
in alloc.c). A sub-char-table appears in an element of a char-table. */
enum CHARTAB_SIZE_BITS
{
@ -4815,7 +4813,7 @@ extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t *);
extern EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t, EMACS_INT,
int, Lisp_Object, Lisp_Object, bool);
bool, Lisp_Object, Lisp_Object, bool);
extern void syms_of_search (void);
extern void clear_regexp_cache (void);

View file

@ -2471,7 +2471,12 @@ The basic completion functions only consider a completion acceptable
if it matches all regular expressions in this list, with
`case-fold-search' bound to the value of `completion-ignore-case'.
See Info node `(elisp)Basic Completion', for a description of these
functions. */);
functions.
Do not set this variable to a non-nil value globally, as that is not
safe and will probably cause errors in completion commands. This
variable should be only let-bound to non-nil values around calls to
basic completion functions like `try-completion' and `all-completions'. */);
Vcompletion_regexp_list = Qnil;
DEFVAR_BOOL ("minibuffer-allow-text-properties",

View file

@ -1027,7 +1027,7 @@ find_before_next_newline (ptrdiff_t from, ptrdiff_t to,
static Lisp_Object
search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
Lisp_Object count, int direction, int RE, bool posix)
Lisp_Object count, int direction, bool RE, bool posix)
{
EMACS_INT np;
EMACS_INT lim;
@ -1130,21 +1130,6 @@ trivial_regexp_p (Lisp_Object regexp)
return 1;
}
/* Search for the n'th occurrence of STRING in the current buffer,
starting at position POS and stopping at position LIM,
treating STRING as a literal string if RE is false or as
a regular expression if RE is true.
If N is positive, searching is forward and LIM must be greater than POS.
If N is negative, searching is backward and LIM must be less than POS.
Returns -x if x occurrences remain to be found (x > 0),
or else the position at the beginning of the Nth occurrence
(if searching backward) or the end (if searching forward).
POSIX is nonzero if we want full backtracking (POSIX style)
for this pattern. 0 means backtrack only enough to get a valid match. */
#define TRANSLATE(out, trt, d) \
do \
{ \
@ -1308,7 +1293,7 @@ search_buffer_re (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
static EMACS_INT
search_buffer_non_re (Lisp_Object string, ptrdiff_t pos,
ptrdiff_t pos_byte, ptrdiff_t lim, ptrdiff_t lim_byte,
EMACS_INT n, int RE, Lisp_Object trt, Lisp_Object inverse_trt,
EMACS_INT n, bool RE, Lisp_Object trt, Lisp_Object inverse_trt,
bool posix)
{
unsigned char *raw_pattern, *pat;
@ -1507,10 +1492,28 @@ search_buffer_non_re (Lisp_Object string, ptrdiff_t pos,
return result;
}
/* Search for the Nth occurrence of STRING in the current buffer,
from buffer position POS/POS_BYTE until LIM/LIM_BYTE.
If RE, look for matches against the regular expression STRING instead;
if POSIX, enable POSIX style backtracking within that regular
expression.
If N is positive, search forward; in this case, LIM must be greater
than POS.
If N is negative, search backward; LIM must be less than POS.
Return -X if there are X remaining occurrences or matches,
or else the position at the beginning (if N is negative) or the end
(if N is positive) of the Nth occurrence or match against STRING.
Use TRT and INVERSE_TRT as character translation tables. */
EMACS_INT
search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n,
int RE, Lisp_Object trt, Lisp_Object inverse_trt, bool posix)
bool RE, Lisp_Object trt, Lisp_Object inverse_trt, bool posix)
{
if (running_asynch_code)
save_search_regs ();
@ -2219,7 +2222,7 @@ Search case-sensitivity is determined by the value of the variable
See also the functions `match-beginning', `match-end' and `replace-match'. */)
(Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
{
return search_command (string, bound, noerror, count, -1, 0, 0);
return search_command (string, bound, noerror, count, -1, false, false);
}
DEFUN ("search-forward", Fsearch_forward, Ssearch_forward, 1, 4, "MSearch: ",
@ -2244,7 +2247,7 @@ Search case-sensitivity is determined by the value of the variable
See also the functions `match-beginning', `match-end' and `replace-match'. */)
(Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
{
return search_command (string, bound, noerror, count, 1, 0, 0);
return search_command (string, bound, noerror, count, 1, false, false);
}
DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4,
@ -2260,7 +2263,7 @@ because REGEXP is still matched in the forward direction. See Info
anchor `(elisp) re-search-backward' for details. */)
(Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
{
return search_command (regexp, bound, noerror, count, -1, 1, 0);
return search_command (regexp, bound, noerror, count, -1, true, false);
}
DEFUN ("re-search-forward", Fre_search_forward, Sre_search_forward, 1, 4,
@ -2291,7 +2294,7 @@ See also the functions `match-beginning', `match-end', `match-string',
and `replace-match'. */)
(Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
{
return search_command (regexp, bound, noerror, count, 1, 1, 0);
return search_command (regexp, bound, noerror, count, 1, true, false);
}
DEFUN ("posix-search-backward", Fposix_search_backward, Sposix_search_backward, 1, 4,
@ -2319,7 +2322,7 @@ See also the functions `match-beginning', `match-end', `match-string',
and `replace-match'. */)
(Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
{
return search_command (regexp, bound, noerror, count, -1, 1, 1);
return search_command (regexp, bound, noerror, count, -1, true, true);
}
DEFUN ("posix-search-forward", Fposix_search_forward, Sposix_search_forward, 1, 4,
@ -2347,7 +2350,7 @@ See also the functions `match-beginning', `match-end', `match-string',
and `replace-match'. */)
(Lisp_Object regexp, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
{
return search_command (regexp, bound, noerror, count, 1, 1, 1);
return search_command (regexp, bound, noerror, count, 1, true, true);
}
DEFUN ("replace-match", Freplace_match, Sreplace_match, 1, 5, 0,

View file

@ -1649,7 +1649,7 @@ buffer. */)
TSRange *treesit_ranges = xmalloc (sizeof (TSRange) * len);
struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer);
/* We can use XFUXNUM, XCAR, XCDR freely because we have checked
/* We can use XFIXNUM, XCAR, XCDR freely because we have checked
the input by treesit_check_range_argument. */
for (int idx = 0; !NILP (ranges); idx++, ranges = XCDR (ranges))
@ -2546,10 +2546,10 @@ static bool
treesit_predicate_equal (Lisp_Object args, struct capture_range captures,
Lisp_Object *signal_data)
{
if (XFIXNUM (Flength (args)) != 2)
if (list_length (args) != 2)
{
*signal_data = list2 (build_string ("Predicate `equal' requires "
"two arguments but only given"),
"two arguments but got"),
Flength (args));
return false;
}
@ -2581,10 +2581,10 @@ static bool
treesit_predicate_match (Lisp_Object args, struct capture_range captures,
Lisp_Object *signal_data)
{
if (XFIXNUM (Flength (args)) != 2)
if (list_length (args) != 2)
{
*signal_data = list2 (build_string ("Predicate `match' requires two "
"arguments but only given"),
"arguments but got"),
Flength (args));
return false;
}
@ -2628,7 +2628,7 @@ treesit_predicate_match (Lisp_Object args, struct capture_range captures,
ZV_BYTE = end_byte;
ptrdiff_t val = search_buffer (regexp, start_pos, start_byte,
end_pos, end_byte, 1, 1, Qnil, Qnil, false);
end_pos, end_byte, 1, true, Qnil, Qnil, false);
BEGV = old_begv;
BEGV_BYTE = old_begv_byte;
@ -2646,11 +2646,11 @@ static bool
treesit_predicate_pred (Lisp_Object args, struct capture_range captures,
Lisp_Object *signal_data)
{
if (XFIXNUM (Flength (args)) < 2)
if (list_length (args) < 2)
{
*signal_data = list2 (build_string ("Predicate `pred' requires "
"at least two arguments, "
"but was only given"),
"but only got"),
Flength (args));
return false;
}
@ -2671,7 +2671,7 @@ treesit_predicate_pred (Lisp_Object args, struct capture_range captures,
return !NILP (CALLN (Fapply, fn, nodes));
}
/* If all predicates in PREDICATES passes, return true; otherwise
/* If all predicates in PREDICATES pass, return true; otherwise
return false. If everything goes fine, don't touch SIGNAL_DATA; if
error occurs, set it to a suitable signal data. */
static bool
@ -2696,7 +2696,7 @@ treesit_eval_predicates (struct capture_range captures, Lisp_Object predicates,
{
*signal_data = list3 (build_string ("Invalid predicate"),
fn, build_string ("Currently Emacs only supports"
" equal, match, and pred"
" `equal', `match', and `pred'"
" predicates"));
pass = false;
}

View file

@ -999,6 +999,9 @@ END:VALARM
(ert-deftest icalendar-export-bug-56241-dotted-pair ()
"See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56241#5"
;; This test started failing early July 2023 without any apparent change
;; to the underlying code, so is probably sensitive to the current date.
:tags '(:unstable)
(let ((icalendar-export-sexp-enumeration-days 366))
(mapc (lambda (diary-string)
(should (string= "" (icalendar-tests--get-error-string-for-export

View file

@ -829,6 +829,10 @@ it, since the setter is nil."
"Test that $UID is equivalent to (user-uid) for local directories."
(eshell-command-result-equal "echo $UID" (user-uid)))
(ert-deftest esh-var-test/gid-var ()
"Test that $GID is equivalent to (group-gid) for local directories."
(eshell-command-result-equal "echo $GID" (group-gid)))
(ert-deftest esh-var-test/last-status-var-lisp-command ()
"Test using the \"last exit status\" ($?) variable with a Lisp command."
(with-temp-eshell

View file

@ -64,4 +64,35 @@
(should (equal (split-string-shell-command "ls /tmp/foo\\ bar")
'("ls" "/tmp/foo bar")))))
(ert-deftest shell-dirtrack-on-by-default ()
(with-temp-buffer
(shell-mode)
(should shell-dirtrack-mode)))
(ert-deftest shell-dirtrack-should-not-be-on-in-unrelated-modes ()
(with-temp-buffer
(should (not shell-dirtrack-mode))))
(ert-deftest shell-dirtrack-sets-list-buffers-directory ()
(let ((start-dir default-directory))
(with-temp-buffer
(should-not list-buffers-directory)
(shell-mode)
(shell-cd "..")
(should list-buffers-directory)
(should (not (equal start-dir list-buffers-directory)))
(should (string-prefix-p list-buffers-directory start-dir)))))
(ert-deftest shell-directory-tracker-cd ()
(let ((start-dir default-directory))
(with-temp-buffer
(should-not list-buffers-directory)
(shell-mode)
(cl-letf (((symbol-function 'shell-unquote-argument)
(lambda (x) x)))
(shell-directory-tracker "cd .."))
(should list-buffers-directory)
(should (not (equal start-dir list-buffers-directory)))
(should (string-prefix-p list-buffers-directory start-dir)))))
;;; shell-tests.el ends here

View file

@ -1256,5 +1256,36 @@ final or penultimate step during initialization."))
"((a b) (a b) #2# #2# #3# #3#)"
"((a b) (a b) [c d] [c d] #s(e f) #s(e f))")))))))
(ert-deftest condition-case-unless-debug ()
"Test `condition-case-unless-debug'."
(let ((debug-on-error nil))
(with-suppressed-warnings ((suspicious condition-case))
(should (= 0 (condition-case-unless-debug nil 0))))
(should (= 0 (condition-case-unless-debug nil 0 (t 1))))
(should (= 0 (condition-case-unless-debug x 0 (t (1+ x)))))
(should (= 1 (condition-case-unless-debug nil (error "") (t 1))))
(should (equal (condition-case-unless-debug x (error "") (t x))
'(error "")))))
(ert-deftest condition-case-unless-debug-success ()
"Test `condition-case-unless-debug' with :success (bug#64404)."
(let ((debug-on-error nil))
(should (= 1 (condition-case-unless-debug nil 0 (:success 1))))
(should (= 1 (condition-case-unless-debug nil 0 (:success 1) (t 2))))
(should (= 1 (condition-case-unless-debug nil 0 (t 2) (:success 1))))
(should (= 1 (condition-case-unless-debug x 0 (:success (1+ x)))))
(should (= 1 (condition-case-unless-debug x 0 (:success (1+ x)) (t x))))
(should (= 1 (condition-case-unless-debug x 0 (t x) (:success (1+ x)))))
(should (= 2 (condition-case-unless-debug nil (error "")
(:success 1) (t 2))))
(should (= 2 (condition-case-unless-debug nil (error "")
(t 2) (:success 1))))
(should (equal (condition-case-unless-debug x (error "")
(:success (1+ x)) (t x))
'(error "")))
(should (equal (condition-case-unless-debug x (error "")
(t x) (:success (1+ x)))
'(error "")))))
(provide 'subr-tests)
;;; subr-tests.el ends here