commit 0aec3117b5f9632d85401b6a4c7e6d99dcd21db0 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Mon Jan 29 15:45:47 2024 +0800 Don't open a new line for long defuns being inserted at column 0 * lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Don't open a new line for long defuns at column 0. * test/lisp/vc/log-edit-tests.el (log-edit-fill-entry-space-substitution): Adjust expected results to match change. (log-edit-fill-entry-initial-wrapping): New test. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 644ea691a76..1f766eea455 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -588,9 +588,11 @@ the \\[vc-prefix-map] prefix for VC commands, for example). (while func-names (setq name (car func-names)) (setq func-names (cdr func-names)) - ;; If inserting `name' in at the current column would overflow - ;; the fill column, place it on its own line. + ;; If inserting `name' after preexisting text in the first + ;; line would overflow the fill column, place it on its own + ;; line. (if (and first-line + (> (current-column) 0) (> (+ (current-column) (string-width name) ;; If this be the last name, the column must be diff --git a/test/lisp/vc/log-edit-tests.el b/test/lisp/vc/log-edit-tests.el index fe0248d05f7..8373156587d 100644 --- a/test/lisp/vc/log-edit-tests.el +++ b/test/lisp/vc/log-edit-tests.el @@ -236,13 +236,11 @@ failures during test. (sfnt_table_names): Add prep. - (sfnt_transform_coordinates): Allow applying offsets during coordinate transform. - (sfnt_decompose_compound_glyph): Defer offset computation until @@ -251,68 +249,54 @@ compound glyph is loaded, then apply it during the transform process. - (sfnt_multiply_divide): Make available everywhere. Implement on 64 bit systems. - (sfnt_multiply_divide_signed): New function. (sfnt_mul_fixed): Fix division overflow. - (sfnt_curve_to_and_build_1) (sfnt_build_glyph_outline): Remove outdated comment. - (sfnt_build_outline_edges): Fix coding style. - (sfnt_lookup_glyph_metrics): Allow looking up metrics without scaling. - (struct sfnt_cvt_table): Fix type of cvt values. - (struct sfnt_prep_table): New structure. - (sfnt_read_cvt_table): Read cvt values in terms of fwords, not longs (as Apple's doc seems to say). - (sfnt_read_fpgm_table): Fix memory allocation for font program table. - (sfnt_read_prep_table): New function. - (struct sfnt_interpreter_zone): New structure. - (struct sfnt_interpreter_graphics_state): New fields `project', `move', `vector_dot_product'. Rename to `sfnt_graphics_state'. - (struct sfnt_interpreter) (sfnt_mul_f26dot6): Stop doing rounding division. - (sfnt_init_graphics_state) (sfnt_make_interpreter) (MOVE, SSW, RAW, SDS) @@ -335,4 +319,29 @@ division. (let ((fill-column 20)) (log-edit-fill-entry)) (should (equal (buffer-string) wanted))))) +(ert-deftest log-edit-fill-entry-initial-wrapping () + ;; This test verifies that a newline is inserted before a defun + ;; itself longer than the fill column when such a defun is being + ;; inserted after a file name, and not otherwise. + (let (string wanted) + (setq string " +* src/sfnt.c (long_entry_1): This entry should be placed on a +new line. +(but_this_entry_should_not): With the prose displaced to the +next line instead." + wanted " +* src/sfnt.c +(long_entry_1): This +entry should be +placed on a new +line. +(but_this_entry_should_not): +With the prose +displaced to the +next line instead.") + (with-temp-buffer + (insert string) + (let ((fill-column 20)) (log-edit-fill-entry)) + (should (equal (buffer-string) wanted))))) + ;;; log-edit-tests.el ends here commit b9f348ce1e2f56fcf8ed5e42adc4027026cde347 Author: Po Lu Date: Mon Jan 29 11:54:46 2024 +0800 * exec/configure.ac (OPENAT_SYSCALL): Define on MIPS. diff --git a/exec/configure.ac b/exec/configure.ac index d70dbea3477..317250332cb 100644 --- a/exec/configure.ac +++ b/exec/configure.ac @@ -404,6 +404,8 @@ AS_CASE([$host], [x86_64-*linux*], AC_DEFINE([CLONE_SYSCALL], [__NR_clone]) AC_DEFINE([READLINK_SYSCALL], [__NR_readlink]) AC_DEFINE([READLINKAT_SYSCALL], [__NR_readlinkat]) + AC_DEFINE([OPEN_SYSCALL], [__NR_open]) + AC_DEFINE([OPENAT_SYSCALL], [__NR_openat]) AC_CHECK_DECL([_MIPS_SIM], [exec_CHECK_MIPS_NABI], [AC_MSG_ERROR([_MIPS_SIM could not be determined]), [[ @@ -432,6 +434,8 @@ AS_CASE([$host], [x86_64-*linux*], AC_DEFINE([CLONE_SYSCALL], [__NR_clone]) AC_DEFINE([READLINK_SYSCALL], [__NR_readlink]) AC_DEFINE([READLINKAT_SYSCALL], [__NR_readlinkat]) + AC_DEFINE([OPEN_SYSCALL], [__NR_open]) + AC_DEFINE([OPENAT_SYSCALL], [__NR_openat]) AC_CACHE_CHECK([whether as understands `daddi'], [exec_cv_as_daddi], [exec_cv_as_daddi=no commit f83d9e16d08347db2a509b65c9c9c9e85a7d97e6 Author: Po Lu Date: Mon Jan 29 11:01:33 2024 +0800 ; * test/lisp/vc/log-edit-tests.el: Pacify compiler warnings. diff --git a/test/lisp/vc/log-edit-tests.el b/test/lisp/vc/log-edit-tests.el index 57407d47ca8..fe0248d05f7 100644 --- a/test/lisp/vc/log-edit-tests.el +++ b/test/lisp/vc/log-edit-tests.el @@ -189,7 +189,8 @@ lines.")))) ;; This test verifies that filling the paragraph surrounding the ;; last line of defuns does not break between defun lists with ;; spaces in identifiers. - (setq string " + (let (string wanted) + (setq string " * src/sfnt.c (xmalloc, xrealloc): Improve behavior upon allocation failures during test. (sfnt_table_names): Add prep. @@ -226,7 +227,7 @@ division. (sfnt_interpret_idef, sfnt_interpret_if, sfnt_interpret_else) (sfnt_round_none, sfnt_round_to_grid, sfnt_round_to_double_grid) " - wanted " + wanted " * src/sfnt.c (xmalloc, xrealloc): Improve behavior @@ -329,9 +330,9 @@ division. (sfnt_round_to_grid) (sfnt_round_to_double_grid): ") - (with-temp-buffer - (insert string) - (let ((fill-column 20)) (log-edit-fill-entry)) - (should (equal (buffer-string) wanted)))) + (with-temp-buffer + (insert string) + (let ((fill-column 20)) (log-edit-fill-entry)) + (should (equal (buffer-string) wanted))))) ;;; log-edit-tests.el ends here commit e9cf215d7067d5375425e605461b155216ed23b5 Author: Po Lu Date: Mon Jan 29 10:54:49 2024 +0800 Prevent filling from mangling ChangeLog defun lists * lisp/vc/log-edit.el (log-edit-fill-entry): Replace space characters within defun lists with NBSPs for the duration of `fill-region''s execution, so that they are never considered break points. * test/lisp/vc/log-edit-tests.el (log-edit-fill-entry-space-substitution): New test. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index b847fb953f2..644ea691a76 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -668,6 +668,9 @@ according to `fill-column'." (defuns nil)) (while (progn + ;; Match a regexp against the next ChangeLog entry. + ;; `defuns-beg' will be the end of the file name, + ;; which marks the beginning of the list of defuns. (setq defuns-beg (and (< beg end) (re-search-forward @@ -676,13 +679,39 @@ according to `fill-column'." "\\)\\|^\\(?1:\\)[[:blank:]]*(") end t) (copy-marker (match-end 1)))) + ;; Fill the intervening prose between the end of the + ;; last match and the beginning of the current match. (let ((fill-indent-according-to-mode t) (end (if defuns-beg (match-beginning 0) end)) (beg (progn (goto-char beg) - (line-beginning-position)))) + (line-beginning-position))) + space-beg space-end) (when (<= (line-end-position) end) - (fill-region beg end justify))) + ;; Replace space characters within parentheses + ;; that resemble ChangeLog defun names between BEG + ;; and END with non-breaking spaces to prevent + ;; them from being considered break points by + ;; `fill-region'. + (save-excursion + (goto-char beg) + (when (re-search-forward + "^[[:blank:]]*(.*\\([[:space:]]\\).*):" + end t) + (replace-regexp-in-region "[[:space:]]" " " + (setq space-beg + (copy-marker + (match-beginning 0))) + (setq space-end + (copy-marker + (match-end 0)))))) + (fill-region beg end justify)) + ;; Restore the spaces replaced by NBSPs. + (when space-beg + (replace-string-in-region " " " " + space-beg space-end) + (set-marker space-beg nil) + (set-marker space-end nil))) defuns-beg) (goto-char defuns-beg) (setq defuns (change-log-read-defuns end)) @@ -1358,3 +1387,7 @@ line of MSG." (provide 'log-edit) ;;; log-edit.el ends here + +;; Local Variables: +;; coding: utf-8-unix +;; End: diff --git a/test/lisp/vc/log-edit-tests.el b/test/lisp/vc/log-edit-tests.el index 5b555809f4c..57407d47ca8 100644 --- a/test/lisp/vc/log-edit-tests.el +++ b/test/lisp/vc/log-edit-tests.el @@ -185,4 +185,153 @@ lines.")))) "* file2.txt (abcdefghijklmnopqrstuvwxyz):"))))) +(ert-deftest log-edit-fill-entry-space-substitution () + ;; This test verifies that filling the paragraph surrounding the + ;; last line of defuns does not break between defun lists with + ;; spaces in identifiers. + (setq string " +* src/sfnt.c (xmalloc, xrealloc): Improve behavior upon allocation +failures during test. +(sfnt_table_names): Add prep. +(sfnt_transform_coordinates): Allow applying offsets during +coordinate transform. +(sfnt_decompose_compound_glyph): Defer offset computation until +any component compound glyph is loaded, then apply it during the +transform process. +(sfnt_multiply_divide): Make available everywhere. Implement on +64 bit systems. +(sfnt_multiply_divide_signed): New function. +(sfnt_mul_fixed): Fix division overflow. +(sfnt_curve_to_and_build_1, sfnt_build_glyph_outline): Remove +outdated comment. +(sfnt_build_outline_edges): Fix coding style. +(sfnt_lookup_glyph_metrics): Allow looking up metrics without +scaling. +(struct sfnt_cvt_table): Fix type of cvt values. +(struct sfnt_prep_table): New structure. +(sfnt_read_cvt_table): Read cvt values in terms of fwords, not +longs (as Apple's doc seems to say). +(sfnt_read_fpgm_table): Fix memory allocation for font program +table. +(sfnt_read_prep_table): New function. +(struct sfnt_interpreter_zone): New structure. +(struct sfnt_interpreter_graphics_state): New fields `project', +`move', `vector_dot_product'. Rename to `sfnt_graphics_state'. +(struct sfnt_interpreter, sfnt_mul_f26dot6): Stop doing rounding +division. +(sfnt_init_graphics_state, sfnt_make_interpreter, MOVE, SSW, RAW) +(SDS, ADD, SUB, ABS, NEG, WCVTF, _MIN, S45ROUND, SVTCAx) +(sfnt_set_srounding_state, sfnt_skip_code) +(sfnt_interpret_unimplemented, sfnt_interpret_fdef) +(sfnt_interpret_idef, sfnt_interpret_if, sfnt_interpret_else) +(sfnt_round_none, sfnt_round_to_grid, sfnt_round_to_double_grid) +" + wanted " +* src/sfnt.c +(xmalloc, xrealloc): +Improve behavior +upon allocation +failures during +test. +(sfnt_table_names): +Add prep. + +(sfnt_transform_coordinates): +Allow applying +offsets during +coordinate +transform. + +(sfnt_decompose_compound_glyph): +Defer offset +computation until +any component +compound glyph is +loaded, then apply +it during the +transform process. + +(sfnt_multiply_divide): +Make available +everywhere. +Implement on 64 bit +systems. + +(sfnt_multiply_divide_signed): +New function. +(sfnt_mul_fixed): +Fix division +overflow. + +(sfnt_curve_to_and_build_1) +(sfnt_build_glyph_outline): +Remove outdated +comment. + +(sfnt_build_outline_edges): +Fix coding style. + +(sfnt_lookup_glyph_metrics): +Allow looking up +metrics without +scaling. + +(struct sfnt_cvt_table): +Fix type of cvt +values. + +(struct sfnt_prep_table): +New structure. + +(sfnt_read_cvt_table): +Read cvt values in +terms of fwords, not +longs (as Apple's +doc seems to say). + +(sfnt_read_fpgm_table): +Fix memory +allocation for font +program table. + +(sfnt_read_prep_table): +New function. + +(struct sfnt_interpreter_zone): +New structure. + +(struct sfnt_interpreter_graphics_state): +New fields +`project', `move', +`vector_dot_product'. +Rename to +`sfnt_graphics_state'. + +(struct sfnt_interpreter) +(sfnt_mul_f26dot6): +Stop doing rounding +division. + +(sfnt_init_graphics_state) +(sfnt_make_interpreter) +(MOVE, SSW, RAW, SDS) +(ADD, SUB, ABS, NEG) +(WCVTF, _MIN) +(S45ROUND, SVTCAx) +(sfnt_set_srounding_state) +(sfnt_skip_code) +(sfnt_interpret_unimplemented) +(sfnt_interpret_fdef) +(sfnt_interpret_idef) +(sfnt_interpret_if) +(sfnt_interpret_else) +(sfnt_round_none) +(sfnt_round_to_grid) +(sfnt_round_to_double_grid): +") + (with-temp-buffer + (insert string) + (let ((fill-column 20)) (log-edit-fill-entry)) + (should (equal (buffer-string) wanted)))) + ;;; log-edit-tests.el ends here commit d2abe91d4bf68f20e4b1cd39f88ed98fd5731524 Author: Jim Porter Date: Sat Sep 2 22:29:22 2023 -0700 In Eshell, don't expand quoted tildes into a user's home directory * lisp/eshell/em-dirs.el (eshell-parse-user-reference): Don't expand quoted tildes. * test/lisp/eshell/em-dirs-tests.el (em-dirs-test/expand-user-reference/local) (em-dirs-test/expand-user-reference/quoted): New tests. diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 85036620c57..07063afc286 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el @@ -262,6 +262,7 @@ Thus, this does not include the current directory.") (defun eshell-parse-user-reference () "An argument beginning with ~ is a filename to be expanded." (when (and (not eshell-current-argument) + (not eshell-current-quoted) (eq (char-after) ?~)) ;; Apply this modifier fairly early so it happens before things ;; like glob expansion. diff --git a/test/lisp/eshell/em-dirs-tests.el b/test/lisp/eshell/em-dirs-tests.el index 2f170fb0c63..9789e519f4c 100644 --- a/test/lisp/eshell/em-dirs-tests.el +++ b/test/lisp/eshell/em-dirs-tests.el @@ -34,6 +34,9 @@ default-directory)))) ;;; Tests: + +;; Variables + (ert-deftest em-dirs-test/pwd-var () "Test using the $PWD variable." (let ((default-directory "/some/path")) @@ -99,6 +102,25 @@ (eshell-match-command-output "echo $-[1][/ 1 3]" "(\"some\" \"here\")\n")))) + +;; Argument expansion + +(ert-deftest em-dirs-test/expand-user-reference/local () + "Test expansion of \"~USER\" references." + (eshell-command-result-equal "echo ~" (expand-file-name "~")) + (eshell-command-result-equal + (format "echo ~%s" user-login-name) + (expand-file-name (format "~%s" user-login-name)))) + +(ert-deftest em-dirs-test/expand-user-reference/quoted () + "Test that a quoted \"~\" isn't expanded." + (eshell-command-result-equal "echo \\~" "~") + (eshell-command-result-equal "echo \"~\"" "~") + (eshell-command-result-equal "echo '~'" "~")) + + +;; `cd' + (ert-deftest em-dirs-test/cd () "Test that changing directories with `cd' works." (ert-with-temp-directory tmpdir commit 1f5a13d5843306af2e6a74fbdfd6d00af8804a23 Author: Jim Porter Date: Sun Jan 28 15:49:03 2024 -0800 In Eshell, allow an escaped newline at the end of a command Normally, "echo" runs the command "echo". Likewise, "echo\" should too: we escape the first newline, and then the second one is unescaped and should send the command input to Eshell. Previously, you had to press RET a third time, but now it works as expected. * lisp/eshell/esh-arg.el (eshell-looking-at-backslash-return): Make obsolete. (eshell-parse-backslash): A backslash sequence is only incomplete if there's nothing at all after it. * test/lisp/eshell/esh-arg-tests.el (esh-arg-test/escape/newline) (esh-arg-test/escape-quoted/newline): Remove inaccurate comment; escaped newlines are always special. (esh-arg-test/escape/trailing-newline): New test. diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 1880cc03885..97ddac58629 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el @@ -440,6 +440,7 @@ Point is left at the end of the arguments." (defsubst eshell-looking-at-backslash-return (pos) "Test whether a backslash-return sequence occurs at POS." + (declare (obsolete nil "30.1")) (and (eq (char-after pos) ?\\) (or (= (1+ pos) (point-max)) (and (eq (char-after (1+ pos)) ?\n) @@ -464,8 +465,8 @@ backslash is ignored and the character after is returned. If the backslash is in a quoted string, the backslash and the character after are both returned." (when (eq (char-after) ?\\) - (when (eshell-looking-at-backslash-return (point)) - (throw 'eshell-incomplete "\\")) + (when (= (1+ (point)) (point-max)) + (throw 'eshell-incomplete "\\")) (forward-char 2) ; Move one char past the backslash. (let ((special-chars (if eshell-current-quoted eshell-special-chars-inside-quoting diff --git a/test/lisp/eshell/esh-arg-tests.el b/test/lisp/eshell/esh-arg-tests.el index b626cf10bf1..b748c5ab4c0 100644 --- a/test/lisp/eshell/esh-arg-tests.el +++ b/test/lisp/eshell/esh-arg-tests.el @@ -60,13 +60,17 @@ chars." "he\\\\llo\n"))) (ert-deftest esh-arg-test/escape/newline () - "Test that an escaped newline is equivalent to the empty string. -When newlines are *nonspecial*, an escaped newline should be -treated as just a newline." + "Test that an escaped newline is equivalent to the empty string." (with-temp-eshell (eshell-match-command-output "echo hi\\\nthere" "hithere\n"))) +(ert-deftest esh-arg-test/escape/trailing-newline () + "Test that an escaped newline is equivalent to the empty string." + (with-temp-eshell + (eshell-match-command-output "echo hi\\\n" + "hi\n"))) + (ert-deftest esh-arg-test/escape/newline-conditional () "Test invocation of an if/else statement using line continuations." (let ((eshell-test-value t)) @@ -95,9 +99,7 @@ chars." "\\\"hi\\\\\n"))) (ert-deftest esh-arg-test/escape-quoted/newline () - "Test that an escaped newline is equivalent to the empty string. -When newlines are *nonspecial*, an escaped newline should be -treated literally, as a backslash and a newline." + "Test that an escaped newline is equivalent to the empty string." (with-temp-eshell (eshell-match-command-output "echo \"hi\\\nthere\"" "hithere\n"))) commit e734f8e502e315441214936e89ecd1e11e981fca Author: Stefan Monnier Date: Sun Jan 28 18:51:11 2024 -0500 xt-mouse.el: Obey `mouse-wheel-*-event` variables (bug#68698) * lisp/xt-mouse.el (xterm-mouse--same-button-p): New function. (xterm-mouse--read-event-sequence): Use it to obey `mouse-wheel-*-event` variables. * lisp/mwheel.el (mouse-wheel-obey-old-style-wheel-buttons): Update docstring. diff --git a/etc/NEWS b/etc/NEWS index 061ac9a7d10..ecb24724ab3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -430,6 +430,12 @@ only to specify the 'mouse-4/5/6/7' events generated by older configurations such as X11 when the X server does not support at least version 2.1 of the X Input Extension, and 'xterm-mouse-mode'. +** 'xterm-mouse-mode' +This mode now emits `wheel-up/down/right/left' events instead of +'mouse-4/5/6/7' events for the mouse wheel. +It uses the 'mouse-wheel-up/down/left/right-event' +variables to decide which button maps to which wheel event (if any). + ** Info --- diff --git a/lisp/mwheel.el b/lisp/mwheel.el index 53042085bf6..66a1fa1a706 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -59,7 +59,7 @@ (defvar mouse-wheel-obey-old-style-wheel-buttons t "If non-nil, treat mouse-4/5/6/7 events as mouse wheel events. These are the event names used historically in X11 before XInput2. -They are sometimes generated by things like `xterm-mouse-mode' as well.") +They are sometimes generated by things like text-terminals as well.") (defcustom mouse-wheel-down-event (if mouse-wheel-obey-old-style-wheel-buttons 'mouse-4) diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index cd00467f14f..081b8f32456 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -40,6 +40,8 @@ ;;; Code: +(require 'mwheel) + (defvar xterm-mouse-debug-buffer nil) (defun xterm-mouse-translate (_event) @@ -193,6 +195,12 @@ single byte." (cons n c)) (cons (- (setq c (xterm-mouse--read-coordinate)) 32) c)))) +(defun xterm-mouse--button-p (event btn) + (and (symbolp event) + (string-prefix-p "mouse-" (symbol-name event)) + (eq btn (car (read-from-string (symbol-name event) + (length "mouse-")))))) + ;; XTerm reports mouse events as ;; in default mode, and ;; ";" ";" <"M" or "m"> in extended mode. @@ -230,13 +238,22 @@ single byte." ;; Spurious release event without previous button-down ;; event: assume, that the last button was button 1. (t 1))) - (sym (if move 'mouse-movement - (intern (concat (if ctrl "C-" "") - (if meta "M-" "") - (if shift "S-" "") - (if down "down-" "") - "mouse-" - (number-to-string btn)))))) + (sym + (if move 'mouse-movement + (intern + (concat + (if ctrl "C-" "") + (if meta "M-" "") + (if shift "S-" "") + (if down "down-" "") + (cond + ;; BEWARE: `mouse-wheel-UP-event' corresponds to + ;; `wheel-DOWN' events and vice versa!! + ((xterm-mouse--button-p mouse-wheel-down-event btn) "wheel-up") + ((xterm-mouse--button-p mouse-wheel-up-event btn) "wheel-down") + ((xterm-mouse--button-p mouse-wheel-left-event btn) "wheel-left") + ((xterm-mouse--button-p mouse-wheel-right-event btn) "wheel-right") + (t (format "mouse-%d" btn)))))))) (list sym (1- x) (1- y)))) (defun xterm-mouse--set-click-count (event click-count) commit 71b5d5a9799a37948b2e8cca125a59e2bfb71e96 Author: Stefan Kangas Date: Sun Jan 28 16:59:50 2024 +0100 ; Fix typos diff --git a/admin/codespell/codespell.exclude b/admin/codespell/codespell.exclude index 2503f4a9a16..416d79cf131 100644 --- a/admin/codespell/codespell.exclude +++ b/admin/codespell/codespell.exclude @@ -1,3 +1,54 @@ + say "And this happens inbetween"; + @ture) + ($sig,$na,@ture) +($sig,$na,@ture) +@ture) +((squery 10 "SQUERY alis :help list") + (0.01 ":Alis@hub.uk NOTICE tester :See also: HELP EXAMPLES")) + (0.04 ":Alis@hub.uk NOTICE tester :[...]") + (0.01 ":Alis@hub.uk NOTICE tester :/SQUERY Alis LIST mask [-options]") + (0.08 ":Alis@hub.uk NOTICE tester :Searches for a channel") + (erc-scenarios-common-say "/SQUERY alis help list") + (should (equal '((regexp . "(string-match-p \"^[fo]+\" \"foobar\")\n => 0")) + (or "comm" "comma" "comman" "command" "commands" + (when (and (not (or skipp erc-timestamp-format)) + (unless skipp + (skipp (or (and erc-stamp--skip-when-invisible invisible) +;; if you type "foo", but typing just "fo" doesn't show the preview. + (Emacs main thre), pid 32619 (org.gnu.emacs) +F DEBUG : pid: 32619, tid: 32644, name: Emacs main thre >>> org.gnu.emacs <<< + bnez $t2, .filld # start filling longs + j .filld # fill either doubleword or byte +.filld: + + (0.01 ":bob!~u@q2weir96jk3r2.irc PRIVMSG #chan :[06:08:40] alice: My sons would never so dishonour me.") + interger intger lits bool boolen constant filename + with typess = (sort (mapcar #'comp-supertypes + for types in typess +;; FIXME: normalise `seq', both the construct and implicit sequences, +;; `intersection', we may end up normalising subtrees multiple times +;; One way to avoid this is to aggressively normalise the entire tree +;; Such normalisation could normalise synonyms, eliminate `minimal-match' + ;; Normalise the constructor to `or' and the args recursively. + "Intersection of the normalised FORMS, as an interval set." +FORM must be normalised (from `rx--normalise-char-pattern')." + "Optimise `or' arguments. Return a new rx form. +Each element of ARGS should have been normalised using + (search-forward "retur") ; leaves point before the "n" +with typess = (sort (mapcar #'comp-supertypes + (font-spec :registry "iso10646-1" :otf '(khmr nil (pres))))) +(0.01 ":bob!~u@q2weir96jk3r2.irc PRIVMSG #chan :[06:08:40] alice: My sons would never so dishonour me.") + (0.05 ":bob!~u@q2weir96jk3r2.irc PRIVMSG #chan :alice: Pawn me to this your honour, she is his.")) + (funcall expect 1 "Entirely honour")) + (0 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #chan :You have paid the heavens your function, and the prisoner the very debt of your calling. I have laboured for the poor gentleman to the extremest shore of my modesty; but my brother justice have I found so severe, that he hath forced me to tell him he is indeed Justice.") + (0.00 ":irc.example.net 501 tester x :is not a recognised user mode.") + (0.00 ":irc.example.net 501 dummy` x :is not a recognised user mode.") + (0.1 ":bob!~u@rz2v467q4rwhy.irc PRIVMSG #utf-8 :alice: Entirely honour; I would not be delay'd.")) + integer integer list bool boolean constant filename + "def" "defi" "defin" "define" + "doc" "docu" "docum" "docume" "documen" "document" + case Aadd : overflow = ckd_add (&a, accum, next); break; + And this the second, again with the same distinction therefrom. Bonus: Return a cons cell: (COMPILED . UPTODATE). Bonus: Return a cons cell: (COMPILED . UPTODATE)." (defun semantic-grammar-create-package (&optional force uptodate) @@ -57,7 +108,6 @@ order but are now listed consecutively en bloc. 2003-06-11 Daniel Néri 2001-07-26 10:00:00 Steven E. Harris 2001-01-15 Jack Twilley - matching LAMDA as a word. Noted by Stefan Monnier. completion variant for every "LAMDA" name (bug#30513). "foto" @@ -195,7 +245,7 @@ mode setting. With the Inverse flag [@code{alog}], this command is @r{ a b@: I B @: @: 2 @:alog@:(a,b) b^a} @r{ a b@: I f I @: @: 2 @:alog@:(a,b) b^a} Change comment about the iif hook to reflect the actual reason. - "I + E (ln), L (exp), B (alog: B^X); f E (lnp1), f L (expm1)" + "\\`I' + \\`E' (ln), \\`L' (exp), \\`B' (alog: B^X); \\`f E' (lnp1), \\`f L' (expm1)" (let (numer denom) (setq numer (car (math-read-expr-list))) (if (and (Math-num-integerp numer) @@ -1177,9 +1227,6 @@ In CLOS, the argument list is (CLASS OBJECT SLOT-NAME), but const char *cm_right; /* right (nd) */ (should (equal (ert-test-result-messages result) "a\nb\nc\nd\n"))))) (insert "a\nb\nc\nd\n") - (insert "a\nb\nc\nd\n") - (insert "a\nb\nc\nd\n") - (insert "a\nb\nc\nd\n") (insert "a\nb\nc\nd\n") (should (string= (buffer-string) "Abc\nd efg\n(h ijk).")))) (nd (read-directory-name "Create directory: " @@ -1192,7 +1239,6 @@ DESCRIPTION:In this meeting\\, we will cover topics from product and enginee ;; RFC5546 refers to uninvited attendees as "party crashers". That includes both spelling (e.g., "behavior", not "behaviour") and * doc/lispref/control.texi (Signalling Errors) - * doc/lispref/control.texi (Signalling Errors) Re "behavior" vs "behaviour", etc. + [[https://protesilaos.com/codelog/2020-07-08-modus-themes-nuanced-colours/][Modus themes: major review of "nuanced" colours]] (2020-07-08) + [[https://protesilaos.com/codelog/2020-09-14-modus-themes-review-blues/][Modus themes: review of blue colours]] (2020-09-14) @@ -1256,7 +1302,6 @@ Put dialogue in buffer." "Given start brace BRA, and end brace KET, expand one line into many lines." (regexp-quote ket) (int-to-string (car vec)) ket sig-tail "\n")) - "Given start brace BRA, and end brace KET, expand one line into many lines." m | mo | mot | moti | motif ) val=motif ;; i | in | ino | inot | inoti | inotif | inotify ) val=inotify ;; 2001-04-23 Kahlil Hodgson @@ -1270,14 +1315,11 @@ Put dialogue in buffer." Rename from whitespace-skipping-for-quotes-not-ouside. (whitespace-skipping-for-quotes-not-ouside) Thread-Modell: posix -Thread-Modell: posix (ert-deftest indent-sexp-cant-go () (ert-deftest thunk-let-bound-vars-cant-be-set-test () (mml-secure-cust-fpr-lookup context 'encrypt "sub@example.org"))) (let ((p-e-fprs (mml-secure-cust-fpr-lookup (p-s-fprs (mml-secure-cust-fpr-lookup - (let ((p-e-fprs (mml-secure-cust-fpr-lookup - (p-s-fprs (mml-secure-cust-fpr-lookup (let ((s-e-fprs (mml-secure-cust-fpr-lookup (s-s-fprs (mml-secure-cust-fpr-lookup (ert-deftest doesnt-time-out () @@ -1308,7 +1350,6 @@ doc/emacs/docstyle.texi:14: fied ==> field * follow.el (follow-inactive-menu): Rename from follow-deactive-menu. * emacs-lisp/cconv.el (cconv-analyse-form): Warn use of ((λ ...) ...). (feedmail-sendmail-f-doesnt-sell-me-out) - (feedmail-sendmail-f-doesnt-sell-me-out) Respect feedmail-sendmail-f-doesnt-sell-me-out. * terminal.el (te-get-char, te-tic-sentinel): from server-external-socket-initialised, since it should be @@ -1401,7 +1442,6 @@ Paul Raines (raines at slac.stanford.edu), (car secnd))) ; fetch_date secnd (cdr secnd)) (car secnd))) ; Keep_flag - secnd (cdr secnd)) (car secnd))) ; NOV_entry_position @c LocalWords: DesBrisay Dcc devel dir dired docstring filll forw Older versions of the themes provided options ~grayscale~ (or ~greyscale~) @@ -1450,14 +1490,12 @@ DEFUN ("cond", Fcond, Scond, 0, UNEVALLED, 0, 2006-10-12 Magnus Henoch 2006-10-11 Magnus Henoch 2006-10-09 Magnus Henoch -2008-10-16 Magnus Henoch 2007-12-31 Magnus Henoch 2007-12-05 Magnus Henoch (ENUMABLE): Remove; no longer needed. * lisp.h (ENUMABLE) [!_AIX]: Don't define to 0 merely because we're * lisp.h (ENUMABLE, DEFINE_GDB_SYMBOL_ENUM): New macros. * lisp.h (ENUMABLE, DEFINE_GDB_SYMBOL_ENUM): Delete macros. - * lisp.h (ENUMABLE, DEFINE_GDB_SYMBOL_ENUM): New macros. 2023-06-29 Andrew G Cohen 2023-05-07 Andrew G Cohen C-x b fo @@ -1467,10 +1505,8 @@ DEFUN ("cond", Fcond, Scond, 0, UNEVALLED, 0, 2022-03-22 Andrew G Cohen 2022-03-20 Andrew G Cohen 2022-03-17 Andrew G Cohen -2022-03-17 Andrew G Cohen 2022-03-04 Andrew G Cohen 2022-02-18 Andrew G Cohen -2022-02-18 Andrew G Cohen 2022-02-11 Andrew G Cohen 2022-02-08 Andrew G Cohen 2022-02-03 Andrew G Cohen @@ -1490,7 +1526,6 @@ extern struct servent *hes_getservbyname (/* char *, char * */); servent = hes_getservbyname (service, "tcp"); if (servent) servent = getservbyname (service, "tcp"); - if (servent) struct servent *srv = getservbyname (service, protocol); 2003-04-10 Sebastian Tennant (tiny change) Reported by Sebastian Tennant . @@ -1515,7 +1550,6 @@ extern struct servent *hes_getservbyname (/* char *, char * */); (substring strin pos end-pos)))))) (defun dun-listify-string2 (strin) (while (setq end-pos (string-search " " (substring strin pos))) - (substring strin pos end-pos)))))) "any" "append" "as" "asc" "ascic" "async" "at_begin" "at_end" "audit" "attribute" "(d)eclaration or (s)pecification?" t) ?s) "quantity" "(f)ree, (b)ranch, or (s)ource quantity?" t))) diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 80e552fa46a..d9113a6811a 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -764,7 +764,7 @@ you first type @kbd{C-M-i}. By default, when you press @kbd{C-M-i}, both Icomplete mode's in-buffer display of possible completions and the @file{*Completions*} buffer appear. If you are using @code{icomplete-in-buffer}, then you -may wish to suppress this apperance of the @file{*Completions*} +may wish to suppress this appearance of the @file{*Completions*} buffer. To do that, add the following to your initialization file (@pxref{Init File}): diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi index b48ed0c1949..8500a0f08c4 100644 --- a/doc/misc/ses.texi +++ b/doc/misc/ses.texi @@ -507,7 +507,7 @@ To list the local printers in a help buffer. Except for @code{ses-prin1}, the other standard printers are suitable only for cells, not columns or default, because they format the value using the column-printer (or default-printer if @code{nil}) and then -post-proces the result, eg.@: center it: +post-process the result, eg.@: center it: @ftable @code @item ses-center diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index 3b7eb393561..71f55379d96 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -1750,7 +1750,7 @@ and `+='...)." ;; Split REM-BODY @ __VA_ARGS__ into LEFT and right (setq part nil) (if (zerop va) - (setq left nil ; __VA_ARGS__ trimed + (setq left nil ; __VA_ARGS__ trimmed rem-body (cdr rem-body)) (setq left rem-body rem-body (cdr (nthcdr va rem-body))) ; _V_ removed diff --git a/src/eval.c b/src/eval.c index c995183ceb8..6f1c39ffb0e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1377,7 +1377,7 @@ DEFUN ("handler-bind-1", Fhandler_bind_1, Shandler_bind_1, 1, MANY, 0, doc: /* Setup error handlers around execution of BODYFUN. BODYFUN be a function and it is called with no arguments. CONDITIONS should be a list of condition names (symbols). -When an error is signaled during executon of BODYFUN, if that +When an error is signaled during execution of BODYFUN, if that error matches one of CONDITIONS, then the associated HANDLER is called with the error as argument. HANDLER should either transfer the control via a non-local exit, @@ -1392,7 +1392,7 @@ usage: (handler-bind BODYFUN [CONDITIONS HANDLER]...) */) Lisp_Object bodyfun = args[0]; int count = 0; if (nargs % 2 == 0) - error ("Trailing CONDITIONS withount HANDLER in `handler-bind`"); + error ("Trailing CONDITIONS without HANDLER in `handler-bind`"); for (ptrdiff_t i = nargs - 2; i > 0; i -= 2) { Lisp_Object conditions = args[i], handler = args[i + 1]; diff --git a/src/xdisp.c b/src/xdisp.c index e69336d5abe..19f176459c7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -30956,7 +30956,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row, #ifdef HAVE_RSVG /* Update SVG image glyphs with mouse face features. FIXME: it - should be possible to have this behaviour with transparent + should be possible to have this behavior with transparent background PNG. */ if (hl == DRAW_MOUSE_FACE) { diff --git a/test/lisp/erc/erc-scenarios-keep-place-indicator.el b/test/lisp/erc/erc-scenarios-keep-place-indicator.el index 572045cf0bc..ccd6f81b7d2 100644 --- a/test/lisp/erc/erc-scenarios-keep-place-indicator.el +++ b/test/lisp/erc/erc-scenarios-keep-place-indicator.el @@ -101,7 +101,7 @@ (recenter 0) (redisplay) ; force ^ to appear on first line - (other-window 1) ; upper still at indicator, swtiches first + (other-window 1) ; upper still at indicator, switches first (switch-to-buffer "#spam") (other-window 1) (switch-to-buffer "#spam") ; lower follows, speaks to sync diff --git a/test/lisp/erc/resources/erc-tests-common.el b/test/lisp/erc/resources/erc-tests-common.el index 906aa891352..05dbe1d50d6 100644 --- a/test/lisp/erc/resources/erc-tests-common.el +++ b/test/lisp/erc/resources/erc-tests-common.el @@ -206,7 +206,7 @@ For simplicity, assume string evaluates to itself." (defun erc-tests-common-snapshot-compare (name dir trans-fn buf-init-fn) "Compare `buffer-string' to snapshot NAME.eld in DIR, if present. -When non-nil, run TRANS-FN to fiter the current buffer string, +When non-nil, run TRANS-FN to filter the current buffer string, and expect a similar string in return. Call BUF-INIT-FN, when non-nil, in the preview buffer after inserting the filtered string." diff --git a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts index fe09a37a32b..f2d0eacee5b 100644 --- a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts @@ -134,7 +134,7 @@ Name: Pipe statements with fn end) =-=-= -Name: Pipe statements stab clases +Name: Pipe statements stab clauses =-= [1, 2] diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 4e7ca88d197..54a9a6c11cc 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -906,7 +906,7 @@ Return a list of results." (defun comp-tests--types-equal (t1 t2) "Whether the types T1 and T2 are equal." - (or (equal t1 t2) ; optimisation for the common case + (or (equal t1 t2) ; optimization for the common case (and (consp t1) (consp t2) (eq (car t1) (car t2)) (if (memq (car t1) '(and or member)) commit 6ebd5aa33765d6d3ffec96f9965d004ad539098e Merge: af10fe49fbf e11c9f9c6e8 Author: Michael Albinus Date: Sun Jan 28 11:51:51 2024 +0100 Merge from origin/emacs-29 e11c9f9c6e8 Handle wrong login program in Tramp # Conflicts: # lisp/net/tramp-sh.el commit af10fe49fbfcdbe3100b9fdbede3750eb2506930 Merge: 833d2636ff8 b2db82c5aec Author: Michael Albinus Date: Sun Jan 28 11:49:59 2024 +0100 ; Merge from origin/emacs-29 The following commits were skipped: b2db82c5aec * doc/lispref/package.texi (Multi-file Packages): Documen... 3c2baa1b954 Avoid signaling errors in emoji.el on empty input commit e11c9f9c6e843779c4b69097490dd78de522a79d Author: Michael Albinus Date: Sun Jan 28 10:31:45 2024 +0100 Handle wrong login program in Tramp * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Exit remote shell when login fails. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 38925652376..1301cd633da 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5340,7 +5340,7 @@ connection if a previous connection has died for some reason." "2>" (tramp-get-remote-null-device previous-hop)) ?l (concat remote-shell " " extra-args " -i")) ;; A restricted shell does not allow "exec". - (when r-shell '("&&" "exit" "||" "exit"))) + (when r-shell '("&&" "exit")) '("||" "exit")) " ")) ;; Send the command. commit 833d2636ff8a65c9f9f982618f1974d424baa3fe Author: Po Lu Date: Sun Jan 28 17:08:50 2024 +0800 ; * lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Fix typos. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index b5f12f0b4fc..b847fb953f2 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -575,8 +575,8 @@ the \\[vc-prefix-map] prefix for VC commands, for example). "Insert FUNC-NAMES, following ChangeLog formatting." (if (not func-names) (insert ":") - ;; Insert a space unless this list of file names is being inserted - ;; at the start of a line or after a space character. + ;; Insert a space unless this list of defun names is being + ;; inserted at the start of a line or after a space character. (unless (or (memq (char-before) '(?\n ?\s)) (> (current-column) fill-column)) (insert " ")) @@ -622,7 +622,7 @@ the \\[vc-prefix-map] prefix for VC commands, for example). (setq inside-paren-pair nil ;; Iterate over this function name again. func-names (cons name func-names))) - ;; Insert this file name with a separator attached. + ;; Insert this defun name with a separator attached. (insert name ", ")) ;; Otherwise, decide whether to start a list of defuns or ;; to insert `name' on its own line. @@ -632,8 +632,9 @@ the \\[vc-prefix-map] prefix for VC commands, for example). ; line after inserting ; `name'... fill-column) - ;; ...would leave insufficient space for any subsequent - ;; file names, so insert it on its own line. + ;; ...would leave insufficient space for any + ;; subsequent defun names so insert it on its own + ;; line. (insert (if func-names (format "(%s)\n" name) (format "(%s):" name))) commit adf32eb69ea34b9c057c9a4321e5f05b00a7c940 Author: Po Lu Date: Sun Jan 28 16:55:56 2024 +0800 ; Correct typo * lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Correct typo in alignment constants. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 5f370511b14..b5f12f0b4fc 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -612,9 +612,9 @@ the \\[vc-prefix-map] prefix for VC commands, for example). ;; however, there are two separator characters ;; that will be deleted, so the number of ;; columns to add to this in the case of - ;; `name' being final and in other cases are - ;; -1 and -2 respectively. - (if func-names -1 -2)) + ;; `name' being final and in other cases are 0 + ;; and 1 respectively. + (if func-names 0 1)) fill-column) (progn (delete-char -2) commit d664814a8d40da63f1906218b73aec62f2cd4d18 Author: Po Lu Date: Sun Jan 28 16:55:33 2024 +0800 ; New log-edit tests * test/lisp/vc/log-edit-tests.el (log-edit-fill-entry-confinement): Test confinement in various contrived scenarious. diff --git a/test/lisp/vc/log-edit-tests.el b/test/lisp/vc/log-edit-tests.el index 1a2af716f34..5b555809f4c 100644 --- a/test/lisp/vc/log-edit-tests.el +++ b/test/lisp/vc/log-edit-tests.el @@ -134,4 +134,55 @@ lines.")))) * a-very-long-directory-name/another-long-directory-name/and-a-long-file-name.ext \(a-really-long-function-name):")))) +(ert-deftest log-edit-fill-entry-confinement () + (let (string string1 string2 string3 string4) + (setq string + ;; This entry is precisely 65 columns in length; + ;; log-edit-fill-column should leave it unmodified. + "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10, fun1134):" + string1 + ;; This entry is 66 columns in length, and must be filled. + "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10, fun11345):" + string2 + ;; The first line of this entry totals 65 columns in length, + ;; and should be preserved intact. + "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10, fun11345) +(fun11356):" + string3 + ;; The first defun in this entry is a file name that brings + ;; the total to 40 columns in length and should be preserved + ;; intact. + "* file2.txt (abcdefghijklmnopqrstuvwxyz) +(ABC):" + string4 + ;; The first defun brings that total to 41, and should be + ;; placed on the next line. + "* file2.txt (abcdefghijklmnopqrstuvwxyz):") + (with-temp-buffer + (insert string) + (let ((fill-column 64)) (log-edit-fill-entry)) + (should (equal (buffer-string) string)) + (erase-buffer) + (insert string1) + (let ((fill-column 64)) (log-edit-fill-entry)) + (should (equal (buffer-string) + "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10) +(fun11345):")) + (erase-buffer) + (insert string2) + (let ((fill-column 64)) (log-edit-fill-entry)) + (should (equal (buffer-string) string2)) + (erase-buffer) + (insert string3) + (let ((fill-column 39)) (log-edit-fill-entry)) + (should (equal (buffer-string) string3)) + (erase-buffer) + (insert string4) + (let ((fill-column 39)) (log-edit-fill-entry)) + (should (equal (buffer-string) + ;; There is whitespace after "file2.txt" which + ;; should not be erased! + "* file2.txt +(abcdefghijklmnopqrstuvwxyz):"))))) + ;;; log-edit-tests.el ends here commit 78fc49407b8ef8ec649fe70fcce09101801dbc05 Author: Po Lu Date: Sun Jan 28 16:31:33 2024 +0800 Improve filling of ChangeLog entries * lisp/vc/log-edit.el (log-edit--insert-filled-defuns): Rewrite completely. (log-edit-fill-entry): Abandon pcase and cl-lib. diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 72867f14d2f..5f370511b14 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -575,19 +575,79 @@ the \\[vc-prefix-map] prefix for VC commands, for example). "Insert FUNC-NAMES, following ChangeLog formatting." (if (not func-names) (insert ":") + ;; Insert a space unless this list of file names is being inserted + ;; at the start of a line or after a space character. (unless (or (memq (char-before) '(?\n ?\s)) (> (current-column) fill-column)) (insert " ")) - (cl-loop for first-fun = t then nil - for def in func-names do - (when (> (+ (current-column) (string-width def)) fill-column) - (unless first-fun - (insert ")")) - (insert "\n")) - (insert (if (memq (char-before) '(?\n ?\s)) - "(" ", ") - def)) - (insert "):"))) + (let ((inside-paren-pair nil) + (first-line t) + name) + ;; Now insert the functions names one by one, inserting newlines + ;; as appropriate. + (while func-names + (setq name (car func-names)) + (setq func-names (cdr func-names)) + ;; If inserting `name' in at the current column would overflow + ;; the fill column, place it on its own line. + (if (and first-line + (> (+ (current-column) + (string-width name) + ;; If this be the last name, the column must be + ;; followed by an extra colon character. + (if func-names 1 2)) + fill-column)) + (progn + (insert "\n") + ;; Iterate over this function name again. + (setq func-names (cons name func-names))) + (if inside-paren-pair + ;; If `name' is not the first item in a list of defuns + ;; and inserting it would overflow the fill column, + ;; start a new list of defuns on the next line. + (if (> (+ (current-column) + (string-width name) + ;; If this be the last name, the column must + ;; be followed by an extra colon character; + ;; however, there are two separator characters + ;; that will be deleted, so the number of + ;; columns to add to this in the case of + ;; `name' being final and in other cases are + ;; -1 and -2 respectively. + (if func-names -1 -2)) + fill-column) + (progn + (delete-char -2) + (insert ")\n") + (setq inside-paren-pair nil + ;; Iterate over this function name again. + func-names (cons name func-names))) + ;; Insert this file name with a separator attached. + (insert name ", ")) + ;; Otherwise, decide whether to start a list of defuns or + ;; to insert `name' on its own line. + (if (> (+ (current-column) + (string-width name) + (if func-names 1 2)) ; The column number of + ; line after inserting + ; `name'... + fill-column) + ;; ...would leave insufficient space for any subsequent + ;; file names, so insert it on its own line. + (insert (if func-names + (format "(%s)\n" name) + (format "(%s):" name))) + ;; Insert a new defun list, unless `name' is the last + ;; function name. + (insert (if (not func-names) + (format "(%s):" name) + (setq inside-paren-pair t) + (format "(%s, " name)))))) + (setq first-line nil)) + ;; Close any open list of defuns. + (when inside-paren-pair + (delete-char -2) + (insert "):"))))) (defun log-edit-fill-entry (&optional justify) "Like \\[fill-paragraph], but for filling ChangeLog-formatted entries. @@ -595,32 +655,41 @@ Consecutive function entries without prose (i.e., lines of the form \"(FUNCTION):\") will be combined into \"(FUNC1, FUNC2):\" according to `fill-column'." (save-excursion - (pcase-let ((`(,beg ,end) (log-edit-changelog-paragraph))) + (let* ((range (log-edit-changelog-paragraph)) + (beg (car range)) + (end (cadr range))) (if (= beg end) ;; Not a ChangeLog entry, fill as normal. nil - (cl-callf copy-marker end) + (setq end (copy-marker end)) (goto-char beg) - (cl-loop - for defuns-beg = - (and (< beg end) - (re-search-forward - (concat "\\(?1:" change-log-unindented-file-names-re - "\\)\\|^\\(?1:\\)[[:blank:]]*(") - end t) - (copy-marker (match-end 1))) - ;; Fill prose between log entries. - do (let ((fill-indent-according-to-mode t) - (end (if defuns-beg (match-beginning 0) end)) - (beg (progn (goto-char beg) (line-beginning-position)))) - (when (<= (line-end-position) end) - (fill-region beg end justify))) - while defuns-beg - for defuns = (progn (goto-char defuns-beg) - (change-log-read-defuns end)) - do (progn (delete-region defuns-beg (point)) - (log-edit--insert-filled-defuns defuns) - (setq beg (point)))) + (let* ((defuns-beg nil) + (defuns nil)) + (while + (progn + (setq defuns-beg + (and (< beg end) + (re-search-forward + (concat "\\(?1:" + change-log-unindented-file-names-re + "\\)\\|^\\(?1:\\)[[:blank:]]*(") + end t) + (copy-marker (match-end 1)))) + (let ((fill-indent-according-to-mode t) + (end (if defuns-beg + (match-beginning 0) end)) + (beg (progn (goto-char beg) + (line-beginning-position)))) + (when (<= (line-end-position) end) + (fill-region beg end justify))) + defuns-beg) + (goto-char defuns-beg) + (setq defuns (change-log-read-defuns end)) + (progn + (delete-region defuns-beg (point)) + (log-edit--insert-filled-defuns defuns) + (setq beg (point)))) + nil) t)))) (defun log-edit-hide-buf (&optional buf where) commit ad2c81082a62f9f781e4f5771fc223520d91cefd Author: Paul Eggert Date: Sun Jan 28 00:15:38 2024 -0800 Prefer C23 ckd_* to Gnulib *_WRAPV and *_OK macros * src/alloc.c (android_make_lisp_symbol) [HAVE_ANDROID && !__clang__]: * src/android.c (android_blit_copy, android_blit_xor) (android_get_image): * src/androidmenu.c (android_menu_show): * src/androidselect.c (Fandroid_get_clipboard_data) (android_notifications_notify_1): * src/androidterm.c (android_decode_utf16) (android_text_to_string): * src/haiku_select.cc (be_display_notification): * src/sfnt.c (sfnt_read_cmap_format_8, sfnt_read_cmap_format_12) (sfnt_read_cmap_format_14, sfnt_read_cmap_table_1) (sfnt_expand_compound_glyph_context, sfnt_poly_edges_exact) (sfnt_read_meta_table, sfnt_read_ttc_header) (sfnt_read_cvt_table, sfnt_read_fpgm_table) (sfnt_read_prep_table, sfnt_make_interpreter) (sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_2) (sfnt_interpret_compound_glyph, sfnt_read_default_uvs_table) (sfnt_read_nondefault_uvs_table, sfnt_create_uvs_context) (sfnt_read_fvar_table, sfnt_read_gvar_table) (sfnt_read_avar_table, sfnt_read_cvar_table): * src/sfntfont-android.c (GET_SCANLINE_BUFFER): * src/textconv.c (really_commit_text, really_set_composing_text) (really_replace_text, get_surrounding_text): Prefer C2x stdckdint.h macros to intprops.h macros. diff --git a/src/alloc.c b/src/alloc.c index b144396948e..15bb65cf74f 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6291,8 +6291,7 @@ android_make_lisp_symbol (struct Lisp_Symbol *sym) intptr_t symoffset; symoffset = (intptr_t) sym; - INT_SUBTRACT_WRAPV (symoffset, (intptr_t) &lispsym, - &symoffset); + ckd_sub (&symoffset, symoffset, (intptr_t) &lispsym); { Lisp_Object a = TAG_PTR_INITIALLY (Lisp_Symbol, symoffset); diff --git a/src/android.c b/src/android.c index 51eb85a97e8..4a74f5b2af4 100644 --- a/src/android.c +++ b/src/android.c @@ -3963,10 +3963,10 @@ android_blit_copy (int src_x, int src_y, int width, int height, /* Turn both into offsets. */ - if (INT_MULTIPLY_WRAPV (temp, pixel, &offset) - || INT_MULTIPLY_WRAPV (i, mask_info->stride, &offset1) - || INT_ADD_WRAPV (offset, offset1, &offset) - || INT_ADD_WRAPV ((uintptr_t) mask, offset, &start)) + if (ckd_mul (&offset, temp, pixel) + || ckd_mul (&offset1, i, mask_info->stride) + || ckd_add (&offset, offset, offset1) + || ckd_add (&start, (uintptr_t) mask, offset)) return; if (height <= 0) @@ -4271,10 +4271,10 @@ android_blit_xor (int src_x, int src_y, int width, int height, /* Turn both into offsets. */ - if (INT_MULTIPLY_WRAPV (temp, pixel, &offset) - || INT_MULTIPLY_WRAPV (i, mask_info->stride, &offset1) - || INT_ADD_WRAPV (offset, offset1, &offset) - || INT_ADD_WRAPV ((uintptr_t) mask, offset, &start)) + if (ckd_mul (&offset, temp, pixel) + || ckd_mul (&offset1, i, mask_info->stride) + || ckd_add (&offset, offset, offset1) + || ckd_add (&start, (uintptr_t) mask, offset)) return; mask = mask_current = (unsigned char *) start; @@ -4899,9 +4899,9 @@ android_get_image (android_drawable handle, if (bitmap_info.format != ANDROID_BITMAP_FORMAT_A_8) { - if (INT_MULTIPLY_WRAPV ((size_t) bitmap_info.stride, - (size_t) bitmap_info.height, - &byte_size)) + if (ckd_mul (&byte_size, + (size_t) bitmap_info.stride, + (size_t) bitmap_info.height)) { ANDROID_DELETE_LOCAL_REF (bitmap); memory_full (0); diff --git a/src/androidmenu.c b/src/androidmenu.c index 1728ae81e42..362d500ac1a 100644 --- a/src/androidmenu.c +++ b/src/androidmenu.c @@ -437,7 +437,7 @@ android_menu_show (struct frame *f, int x, int y, int menuflags, /* Compute the item ID. This is the index of value. Make sure it doesn't overflow. */ - if (!INT_ADD_OK (0, i + MENU_ITEMS_ITEM_VALUE, &item_id)) + if (ckd_add (&item_id, i + MENU_ITEMS_ITEM_VALUE, 0)) memory_full (i + MENU_ITEMS_ITEM_VALUE * sizeof (Lisp_Object)); /* Add this menu item with the appropriate state. */ diff --git a/src/androidselect.c b/src/androidselect.c index 3ba3058aeb9..5b23c559d2c 100644 --- a/src/androidselect.c +++ b/src/androidselect.c @@ -446,7 +446,7 @@ does not have any corresponding data. In that case, use { rc = emacs_read_quit (fd, start, BUFSIZ); - if (!INT_ADD_OK (rc, length, &length) + if (ckd_add (&length, length, rc) || PTRDIFF_MAX - length < BUFSIZ) memory_full (PTRDIFF_MAX); @@ -588,7 +588,7 @@ android_notifications_notify_1 (Lisp_Object title, Lisp_Object body, if (NILP (replaces_id)) { /* Generate a new identifier. */ - INT_ADD_WRAPV (counter, 1, &counter); + ckd_add (&counter, counter, 1); id = counter; } else diff --git a/src/androidterm.c b/src/androidterm.c index 8632df1d4fc..d4612bb20fa 100644 --- a/src/androidterm.c +++ b/src/androidterm.c @@ -619,7 +619,7 @@ android_decode_utf16 (unsigned short *utf16, size_t n) struct coding_system coding; ptrdiff_t size; - if (INT_MULTIPLY_WRAPV (n, sizeof *utf16, &size)) + if (ckd_mul (&size, n, sizeof *utf16)) return Qnil; /* Set up the coding system. Decoding a UTF-16 string (with no BOM) @@ -5010,7 +5010,7 @@ android_text_to_string (JNIEnv *env, char *buffer, ptrdiff_t n, { /* This buffer holds no multibyte characters. */ - if (INT_MULTIPLY_WRAPV (n, sizeof *utf16, &size)) + if (ckd_mul (&size, n, sizeof *utf16)) return NULL; utf16 = malloc (size); @@ -5033,7 +5033,7 @@ android_text_to_string (JNIEnv *env, char *buffer, ptrdiff_t n, /* Allocate enough to hold N characters. */ - if (INT_MULTIPLY_WRAPV (n, sizeof *utf16, &size)) + if (ckd_mul (&size, n, sizeof *utf16)) return NULL; utf16 = malloc (size); diff --git a/src/haiku_select.cc b/src/haiku_select.cc index 02f3272514f..74467edf710 100644 --- a/src/haiku_select.cc +++ b/src/haiku_select.cc @@ -619,8 +619,7 @@ be_display_notification (const char *title, const char *body, /* SUPERSEDES hasn't been provided, so allocate a new notification ID. */ - INT_ADD_WRAPV (last_notification_id, 1, - &last_notification_id); + ckd_add (&last_notification_id, last_notification_id, 1); id = last_notification_id; } else diff --git a/src/sfnt.c b/src/sfnt.c index 41dba8b486e..030442fad68 100644 --- a/src/sfnt.c +++ b/src/sfnt.c @@ -663,14 +663,13 @@ sfnt_read_cmap_format_8 (int fd, min_size = SFNT_ENDOF (struct sfnt_cmap_format_8, num_groups, uint32_t); - if (INT_MULTIPLY_WRAPV (format8->num_groups, sizeof *format8->groups, - &temp)) + if (ckd_mul (&temp, format8->num_groups, sizeof *format8->groups)) { xfree (format8); return NULL; } - if (INT_ADD_WRAPV (min_size, temp, &min_size)) + if (ckd_add (&min_size, min_size, temp)) { xfree (format8); return NULL; @@ -755,14 +754,13 @@ sfnt_read_cmap_format_12 (int fd, min_size = SFNT_ENDOF (struct sfnt_cmap_format_12, num_groups, uint32_t); - if (INT_MULTIPLY_WRAPV (format12->num_groups, sizeof *format12->groups, - &temp)) + if (ckd_mul (&temp, format12->num_groups, sizeof *format12->groups)) { xfree (format12); return NULL; } - if (INT_ADD_WRAPV (min_size, temp, &min_size)) + if (ckd_add (&min_size, min_size, temp)) { xfree (format12); return NULL; @@ -841,9 +839,8 @@ sfnt_read_cmap_format_14 (int fd, 14 cmap table. */ size = sizeof *format14; - if (INT_MULTIPLY_WRAPV (num_records, sizeof *format14->records, - &temp) - || INT_ADD_WRAPV (size, temp, &size)) + if (ckd_mul (&temp, num_records, sizeof *format14->records) + || ckd_add (&size, size, temp)) return NULL; format14 = xmalloc (size); @@ -901,7 +898,7 @@ sfnt_read_cmap_table_1 (int fd, uint32_t directory_offset, off_t offset; struct sfnt_cmap_encoding_subtable_data header; - if (INT_ADD_WRAPV (directory_offset, table_offset, &offset)) + if (ckd_add (&offset, directory_offset, table_offset)) return (struct sfnt_cmap_encoding_subtable_data *) -1; if (lseek (fd, offset, SEEK_SET) == (off_t) -1) @@ -2632,24 +2629,21 @@ sfnt_expand_compound_glyph_context (struct sfnt_compound_glyph_context *context, size_t size_bytes; /* Add each field while checking for overflow. */ - if (INT_ADD_WRAPV (number_of_contours, context->num_end_points, - &context->num_end_points)) + if (ckd_add (&context->num_end_points, number_of_contours, + context->num_end_points)) return 1; - if (INT_ADD_WRAPV (number_of_points, context->num_points, - &context->num_points)) + if (ckd_add (&context->num_points, number_of_points, context->num_points)) return 1; /* Reallocate each array to the new size if necessary. */ if (context->points_size < context->num_points) { - if (INT_MULTIPLY_WRAPV (context->num_points, 2, - &context->points_size)) + if (ckd_mul (&context->points_size, context->num_points, 2)) context->points_size = context->num_points; - if (INT_MULTIPLY_WRAPV (context->points_size, - sizeof *context->x_coordinates, - &size_bytes)) + if (ckd_mul (&size_bytes, context->points_size, + sizeof *context->x_coordinates)) return 1; context->x_coordinates = xrealloc (context->x_coordinates, @@ -2673,13 +2667,11 @@ sfnt_expand_compound_glyph_context (struct sfnt_compound_glyph_context *context, if (context->end_points_size < context->num_end_points) { - if (INT_MULTIPLY_WRAPV (context->num_end_points, 2, - &context->end_points_size)) + if (ckd_mul (&context->end_points_size, context->num_end_points, 2)) context->end_points_size = context->num_end_points; - if (INT_MULTIPLY_WRAPV (context->end_points_size, - sizeof *context->contour_end_points, - &size_bytes)) + if (ckd_mul (&size_bytes, context->end_points_size, + sizeof *context->contour_end_points)) return 1; context->contour_end_points @@ -5109,7 +5101,7 @@ sfnt_poly_edges_exact (struct sfnt_fedge *edges, size_t nedges, raster.scanlines = height; raster.chunks = NULL; - if (!INT_MULTIPLY_OK (height, sizeof *raster.steps, &size)) + if (ckd_mul (&size, height, sizeof *raster.steps)) abort (); raster.steps = xzalloc (size); @@ -6040,11 +6032,10 @@ sfnt_read_meta_table (int fd, struct sfnt_offset_subtable *subtable) so an unswapped copy of the whole meta contents must be retained. */ - if (INT_MULTIPLY_WRAPV (sizeof *meta->data_maps, meta->num_data_maps, - &map_size) + if (ckd_mul (&map_size, sizeof *meta->data_maps, meta->num_data_maps) /* Do so while checking for overflow from bad sfnt files. */ - || INT_ADD_WRAPV (map_size, sizeof *meta, &data_size) - || INT_ADD_WRAPV (data_size, directory->length, &data_size)) + || ckd_add (&data_size, map_size, sizeof *meta) + || ckd_add (&data_size, data_size, directory->length)) { xfree (meta); return NULL; @@ -6094,9 +6085,8 @@ sfnt_read_meta_table (int fd, struct sfnt_offset_subtable *subtable) /* Verify the data offsets. Overflow checking is particularly important here. */ - if (INT_ADD_WRAPV (meta->data_maps[i].data_offset, - meta->data_maps[i].data_length, - &offset)) + if (ckd_add (&offset, meta->data_maps[i].data_offset, + meta->data_maps[i].data_length)) { xfree (meta); return NULL; @@ -6182,9 +6172,7 @@ sfnt_read_ttc_header (int fd) /* Now, read the variable length data. Make sure to check for overflow. */ - if (INT_MULTIPLY_WRAPV (ttc->num_fonts, - sizeof *ttc->offset_table, - &size)) + if (ckd_mul (&size, ttc->num_fonts, sizeof *ttc->offset_table)) { xfree (ttc); return NULL; @@ -6303,7 +6291,7 @@ sfnt_read_cvt_table (int fd, struct sfnt_offset_subtable *subtable) return NULL; /* Figure out the minimum amount that has to be read. */ - if (INT_ADD_WRAPV (sizeof *cvt, directory->length, &required)) + if (ckd_add (&required, directory->length, sizeof *cvt)) return NULL; /* Allocate enough for that much data. */ @@ -6354,7 +6342,7 @@ sfnt_read_fpgm_table (int fd, struct sfnt_offset_subtable *subtable) return NULL; /* Figure out the minimum amount that has to be read. */ - if (INT_ADD_WRAPV (sizeof *fpgm, directory->length, &required)) + if (ckd_add (&required, directory->length, sizeof *fpgm)) return NULL; /* Allocate enough for that much data. */ @@ -6402,7 +6390,7 @@ sfnt_read_prep_table (int fd, struct sfnt_offset_subtable *subtable) return NULL; /* Figure out the minimum amount that has to be read. */ - if (INT_ADD_WRAPV (sizeof *prep, directory->length, &required)) + if (ckd_add (&required, directory->length, sizeof *prep)) return NULL; /* Allocate enough for that much data. */ @@ -6654,59 +6642,51 @@ sfnt_make_interpreter (struct sfnt_maxp_table *maxp, size = sizeof (*interpreter); /* Add program stack. */ - if (INT_ADD_WRAPV ((maxp->max_stack_elements - * sizeof *interpreter->stack), - size, &size)) + if (ckd_add (&size, size, (maxp->max_stack_elements + * sizeof *interpreter->stack))) return NULL; /* Add twilight zone. */ - if (INT_ADD_WRAPV ((maxp->max_twilight_points - * sizeof *interpreter->twilight_x), - size, &size)) + if (ckd_add (&size, size, (maxp->max_twilight_points + * sizeof *interpreter->twilight_x))) return NULL; - if (INT_ADD_WRAPV ((maxp->max_twilight_points - * sizeof *interpreter->twilight_y), - size, &size)) + if (ckd_add (&size, size, (maxp->max_twilight_points + * sizeof *interpreter->twilight_y))) return NULL; - if (INT_ADD_WRAPV ((maxp->max_twilight_points - * sizeof *interpreter->twilight_y), - size, &size)) + if (ckd_add (&size, size, (maxp->max_twilight_points + * sizeof *interpreter->twilight_y))) return NULL; - if (INT_ADD_WRAPV ((maxp->max_twilight_points - * sizeof *interpreter->twilight_y), - size, &size)) + if (ckd_add (&size, size, (maxp->max_twilight_points + * sizeof *interpreter->twilight_y))) return NULL; /* Add the storage area. */ storage_size = maxp->max_storage * sizeof *interpreter->storage; - if (INT_ADD_WRAPV (storage_size, size, &size)) + if (ckd_add (&size, size, storage_size)) return NULL; /* Add padding for the storage area. */ pad = alignof (struct sfnt_interpreter_definition); pad -= size & (pad - 1); - if (INT_ADD_WRAPV (pad, size, &size)) + if (ckd_add (&size, size, pad)) return NULL; /* Add function and instruction definitions. */ - if (INT_ADD_WRAPV ((((int) maxp->max_instruction_defs - + maxp->max_function_defs) - * sizeof *interpreter->function_defs), - size, &size)) + if (ckd_add (&size, size, (((int) maxp->max_instruction_defs + + maxp->max_function_defs) + * sizeof *interpreter->function_defs))) return NULL; /* Add control value table. */ if (cvt) { - if (INT_MULTIPLY_WRAPV (cvt->num_elements, - sizeof *interpreter->cvt, - &temp) - || INT_ADD_WRAPV (temp, size, &size)) + if (ckd_mul (&temp, cvt->num_elements, sizeof *interpreter->cvt) + || ckd_add (&size, size, temp)) return NULL; } @@ -12648,19 +12628,16 @@ sfnt_interpret_simple_glyph (struct sfnt_glyph *glyph, /* Calculate the size of the zone structure. */ - if (INT_MULTIPLY_WRAPV (glyph->simple->number_of_points + 2, - sizeof *zone->x_points * 4, - &temp) - || INT_ADD_WRAPV (temp, zone_size, &zone_size) - || INT_MULTIPLY_WRAPV (glyph->number_of_contours, - sizeof *zone->contour_end_points, - &temp) - || INT_ADD_WRAPV (temp, zone_size, &zone_size) - || INT_MULTIPLY_WRAPV (glyph->simple->number_of_points + 2, - sizeof *zone->flags, - &temp) - || INT_ADD_WRAPV (temp, zone_size, &zone_size) - || INT_ADD_WRAPV (sizeof *zone, zone_size, &zone_size)) + if (ckd_mul (&temp, glyph->simple->number_of_points + 2, + sizeof *zone->x_points * 4) + || ckd_add (&zone_size, zone_size, temp) + || ckd_mul (&temp, glyph->number_of_contours, + sizeof *zone->contour_end_points) + || ckd_add (&zone_size, zone_size, temp) + || ckd_mul (&temp, glyph->simple->number_of_points + 2, + sizeof *zone->flags) + || ckd_add (&zone_size, zone_size, temp) + || ckd_add (&zone_size, zone_size, sizeof *zone)) return "Glyph exceeded maximum permissible size"; /* Don't use malloc if possible. */ @@ -12947,19 +12924,13 @@ sfnt_interpret_compound_glyph_2 (struct sfnt_glyph *glyph, zone_size = 0; zone_was_allocated = false; - if (INT_MULTIPLY_WRAPV (num_points + 2, - sizeof *zone->x_points * 4, - &temp) - || INT_ADD_WRAPV (temp, zone_size, &zone_size) - || INT_MULTIPLY_WRAPV (num_contours, - sizeof *zone->contour_end_points, - &temp) - || INT_ADD_WRAPV (temp, zone_size, &zone_size) - || INT_MULTIPLY_WRAPV (num_points + 2, - sizeof *zone->flags, - &temp) - || INT_ADD_WRAPV (temp, zone_size, &zone_size) - || INT_ADD_WRAPV (sizeof *zone, zone_size, &zone_size)) + if (ckd_mul (&temp, num_points + 2, sizeof *zone->x_points * 4) + || ckd_add (&zone_size, zone_size, temp) + || ckd_mul (&temp, num_contours, sizeof *zone->contour_end_points) + || ckd_add (&zone_size, zone_size, temp) + || ckd_mul (&temp, num_points + 2, sizeof *zone->flags) + || ckd_add (&zone_size, zone_size, temp) + || ckd_add (&zone_size, zone_size, sizeof *zone)) return "Glyph exceeded maximum permissible size"; /* Don't use malloc if possible. */ @@ -13602,16 +13573,12 @@ sfnt_interpret_compound_glyph (struct sfnt_glyph *glyph, /* Copy the compound glyph data into an instructed outline. */ outline_size = sizeof (*outline); - if (INT_MULTIPLY_WRAPV (context.num_end_points, - sizeof *outline->contour_end_points, - &temp) - || INT_ADD_WRAPV (outline_size, temp, &outline_size) - || INT_MULTIPLY_WRAPV (context.num_points, - sizeof *outline->x_points * 2, - &temp) - || INT_ADD_WRAPV (outline_size, temp, &outline_size) - || INT_ADD_WRAPV (context.num_points, outline_size, - &outline_size)) + if (ckd_mul (&temp, context.num_end_points, + sizeof *outline->contour_end_points) + || ckd_add (&outline_size, outline_size, temp) + || ckd_mul (&temp, context.num_points, sizeof *outline->x_points * 2) + || ckd_add (&outline_size, outline_size, temp) + || ckd_add (&outline_size, outline_size, context.num_points)) { xfree (context.x_coordinates); xfree (context.y_coordinates); @@ -13734,9 +13701,8 @@ sfnt_read_default_uvs_table (int fd, off_t offset) /* Now, allocate enough to hold the UVS table. */ size = sizeof *uvs; - if (INT_MULTIPLY_WRAPV (sizeof *uvs->ranges, num_ranges, - &temp) - || INT_ADD_WRAPV (temp, size, &size)) + if (ckd_mul (&temp, num_ranges, sizeof *uvs->ranges) + || ckd_add (&size, size, temp)) return NULL; uvs = xmalloc (size); @@ -13805,9 +13771,8 @@ sfnt_read_nondefault_uvs_table (int fd, off_t offset) /* Now, allocate enough to hold the UVS table. */ size = sizeof *uvs; - if (INT_MULTIPLY_WRAPV (sizeof *uvs->mappings, num_mappings, - &temp) - || INT_ADD_WRAPV (temp, size, &size)) + if (ckd_mul (&temp, num_mappings, sizeof *uvs->mappings) + || ckd_add (&size, size, temp)) return NULL; uvs = xmalloc (size); @@ -13887,9 +13852,9 @@ sfnt_create_uvs_context (struct sfnt_cmap_format_14 *cmap, int fd) off_t offset; struct sfnt_uvs_context *context; - if (INT_MULTIPLY_WRAPV (cmap->num_var_selector_records, - sizeof *table_offsets, &size) - || INT_MULTIPLY_WRAPV (size, 2, &size)) + if (ckd_mul (&size, cmap->num_var_selector_records, + sizeof *table_offsets) + || ckd_mul (&size, size, 2)) return NULL; context = NULL; @@ -13909,9 +13874,8 @@ sfnt_create_uvs_context (struct sfnt_cmap_format_14 *cmap, int fd) if (cmap->records[i].default_uvs_offset) { - if (INT_ADD_WRAPV (cmap->offset, - cmap->records[i].default_uvs_offset, - &table_offsets[j].offset)) + if (ckd_add (&table_offsets[j].offset, cmap->offset, + cmap->records[i].default_uvs_offset)) goto bail; table_offsets[j++].is_nondefault_table = false; @@ -13919,9 +13883,8 @@ sfnt_create_uvs_context (struct sfnt_cmap_format_14 *cmap, int fd) if (cmap->records[i].nondefault_uvs_offset) { - if (INT_ADD_WRAPV (cmap->offset, - cmap->records[i].nondefault_uvs_offset, - &table_offsets[j].offset)) + if (ckd_add (&table_offsets[j].offset, cmap->offset, + cmap->records[i].nondefault_uvs_offset)) goto bail; table_offsets[j++].is_nondefault_table = true; @@ -14359,14 +14322,12 @@ sfnt_read_fvar_table (int fd, struct sfnt_offset_subtable *subtable) name identifier, or 3 * sizeof (uint16_t) + axisCount * sizeof (sfnt_fixed), meaning there is. */ - if (INT_MULTIPLY_WRAPV (fvar->axis_count, sizeof (sfnt_fixed), - &temp) - || INT_ADD_WRAPV (2 * sizeof (uint16_t), temp, &non_ps_size)) + if (ckd_mul (&temp, fvar->axis_count, sizeof (sfnt_fixed)) + || ckd_add (&non_ps_size, temp, 2 * sizeof (uint16_t))) goto bail; - if (INT_MULTIPLY_WRAPV (fvar->axis_count, sizeof (sfnt_fixed), - &temp) - || INT_ADD_WRAPV (3 * sizeof (uint16_t), temp, &ps_size)) + if (ckd_mul (&temp, fvar->axis_count, sizeof (sfnt_fixed)) + || ckd_add (&ps_size, temp, 3 * sizeof (uint16_t))) goto bail; if (fvar->instance_size != non_ps_size @@ -14376,8 +14337,7 @@ sfnt_read_fvar_table (int fd, struct sfnt_offset_subtable *subtable) /* Now compute the offset of the axis data from the start of the font file. */ - if (INT_ADD_WRAPV (fvar->offset_to_data, directory->offset, - &offset)) + if (ckd_add (&offset, fvar->offset_to_data, directory->offset)) goto bail; /* Seek there. */ @@ -14394,28 +14354,23 @@ sfnt_read_fvar_table (int fd, struct sfnt_offset_subtable *subtable) sfnt_instance) + sizeof (sfnt_fixed) * fvar->instance_count * fvar->axis_count. */ - if (INT_MULTIPLY_WRAPV (fvar->axis_count, sizeof *fvar->axis, - &temp) - || INT_ADD_WRAPV (min_bytes, temp, &min_bytes)) + if (ckd_mul (&temp, fvar->axis_count, sizeof *fvar->axis) + || ckd_add (&min_bytes, min_bytes, temp)) goto bail; pad = alignof (struct sfnt_instance); pad -= min_bytes & (pad - 1); - if (INT_ADD_WRAPV (min_bytes, pad, &min_bytes)) + if (ckd_add (&min_bytes, min_bytes, pad)) goto bail; - if (INT_MULTIPLY_WRAPV (fvar->instance_count, - sizeof *fvar->instance, - &temp) - || INT_ADD_WRAPV (min_bytes, temp, &min_bytes)) + if (ckd_mul (&temp, fvar->instance_count, sizeof *fvar->instance) + || ckd_add (&min_bytes, min_bytes, temp)) goto bail; - if (INT_MULTIPLY_WRAPV (fvar->instance_count, - sizeof *fvar->instance->coords, - &temp) - || INT_MULTIPLY_WRAPV (temp, fvar->axis_count, &temp) - || INT_ADD_WRAPV (min_bytes, temp, &min_bytes)) + if (ckd_mul (&temp, fvar->instance_count, sizeof *fvar->instance->coords) + || ckd_mul (&temp, temp, fvar->axis_count) + || ckd_add (&min_bytes, min_bytes, temp)) goto bail; /* Reallocate fvar. */ @@ -14597,9 +14552,9 @@ sfnt_read_gvar_table (int fd, struct sfnt_offset_subtable *subtable) goto bail; /* Figure out how big gvar needs to be. */ - if (INT_ADD_WRAPV (sizeof *gvar, coordinate_size, &min_bytes) - || INT_ADD_WRAPV (min_bytes, off_size, &min_bytes) - || INT_ADD_WRAPV (min_bytes, data_size, &min_bytes)) + if (ckd_add (&min_bytes, coordinate_size, sizeof *gvar) + || ckd_add (&min_bytes, min_bytes, off_size) + || ckd_add (&min_bytes, min_bytes, data_size)) goto bail; /* Now allocate enough for all of this extra data. */ @@ -14635,8 +14590,7 @@ sfnt_read_gvar_table (int fd, struct sfnt_offset_subtable *subtable) if (gvar->shared_coord_count) { - if (INT_ADD_WRAPV (gvar->offset_to_coord, directory->offset, - &offset)) + if (ckd_add (&offset, gvar->offset_to_coord, directory->offset)) goto bail; if (lseek (fd, offset, SEEK_SET) != offset) @@ -14660,8 +14614,7 @@ sfnt_read_gvar_table (int fd, struct sfnt_offset_subtable *subtable) if (gvar->data_size) { - if (INT_ADD_WRAPV (gvar->offset_to_data, directory->offset, - &offset)) + if (ckd_add (&offset, gvar->offset_to_data, directory->offset)) goto bail; if (lseek (fd, offset, SEEK_SET) != offset) @@ -14757,10 +14710,10 @@ sfnt_read_avar_table (int fd, struct sfnt_offset_subtable *subtable) /* Now add one struct sfnt_short_frac_segment for each axis and each of its correspondences. */ - if (INT_ADD_WRAPV (sizeof (struct sfnt_short_frac_segment), - min_size, &min_size) - || INT_ADD_WRAPV (sizeof (struct sfnt_short_frac_correspondence) - * buffer[k], min_size, &min_size)) + if (ckd_add (&min_size, min_size, sizeof (struct sfnt_short_frac_segment)) + || ckd_add (&min_size, min_size, + (sizeof (struct sfnt_short_frac_correspondence) + * buffer[k]))) goto bail1; /* Verify that words from here to buffer[1 + buffer[k] * 2], the @@ -15109,8 +15062,7 @@ sfnt_read_cvar_table (int fd, struct sfnt_offset_subtable *subtable, goto bail2; tuple += sizeof *coords * fvar->axis_count; - if (INT_ADD_WRAPV (size, sizeof *coords * fvar->axis_count, - &size)) + if (ckd_add (&size, size, sizeof *coords * fvar->axis_count)) goto bail2; } else @@ -15122,20 +15074,20 @@ sfnt_read_cvar_table (int fd, struct sfnt_offset_subtable *subtable, if (index & 0x4000) { tuple += fvar->axis_count * 4; - if (INT_ADD_WRAPV (size, fvar->axis_count * 4, &size)) + if (ckd_add (&size, size, fvar->axis_count * 4)) goto bail2; } /* Add one point and one delta for each CVT element. */ - if (INT_ADD_WRAPV (size, cvt->num_elements * 4, &size)) + if (ckd_add (&size, size, cvt->num_elements * 4)) goto bail2; /* Now add the size of the tuple. */ - if (INT_ADD_WRAPV (size, sizeof *cvar->variation, &size)) + if (ckd_add (&size, size, sizeof *cvar->variation)) goto bail2; } - if (INT_ADD_WRAPV (sizeof *cvar, size, &size)) + if (ckd_add (&size, size, sizeof *cvar)) goto bail2; /* Reallocate cvar. */ diff --git a/src/sfntfont-android.c b/src/sfntfont-android.c index 9ead43a9c5d..94aedd0cd66 100644 --- a/src/sfntfont-android.c +++ b/src/sfntfont-android.c @@ -78,7 +78,7 @@ static size_t max_scanline_buffer_size; { \ size_t _size; \ \ - if (INT_MULTIPLY_WRAPV (height, stride, &_size)) \ + if (ckd_mul (&_size, height, stride)) \ memory_full (SIZE_MAX); \ \ if (_size < MAX_ALLOCA) \ @@ -112,7 +112,7 @@ static size_t max_scanline_buffer_size; size_t _size; \ void *_temp; \ \ - if (INT_MULTIPLY_WRAPV (height, stride, &_size)) \ + if (ckd_mul (&_size, height, stride)) \ memory_full (SIZE_MAX); \ \ if (_size > scanline_buffer.buffer_size) \ diff --git a/src/textconv.c b/src/textconv.c index 2a7b0ed330d..0d35ec19c55 100644 --- a/src/textconv.c +++ b/src/textconv.c @@ -649,8 +649,7 @@ really_commit_text (struct frame *f, EMACS_INT position, start of the text that was inserted. */ wanted = start; - if (INT_ADD_WRAPV (wanted, position, &wanted) - || wanted < BEGV) + if (ckd_add (&wanted, wanted, position) || wanted < BEGV) wanted = BEGV; if (wanted > ZV) @@ -664,8 +663,7 @@ really_commit_text (struct frame *f, EMACS_INT position, TEXT. */ wanted = PT; - if (INT_ADD_WRAPV (wanted, position - 1, &wanted) - || wanted > ZV) + if (ckd_add (&wanted, wanted, position - 1) || wanted > ZV) wanted = ZV; if (wanted < BEGV) @@ -712,8 +710,7 @@ really_commit_text (struct frame *f, EMACS_INT position, if (position <= 0) { - if (INT_ADD_WRAPV (wanted, position, &wanted) - || wanted < BEGV) + if (ckd_add (&wanted, wanted, position) || wanted < BEGV) wanted = BEGV; if (wanted > ZV) @@ -725,8 +722,7 @@ really_commit_text (struct frame *f, EMACS_INT position, { wanted = PT; - if (INT_ADD_WRAPV (wanted, position - 1, &wanted) - || wanted > ZV) + if (ckd_add (&wanted, wanted, position - 1) || wanted > ZV) wanted = ZV; if (wanted < BEGV) @@ -870,8 +866,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t position, { wanted = start; - if (INT_SUBTRACT_WRAPV (wanted, position, &wanted) - || wanted < BEGV) + if (ckd_sub (&wanted, wanted, position) || wanted < BEGV) wanted = BEGV; if (wanted > ZV) @@ -885,8 +880,7 @@ really_set_composing_text (struct frame *f, ptrdiff_t position, /* end should be PT after the edit. */ eassert (end == PT); - if (INT_ADD_WRAPV (wanted, position - 1, &wanted) - || wanted > ZV) + if (ckd_add (&wanted, wanted, position - 1) || wanted > ZV) wanted = ZV; if (wanted < BEGV) @@ -1256,8 +1250,7 @@ really_replace_text (struct frame *f, ptrdiff_t start, ptrdiff_t end, if (position <= 0) { - if (INT_ADD_WRAPV (wanted, position, &wanted) - || wanted < BEGV) + if (ckd_add (&wanted, wanted, position) || wanted < BEGV) wanted = BEGV; if (wanted > ZV) @@ -1269,8 +1262,7 @@ really_replace_text (struct frame *f, ptrdiff_t start, ptrdiff_t end, { wanted = PT; - if (INT_ADD_WRAPV (wanted, position - 1, &wanted) - || wanted > ZV) + if (ckd_add (&wanted, wanted, position - 1) || wanted > ZV) wanted = ZV; if (wanted < BEGV) @@ -2020,8 +2012,8 @@ get_surrounding_text (struct frame *f, ptrdiff_t left, /* And subtract left and right. */ - if (INT_SUBTRACT_WRAPV (start, left, &start) - || INT_ADD_WRAPV (end, right, &end)) + if (ckd_sub (&start, start, left) + || ckd_add (&end, end, right)) goto finish; start = max (start, BEGV); commit a3d7092114db09fee392ccc8187fde03376f2089 Author: Paul Eggert Date: Sun Jan 28 00:15:38 2024 -0800 Rename TAG_PTR to TAG_PTR_INITIALLY * src/lisp.h (TAG_PTR_INITIALLY): Rename from TAG_PTR, since calls can be used only as initializers, and the convention elsewhere in lisp.c is to give these macros names ending in ‘_INITIALLY’. This should help avoid confusion such as we recently experienced in make_lisp_symbol_internal. All uses changed. diff --git a/src/alloc.c b/src/alloc.c index ab31d21fb33..b144396948e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6295,7 +6295,7 @@ android_make_lisp_symbol (struct Lisp_Symbol *sym) &symoffset); { - Lisp_Object a = TAG_PTR (Lisp_Symbol, symoffset); + Lisp_Object a = TAG_PTR_INITIALLY (Lisp_Symbol, symoffset); return a; } } diff --git a/src/lisp.h b/src/lisp.h index db886c65204..75134425a07 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -303,7 +303,7 @@ DEFINE_GDB_SYMBOL_END (VALMASK) #define LISP_WORDS_ARE_POINTERS (EMACS_INT_MAX == INTPTR_MAX) #if LISP_WORDS_ARE_POINTERS -/* TAG_PTR casts to Lisp_Word and can be used in static initializers, +/* TAG_PTR_INITIALLY casts to Lisp_Word and can be used in static initializers so this typedef assumes static initializers can contain casts to pointers. All Emacs targets support this extension to the C standard. */ typedef struct Lisp_X *Lisp_Word; @@ -937,13 +937,13 @@ typedef EMACS_UINT Lisp_Word_tag; /* An initializer for a Lisp_Object that contains TAG along with P. P can be a pointer or an integer. The result is usable in a static initializer if TAG and P are both integer constant expressions. */ -#define TAG_PTR(tag, p) \ +#define TAG_PTR_INITIALLY(tag, p) \ LISP_INITIALLY ((Lisp_Word) ((uintptr_t) (p) + LISP_WORD_TAG (tag))) /* LISPSYM_INITIALLY (Qfoo) is equivalent to Qfoo except it is designed for use as a (possibly static) initializer. */ #define LISPSYM_INITIALLY(name) \ - TAG_PTR (Lisp_Symbol, (intptr_t) ((i##name) * sizeof *lispsym)) + TAG_PTR_INITIALLY (Lisp_Symbol, (intptr_t) ((i##name) * sizeof *lispsym)) /* Declare extern constants for Lisp symbols. These can be helpful when using a debugger like GDB, on older platforms where the debug @@ -1178,11 +1178,7 @@ make_lisp_symbol_internal (struct Lisp_Symbol *sym) Do not use eassert here, so that builtin symbols like Qnil compile to constants; this is needed for some circa-2024 GCCs even with -O2. */ char *symoffset = (char *) ((char *) sym - (char *) lispsym); - /* FIXME: We need this silly `a = ... return` η-redex because otherwise GCC - complains about: - lisp.h:615:28: error: expected expression before ‘{’ token - 615 | # define LISP_INITIALLY(w) {w} */ - Lisp_Object a = TAG_PTR (Lisp_Symbol, symoffset); + Lisp_Object a = TAG_PTR_INITIALLY (Lisp_Symbol, symoffset); return a; } @@ -1383,7 +1379,7 @@ clip_to_bounds (intmax_t lower, intmax_t num, intmax_t upper) INLINE Lisp_Object make_lisp_ptr (void *ptr, enum Lisp_Type type) { - Lisp_Object a = TAG_PTR (type, ptr); + Lisp_Object a = TAG_PTR_INITIALLY (type, ptr); eassert (TAGGEDP (a, type) && XUNTAG (a, type, char) == ptr); return a; } @@ -1456,7 +1452,7 @@ XFIXNUMPTR (Lisp_Object a) INLINE Lisp_Object make_pointer_integer_unsafe (void *p) { - Lisp_Object a = TAG_PTR (Lisp_Int0, p); + Lisp_Object a = TAG_PTR_INITIALLY (Lisp_Int0, p); return a; } @@ -2749,7 +2745,7 @@ extern Lisp_Object make_misc_ptr (void *); INLINE Lisp_Object make_mint_ptr (void *a) { - Lisp_Object val = TAG_PTR (Lisp_Int0, a); + Lisp_Object val = TAG_PTR_INITIALLY (Lisp_Int0, a); return FIXNUMP (val) && XFIXNUMPTR (val) == a ? val : make_misc_ptr (a); } commit fcf69960e89b826841a8c6ccc2af4019b5dc5e31 Author: Paul Eggert Date: Sun Jan 28 00:15:38 2024 -0800 * src/lisp.h: Improve TAG_PTR comments. diff --git a/src/lisp.h b/src/lisp.h index eb78176aed6..db886c65204 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -303,6 +303,9 @@ DEFINE_GDB_SYMBOL_END (VALMASK) #define LISP_WORDS_ARE_POINTERS (EMACS_INT_MAX == INTPTR_MAX) #if LISP_WORDS_ARE_POINTERS +/* TAG_PTR casts to Lisp_Word and can be used in static initializers, + so this typedef assumes static initializers can contain casts to pointers. + All Emacs targets support this extension to the C standard. */ typedef struct Lisp_X *Lisp_Word; #else typedef EMACS_INT Lisp_Word; @@ -931,12 +934,14 @@ typedef EMACS_UINT Lisp_Word_tag; #define LISP_WORD_TAG(tag) \ ((Lisp_Word_tag) (tag) << (USE_LSB_TAG ? 0 : VALBITS)) -/* An initializer for a Lisp_Object that contains TAG along with PTR. */ -#define TAG_PTR(tag, ptr) \ - LISP_INITIALLY ((Lisp_Word) ((uintptr_t) (ptr) + LISP_WORD_TAG (tag))) +/* An initializer for a Lisp_Object that contains TAG along with P. + P can be a pointer or an integer. The result is usable in a static + initializer if TAG and P are both integer constant expressions. */ +#define TAG_PTR(tag, p) \ + LISP_INITIALLY ((Lisp_Word) ((uintptr_t) (p) + LISP_WORD_TAG (tag))) /* LISPSYM_INITIALLY (Qfoo) is equivalent to Qfoo except it is - designed for use as an initializer, even for a constant initializer. */ + designed for use as a (possibly static) initializer. */ #define LISPSYM_INITIALLY(name) \ TAG_PTR (Lisp_Symbol, (intptr_t) ((i##name) * sizeof *lispsym)) commit 99a122b5b816f6c5dd2acc67eeca13eb4d1d8cd5 Author: Paul Eggert Date: Sun Jan 28 00:15:38 2024 -0800 Fix C conformance issue in LISPSYM_INITIALLY * src/lisp.h (LISPSYM_INITIALLY): Remove unnecessary cast to char *. The C standard allows but does not require support for casts to pointers in constant expressions in static initializers. diff --git a/src/lisp.h b/src/lisp.h index c2dfd1afad5..eb78176aed6 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -938,7 +938,7 @@ typedef EMACS_UINT Lisp_Word_tag; /* LISPSYM_INITIALLY (Qfoo) is equivalent to Qfoo except it is designed for use as an initializer, even for a constant initializer. */ #define LISPSYM_INITIALLY(name) \ - TAG_PTR (Lisp_Symbol, (char *) (intptr_t) ((i##name) * sizeof *lispsym)) + TAG_PTR (Lisp_Symbol, (intptr_t) ((i##name) * sizeof *lispsym)) /* Declare extern constants for Lisp symbols. These can be helpful when using a debugger like GDB, on older platforms where the debug commit e1970c99f097715fc5bb3b88154799bfe13de90f Author: Eli Zaretskii Date: Sun Jan 28 10:19:48 2024 +0200 Fix "emacs -nw" on MS-Windows * src/w32term.c (w32_flip_buffers_if_dirty): Do nothing if F is not a GUI frame. This avoids rare crashes in "emacs -nw". * src/w32console.c (initialize_w32_display): Set the ENABLE_EXTENDED_FLAGS bit in 'prev_console_mode'. diff --git a/src/w32console.c b/src/w32console.c index c2b87928cc1..0936b5f37e6 100644 --- a/src/w32console.c +++ b/src/w32console.c @@ -705,6 +705,10 @@ initialize_w32_display (struct terminal *term, int *width, int *height) /* Remember original console settings. */ keyboard_handle = GetStdHandle (STD_INPUT_HANDLE); GetConsoleMode (keyboard_handle, &prev_console_mode); + /* Make sure ENABLE_EXTENDED_FLAGS is set in console settings, + otherwise restoring the original setting of ENABLE_MOUSE_INPUT + will not work. */ + prev_console_mode |= ENABLE_EXTENDED_FLAGS; prev_screen = GetStdHandle (STD_OUTPUT_HANDLE); diff --git a/src/w32term.c b/src/w32term.c index f5611772637..7afd1303b4d 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -776,12 +776,13 @@ w32_buffer_flipping_unblocked_hook (struct frame *f) /* Flip buffers on F if drawing has happened. This function is not called to flush the display connection of a frame (which doesn't - exist on MS Windows), but also called in some situations in + exist on MS Windows), but is called in some situations in minibuf.c to make the contents of the back buffer visible. */ void w32_flip_buffers_if_dirty (struct frame *f) { - if (FRAME_OUTPUT_DATA (f)->paint_buffer + if (FRAME_W32_P (f) /* do nothing in TTY frames */ + && FRAME_OUTPUT_DATA (f)->paint_buffer && FRAME_OUTPUT_DATA (f)->paint_buffer_dirty && !f->garbaged && !buffer_flipping_blocked_p ()) w32_show_back_buffer (f); commit b2db82c5aecd2d6f5f34941cc973177311465683 Author: Jim Porter Date: Wed Aug 2 21:51:18 2023 -0700 * doc/lispref/package.texi (Multi-file Packages): Document ".elpaignore". (cherry picked from commit 744a10a4d722a361bc21561b4162045e4ec97ed6) diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi index 6f52a33d194..ebe578932bf 100644 --- a/doc/lispref/package.texi +++ b/doc/lispref/package.texi @@ -284,6 +284,13 @@ variable @code{load-file-name} (@pxref{Loading}). Here is an example: (expand-file-name file superfrobnicator-base)) @end smallexample + If your project contains files that you don't wish to distribute to +users (e.g.@: regression tests), you can add them to an +@file{.elpaignore} file. In this file, each line lists a file or +wildcard matching files to ignore when producing your package's tar +file on ELPA. (ELPA will pass this file to @command{tar} with the +@code{-X} option.) + @node Package Archives @section Creating and Maintaining Package Archives @cindex package archive commit 3c2baa1b95442c114f717aaf2d017986bc07a270 Author: Eshel Yaron Date: Sat Jan 27 14:01:47 2024 +0100 Avoid signaling errors in emoji.el on empty input * lisp/international/emoji.el (emoji--read-emoji): Signal user-error on empty input. (Bug#68671) Do not merge to master. diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index 8134214bba5..3bb5c36e4c7 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -680,11 +680,12 @@ We prefer the earliest unique letter." strings)))) (complete-with-action action table string pred))) nil t))) - (when (cl-plusp (length name)) - (let ((glyph (if emoji-alternate-names - (cadr (split-string name "\t")) - (gethash name emoji--all-bases)))) - (cons glyph (gethash glyph emoji--derived)))))) + (if (cl-plusp (length name)) + (let ((glyph (if emoji-alternate-names + (cadr (split-string name "\t")) + (gethash name emoji--all-bases)))) + (cons glyph (gethash glyph emoji--derived))) + (user-error "You didn't specify an emoji")))) (defun emoji--choose-emoji () (pcase-let ((`(,glyph . ,derived) (emoji--read-emoji)))