Merge from origin/emacs-30

f88dc0f2f9 ; Fix documentation of 'buffer-text-pixel-size'
734986349f ; Minor Android documentation improvements
a90da89903 ; Fix up emacs-lisp-mode docstring
58c7acb555 ; Fix completion-fail-discreetly docstring typo.
02c830ba22 Fix ert-font-lock macro signatures
0c6b8643ae Fix a typo in 'window_text_pixel_size'
8a8c25eacc ; Add Rudolf Schlatte to authors.el
94c0ea39a5 * doc/misc/efaq.texi (New in Emacs 30): Fix typo.  (Bug#7...
0be5f9115e ; * etc/images/README (Files): Add an entry for last-page...
63adf9dcf5 ; Reflow some cl-lib docstrings
99253f7970 ; * etc/TODO: New section "Make it easier to contribute".

# Conflicts:
#	lisp/emacs-lisp/cl-macs.el
This commit is contained in:
Eli Zaretskii 2025-03-01 10:01:09 -05:00
commit 6c411de542
13 changed files with 141 additions and 110 deletions

View file

@ -249,6 +249,7 @@ files.")
("Rodney J. Whitby" "Rod Whitby")
("Roland B. Roberts" "Roland B Roberts" "Roland Roberts")
("Ron Schnell" "Ronnie Schnell")
("Rudolf Schlatte" "Rudi Schlatte")
("Rui-Tao Dong" "Rui-Tao Dong ~{6-HpLN~}")
("Ryan Thompson" "Ryan .*rct@thompsonclan")
(nil "rvs314")

View file

@ -145,8 +145,8 @@ attempts to open the file with the wrapper will fail.
@cindex /content/by-authority directory, android
@cindex /content/by-authority-named directory, android
Some files are given to Emacs as ``content identifiers'' that the
system provides access to outside the normal filesystem APIs. Emacs
uses pseudo-directories named @file{/content/by-authority} and
system provides access to independently of the normal filesystem APIs.
Emacs uses pseudo-directories named @file{/content/by-authority} and
@file{/content/by-authority-named} to access those files. Do not make
any assumptions about the contents of these directories, or try to open
files in it yourself.
@ -227,9 +227,9 @@ system settings.
@item
Directories provided by @dfn{document providers} on Android 5.0 and
later. These directories exist outside the normal Unix filesystem,
containing files provided by external programs (@pxref{Android
Document Providers}.)
later. These directories exist independently of the Unix virtual
filesystem, containing files provided by external programs
(@pxref{Android Document Providers}.)
@end itemize
Despite ordinary installations of Android not having files within
@ -324,9 +324,8 @@ its name to the command @code{android-relinquish-directory-access}.
The same limitations applied to the @file{/assets} directory
(@pxref{Android File System}) are applied when creating sub-processes
within those directories, because they do not exist within the Unix
file-system. In addition, although Emacs can normally write and
create files inside these directories, it cannot create symlinks or
hard links.
file-system. In addition, although Emacs can normally write and create
files inside these directories, it cannot create symlinks or hard links.
Since document providers are allowed to perform expensive network
operations to obtain file contents, a file access operation within one

View file

@ -2377,7 +2377,7 @@ though when this function is run from an idle timer with a delay of zero
seconds.
@end defun
@defun buffer-text-pixel-size &optional buffer-or-name window from to x-limit y-limit
@defun buffer-text-pixel-size &optional buffer-or-name window x-limit y-limit
This is much like @code{window-text-pixel-size}, but can be used when
the buffer isn't shown in a window. (@code{window-text-pixel-size} is
faster when it is, so this function shouldn't be used in that case.)
@ -2388,10 +2388,14 @@ live window and defaults to the selected one; the function will
compute the text dimensions as if @var{buffer} is displayed in
@var{window}. The return value is a cons of the maximum pixel-width
of any text line and the pixel-height of all the text lines of the
buffer specified by @var{buffer-or-name}.
accessible portion of the buffer specified by @var{buffer-or-name}.
The optional arguments @var{x-limit} and @var{y-limit} have the same
meaning as with @code{window-text-pixel-size}.
If you want to measure dimensions of some part of the buffer text,
narrow the buffer to that part before calling this function
(@pxref{Narrowing}).
@end defun
@defun string-pixel-width string &optional buffer

View file

@ -943,7 +943,7 @@ Emacs has been ported to the Android operating system. See the file
to build it.
@item
New user option @code{trusted-contents} to allow potentially dangerous
New user option @code{trusted-content} to allow potentially dangerous
Emacs features which could execute arbitrary Lisp code. Use this
variable to list files and directories whose contents Emacs should
trust, thus allowing those potentially dangerous features when those

View file

@ -963,7 +963,7 @@ checking face assignment. Test assertions are included in code-level
comments directly and can be read either from inline strings or files.
The parser expects the input string to contain at least one assertion.
Test assertion parser extracts tests from comment-only lines. Every
The test assertion parser extracts tests from comment-only lines. Every
comment assertion line starts either with a caret (@samp{^}) or an arrow
(@samp{<-}). A single caret/arrow or carets should be followed
immediately by the name of a face or a list of faces to be checked
@ -985,7 +985,7 @@ var variable = 11;
@end example
Both symbol-only @code{:face} property values and assertion face values
are normalized to single element lists so assertions below are
are normalized to single element lists so the assertions below are
equivalent:
@example
@ -1062,7 +1062,7 @@ definition:
@lisp
(ert-font-lock-deftest test-macro-test--inline
emacs-lisp-mode
emacs-lisp-mode
"
(defun fun ())
;; ^ font-lock-keyword-face
@ -1076,13 +1076,13 @@ file:
@lisp
(ert-font-lock-deftest-file test-macro-test--file
"Test reading correct assertions from a file"
"Test reading correct assertions from a file."
javascript-mode
"correct.js")
@end lisp
The @code{ert-font-lock-deftest} and @code{ert-font-lock-deftest-file}
macros accept the same keyword parameters as @code{ert-deftest} i.e.,
macros accept the same keyword arguments as @code{ert-deftest}, i.e.,
@code{:tag} and @code{:expected-result}.

View file

@ -222,6 +222,31 @@ https://lists.gnu.org/r/emacs-devel/2008-08/msg00456.html
* Important features
** Make it easier to contribute
*** New script to catch common mistakes in patches.
Examples of things to catch are missing or malformed ChangeLog, style
issues in C, Lisp, and Texinfo, etc. There is no need to be overly
ambitious in a first draft, making a start is better than nothing. It
could draw inspiration from checkpatch.pl used by the Linux kernel.
*** New make target or script to run tests for changed files.
This might require some kind of data structure mapping a source file to
the tests which exercise some of the code in that source file. The
first approximation is to run FOO-tests when you modify a file FOO, but
some FOO's get used in many places in the test suite, so this is not a
simple 1:1 relation. Then we could ask contributors to run the relevant
tests as part of the submission process.
*** Automated emails to contributors when their commits make tests fail
Having EMBA or something similar email the guilty parties in case of
new test failures (or maybe even warnings) would be great.
*** Automated testing of patches submitted to the bug tracker
Create a bot that can run the above "check patch" script, and perhaps
even run unit tests, for every patch submitted to the bug tracker, and
then send an automated email with the results. Can EMBA help with this?
** Speed up Elisp execution
*** Speed up function calls

View file

@ -83,6 +83,7 @@ Emacs images and their source in the GNOME icons stock/ directory:
lock-ok.xpm data/stock_lock-ok
lock.xpm data/stock_lock
next-page.xpm navigation/stock_next-page
last-page.xpm mirrored from navigation/stock_next-page
redo.xpm generic/stock_redo
refresh.xpm generic/stock_refresh
search-replace.xpm slightly modified generic/stock_search-and-replace

View file

@ -2069,16 +2069,14 @@ a `let' form, except that the list of symbols can be computed at run-time."
;;;###autoload
(defmacro cl-flet (bindings &rest body)
"Make local function definitions.
Each definition can take the form (FUNC EXP) where
FUNC is the function name, and EXP is an expression that returns the
function value to which it should be bound, or it can take the more common
form (FUNC ARGLIST BODY...) which is a shorthand
for (FUNC (lambda ARGLIST BODY)) where BODY is wrapped in
a `cl-block' named FUNC.
Each definition can take the form (FUNC EXP) where FUNC is the function
name, and EXP is an expression that returns the function value to which
it should be bound, or it can take the more common form (FUNC ARGLIST
BODY...) which is a shorthand for (FUNC (lambda ARGLIST BODY)).
FUNC is defined only within FORM, not BODY, so you can't write
recursive function definitions. Use `cl-labels' for that. See
info node `(cl) Function Bindings' for details.
FUNC is defined only within FORM, not BODY, so you can't write recursive
function definitions. Use `cl-labels' for that. See Info node
`(cl) Function Bindings' for details.
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
(declare (indent 1)
@ -2277,16 +2275,14 @@ Like `cl-flet' but the definitions can refer to previous ones.
;;;###autoload
(defmacro cl-labels (bindings &rest body)
"Make local (recursive) function definitions.
BINDINGS is a list of definitions of the form either (FUNC EXP)
where EXP is a form that should return the function to bind to the
function name FUNC, or (FUNC ARGLIST BODY...) where
FUNC is the function name, ARGLIST its arguments, and BODY the
forms of the function body. BODY is wrapped in a `cl-block' named FUNC.
FUNC is in scope in any BODY or EXP, as well as in FORM, so you can write
recursive and mutually recursive function definitions, with the caveat
that EXPs are evaluated in sequence and you cannot call a FUNC before its
EXP has been evaluated.
See info node `(cl) Function Bindings' for details.
BINDINGS is a list of definitions of the form (FUNC ARGLIST BODY...)
where FUNC is the function name, ARGLIST its arguments, and BODY the
forms of the function body.
FUNC is defined in any BODY, as well as FORM, so you can write recursive
and mutually recursive function definitions. See Info node
`(cl) Function Bindings' for details.
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
(declare (indent 1) (debug cl-flet))

View file

@ -27,8 +27,8 @@
;; highlighting provided by font-lock.
;;
;; ert-font-lock entry points are functions
;; `ert-font-lock-test-string' and `ert-font-lock-test-file' and
;; convenience macros: `ert-font-lock-deftest' and
;; `ert-font-lock-test-string' and `ert-font-lock-test-file', and
;; convenience macros `ert-font-lock-deftest' and
;; `ert-font-lock-deftest-file'.
;;
;; See unit tests in ert-font-lock-tests.el for usage examples.
@ -124,19 +124,21 @@ Argument TEST-NAME - name of the currently running ert test."
(defmacro ert-font-lock-deftest (name &rest docstring-keys-mode-and-str)
"Define test NAME (a symbol) using assertions from TEST-STR.
Other than MAJOR-MODE and TEST-STR parameters, this macro accepts
the same parameters and keywords as `ert-deftest' and is intended
to be used through `ert'.
The MAJOR-MODE symbol determines the syntax and font lock of TEST-STR.
\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \
Except for the MAJOR-MODE and TEST-STR parameters, this macro accepts
the same arguments and keywords as `ert-deftest' and is intended to be
used through `ert'.
\(fn NAME [DOCSTRING] [:expected-result RESULT-TYPE] \
[:tags \\='(TAG...)] MAJOR-MODE TEST-STR)"
(declare (debug (&define [&name "test@" symbolp]
sexp [&optional stringp]
[&optional stringp]
[&rest keywordp sexp]
symbolp
stringp))
(doc-string 3)
(indent 2))
(doc-string 2)
(indent 1))
(pcase-let ((`(,documentation
,documentation-supplied-p
,keys ,mode ,arg)
@ -159,22 +161,23 @@ to be used through `ert'.
(defmacro ert-font-lock-deftest-file (name &rest docstring-keys-mode-and-file)
"Define test NAME (a symbol) using assertions from FILE.
FILE - path to a file with assertions in ERT resource director as
return by `ert-resource-directory'.
FILE names a file with assertions in the ERT resource directory, as
returned by `ert-resource-directory'. The MAJOR-MODE symbol determines
the syntax and font lock of FILE's contents.
Other than MAJOR-MODE and FILE parameters, this macro accepts the
same parameters and keywords as `ert-deftest' and is intended to
be used through `ert'.
Except for the MAJOR-MODE and FILE parameters, this macro accepts the
same arguments and keywords as `ert-deftest' and is intended to be used
through `ert'.
\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \
\(fn NAME [DOCSTRING] [:expected-result RESULT-TYPE] \
[:tags \\='(TAG...)] MAJOR-MODE FILE)"
(declare (debug (&define [&name "test@" symbolp]
sexp [&optional stringp]
[&optional stringp]
[&rest keywordp sexp]
symbolp
stringp))
(doc-string 3)
(indent 2))
(doc-string 2)
(indent 1))
(pcase-let ((`(,documentation
,documentation-supplied-p

View file

@ -1516,7 +1516,7 @@ pair of a group title string and a list of group candidate strings."
(defvar completion-tab-width nil)
(defvar completion-fail-discreetly nil
"If non-nil, stay quiet when there is no match.")
"If non-nil, stay quiet when there is no match.")
(defun completion--message (msg)
(if completion-show-inline-help

View file

@ -335,9 +335,10 @@ mouse-1: Enable lexical-binding mode"
mouse-face mode-line-highlight
local-map ,elisp--dynlex-modeline-map)))
"Major mode for editing Lisp code to run in Emacs.
Commands:
Delete converts tabs to spaces as it moves back.
Blank lines separate paragraphs. Semicolons start comments.
- Delete converts tabs to spaces as it moves back.
- Blank lines separate paragraphs.
- Semicolons start comments.
When editing Lisp data (as opposed to code), `lisp-data-mode' can
be used instead.
@ -367,7 +368,7 @@ be used instead.
#'elisp-completion-at-point nil 'local)
(add-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc nil t)
(add-hook 'flymake-diagnostic-functions
#'elisp-flymake-byte-compile nil t)
#'elisp-flymake-byte-compile nil t)
(add-hook 'context-menu-functions #'elisp-context-menu 10 t))
;; Font-locking support.
@ -1333,10 +1334,9 @@ before point, and prints its value into the buffer, advancing point.
Note that printing is controlled by `eval-expression-print-length'
and `eval-expression-print-level'.
Commands:
Delete converts tabs to spaces as it moves back.
Paragraphs are separated only by blank lines.
Semicolons start comments.
- Delete converts tabs to spaces as it moves back.
- Paragraphs are separated only by blank lines.
- Semicolons start comments.
\\{lisp-interaction-mode-map}"
:abbrev-table nil

View file

@ -11653,6 +11653,7 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to,
it.bidi_p = false;
int start_x;
ptrdiff_t start_bpos = BYTEPOS (startp);
if (vertical_offset != 0)
{
int last_y;
@ -11685,6 +11686,7 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to,
it.current_y = (WINDOW_TAB_LINE_HEIGHT (w)
+ WINDOW_HEADER_LINE_HEIGHT (w));
start = clip_to_bounds (BEGV, IT_CHARPOS (it), ZV);
start_bpos = CHAR_TO_BYTE (start);
start_y = it.current_y;
start_x = it.current_x;
}
@ -11746,7 +11748,7 @@ window_text_pixel_size (Lisp_Object window, Lisp_Object from, Lisp_Object to,
it.current_y = start_y;
/* If FROM is on a newline, pretend that we start at the beginning
of the next line, because the newline takes no place on display. */
if (FETCH_BYTE (start) == '\n')
if (FETCH_BYTE (start_bpos) == '\n')
it.current_x = 0, it.wrap_prefix_width = 0;
if (!NILP (x_limit))
{

View file

@ -39,13 +39,13 @@
"Create a buffer with STR contents and MODE. "
(declare (indent 1) (debug t))
`(with-temp-buffer
(insert ,str)
(,mode)
(insert ,str)
(goto-char (point-min))
,@body))
(defun ert-font-lock--wrap-begin-end (re)
(concat "^" re "$"))
(rx bol (regexp re) eol))
;;; Regexp tests
;;;
@ -97,89 +97,89 @@
(ert-deftest test-line-comment-p--emacs-lisp ()
(with-temp-buffer-str-mode emacs-lisp-mode
"not comment
"not comment
;; comment
"
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))))
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))))
(ert-deftest test-line-comment-p--shell-script ()
(with-temp-buffer-str-mode shell-script-mode
"echo Not a comment
"echo Not a comment
# comment
"
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))))
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))))
(declare-function php-mode "php-mode")
(ert-deftest test-line-comment-p--php ()
(skip-unless (featurep 'php-mode))
(skip-unless (fboundp 'php-mode))
(with-temp-buffer-str-mode php-mode
"echo 'Not a comment'
"echo 'Not a comment'
// comment
/* comment */
"
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))))
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))))
(ert-deftest test-line-comment-p--javascript ()
(with-temp-buffer-str-mode javascript-mode
"// comment
"// comment
// comment, after a blank line
var abc = function(d) {};
"
(should (ert-font-lock--line-comment-p))
(should (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))))
(forward-line)
(should-not (ert-font-lock--line-comment-p))))
(ert-deftest test-line-comment-p--python ()
(with-temp-buffer-str-mode python-mode
"# comment
"# comment
# comment
print(\"Hello, world!\")"
(should (ert-font-lock--line-comment-p))
(should (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))
(forward-line)
(should-not (ert-font-lock--line-comment-p))))
(forward-line)
(should-not (ert-font-lock--line-comment-p))))
(ert-deftest test-line-comment-p--c ()
(with-temp-buffer-str-mode c-mode
"// comment
"// comment
/* also comment */"
(should (ert-font-lock--line-comment-p))
(should (ert-font-lock--line-comment-p))
(forward-line)
(should (ert-font-lock--line-comment-p))))
(forward-line)
(should (ert-font-lock--line-comment-p))))
(ert-deftest test-parse-comments--no-assertion-error ()
(let* ((str "
@ -568,14 +568,14 @@ var abc = function(d) {
;;
(ert-font-lock-deftest test-macro-test--correct-highlighting
emacs-lisp-mode
emacs-lisp-mode
"
(defun fun ())
;; ^ font-lock-keyword-face
;; ^ font-lock-function-name-face")
(ert-font-lock-deftest test-macro-test--docstring
"A test with a docstring."
"A test with a docstring."
emacs-lisp-mode
"
(defun fun ())
@ -583,7 +583,7 @@ var abc = function(d) {
)
(ert-font-lock-deftest test-macro-test--failing
"A failing test."
"A failing test."
:expected-result :failed
emacs-lisp-mode
"
@ -591,18 +591,18 @@ var abc = function(d) {
;; ^ wrong-face")
(ert-font-lock-deftest-file test-macro-test--file
"Test reading correct assertions from a file"
"Test reading correct assertions from a file."
javascript-mode
"correct.js")
(ert-font-lock-deftest-file test-macro-test--file-no-asserts
"Check failing on files without assertions"
"Check failing on files without assertions."
:expected-result :failed
javascript-mode
"no-asserts.js")
(ert-font-lock-deftest-file test-macro-test--file-failing
"Test reading wrong assertions from a file"
"Test reading wrong assertions from a file."
:expected-result :failed
javascript-mode
"broken.js")