diff --git a/admin/authors.el b/admin/authors.el index 57cb8e21c13..598deb681e5 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -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") diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index a1801d378ea..568fd8022d1 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -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 diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 90e76655e9b..49b69a604df 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -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 diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 095af736973..32a83d3e774 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -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 diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi index 2327cc94b29..3fa3019f266 100644 --- a/doc/misc/ert.texi +++ b/doc/misc/ert.texi @@ -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}. diff --git a/etc/TODO b/etc/TODO index 30c745c6b40..122a09063be 100644 --- a/etc/TODO +++ b/etc/TODO @@ -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 diff --git a/etc/images/README b/etc/images/README index d3f442a3b24..a439c0c9348 100644 --- a/etc/images/README +++ b/etc/images/README @@ -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 diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c3c8361b38e..8673b360319 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -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)) diff --git a/lisp/emacs-lisp/ert-font-lock.el b/lisp/emacs-lisp/ert-font-lock.el index e584eb679fd..80f4a6d5467 100644 --- a/lisp/emacs-lisp/ert-font-lock.el +++ b/lisp/emacs-lisp/ert-font-lock.el @@ -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 diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 8caf696a21b..b0ca0a2ece8 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -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 diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 64813370e9c..502292428b2 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -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 diff --git a/src/xdisp.c b/src/xdisp.c index adc0f4d7e0a..55c764fa03b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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)) { diff --git a/test/lisp/emacs-lisp/ert-font-lock-tests.el b/test/lisp/emacs-lisp/ert-font-lock-tests.el index e410cf5fa13..0c3e4405562 100644 --- a/test/lisp/emacs-lisp/ert-font-lock-tests.el +++ b/test/lisp/emacs-lisp/ert-font-lock-tests.el @@ -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")