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

This commit is contained in:
Po Lu 2023-05-27 09:49:49 +08:00
commit cdca0fddcc
48 changed files with 807 additions and 241 deletions

View file

@ -394,6 +394,12 @@ typical 32-bit host, Emacs integers have 62 bits instead of 30.
Use --with-cairo to compile Emacs with Cairo drawing.
Use --with-cairo-xcb to also utilize the Cairo XCB backend on systems
where it is available. While such a configuration is moderately
faster when running over X connections with high latency, it is likely
to crash when a new frame is created on a display connection opened
after a display connection is closed.
Use --with-modules to build Emacs with support for dynamic modules.
This needs a C compiler that supports '__attribute__ ((cleanup (...)))',
as in GCC 3.4 and later.

View file

@ -551,6 +551,7 @@ OPTION_DEFAULT_ON([sqlite3],[don't compile with sqlite3 support])
OPTION_DEFAULT_ON([lcms2],[don't compile with Little CMS support])
OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support])
OPTION_DEFAULT_ON([cairo],[don't compile with Cairo drawing])
OPTION_DEFAULT_OFF([cairo-xcb], [use XCB surfaces for Cairo support])
OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support])
OPTION_DEFAULT_ON([native-image-api], [don't use native image APIs (GDI+ on Windows)])
@ -4355,14 +4356,14 @@ if test "${HAVE_X11}" = "yes"; then
CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
EMACS_CHECK_MODULES([CAIRO], [$CAIRO_MODULE])
if test $HAVE_CAIRO = yes; then
CAIRO_XCB_MODULE="cairo-xcb >= $CAIRO_REQUIRED"
EMACS_CHECK_MODULES([CAIRO_XCB], [$CAIRO_XCB_MODULE])
if test $HAVE_CAIRO_XCB = yes; then
CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XCB_LIBS"
AC_DEFINE([USE_CAIRO_XCB], [1],
[Define to 1 if cairo XCB surfaces are available.])
fi
AS_IF([test "x$with_cairo_xcb" = "xyes"], [
CAIRO_XCB_MODULE="cairo-xcb >= $CAIRO_REQUIRED"
EMACS_CHECK_MODULES([CAIRO_XCB], [$CAIRO_XCB_MODULE])
AS_IF([test "x$HAVE_CAIRO_XCB" = "xyes"], [
CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_XCB_CFLAGS"
CAIRO_LIBS="$CAIRO_LIBS $CAIRO_XCB_LIBS"
AC_DEFINE([USE_CAIRO_XCB], [1],
[Define to 1 if cairo XCB surfaces are available.])])])
AC_DEFINE([USE_CAIRO], [1], [Define to 1 if using cairo.])
CFLAGS="$CFLAGS $CAIRO_CFLAGS"
LIBS="$LIBS $CAIRO_LIBS"

View file

@ -127,7 +127,10 @@ command leaves point in the window. This variable affects all the
scroll commands documented in this section, as well as scrolling with
the mouse wheel (@pxref{Mouse Commands}); in general, it affects any
command that has a non-@code{nil} @code{scroll-command} property.
@xref{Property Lists,,, elisp, The Emacs Lisp Reference Manual}.
@xref{Property Lists,,, elisp, The Emacs Lisp Reference Manual}. The
same property also causes Emacs not to exit incremental search when
one of these commands is invoked and @code{isearch-allow-scroll} is
non-@code{nil} (@pxref{Not Exiting Isearch}).
@vindex fast-but-imprecise-scrolling
Sometimes, particularly when you hold down keys such as @kbd{C-v}

View file

@ -999,6 +999,10 @@ Display the change history for the current fileset
Display the change history for the current repository
(@code{vc-print-root-log}).
@item C-x v b l
Display the change history for another branch
(@code{vc-print-branch-log}).
@item C-x v I
Display the changes that a ``pull'' operation will retrieve
(@code{vc-log-incoming}).
@ -1063,6 +1067,14 @@ showing only the first line of each log entry. However, you can type
@file{*vc-change-log*} buffer to reveal the entire log entry for the
revision at point. A second @key{RET} hides it again.
@kindex C-x v b l
@findex vc-print-branch-log
@kbd{C-x v b l @var{branch-name} @key{RET}} (@code{vc-print-branch-log})
displays a @file{*vc-change-log*} buffer showing the history of the
version-controlled directory tree, like @code{vc-print-root-log} does,
but it shows the history of a branch other than the current one; it
prompts for the branch whose history to display.
@kindex C-x v I
@kindex C-x v O
@findex vc-log-incoming
@ -1523,6 +1535,8 @@ switch to another branch using the @kbd{svn switch} command. With
Mercurial, command @kbd{hg update} is used to switch to another
branch.
@kindex C-x v b s
@findex vc-switch-branch
The VC command to switch to another branch in the current directory
is @kbd{C-x v b s @var{branch-name} @key{RET}} (@code{vc-switch-branch}).
@ -1673,9 +1687,12 @@ branch ID for a branch starting at the current revision. For example,
if the current revision is 2.5, the branch ID should be 2.5.1, 2.5.2,
and so on, depending on the number of existing branches at that point.
@kindex C-x v b c
@findex vc-create-branch
This procedure will not work for distributed version control systems
like git or Mercurial. For those systems you should use the command
@code{vc-create-branch} (@kbd{C-x v b c}) instead.
@code{vc-create-branch} (@w{@kbd{C-x v b c @var{branch-name} @key{RET}}})
instead.
To create a new branch at an older revision (one that is no longer
the head of a branch), first select that revision (@pxref{Switching

View file

@ -587,26 +587,30 @@ i.e., they don't terminate the search, even if
@item Scrolling Commands
@cindex scrolling commands, during incremental search
@vindex isearch-allow-scroll
Normally, scrolling commands exit incremental search. If you change
the variable @code{isearch-allow-scroll} to a non-@code{nil} value,
that enables the use of the scroll-bar, as well as keyboard scrolling
commands like @kbd{C-v}, @kbd{M-v}, and @kbd{C-l} (@pxref{Scrolling}).
This applies only to calling these commands via their bound key
sequences---typing @kbd{M-x} will still exit the search. You can give
prefix arguments to these commands in the usual way. This feature
normally won't let you scroll the current match out of visibility; but
if you customize @code{isearch-allow-scroll} to the special value
@code{unlimited}, that restriction is lifted.
@cindex @code{scroll-command} property, and incremental search
Normally, scrolling commands exit incremental search. But if you
change the variable @code{isearch-allow-scroll} to a non-@code{nil}
value, that enables the use of the scroll-bar, as well as keyboard
scrolling commands like @kbd{C-v}, @kbd{M-v}, and @kbd{C-l}
(@pxref{Scrolling}), which have a non-@code{nil} @code{scroll-command}
property, without exiting the search. This applies only to calling
these commands via their bound key sequences---typing @kbd{M-x} will
still exit the search. You can give prefix arguments to these
commands in the usual way. This feature normally won't let you scroll
the current match out of visibility; but if you customize
@code{isearch-allow-scroll} to the special value @code{unlimited},
that restriction is lifted.
@cindex @code{isearch-scroll} property
@cindex prevent commands from exiting incremental search
The @code{isearch-allow-scroll} feature also affects some other
commands, such as @kbd{C-x 2} (@code{split-window-below}) and
@kbd{C-x ^} (@code{enlarge-window}), which don't exactly scroll but do
affect where the text appears on the screen. It applies to any
command whose name has a non-@code{nil} @code{isearch-scroll}
property. So you can control which commands are affected by changing
these properties.
affect where the text appears on the screen. In fact, it affects
any command that has a non-@code{nil} @code{isearch-scroll} property.
So you can control which commands are affected by changing these
properties.
@cindex prevent commands from exiting incremental search
For example, to make @kbd{C-h l} usable within an incremental search
in all future Emacs sessions, use @kbd{C-h c} to find what command it
runs (@pxref{Key Help}), which is @code{view-lossage}. Then you can
@ -643,6 +647,7 @@ you can extend the search string by holding down the shift key while
typing cursor motion commands. It will yank text that ends at the new
position after moving point in the current buffer.
@cindex @code{isearch-move} property
When @code{isearch-yank-on-move} is @code{t}, you can extend the
search string without using the shift key for cursor motion commands,
but it applies only for certain motion command that have the

View file

@ -2174,13 +2174,14 @@ will not have serious consequences. @code{yes-or-no-p} is suitable for
more momentous questions, since it requires three or four characters to
answer.
If either of these functions is called in a command that was invoked
using the mouse---more precisely, if @code{last-nonmenu-event}
(@pxref{Command Loop Info}) is either @code{nil} or a list---then it
uses a dialog box or pop-up menu to ask the question. Otherwise, it
uses keyboard input. You can force use either of the mouse or of keyboard
input by binding @code{last-nonmenu-event} to a suitable value around
the call.
If either of these functions is called in a command that was
invoked using the mouse or some other window-system gesture, or in a
command invoked via a menu, then they use a dialog box or pop-up menu
to ask the question if dialog boxes are supported. Otherwise, they
use keyboard input. You can force use either of the mouse or of
keyboard input by binding @code{last-nonmenu-event} to a suitable
value around the call---bind it to @code{t} to force keyboard
interaction, and to a list to force dialog boxes.
Both @code{yes-or-no-p} and @code{y-or-n-p} use the minibuffer.
@ -2386,13 +2387,14 @@ Normally, @code{map-y-or-n-p} binds @code{cursor-in-echo-area} while
prompting. But if @var{no-cursor-in-echo-area} is non-@code{nil}, it
does not do that.
If @code{map-y-or-n-p} is called in a command that was invoked using the
mouse---more precisely, if @code{last-nonmenu-event} (@pxref{Command
Loop Info}) is either @code{nil} or a list---then it uses a dialog box
or pop-up menu to ask the question. In this case, it does not use
keyboard input or the echo area. You can force use either of the mouse or
of keyboard input by binding @code{last-nonmenu-event} to a suitable
value around the call.
If @code{map-y-or-n-p} is called in a command that was invoked using
the mouse or some other window-system gesture, or a command invoked
via a menu, then it uses a dialog box or pop-up menu to ask the
question if dialog boxes are supported. In this case, it does not use
keyboard input or the echo area. You can force use either of the
mouse or of keyboard input by binding @code{last-nonmenu-event} to a
suitable value around the call---bind it to @code{t} to force keyboard
interaction, and to a list to force dialog boxes.
The return value of @code{map-y-or-n-p} is the number of objects acted on.
@end defun

View file

@ -4074,8 +4074,8 @@ replacing syntactic font lock, then the regexp-based font lock.
Although parser-based font lock doesn't share the same customization
variables with regexp-based font lock, it uses similar customization
schemes. The tree-sitter counterpart of @var{font-lock-keywords} is
@var{treesit-font-lock-settings}.
schemes. The tree-sitter counterpart of @code{font-lock-keywords} is
@code{treesit-font-lock-settings}.
@cindex tree-sitter fontifications, overview
@cindex fontifications with tree-sitter, overview
@ -4109,9 +4109,9 @@ To setup tree-sitter fontification, a major mode should first set
@code{treesit-major-mode-setup}.
@defun treesit-font-lock-rules &rest query-specs
This function is used to set @var{treesit-font-lock-settings}. It
This function is used to set @code{treesit-font-lock-settings}. It
takes care of compiling queries and other post-processing, and outputs
a value that @var{treesit-font-lock-settings} accepts. Here's an
a value that @code{treesit-font-lock-settings} accepts. Here's an
example:
@example
@ -4982,7 +4982,7 @@ below: then the major mode needs only to write some indentation rules
and the engine takes care of the rest.
To enable the parser-based indentation engine, either set
@var{treesit-simple-indent-rules} and call
@code{treesit-simple-indent-rules} and call
@code{treesit-major-mode-setup}, or equivalently, set the value of
@code{indent-line-function} to @code{treesit-indent}.

View file

@ -1692,9 +1692,9 @@ directly translate into operations shown above.
@end example
@defun treesit-range-rules &rest query-specs
This function is used to set @var{treesit-range-settings}. It
takes care of compiling queries and other post-processing, and outputs
a value that @var{treesit-range-settings} can have.
This function is used to set @code{treesit-range-settings}. It takes
care of compiling queries and other post-processing, and outputs a
value that @code{treesit-range-settings} can have.
It takes a series of @var{query-spec}s, where each @var{query-spec} is
a @var{query} preceded by zero or more @var{keyword}/@var{value}

View file

@ -713,7 +713,6 @@ Choosing a Mail Back End
Browsing the Web
* Archiving Mail::
* Web Searches:: Creating groups from articles that match a string.
* RSS:: Reading RDF site summary.
@ -17247,7 +17246,6 @@ Gnus has been getting a bit of a collection of back ends for providing
interfaces to these sources.
@menu
* Archiving Mail::
* Web Searches:: Creating groups from articles that match a string.
* RSS:: Reading RDF site summary.
@end menu
@ -17264,29 +17262,6 @@ cases, it makes a lot of sense to let the Gnus Agent (@pxref{Gnus
Unplugged}) handle downloading articles, and then you can read them at
leisure from your local disk. No more World Wide Wait for you.
@node Archiving Mail
@subsection Archiving Mail
@cindex archiving mail
@cindex backup of mail
Some of the back ends, notably @code{nnml}, @code{nnfolder}, and
@code{nnmaildir}, now actually store the article marks with each group.
For these servers, archiving and restoring a group while preserving
marks is fairly simple.
(Preserving the group level and group parameters as well still
requires ritual dancing and sacrifices to the @file{.newsrc.eld} deity
though.)
To archive an entire @code{nnml}, @code{nnfolder}, or @code{nnmaildir}
server, take a recursive copy of the server directory. There is no need
to shut down Gnus, so archiving may be invoked by @code{cron} or
similar. You restore the data by restoring the directory tree, and
adding a server definition pointing to that directory in Gnus. The
@ref{Article Backlog}, @ref{Asynchronous Fetching} and other things
might interfere with overwriting data, so you may want to shut down Gnus
before you restore the data.
@node Web Searches
@subsection Web Searches
@cindex nnweb

View file

@ -360,6 +360,51 @@ The new Rmail commands 'rmail-mailing-list-post',
'rmail-mailing-list-archive allow to, respectively, post to,
unsubscribe from, request help about, and browse the archives, of the
mailing list from which the current email message was delivered.
** Dictionary
---
*** New user option 'dictionary-search-interface'.
Controls how the 'dictionary-search' command prompts for and displays
dictionary definitions. Customize this user option to 'help' to have
'dictionary-search' display definitions in a *Help* buffer and provide
dictionary-based minibuffer completion for word selection.
---
*** New user option 'dictionary-read-word-prompt'.
This allows the user to customize the prompt that is used by
'dictionary-search' when asking for a word to search in the
dictionary.
---
*** New user option 'dictionary-display-definition-function'.
This allows the user to customize the way in which 'dictionary-search'
displays word definitions. If non-nil, this user option should be set
to a function that displays a word definition obtained from a
dictionary server. The new function
'dictionary-display-definition-in-help-buffer' can be used to display
the definition in a *Help* buffer, instead of the default *Dictionary*
buffer.
---
*** New user option 'dictionary-read-word-function'.
This allows the user to customize the way in which 'dictionary-search'
prompts for a word to search in the dictionary. This user option
should be set to a function that lets the user select a word and
returns it as a string. The new function
'dictionary-completing-read-word' can be used to prompt with
completion based on dictionary matches.
---
*** New user option 'dictionary-read-dictionary-function'.
This allows the user to customize the way in which 'dictionary-search'
prompts for a dictionary to search in. This user option should be set
to a function that lets the user select a dictionary and returns its
name as a string. The new function
'dictionary-completing-read-dictionary' can be used to prompt with
completion based on dictionaries that the server supports.
* New Modes and Packages in Emacs 30.1

View file

@ -91,24 +91,6 @@ available, and includes support for animated WebP images. To disable
WebP support, use the '--without-webp' configure flag. Image
specifiers can now use ':type webp'.
+++
** Emacs has been ported to the Haiku operating system.
The configuration process should automatically detect and build for
Haiku. There is also an optional window-system port to Haiku, which
can be enabled by configuring Emacs with the option '--with-be-app',
which will require the Haiku Application Kit development headers and a
C++ compiler to be present on your system. If Emacs is not built with
the option '--with-be-app', the resulting Emacs will only run in
text-mode terminals.
To enable Cairo support, ensure that the Cairo and FreeType
development files are present on your system, and configure Emacs with
'--with-be-cairo'.
Unlike X, there is no compile-time option to enable or disable
double-buffering; it is always enabled. To disable it, change the
frame parameter 'inhibit-double-buffering' instead.
---
** Emacs now installs the ".pdmp" file using a unique fingerprint in the name.
The file is typically installed using a file name akin to
@ -126,6 +108,16 @@ option '--without-xinput2' to disable this support.
'(featurep 'xinput2)' can be used to test for the presence of XInput 2
support from Lisp programs.
---
** Emacs can now be optionally built with the Cairo XCB backend.
Configure Emacs with the '--with-cairo-xcb' option to use the Cairo
XCB backend; the default is not to use it. This backend makes Emacs
moderately faster when running over X connections with high latency,
but is currently known to crash when Emacs repeatedly closes and opens
a display connection to the same terminal; this could happen, for
example, if you repeatedly visit files via emacsclient in a single
client frame, each time deleting the frame with 'C-x C-c'.
+++
** Emacs now supports being built with pure GTK.
To use this option, make sure the GTK 3 (version 3.22.23 or later) and
@ -139,6 +131,29 @@ known to have problems, such as undesirable frame positioning and
various issues with keyboard input of sequences such as 'C-;' and
'C-S-u'.
Note that, unlike the X build of Emacs, the PGTK build cannot
automatically switch to text-mode interface (thus emulating '-nw') if
it cannot determine the default display; it will instead complain and
ask you to invoke it with the explicit '-nw' option.
+++
** Emacs has been ported to the Haiku operating system.
The configuration process should automatically detect and build for
Haiku. There is also an optional window-system port to Haiku, which
can be enabled by configuring Emacs with the option '--with-be-app',
which will require the Haiku Application Kit development headers and a
C++ compiler to be present on your system. If Emacs is not built with
the option '--with-be-app', the resulting Emacs will only run in
text-mode terminals.
To enable Cairo support, ensure that the Cairo and FreeType
development files are present on your system, and configure Emacs with
'--with-be-cairo'.
Unlike X, there is no compile-time option to enable or disable
double-buffering; it is always enabled. To disable it, change the
frame parameter 'inhibit-double-buffering' instead.
---
** Emacs no longer reduces the size of the Japanese dictionary.
Building Emacs includes generation of a Japanese dictionary, which is
@ -1844,10 +1859,10 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'.
+++
*** New command 'package-upgrade'.
This command allows you to upgrade packages without using 'M-x
list-packages'. A package that comes with the Emacs distribution can
only be upgraded after you install, once, a newer version from ELPA
via the package-menu displayed by 'list-packages'.
This command allows you to upgrade packages without using 'list-packages'.
A package that comes with the Emacs distribution can only be upgraded
after you install, once, a newer version from ELPA via the
package-menu displayed by 'list-packages'.
+++
*** New command 'package-upgrade-all'.
@ -1908,10 +1923,10 @@ enabled.
In addition, when this option is non-nil, built-in packages for which
a new version is available in archives can be upgraded via the package
menu produced by 'M-x list-packages'. If you do set this option
non-nil, we recommend not to use the 'U' command, but instead to use
'/ u' to show the packages which can be upgraded, and then decide
which ones of them you actually want to update from the archives.
menu produced by 'list-packages'. If you do set this option non-nil,
we recommend not to use the 'U' command, but instead to use '/ u' to
show the packages which can be upgraded, and then decide which ones of
them you actually want to update from the archives.
If you customize this option, we recommend you place its non-default
setting in your early-init file.
@ -3871,6 +3886,19 @@ The following generalized variables have been made obsolete:
'standard-case-table', 'syntax-table', 'visited-file-modtime',
'window-height', 'window-width', and 'x-get-secondary-selection'.
---
** The 'dotimes' loop variable can no longer be manipulated in the loop body.
Previously, the 'dotimes' loop counter could be modified inside the
loop body, but only in code using dynamic binding. Now the behavior
is the same as when using lexical binding: changes to the loop
variable have no effect on subsequent iterations. That is,
(dotimes (i 10)
(print i)
(setq i (+ i 6)))
now always prints the numbers 0 .. 9.
* Lisp Changes in Emacs 29.1

View file

@ -516,6 +516,13 @@ directory copy is ineffective.
This is due to an arbitrary limit in certain versions of awk.
The solution is to use gawk (GNU awk).
*** Saving, via EasyPG, a file encrypted with GnuPG hangs
This is known to happen with GnuPG v2.4.1. The only known workaround
is to downgrade to a version of GnuPG older than 2.4.1 (or, in the
future, upgrade to a newer version which solves the problem, when such
a fixed version becomes available).
** Problems with hostname resolution
*** Emacs does not know your host's fully-qualified domain name.

View file

@ -258,6 +258,35 @@ to set this in a mode hook, rather than customize the default value."
file)
:group 'comint)
(defcustom comint-pager nil
"If non-nil, the program to use for pagination of program output.
Some programs produce large amounts of output, and have provision for
pagination of their output through a filter program, commonly known as
a \"pager\". The pager limits the amount of output produced and
allows the user to interactively browse the output one page at a time.
Some programs paginate their output by default, by always starting a
pager. The program they use as the pager is specified by the
environment variable PAGER; if that variable is not defined, they use
some fixed default, such as \"less\".
The interactive browsing aspects of pagination are not needed, and get
in the way, when the output of the program is directed to an Emacs
buffer, so in those cases pagination might need to be disabled.
Disabling pagination means that some programs will produce large
amounts of output, but most such programs have other ways to limit
their output, such as additional arguments or Emacs interfaces.
To disable pagination, this variable's value should be a string that
names a program, such as \"cat\", which passes through all of the
output without any filtering or delays. Comint will then set the
PAGER variable to name that program, when it invokes external
programs."
:version "30.1"
:type '(choice (const :tag "Use default PAGER" nil)
(const :tag "Don't do paging (PAGER=cat)" "cat")
(string :tag "Program name or absolute path of pager"))
:group 'comint)
(defvar comint-input-ring-file-prefix nil
"The prefix to skip when parsing the input ring file.
This is useful in Zsh when the extended_history option is on.")
@ -868,6 +897,10 @@ series of processes in the same Comint buffer. The hook
(nconc
(comint-term-environment)
(list (format "INSIDE_EMACS=%s,comint" emacs-version))
(when comint-pager
(if (stringp comint-pager)
(list (format "PAGER=%s" comint-pager))
(error "comint-pager should be a string: %s" comint-pager)))
process-environment))
(default-directory
(if (file-accessible-directory-p default-directory)
@ -1546,6 +1579,8 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'."
(setq isearch-message-function nil)
(setq isearch-wrap-function nil)
(setq isearch-push-state-function nil)
;; Force isearch to not change mark.
(setq isearch-opoint (point))
(kill-local-variable 'isearch-lazy-count)
(remove-hook 'isearch-mode-end-hook 'comint-history-isearch-end t)
(unless isearch-suspended

View file

@ -152,7 +152,7 @@ to call it without any argument."
(defmacro benchmark-progn (&rest body)
"Evaluate BODY and message the time taken.
The return value is the value of the final form in BODY."
(declare (debug body) (indent 0))
(declare (debug t) (indent 0))
(let ((value (make-symbol "value"))
(start (make-symbol "start"))
(gcs (make-symbol "gcs"))

View file

@ -1106,8 +1106,12 @@ untar into a directory named DIR; otherwise, signal an error."
;; Add the directory that will contain the autoload file to
;; the load path. We don't hard-code `pkg-dir', to avoid
;; issues if the package directory is moved around.
(or (and load-file-name (file-name-directory load-file-name))
(car load-path)))))
;; `loaddefs-generate' has code to do this for us, but it's
;; not currently exposed. (Bug#63625)
(or (and load-file-name
(directory-file-name
(file-name-directory load-file-name)))
(car load-path)))))
(let ((buf (find-buffer-visiting output-file)))
(when buf (kill-buffer buf)))
auto-name))
@ -1195,7 +1199,7 @@ boundaries."
;; the earliest in version 31.1. The idea is to phase out the
;; requirement for a "footer line" without unduly impacting users
;; on earlier Emacs versions. See Bug#26490 for more details.
(unless (search-forward (concat ";;; " file-name ".el ends here") nil t)
(unless (search-forward (concat ";;; " file-name ".el ends here") nil 'move)
(lwarn '(package package-format) :warning
"Package lacks a terminating comment"))
;; Try to include a trailing newline.

View file

@ -154,6 +154,7 @@ usually more efficient than that of a simplified version:
"Return the depth of REGEXP.
This means the number of non-shy regexp grouping constructs
\(parenthesized expressions) in REGEXP."
(declare (pure t) (side-effect-free t))
(save-match-data
;; Hack to signal an error if REGEXP does not have balanced parentheses.
(string-match regexp "")
@ -270,6 +271,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
CHARS should be a list of characters.
If CHARS is the empty list, the return value is a regexp that
never matches anything."
(declare (pure t) (side-effect-free t))
;; The basic idea is to find character ranges. Also we take care in the
;; position of character set meta characters in the character set regexp.
;;

View file

@ -1144,6 +1144,7 @@ If NO-GROUP is non-nil, don't bracket the result in a non-capturing
group.
For extending the `rx' notation in FORM, use `rx-define' or `rx-let-eval'."
(declare (important-return-value t))
(let* ((item (rx--translate form))
(exprs (if no-group
(car item)

View file

@ -81,18 +81,22 @@ Note how the single `-' got converted into a list before
threading."
(declare (indent 0) (debug thread-first))
`(internal--thread-argument nil ,@forms))
(defsubst hash-table-empty-p (hash-table)
"Check whether HASH-TABLE is empty (has 0 elements)."
(declare (side-effect-free t))
(zerop (hash-table-count hash-table)))
(defsubst hash-table-keys (hash-table)
"Return a list of keys in HASH-TABLE."
(declare (side-effect-free t))
(let ((keys nil))
(maphash (lambda (k _) (push k keys)) hash-table)
keys))
(defsubst hash-table-values (hash-table)
"Return a list of values in HASH-TABLE."
(declare (side-effect-free t))
(let ((values nil))
(maphash (lambda (_ v) (push v values)) hash-table)
values))
@ -149,6 +153,7 @@ carriage return."
All sequences of whitespaces in STRING are collapsed into a
single space character, and leading/trailing whitespace is
removed."
(declare (important-return-value t))
(let ((blank "[[:blank:]\r\n]+"))
(string-trim (replace-regexp-in-string blank " " string t t)
blank blank)))
@ -158,6 +163,7 @@ removed."
Wrapping is done where there is whitespace. If there are
individual words in STRING that are longer than LENGTH, the
result will have lines that are longer than LENGTH."
(declare (important-return-value t))
(with-temp-buffer
(insert string)
(goto-char (point-min))
@ -189,6 +195,7 @@ coding system that doesn't specify a BOM, like `utf-16le' or `utf-16be'.
When shortening strings for display purposes,
`truncate-string-to-width' is almost always a better alternative
than this function."
(declare (important-return-value t))
(unless (natnump length)
(signal 'wrong-type-argument (list 'natnump length)))
(if coding-system
@ -324,6 +331,7 @@ as the new values of the bound variables in the recursive invocation."
;;;###autoload
(defun string-pixel-width (string)
"Return the width of STRING in pixels."
(declare (important-return-value t))
(if (zerop (length string))
0
;; Keeping a work buffer around is more efficient than creating a
@ -344,6 +352,7 @@ This takes into account combining characters and grapheme clusters:
if compositions are enabled, each sequence of characters composed
on display into a single grapheme cluster is treated as a single
indivisible unit."
(declare (side-effect-free t))
(let ((result nil)
(start 0)
comp)

View file

@ -76,6 +76,7 @@ If it is non-nil and not a function, references to undefined variables are
left unchanged.
Use `$$' to insert a single dollar sign."
(declare (important-return-value t))
(let ((start 0))
(while (string-match env--substitute-vars-regexp string start)
(cond ((match-beginning 1)
@ -94,6 +95,7 @@ Use `$$' to insert a single dollar sign."
string))
(defun substitute-env-in-file-name (filename)
(declare (important-return-value t))
(substitute-env-vars filename
;; How 'bout we lookup other tables than the env?
;; E.g. we could accept bookmark names as well!
@ -104,6 +106,7 @@ Use `$$' to insert a single dollar sign."
(defun setenv-internal (env variable value keep-empty)
"Set VARIABLE to VALUE in ENV, adding empty entries if KEEP-EMPTY.
Changes ENV by side-effect, and returns its new value."
(declare (important-return-value t))
(let ((pattern (concat "\\`" (regexp-quote variable) "\\(=\\|\\'\\)"))
(case-fold-search nil)
(scan env)

View file

@ -2484,10 +2484,12 @@ This function is intended to be added to `auto-coding-functions'."
;; called as part of visiting a file, as opposed
;; to when saving a buffer to a file.
(if (and enable-multibyte-characters
;; 'charset' will signal an error in
;; coding-system-equal, since it isn't a
;; coding-system. So test that up front.
;; 'charset' and 'iso-2022' will signal
;; an error in coding-system-equal, since
;; they aren't coding-systems. So test
;; that up front.
(not (equal sym-type 'charset))
(not (equal sym-type 'iso-2022))
(coding-system-equal 'utf-8 sym-type)
(coding-system-equal 'utf-8 bfcs-type))
buffer-file-coding-system
@ -2540,11 +2542,13 @@ This function is intended to be added to `auto-coding-functions'."
(bfcs-type
(coding-system-type buffer-file-coding-system)))
(if (and enable-multibyte-characters
;; 'charset' will signal an error in
;; coding-system-equal, since it isn't a
;; coding-system. So test that up front.
;; 'charset' and 'iso-2022' will signal an error
;; in coding-system-equal, since they aren't
;; coding-systems. So test that up front.
(not (equal sym-type 'charset))
(not (equal bfcs-type 'charset))
(not (equal sym-type 'iso-2022))
(not (equal bfcs-type 'iso-2022))
(coding-system-equal 'utf-8 sym-type)
(coding-system-equal 'utf-8 bfcs-type))
buffer-file-coding-system

View file

@ -2589,10 +2589,11 @@ See `menu-bar-mode' for more information."
binding)))
(defun popup-menu (menu &optional position prefix from-menu-bar)
"Popup the given menu and call the selected option.
"Popup MENU and call the selected option.
MENU can be a keymap, an easymenu-style menu or a list of keymaps as for
`x-popup-menu'.
The menu is shown at the place where POSITION specifies.
The menu is shown at the location specified by POSITION, which
defaults to the place of the mouse click that popped the menu.
For the form of POSITION, see `popup-menu-normalize-position'.
PREFIX is the prefix argument (if any) to pass to the command.
FROM-MENU-BAR, if non-nil, means we are dropping one of menu-bar's menus."

View file

@ -38,6 +38,8 @@
(require 'custom)
(require 'dictionary-connection)
(require 'button)
(require 'help-mode)
(require 'external-completion)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Stuff for customizing.
@ -247,6 +249,65 @@ is utf-8"
)))
:version "28.1")
(defcustom dictionary-read-word-prompt "Search word"
"Prompt string to use when prompting for a word."
:type 'string
:version "30.1")
(defcustom dictionary-display-definition-function nil
"Function to use for displaying dictionary definitions.
It is called with three string arguments: the word being defined,
the dictionary name, and the full definition."
:type '(choice (const :tag "Dictionary buffer" nil)
(const :tag "Help buffer"
dictionary-display-definition-in-help-buffer)
(function :tag "Custom function"))
:version "30.1")
(defcustom dictionary-read-word-function #'dictionary-read-word-default
"Function to use for prompting for a word.
It is called with one string argument, the name of the dictionary to use, and
must return a string."
:type '(choice (const :tag "Default" dictionary-read-word-default)
(const :tag "Dictionary-based completion"
dictionary-completing-read-word)
(function :tag "Custom function"))
:version "30.1")
(defcustom dictionary-read-dictionary-function
#'dictionary-read-dictionary-default
"Function to use for prompting for a dictionary.
It is called with no arguments and must return a string."
:type '(choice (const :tag "Default" dictionary-read-dictionary-default)
(const :tag "Choose among server-provided dictionaries"
dictionary-completing-read-dictionary)
(function :tag "Custom function"))
:version "30.1")
(defcustom dictionary-search-interface nil
"Controls how `dictionary-search' prompts for words and displays definitions.
When set to `help', `dictionary-search' displays definitions in a *Help* buffer,
and provides completion for word selection based on dictionary matches.
Otherwise, `dictionary-search' displays definitions in a *Dictionary* buffer."
:type '(choice (const :tag "Dictionary buffer" nil)
(const :tag "Help buffer" help))
:set (lambda (symbol value)
(let ((vals (pcase value
('help '(dictionary-display-definition-in-help-buffer
dictionary-completing-read-word
dictionary-completing-read-dictionary))
(_ '(nil
dictionary-read-word-default
dictionary-read-dictionary-default)))))
(seq-setq (dictionary-display-definition-function
dictionary-read-word-function
dictionary-read-dictionary-function)
vals))
(set-default-toplevel-value symbol value))
:version "30.1")
(defface dictionary-word-definition-face
'((((supports (:family "DejaVu Serif")))
(:family "DejaVu Serif"))
@ -366,6 +427,8 @@ is utf-8"
'()
"History list of searched word.")
(defvar dictionary--last-match nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Basic function providing startup actions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1139,6 +1202,20 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
((car (get-char-property (point) 'data)))
(t (current-word t))))
(defun dictionary-read-dictionary-default ()
"Prompt for a dictionary name."
(read-string (if dictionary-default-dictionary
(format "Dictionary (%s): "
dictionary-default-dictionary)
"Dictionary: ")
nil nil dictionary-default-dictionary))
(defun dictionary-read-word-default (_dictionary)
"Prompt for a word to search in the dictionary."
(let ((default (dictionary-search-default)))
(read-string (format-prompt dictionary-read-word-prompt default)
nil 'dictionary-word-history default)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; User callable commands
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -1149,23 +1226,22 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
It presents the selection or word at point as default input and
allows editing it."
(interactive
(list (let ((default (dictionary-search-default)))
(read-string (format-prompt "Search word" default)
nil 'dictionary-word-history default))
(if current-prefix-arg
(read-string (if dictionary-default-dictionary
(format "Dictionary (%s): " dictionary-default-dictionary)
"Dictionary: ")
nil nil dictionary-default-dictionary)
dictionary-default-dictionary)))
;; if called by pressing the button
(unless word
(setq word (read-string "Search word: " nil 'dictionary-word-history)))
;; just in case non-interactively called
(let ((dict
(if current-prefix-arg
(funcall dictionary-read-dictionary-function)
dictionary-default-dictionary)))
(list (funcall dictionary-read-word-function dict) dict)))
(unless dictionary
(setq dictionary dictionary-default-dictionary))
(dictionary-new-search (cons word dictionary)))
(if dictionary-display-definition-function
(if-let ((definition (dictionary-define-word word dictionary)))
(funcall dictionary-display-definition-function word dictionary definition)
(user-error "No definition found for \"%s\"" word))
;; if called by pressing the button
(unless word
(setq word (read-string "Search word: " nil 'dictionary-word-history)))
;; just in case non-interactively called
(dictionary-new-search (cons word dictionary))))
;;;###autoload
(defun dictionary-lookup-definition ()
@ -1386,5 +1462,102 @@ the word at mouse click."
'dictionary-separator))
menu)
(defun dictionary-define-word (word dictionary)
"Return the definition of WORD in DICTIONARY, or nil if not found."
(dictionary-send-command
(format "define %s \"%s\"" dictionary word))
(when (and (= (read (dictionary-read-reply)) 150)
(= (read (dictionary-read-reply)) 151))
(dictionary-read-answer)))
(defun dictionary-match-word (word &rest _)
"Return dictionary matches for WORD as a list of strings.
Further arguments are currently ignored."
(unless (string-empty-p word)
(if (string= (car dictionary--last-match) word)
(cdr dictionary--last-match)
(dictionary-send-command
(format "match %s %s \"%s\""
dictionary-default-dictionary
dictionary-default-strategy
word))
(when (and (= (read (dictionary-read-reply)) 152))
(with-temp-buffer
(insert (dictionary-read-answer))
(goto-char (point-min))
(let ((result nil))
(while (not (eobp))
(search-forward " " nil t)
(push (read (current-buffer)) result)
(search-forward "\n" nil t))
(setq result (reverse result))
(setq dictionary--last-match (cons word result))
result))))))
(defun dictionary-completing-read-word (dictionary)
"Prompt for a word with completion based on matches in DICTIONARY."
(let* ((completion-ignore-case t)
(dictionary-default-dictionary dictionary)
(word-at-point (thing-at-point 'word t))
(default (dictionary-match-word word-at-point)))
(completing-read (format-prompt dictionary-read-word-prompt default)
(external-completion-table 'dictionary-definition
#'dictionary-match-word)
nil t nil 'dictionary-word-history default t)))
(defun dictionary-dictionaries ()
"Return the list of dictionaries the server supports."
(dictionary-send-command "show db")
(when (and (= (read (dictionary-read-reply)) 110))
(with-temp-buffer
(insert (dictionary-read-answer))
(goto-char (point-min))
(let ((result '(("!" . "First matching dictionary")
("*" . "All dictionaries"))))
(while (not (eobp))
(push (cons (buffer-substring
(search-forward "\n" nil t)
(1- (search-forward " " nil t)))
(read (current-buffer)))
result))
(reverse result)))))
(defun dictionary-completing-read-dictionary ()
"Prompt for a dictionary the server supports."
(let* ((dicts (dictionary-dictionaries))
(len (apply #'max (mapcar #'length (mapcar #'car dicts))))
(completion-extra-properties
(list :annotation-function
(lambda (key)
(concat (make-string (1+ (- len (length key))) ?\s)
(alist-get key dicts nil nil #'string=))))))
(completing-read (format-prompt "Select dictionary"
dictionary-default-dictionary)
dicts nil t nil nil dictionary-default-dictionary)))
(define-button-type 'help-word
:supertype 'help-xref
'help-function 'dictionary-search
'help-echo "mouse-2, RET: describe this word")
(defun dictionary-display-definition-in-help-buffer (word dictionary definition)
"Display DEFINITION, the definition of WORD in DICTIONARY."
(let ((help-buffer-under-preparation t))
(help-setup-xref (list #'dictionary-search word dictionary)
(called-interactively-p 'interactive))
(with-help-window (help-buffer)
(with-current-buffer (help-buffer)
(insert definition)
;; Buttonize references to other definitions. These appear as
;; words enclosed with curly braces.
(goto-char (point-min))
(while (re-search-forward (rx "{"
(group-n 1 (* (not (any ?}))))
"}")
nil t)
(help-xref-button 1 'help-word
(match-string 1)
dictionary))))))
(provide 'dictionary)
;;; dictionary.el ends here

View file

@ -1215,7 +1215,6 @@ START, and END. Note that START and END should be markers."
(add-text-properties
start (point)
(list 'shr-url url
'shr-tab-stop t
'button t
'category 'shr ; For button.el button buffers.
'help-echo (let ((parsed (url-generic-parse-url
@ -1240,6 +1239,8 @@ START, and END. Note that START and END should be markers."
;; Make separate regions not `eq' so that they'll get
;; separate mouse highlights.
'mouse-face (list 'highlight)))
(when (< start (point))
(add-text-properties start (1+ start) '(shr-tab-stop t)))
;; Don't overwrite any keymaps that are already in the buffer (i.e.,
;; image keymaps).
(while (and start

View file

@ -4135,8 +4135,10 @@ Let-bind it when necessary.")
(defun tramp-handle-file-name-as-directory (file)
"Like `file-name-as-directory' for Tramp files."
;; `file-name-as-directory' would be sufficient except localname is
;; the empty string.
(let ((v (tramp-dissect-file-name file t)))
;; the empty string. Suppress adding a hop to
;; `tramp-default-proxies-alist' due to non-expanded default values.
(let ((v (tramp-dissect-file-name file t))
tramp-default-proxies-alist)
;; Run the command on the localname portion only unless we are in
;; completion mode.
(tramp-make-tramp-file-name
@ -4225,8 +4227,10 @@ Let-bind it when necessary.")
"Like `file-name-directory' for Tramp files."
;; Everything except the last filename thing is the directory. We
;; cannot apply `with-parsed-tramp-file-name', because this expands
;; the remote file name parts.
(let ((v (tramp-dissect-file-name file t)))
;; the remote file name parts. Suppress adding a hop to
;; `tramp-default-proxies-alist' due to non-expanded default values.
(let ((v (tramp-dissect-file-name file t))
tramp-default-proxies-alist)
;; Run the command on the localname portion only. If this returns
;; nil, mark also the localname part of `v' as nil.
(tramp-make-tramp-file-name

View file

@ -119,7 +119,8 @@ Test is done using `equal'."
(with-temp-buffer
(apply #'call-process
"systemctl" nil '(t nil) nil
"list-units" "--full" "--legend=no" "--plain" args)
;; "--legend=no" doesn't exist before systemd v248
"list-units" "--full" "--no-legend" "--plain" args)
(goto-char (point-min))
(let (result)
(while (re-search-forward (rx bol (group (+ (not space)))

View file

@ -290,6 +290,10 @@ This is and alternative of `scroll-down'. Scope moves upward."
(scroll-down 1) ; relay on robust method
(pixel-scroll-pixel-down amt))))))
;; isearch-scroll support
(put 'pixel-scroll-up 'scroll-command t)
(put 'pixel-scroll-down 'scroll-command t)
(defun pixel-bob-at-top-p (amt)
"Return non-nil if window-start is at beginning of the current buffer.
Window must be vertically scrolled by not more than AMT pixels."
@ -730,6 +734,9 @@ wheel."
(message (error-message-string '(end-of-buffer))))))))))
(mwheel-scroll event nil))))
;; isearch-scroll support
(put 'pixel-scroll-precision 'scroll-command t)
(defun pixel-scroll-kinetic-state (&optional window)
"Return the kinetic scroll state of WINDOW.
If WINDOW is nil, return the state of the current window.

View file

@ -627,6 +627,13 @@ MODE is either `c' or `cpp'."
(function_definition
declarator: (_) @c-ts-mode--fontify-declarator)
;; When a function definition has preproc directives in its body,
;; it can't correctly parse into a function_definition. We still
;; want to highlight the function_declarator correctly, hence
;; this rule. See bug#63390 for more detail.
((function_declarator) @c-ts-mode--fontify-declarator
(:pred c-ts-mode--top-level-declarator
@c-ts-mode--fontify-declarator))
(parameter_declaration
declarator: (_) @c-ts-mode--fontify-declarator)
@ -750,6 +757,19 @@ For NODE, OVERRIDE, START, END, and ARGS, see
(treesit-node-start identifier) (treesit-node-end identifier)
face override start end))))
(defun c-ts-mode--top-level-declarator (node)
"Return non-nil if NODE is a top-level function_declarator."
;; These criterion are observed in
;; xterm.c:x_draw_glyphless_glyph_string_foreground on emacs-29
;; branch, described in bug#63390. They might not cover all cases
;; where a function_declarator is at top-level, outside of a
;; function_definition. We might need to amend them as we discover
;; more cases.
(let* ((parent (treesit-node-parent node))
(grandparent (treesit-node-parent parent)))
(and (equal (treesit-node-type parent) "ERROR")
(null grandparent))))
(defun c-ts-mode--fontify-variable (node override start end &rest _)
"Fontify an identifier node if it is a variable.
Don't fontify if it is a function identifier. For NODE,

View file

@ -10636,6 +10636,10 @@ This function might do hidden buffer changes."
got-parens
;; True if there is a terminated argument list.
got-arglist
;; True when `got-arglist' and the token after the end of the
;; arglist is an opening brace. Used only when we have a
;; suspected typeless function name.
got-stmt-block
;; True if there is an identifier in the declarator.
got-identifier
;; True if we find a number where an identifier was expected.
@ -10788,6 +10792,10 @@ This function might do hidden buffer changes."
(setq got-arglist t))
t)
(when (cond
((and (eq (char-after) ?\()
(c-safe (c-forward-sexp 1) t))
(when (eq (char-before) ?\))
(setq got-arglist t)))
((save-match-data (looking-at "\\s("))
(c-safe (c-forward-sexp 1) t))
((save-match-data
@ -10802,6 +10810,11 @@ This function might do hidden buffer changes."
(setq got-suffix-after-parens (match-beginning 0)))
(setq got-suffix t))))
((and got-arglist
(eq (char-after) ?{))
(setq got-stmt-block t)
nil)
(t
;; No suffix matched. We might have matched the
;; identifier as a type and the open paren of a
@ -10870,9 +10883,17 @@ This function might do hidden buffer changes."
(not (memq context '(arglist decl))))
(or (and new-style-auto
(looking-at c-auto-ops-re))
(and (or maybe-typeless backup-maybe-typeless)
(not got-prefix)
at-type)))
(and (not got-prefix)
at-type
(or maybe-typeless backup-maybe-typeless
;; Do we have a (typeless) constructor?
(and got-stmt-block
(save-excursion
(goto-char type-start)
(and
(looking-at c-identifier-key)
(c-directly-in-class-called-p
(match-string 0)))))))))
;; Have found no identifier but `c-typeless-decl-kwds' has
;; matched so we know we're inside a declaration. The
;; preceding type must be the identifier instead.
@ -12554,7 +12575,8 @@ comment at the start of cc-engine.el for more info."
(looking-at c-class-key))
(goto-char (match-end 1))
(c-forward-syntactic-ws)
(looking-at name))))))
(and (looking-at c-identifier-key)
(string= (match-string 0) name)))))))
(defun c-search-uplist-for-classkey (paren-state)
;; Check if the closest containing paren sexp is a declaration

View file

@ -412,8 +412,8 @@ the buffer's value of `default-directory'."
(defcustom project-vc-ignores nil
"List of patterns to add to `project-ignores'."
:type '(repeat string)
:safe #'listp)
:type '(repeat string))
;;;###autoload(put 'project-vc-ignores 'safe-local-variable #'listp)
(defcustom project-vc-merge-submodules t
"Non-nil to consider submodules part of the parent project.
@ -422,14 +422,14 @@ After changing this variable (using Customize or .dir-locals.el)
you might have to restart Emacs to see the effect."
:type 'boolean
:version "28.1"
:package-version '(project . "0.2.0")
:safe #'booleanp)
:package-version '(project . "0.2.0"))
;;;###autoload(put 'project-vc-merge-submodules 'safe-local-variable #'booleanp)
(defcustom project-vc-include-untracked t
"When non-nil, the VC-aware project backend includes untracked files."
:type 'boolean
:version "29.1"
:safe #'booleanp)
:version "29.1")
;;;###autoload(put 'project-vc-include-untracked 'safe-local-variable #'booleanp)
(defcustom project-vc-name nil
"When non-nil, the name of the current VC-aware project.
@ -439,8 +439,8 @@ its name, is by setting this in .dir-locals.el."
:type '(choice (const :tag "Default to the base name" nil)
(string :tag "Custom name"))
:version "29.1"
:package-version '(project . "0.9.0")
:safe #'stringp)
:package-version '(project . "0.9.0"))
;;;###autoload(put 'project-vc-name 'safe-local-variable #'stringp)
;; Not using regexps because these wouldn't work in Git pathspecs, in
;; case we decide we need to be able to list nested projects.
@ -467,8 +467,8 @@ In either case, their behavior will still obey the relevant
variables, such as `project-vc-ignores' or `project-vc-name'."
:type '(repeat string)
:version "29.1"
:package-version '(project . "0.9.0")
:safe (lambda (val) (and (listp val) (cl-every #'stringp val))))
:package-version '(project . "0.9.0"))
;;;###autoload(put 'project-vc-extra-root-markers 'safe-local-variable (lambda (val) (and (listp val) (not (memq nil (mapcar #'stringp val))))))
;; FIXME: Using the current approach, major modes are supposed to set
;; this variable to a buffer-local value. So we don't have access to
@ -1476,8 +1476,8 @@ Used by `project-kill-buffers'."
:type 'boolean
:version "29.1"
:group 'project
:package-version '(project . "0.8.2")
:safe #'booleanp)
:package-version '(project . "0.8.2"))
;;;###autoload(put 'project-kill-buffers-display-buffer-list 'safe-local-variable #'booleanp)
(defun project--buffer-check (buf conditions)
"Check if buffer BUF matches any element of the list CONDITIONS.
@ -1808,11 +1808,12 @@ invoked immediately without any dispatch menu."
(symbol :tag "Single command")))
(defcustom project-switch-use-entire-map nil
"Make `project-switch-project' use entire `project-prefix-map'.
"Whether `project-switch-project' will use the entire `project-prefix-map'.
If nil, `project-switch-project' will only recognize commands
listed in `project-switch-commands' and signal an error when
others are invoked. Otherwise, all keys in `project-prefix-map'
are legal even if they aren't listed in the dispatch menu."
listed in `project-switch-commands', and will signal an error
when other commands are invoked. If this is non-nil, all the
keys in `project-prefix-map' are valid even if they aren't
listed in the dispatch menu produced from `project-switch-commands'."
:type 'boolean
:group 'project
:version "28.1")

View file

@ -869,18 +869,22 @@ decorators, exceptions, and assignments.")
Which one will be chosen depends on the value of
`font-lock-maximum-decoration'.")
(defun python-font-lock-extend-region (beg end _old-len)
"Extend font-lock region given by BEG and END to statement boundaries."
(save-excursion
(save-match-data
(goto-char beg)
(python-nav-beginning-of-statement)
(setq beg (point))
(goto-char end)
(python-nav-end-of-statement)
(setq end (point))
(cons beg end))))
(defvar font-lock-beg)
(defvar font-lock-end)
(defun python-font-lock-extend-region ()
"Extend font-lock region to statement boundaries."
(let ((beg font-lock-beg)
(end font-lock-end))
(goto-char beg)
(python-nav-beginning-of-statement)
(beginning-of-line)
(when (< (point) beg)
(setq font-lock-beg (point)))
(goto-char end)
(python-nav-end-of-statement)
(when (< end (point))
(setq font-lock-end (point)))
(or (/= beg font-lock-beg) (/= end font-lock-end))))
(defconst python-syntax-propertize-function
(syntax-propertize-rules
@ -6078,8 +6082,7 @@ point's current `syntax-ppss'."
(let ((counter 1)
(indentation (current-indentation))
(backward-sexp-point)
(re (concat "[uU]?[rR]?"
(python-rx string-delimiter))))
(re "[uU]?[rR]?[\"']"))
(when (and
(not (python-info-assignment-statement-p))
(looking-at-p re)
@ -6100,9 +6103,7 @@ point's current `syntax-ppss'."
backward-sexp-point))
(setq last-backward-sexp-point
backward-sexp-point))
(looking-at-p
(concat "[uU]?[rR]?"
(python-rx string-delimiter))))))
(looking-at-p re))))
;; Previous sexp was a string, restore point.
(goto-char backward-sexp-point)
(cl-incf counter))
@ -6754,8 +6755,6 @@ implementations: `python-mode' and `python-ts-mode'."
(setq-local prettify-symbols-alist python-prettify-symbols-alist)
(python-skeleton-add-menu-items)
(make-local-variable 'python-shell-internal-buffer)
(add-hook 'flymake-diagnostic-functions #'python-flymake nil t))
@ -6769,9 +6768,9 @@ implementations: `python-mode' and `python-ts-mode'."
`(,python-font-lock-keywords
nil nil nil nil
(font-lock-syntactic-face-function
. python-font-lock-syntactic-face-function)
(font-lock-extend-after-change-region-function
. python-font-lock-extend-region)))
. python-font-lock-syntactic-face-function)))
(add-hook 'font-lock-extend-region-functions
#'python-font-lock-extend-region nil t)
(setq-local syntax-propertize-function
python-syntax-propertize-function)
(setq-local imenu-create-index-function
@ -6779,6 +6778,8 @@ implementations: `python-mode' and `python-ts-mode'."
(add-hook 'which-func-functions #'python-info-current-defun nil t)
(python-skeleton-add-menu-items)
(when python-indent-guess-indent-offset
(python-indent-guess-indent-offset)))
@ -6805,6 +6806,8 @@ implementations: `python-mode' and `python-ts-mode'."
#'python--treesit-defun-name)
(treesit-major-mode-setup)
(python-skeleton-add-menu-items)
(when python-indent-guess-indent-offset
(python-indent-guess-indent-offset))

View file

@ -1143,8 +1143,18 @@ The following commands are accepted by the client:
(process-put proc :authenticated t)
(server-log "Authentication successful" proc))
(server-log "Authentication failed" proc)
;; Display the error as a message and give the user time to see
;; it, in case the error written by emacsclient to stderr is not
;; visible for some reason.
(message "Authentication failed")
(sit-for 2)
(server-send-string
proc (concat "-error " (server-quote-arg "Authentication failed")))
(unless (eq system-type 'windows-nt)
(let ((terminal (process-get proc 'terminal)))
;; Only delete the terminal if it is non-nil.
(when (and terminal (eq (terminal-live-p terminal) t))
(delete-terminal terminal))))
;; Before calling `delete-process', give emacsclient time to
;; receive the error string and shut down on its own.
(sit-for 1)
@ -1462,10 +1472,20 @@ The following commands are accepted by the client:
(defun server-return-error (proc err)
(ignore-errors
;; Display the error as a message and give the user time to see
;; it, in case the error written by emacsclient to stderr is not
;; visible for some reason.
(message (error-message-string err))
(sit-for 2)
(server-send-string
proc (concat "-error " (server-quote-arg
(error-message-string err))))
(server-log (error-message-string err) proc)
(unless (eq system-type 'windows-nt)
(let ((terminal (process-get proc 'terminal)))
;; Only delete the terminal if it is non-nil.
(when (and terminal (eq (terminal-live-p terminal) t))
(delete-terminal terminal))))
;; Before calling `delete-process', give emacsclient time to
;; receive the error string and shut down on its own.
(sit-for 5)

View file

@ -3611,8 +3611,10 @@ confusing to some users.")
(defun use-dialog-box-p ()
"Return non-nil if the current command should prompt the user via a dialog box."
(and last-input-event ; not during startup
(or (featurep 'android) ; prefer dialog boxes on Android
(consp last-nonmenu-event) ; invoked by a mouse event
(or (consp last-nonmenu-event) ; invoked by a mouse event
(and (null last-nonmenu-event)
(consp last-input-event))
(featurep 'android) ; Prefer dialog boxes on Android.
from--tty-menu-p) ; invoked via TTY menu
use-dialog-box))
@ -3649,8 +3651,9 @@ If the user enters `recenter', `scroll-up', or `scroll-down'
responses, perform the requested window recentering or scrolling
and ask again.
Under a windowing system a dialog box will be used if `last-nonmenu-event'
is nil and `use-dialog-box' is non-nil.
If dialog boxes are supported, this function will use a dialog box
if `use-dialog-box' is non-nil and the last input event was produced
by a mouse, or by some window-system gesture, or via a menu.
By default, this function uses the minibuffer to read the key.
If `y-or-n-p-use-read-key' is non-nil, `read-key' is used
@ -4041,6 +4044,7 @@ See also `locate-user-emacs-file'.")
(defsubst buffer-narrowed-p ()
"Return non-nil if the current buffer is narrowed."
(declare (side-effect-free t))
(/= (- (point-max) (point-min)) (buffer-size)))
(defmacro with-restriction (start end &rest rest)
@ -4167,7 +4171,7 @@ See Info node `(elisp)Security Considerations'.
If the optional POSIX argument is non-nil, ARGUMENT is quoted
according to POSIX shell quoting rules, regardless of the
system's shell."
(cond
(cond
((and (not posix) (eq system-type 'ms-dos))
;; Quote using double quotes, but escape any existing quotes in
;; the argument with backslashes.
@ -4299,6 +4303,7 @@ string; otherwise returna 40-character string.
Note that SHA-1 is not collision resistant and should not be used
for anything security-related. See `secure-hash' for
alternatives."
(declare (side-effect-free t))
(secure-hash 'sha1 object start end binary))
(defun function-get (f prop &optional autoload)
@ -4306,6 +4311,7 @@ alternatives."
If AUTOLOAD is non-nil and F is autoloaded, try to load it
in the hope that it will set PROP. If AUTOLOAD is `macro', do it only
if it's an autoloaded macro."
(declare (important-return-value t))
(let ((val nil))
(while (and (symbolp f)
(null (setq val (get f prop)))
@ -5261,6 +5267,7 @@ In other words, all back-references in the form `\\&' and `\\N'
are substituted with actual strings matched by the last search.
Optional FIXEDCASE, LITERAL, STRING and SUBEXP have the same
meaning as for `replace-match'."
(declare (side-effect-free t))
(let ((match (match-string 0 string)))
(save-match-data
(match-data--translate (- (match-beginning 0)))
@ -5322,6 +5329,7 @@ A non-subregexp context is for example within brackets, or within a
repetition bounds operator `\\=\\{...\\}', or right after a `\\'.
If START is non-nil, it should be a position in REGEXP, smaller
than POS, and known to be in a subregexp context."
(declare (important-return-value t))
;; Here's one possible implementation, with the great benefit that it
;; reuses the regexp-matcher's own parser, so it understands all the
;; details of the syntax. A disadvantage is that it needs to match the
@ -5403,6 +5411,7 @@ case that you wish to retain zero-length substrings when splitting on
whitespace, use `(split-string STRING split-string-default-separators)'.
Modifies the match data; use `save-match-data' if necessary."
(declare (important-return-value t))
(let* ((keep-nulls (not (if separators omit-nulls t)))
(rexp (or separators split-string-default-separators))
(start 0)
@ -5460,6 +5469,7 @@ Only some SEPARATORs will work properly.
Note that this is not intended to protect STRINGS from
interpretation by shells, use `shell-quote-argument' for that."
(declare (important-return-value t))
(let* ((sep (or separator " "))
(re (concat "[\\\"]" "\\|" (regexp-quote sep))))
(mapconcat
@ -5474,6 +5484,7 @@ interpretation by shells, use `shell-quote-argument' for that."
It understands Emacs Lisp quoting within STRING, such that
(split-string-and-unquote (combine-and-quote-strings strs)) == strs
The SEPARATOR regexp defaults to \"\\s-+\"."
(declare (important-return-value t))
(let ((sep (or separator "\\s-+"))
(i (string-search "\"" string)))
(if (null i)
@ -5541,6 +5552,7 @@ To replace only the first match (if any), make REGEXP match up to \\\\='
and replace a sub-expression, e.g.
(replace-regexp-in-string \"\\\\(foo\\\\).*\\\\\\='\" \"bar\" \" foo foo\" nil nil 1)
=> \" bar foo\""
(declare (important-return-value t))
;; To avoid excessive consing from multiple matches in long strings,
;; don't just call `replace-match' continually. Walk down the
@ -5896,6 +5908,7 @@ from `standard-syntax-table' otherwise."
(defun syntax-after (pos)
"Return the raw syntax descriptor for the char after POS.
If POS is outside the buffer's accessible portion, return nil."
(declare (important-return-value t))
(unless (or (< pos (point-min)) (>= pos (point-max)))
(let ((st (if parse-sexp-lookup-properties
(get-char-property pos 'syntax-table))))
@ -6710,6 +6723,7 @@ Examples of version conversion:
\"22.8beta3\" (22 8 -2 3)
See documentation for `version-separator' and `version-regexp-alist'."
(declare (side-effect-free t))
(unless (stringp ver)
(error "Version must be a string"))
;; Change .x.y to 0.x.y
@ -6840,6 +6854,7 @@ etc. That is, the trailing \".0\"s are insignificant. Also, version
string \"1\" is higher (newer) than \"1pre\", which is higher than \"1beta\",
which is higher than \"1alpha\", which is higher than \"1snapshot\".
Also, \"-GIT\", \"-CVS\" and \"-NNN\" are treated as snapshot versions."
(declare (side-effect-free t))
(version-list-< (version-to-list v1) (version-to-list v2)))
(defun version<= (v1 v2)
@ -6850,6 +6865,7 @@ etc. That is, the trailing \".0\"s are insignificant. Also, version
string \"1\" is higher (newer) than \"1pre\", which is higher than \"1beta\",
which is higher than \"1alpha\", which is higher than \"1snapshot\".
Also, \"-GIT\", \"-CVS\" and \"-NNN\" are treated as snapshot versions."
(declare (side-effect-free t))
(version-list-<= (version-to-list v1) (version-to-list v2)))
(defun version= (v1 v2)
@ -6860,6 +6876,7 @@ etc. That is, the trailing \".0\"s are insignificant. Also, version
string \"1\" is higher (newer) than \"1pre\", which is higher than \"1beta\",
which is higher than \"1alpha\", which is higher than \"1snapshot\".
Also, \"-GIT\", \"-CVS\" and \"-NNN\" are treated as snapshot versions."
(declare (side-effect-free t))
(version-list-= (version-to-list v1) (version-to-list v2)))
(defvar package--builtin-versions
@ -6982,6 +6999,7 @@ returned list are in the same order as in TREE.
"Trim STRING of leading string matching REGEXP.
REGEXP defaults to \"[ \\t\\n\\r]+\"."
(declare (important-return-value t))
(if (string-match (if regexp
(concat "\\`\\(?:" regexp "\\)")
"\\`[ \t\n\r]+")
@ -7004,6 +7022,7 @@ REGEXP defaults to \"[ \\t\\n\\r]+\"."
"Trim STRING of leading and trailing strings matching TRIM-LEFT and TRIM-RIGHT.
TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
(declare (important-return-value t))
(string-trim-left (string-trim-right string trim-right) trim-left))
;; The initial anchoring is for better performance in searching matches.

View file

@ -1408,8 +1408,8 @@ Negative TAB-NUMBER counts tabs from the end of the tab bar."
(ws
;; `window-state-put' fails when called in the minibuffer
(when (minibuffer-selected-window)
(select-window (minibuffer-selected-window)))
(when (window-minibuffer-p)
(select-window (get-mru-window)))
(window-state-put ws nil 'safe)))
;; Select the minibuffer when it was active before switching tabs
@ -1420,8 +1420,8 @@ Negative TAB-NUMBER counts tabs from the end of the tab bar."
;; another tab, then after going back to the first tab, it has
;; such inconsistent state that the current buffer is the minibuffer,
;; but its window is not active. So try to undo this mess.
(when (and (minibufferp) (not (active-minibuffer-window)))
(other-window 1))
(when (and (window-minibuffer-p) (not (active-minibuffer-window)))
(select-window (get-mru-window)))
(when tab-bar-history-mode
(setq tab-bar-history-omit t))
@ -1644,8 +1644,8 @@ After the tab is created, the hooks in
(when tab-bar-new-tab-choice
;; Handle the case when it's called in the active minibuffer.
(when (minibuffer-selected-window)
(select-window (minibuffer-selected-window)))
(when (window-minibuffer-p)
(select-window (get-mru-window)))
(let ((ignore-window-parameters t)
(window--sides-inhibit-check t))
(if (eq tab-bar-new-tab-choice 'clone)
@ -1662,7 +1662,8 @@ After the tab is created, the hooks in
(window-state-put (window-state-get)))
;; Create a new window to get rid of old window parameters
;; (e.g. prev/next buffers) of old window.
(split-window) (delete-window))))
(split-window nil window-safe-min-width t)
(delete-window))))
(let ((buffer
(if (and (functionp tab-bar-new-tab-choice)

View file

@ -330,7 +330,7 @@ cover the range from the oldest annotation to the newest."
["Show changeset diff of revision at line"
vc-annotate-show-changeset-diff-revision-at-line
:enable
(eq 'repository (vc-call-backend ,vc-annotate-backend 'revision-granularity))
(eq 'repository (vc-call-backend vc-annotate-backend 'revision-granularity))
:help "Visit the diff of the revision at line from its previous revision"]
["Visit revision at line" vc-annotate-find-revision-at-line
:help "Visit the revision identified in the current line"]))

View file

@ -897,6 +897,15 @@ In the latter case, VC mode is deactivated for this buffer."
(bindings--define-key map [vc-create-tag]
'(menu-item "Create Tag" vc-create-tag
:help "Create version tag"))
(bindings--define-key map [vc-print-branch-log]
'(menu-item "Show Branch History..." vc-print-branch-log
:help "List the change log for another branch"))
(bindings--define-key map [vc-switch-branch]
'(menu-item "Switch Branch..." vc-switch-branch
:help "Switch to another branch"))
(bindings--define-key map [vc-create-branch]
'(menu-item "Create Branch..." vc-create-branch
:help "Make a new branch"))
(bindings--define-key map [separator1] menu-bar-separator)
(bindings--define-key map [vc-annotate]
'(menu-item "Annotate" vc-annotate

View file

@ -2504,9 +2504,13 @@ Otherwise, return nil."
(defun vc-create-tag (dir name branchp)
"Descending recursively from DIR, make a tag called NAME.
For each registered file, the working revision becomes part of
the named configuration. If the prefix argument BRANCHP is
given, the tag is made as a new branch and the files are
checked out in that new branch."
the configuration identified by the tag.
If BRANCHP is non-nil (interactively, the prefix argument), the
tag NAME is a new branch, and the files are checked out and
updated to reflect their revisions on that branch.
In interactive use, DIR is `default-directory' for repository-granular
VCSes (all the modern decentralized VCSes belong to this group),
otherwise the command will prompt for DIR."
(interactive
(let ((granularity
(vc-call-backend (vc-responsible-backend default-directory)
@ -2529,9 +2533,23 @@ checked out in that new branch."
;;;###autoload
(defun vc-create-branch (dir name)
"Descending recursively from DIR, make a branch called NAME.
After a new branch is made, the files are checked out in that new branch.
Uses `vc-create-tag' with the non-nil arg `branchp'."
"Make a branch called NAME in directory DIR.
After making the new branch, check out the branch, i.e. update the
files in the tree to their revisions on the branch.
Interactively, prompt for the NAME of the branch.
With VCSes that maintain version information per file, this command also
prompts for the directory DIR whose files, recursively, will be tagged
with the NAME of new branch. For VCSes that maintain version
information for the entire repository (all the modern decentralized
VCSes belong to this group), DIR is always the `default-directory'.
Finally, this command might prompt for the branch or tag from which to
start (\"fork\") the new branch, with completion candidates including
all the known branches and tags in the repository.
This command invokes `vc-create-tag' with the non-nil BRANCHP argument."
(interactive
(let ((granularity
(vc-call-backend (vc-responsible-backend default-directory)
@ -2545,17 +2563,17 @@ Uses `vc-create-tag' with the non-nil arg `branchp'."
;;;###autoload
(defun vc-retrieve-tag (dir name &optional branchp)
"For each file in or below DIR, retrieve their tagged version NAME.
"For each file in or below DIR, retrieve their version identified by tag NAME.
NAME can name a branch, in which case this command will switch to the
named branch in the directory DIR.
Interactively, prompt for DIR only for VCS that works at file level;
otherwise use the repository root of the current buffer.
otherwise use the root directory of the current buffer's VC tree.
If NAME is empty, it refers to the latest revisions of the current branch.
If locking is used for the files in DIR, then there must not be any
locked files at or below DIR (but if NAME is empty, locked files are
allowed and simply skipped).
If the prefix argument BRANCHP is given, switch the branch
and check out the files in that branch.
If BRANCHP is non-nil (interactively, the prefix argument), switch to the
branch and check out and update the files to their version on that branch.
This function runs the hook `vc-retrieve-tag-hook' when finished."
(interactive
(let* ((granularity
@ -2596,7 +2614,12 @@ This function runs the hook `vc-retrieve-tag-hook' when finished."
;;;###autoload
(defun vc-switch-branch (dir name)
"Switch to the branch NAME in the directory DIR.
If NAME is empty, it refers to the latest revisions of the current branch.
If NAME is empty, it refers to the latest revision of the current branch.
Interactively, prompt for DIR only for VCS that works at file level;
otherwise use the root directory of the current buffer's VC tree.
Interactively, prompt for the NAME of the branch.
After switching to the branch, check out and update the files to their
version on that branch.
Uses `vc-retrieve-tag' with the non-nil arg `branchp'."
(interactive
(let* ((granularity
@ -2851,7 +2874,8 @@ with its diffs (if the underlying VCS backend supports that)."
;;;###autoload
(defun vc-print-branch-log (branch)
"Show the change log for BRANCH root in a window."
"Show the change log for BRANCH in another window.
The command prompts for the branch whose change log to show."
(interactive
(let* ((backend (vc-responsible-backend default-directory))
(rootdir (vc-call-backend backend 'root default-directory)))

View file

@ -470,6 +470,9 @@ non-nil means return old filename."
(insert wdired--old-content)
(goto-char wdired--old-point))
(wdired-change-to-dired-mode)
;; Make sure the display is in synch, and all the variables are set
;; correctly.
(dired-revert)
(set-buffer-modified-p nil)
(setq buffer-undo-list nil)
(message "Changes aborted"))

View file

@ -6391,7 +6391,7 @@ windows can get as small as `window-safe-min-height' and
(selected-window)))
(delete-other-windows-internal window root)
;; Create a new window to replace the existing one.
(setq window (prog1 (split-window window)
(setq window (prog1 (split-window window window-safe-min-width t)
(delete-window window)))))
(set-window-dedicated-p window nil)

View file

@ -3213,16 +3213,21 @@ If the `use-short-answers' variable is non-nil, instead of asking for
\"yes\" or \"no\", this function will ask for \"y\" or \"n\" (and
ignore the value of `yes-or-no-prompt').
If dialog boxes are supported, a dialog box will be used
if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */)
If dialog boxes are supported, this function will use a dialog box
if `use-dialog-box' is non-nil and the last input event was produced
by a mouse, or by some window-system gesture, or via a menu. */)
(Lisp_Object prompt)
{
Lisp_Object ans;
Lisp_Object ans, val;
CHECK_STRING (prompt);
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
&& use_dialog_box && ! NILP (last_input_event))
if (!NILP (last_input_event)
&& (CONSP (last_nonmenu_event)
|| (NILP (last_nonmenu_event) && CONSP (last_input_event))
|| (val = find_symbol_value (Qfrom__tty_menu_p),
(!NILP (val) && !EQ (val, Qunbound))))
&& use_dialog_box)
{
Lisp_Object pane, menu, obj;
redisplay_preserve_echo_area (4);
@ -6401,4 +6406,5 @@ For best results this should end in a space. */);
defsubr (&Sbuffer_line_statistics);
DEFSYM (Qreal_this_command, "real-this-command");
DEFSYM (Qfrom__tty_menu_p, "from--tty-menu-p");
}

View file

@ -3646,8 +3646,9 @@ read_bool_vector (Lisp_Object readcharfun)
}
/* Skip (and optionally remember) a lazily-loaded string
preceded by "#@". */
static void
preceded by "#@". Return true if this was a normal skip,
false if we read #@00 (which skips to EOB). */
static bool
skip_lazy_string (Lisp_Object readcharfun)
{
ptrdiff_t nskip = 0;
@ -3673,9 +3674,9 @@ skip_lazy_string (Lisp_Object readcharfun)
digits++;
if (digits == 2 && nskip == 0)
{
/* #@00 means "skip to end" */
/* #@00 means "read nil and skip to end" */
skip_dyn_eof (readcharfun);
return;
return false;
}
}
@ -3722,6 +3723,8 @@ skip_lazy_string (Lisp_Object readcharfun)
else
/* Skip that many bytes. */
skip_dyn_bytes (readcharfun, nskip);
return true;
}
/* Given a lazy-loaded string designator VAL, return the actual string.
@ -4179,8 +4182,10 @@ read0 (Lisp_Object readcharfun, bool locate_syms)
/* #@NUMBER is used to skip NUMBER following bytes.
That's used in .elc files to skip over doc strings
and function definitions that can be loaded lazily. */
skip_lazy_string (readcharfun);
goto read_obj;
if (skip_lazy_string (readcharfun))
goto read_obj;
obj = Qnil; /* #@00 skips to EOB and yields nil. */
break;
case '$':
/* #$ -- reference to lazy-loaded string */

View file

@ -376,6 +376,13 @@ mark_pgtkterm (void)
for (i = 0; i < n; i++)
{
union buffered_input_event *ev = &evq->q[i];
/* Selection requests don't have Lisp object members. */
if (ev->ie.kind == SELECTION_REQUEST_EVENT
|| ev->ie.kind == SELECTION_CLEAR_EVENT)
continue;
mark_object (ev->ie.x);
mark_object (ev->ie.y);
mark_object (ev->ie.frame_or_window);

View file

@ -23,6 +23,8 @@ YOSHIDA <syohex@gmail.com>, which can be found at:
https://github.com/syohex/emacs-sqlite3 */
#include <config.h>
#include <c-strcase.h>
#include "lisp.h"
#include "coding.h"
@ -30,6 +32,17 @@ YOSHIDA <syohex@gmail.com>, which can be found at:
#include <sqlite3.h>
/* Support for loading SQLite extensions requires the ability to
enable and disable loading of extensions (by default this is
disabled, and we want to keep it that way). The required macro is
available since SQLite 3.13. */
# if defined HAVE_SQLITE3_LOAD_EXTENSION && \
defined SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
# define HAVE_LOAD_EXTENSION 1
# else
# define HAVE_LOAD_EXTENSION 0
# endif
#ifdef WINDOWSNT
# include <windows.h>
@ -75,11 +88,14 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_exec,
DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2,
(sqlite3*, const char*, int, sqlite3_stmt**, const char**));
# ifdef HAVE_SQLITE3_LOAD_EXTENSION
# if HAVE_LOAD_EXTENSION
DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension,
(sqlite3*, const char*, const char*, char**));
# undef sqlite3_load_extension
# define sqlite3_load_extension fn_sqlite3_load_extension
DEF_DLL_FN (SQLITE_API int, sqlite3_db_config, (sqlite3*, int, ...));
# undef sqlite3_db_config
# define sqlite3_db_config fn_sqlite3_db_config
# endif
# undef sqlite3_finalize
@ -170,8 +186,9 @@ load_dll_functions (HMODULE library)
LOAD_DLL_FN (library, sqlite3_column_text);
LOAD_DLL_FN (library, sqlite3_column_name);
LOAD_DLL_FN (library, sqlite3_exec);
# ifdef HAVE_SQLITE3_LOAD_EXTENSION
# if HAVE_LOAD_EXTENSION
LOAD_DLL_FN (library, sqlite3_load_extension);
LOAD_DLL_FN (library, sqlite3_db_config);
# endif
LOAD_DLL_FN (library, sqlite3_prepare_v2);
return true;
@ -669,7 +686,7 @@ DEFUN ("sqlite-pragma", Fsqlite_pragma, Ssqlite_pragma, 2, 2, 0,
SSDATA (concat2 (build_string ("PRAGMA "), pragma)));
}
#ifdef HAVE_SQLITE3_LOAD_EXTENSION
#if HAVE_LOAD_EXTENSION
DEFUN ("sqlite-load-extension", Fsqlite_load_extension,
Ssqlite_load_extension, 2, 2, 0,
doc: /* Load an SQlite MODULE into DB.
@ -684,9 +701,28 @@ Only modules on Emacs' list of allowed modules can be loaded. */)
CHECK_STRING (module);
/* Add names of useful and free modules here. */
const char *allowlist[3] = { "pcre", "csvtable", NULL };
const char *allowlist[] = {
"base64",
"cksumvfs",
"compress",
"csv",
"csvtable",
"fts3",
"icu",
"pcre",
"percentile",
"regexp",
"rot13",
"rtree",
"sha1",
"uuid",
"vfslog",
"zipfile",
NULL
};
char *name = SSDATA (Ffile_name_nondirectory (module));
/* Possibly skip past a common prefix. */
/* Possibly skip past a common prefix (libsqlite3_mod_ is used by
Debian, see https://packages.debian.org/source/sid/sqliteodbc). */
const char *prefix = "libsqlite3_mod_";
if (!strncmp (name, prefix, strlen (prefix)))
name += strlen (prefix);
@ -694,10 +730,12 @@ Only modules on Emacs' list of allowed modules can be loaded. */)
bool do_allow = false;
for (const char **allow = allowlist; *allow; allow++)
{
if (strlen (*allow) < strlen (name)
&& !strncmp (*allow, name, strlen (*allow))
&& (!strcmp (name + strlen (*allow), ".so")
|| !strcmp (name + strlen (*allow), ".DLL")))
ptrdiff_t allow_len = strlen (*allow);
if (allow_len < strlen (name)
&& !strncmp (*allow, name, allow_len)
&& (!strcmp (name + allow_len, ".so")
||!strcmp (name + allow_len, ".dylib")
|| !strcasecmp (name + allow_len, ".dll")))
{
do_allow = true;
break;
@ -707,15 +745,25 @@ Only modules on Emacs' list of allowed modules can be loaded. */)
if (!do_allow)
xsignal1 (Qsqlite_error, build_string ("Module name not on allowlist"));
int result = sqlite3_load_extension
(XSQLITE (db)->db,
SSDATA (ENCODE_FILE (Fexpand_file_name (module, Qnil))),
NULL, NULL);
if (result == SQLITE_OK)
return Qt;
/* Expand all Lisp data explicitly, so as to avoid signaling an
error while extension loading is enabled -- we don't want to
"leak" this outside this function. */
sqlite3 *sdb = XSQLITE (db)->db;
char *ext_fn = SSDATA (ENCODE_FILE (Fexpand_file_name (module, Qnil)));
/* Temporarily enable loading extensions via the C API. */
int result = sqlite3_db_config (sdb, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1,
NULL);
if (result == SQLITE_OK)
{
result = sqlite3_load_extension (sdb, ext_fn, NULL, NULL);
/* Disable loading extensions via C API. */
sqlite3_db_config (sdb, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 0, NULL);
if (result == SQLITE_OK)
return Qt;
}
return Qnil;
}
#endif /* HAVE_SQLITE3_LOAD_EXTENSION */
#endif /* HAVE_LOAD_EXTENSION */
DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0,
doc: /* Return the next result set from SET.
@ -825,7 +873,7 @@ syms_of_sqlite (void)
defsubr (&Ssqlite_commit);
defsubr (&Ssqlite_rollback);
defsubr (&Ssqlite_pragma);
#ifdef HAVE_SQLITE3_LOAD_EXTENSION
#if HAVE_LOAD_EXTENSION
defsubr (&Ssqlite_load_extension);
#endif
defsubr (&Ssqlite_next);

View file

@ -21186,8 +21186,10 @@ try_window_reusing_current_matrix (struct window *w)
pt_row = first_row_to_display;
}
if (first_row_to_display->y >= yb)
return false;
/* Start displaying at the start of first_row_to_display. */
eassert (first_row_to_display->y < yb);
init_to_row_start (&it, w, first_row_to_display);
nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix)

View file

@ -219,9 +219,14 @@ Must called from within a `tar-mode' buffer."
(ert-deftest package-test-desc-from-buffer ()
"Parse an elisp buffer to get a `package-desc' object."
(with-package-test (:basedir (ert-resource-directory) :file "simple-single-1.3.el")
(should (package-test--compatible-p
(package-buffer-info) simple-single-desc 'kind)))
(with-package-test (:basedir (ert-resource-directory)
:file "simple-single-1.3.el")
(let ((pi (package-buffer-info)))
(should (package-test--compatible-p pi simple-single-desc 'kind))
;; The terminating line is not mandatory any more.
(re-search-forward "^;;; .* ends here")
(delete-region (match-beginning 0) (point-max))
(should (equal (package-buffer-info) pi))))
(with-package-test (:basedir (ert-resource-directory) :file "simple-depend-1.0.el")
(should (package-test--compatible-p
(package-buffer-info) simple-depend-desc 'kind)))

View file

@ -729,6 +729,7 @@ u\"\\n\""
(845 . font-lock-string-face) (886))))
(ert-deftest python-font-lock-escape-sequence-bytes-newline ()
:expected-result :failed
(python-tests-assert-faces
"b'\\n'
b\"\\n\""
@ -741,6 +742,7 @@ b\"\\n\""
(11 . font-lock-doc-face))))
(ert-deftest python-font-lock-escape-sequence-hex-octal ()
:expected-result :failed
(python-tests-assert-faces
"b'\\x12 \\777 \\1\\23'
'\\x12 \\777 \\1\\23'"
@ -761,6 +763,7 @@ b\"\\n\""
(36 . font-lock-doc-face))))
(ert-deftest python-font-lock-escape-sequence-unicode ()
:expected-result :failed
(python-tests-assert-faces
"b'\\u1234 \\U00010348 \\N{Plus-Minus Sign}'
'\\u1234 \\U00010348 \\N{Plus-Minus Sign}'"
@ -775,6 +778,7 @@ b\"\\n\""
(80 . font-lock-doc-face))))
(ert-deftest python-font-lock-raw-escape-sequence ()
:expected-result :failed
(python-tests-assert-faces
"rb'\\x12 \123 \\n'
r'\\x12 \123 \\n \\u1234 \\U00010348 \\N{Plus-Minus Sign}'"
@ -6710,6 +6714,18 @@ class Class:
(python-tests-look-at "'''Not a method docstring.'''")
(should (not (python-info-docstring-p)))))
(ert-deftest python-info-docstring-p-7 ()
"Test string in a dictionary."
(python-tests-with-temp-buffer
"
{'Not a docstring': 1}
'Also not a docstring'
"
(python-tests-look-at "Not a docstring")
(should-not (python-info-docstring-p))
(python-tests-look-at "Also not a docstring")
(should-not (python-info-docstring-p))))
(ert-deftest python-info-triple-quoted-string-p-1 ()
"Test triple quoted string."
(python-tests-with-temp-buffer

View file

@ -360,4 +360,20 @@ literals (Bug#20852)."
(should (byte-code-function-p f))
(should (equal (aref f 4) "My little\ndoc string\nhere"))))))
(ert-deftest lread-skip-to-eof ()
;; Check the special #@00 syntax that, for compatibility, reads as
;; nil while absorbing the remainder of the input.
(with-temp-buffer
(insert "#@00 and the rest\n"
"should be ignored) entirely\n")
(goto-char (point-min))
(should (equal (read (current-buffer)) nil))
(should (eobp))
;; Add an unbalanced bracket to the beginning and try again;
;; we should get an error.
(goto-char (point-min))
(insert "( ")
(goto-char (point-min))
(should-error (read (current-buffer)) :type 'end-of-file)))
;;; lread-tests.el ends here

View file

@ -197,10 +197,13 @@
(sqlite-load-extension db "/usr/lib/sqlite3/"))
(should-error
(sqlite-load-extension db "/usr/lib/sqlite3"))
(should
(memq
(sqlite-load-extension db "/usr/lib/sqlite3/pcre.so")
'(nil t)))
(if (eq system-type 'windows-nt)
(should
(eq (sqlite-load-extension db "/usr/lib/sqlite3/pcre.dll")
(file-readable-p "/usr/lib/sqlite3/pcre.dll")))
(should
(eq (sqlite-load-extension db "/usr/lib/sqlite3/pcre.so")
(file-readable-p "/usr/lib/sqlite3/pcre.so"))))
(should-error
(sqlite-load-extension
@ -211,11 +214,13 @@
(should-error
(sqlite-load-extension
db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable"))
(should
(memq
(sqlite-load-extension
db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable.so")
'(nil t)))))
(if (eq system-type 'windows-nt)
(should
(eq (sqlite-load-extension db "/usr/lib/sqlite3/csvtable.dll")
(file-readable-p "/usr/lib/sqlite3/csvtable.dll")))
(should
(eq (sqlite-load-extension db "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable.so")
(file-readable-p "/usr/lib/x86_64-linux-gnu/libsqlite3_mod_csvtable.so"))))))
(ert-deftest sqlite-blob ()
(skip-unless (sqlite-available-p))

View file

@ -69,7 +69,7 @@
(should
(equal (treesit-node-string
(treesit-parser-root-node parser))
"(ERROR)"))
"(document)"))
(insert "[1,2,3]")
(should