commit eaf5bf736e1dd5eb977a16a3f1b3dfd3da3c4612 (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Mon Dec 16 03:26:48 2024 +0100 Invert preprocessor condition to fix 'C-x 4 a' Typing 'C-x 4 a' in the main function now correctly adds 'main' to the generated ChangeLog, whereas before it added 'andreid_emacs_init'. Inverting the preprocessor condition seems like an easier fix than changing the add-change-log-entry-other-window heuristic. * src/emacs.c (main): Invert preprocessor condition to appease the 'add-change-log-entry-other-window' heuristic. diff --git a/src/emacs.c b/src/emacs.c index bdd9eee10c4..25b014bf83c 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1263,12 +1263,12 @@ maybe_load_seccomp (int argc, char **argv) #endif /* SECCOMP_USABLE */ -#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY +#if !defined HAVE_ANDROID || defined ANDROID_STUBIFY int -android_emacs_init (int argc, char **argv, char *dump_file) +main (int argc, char **argv) #else int -main (int argc, char **argv) +android_emacs_init (int argc, char **argv, char *dump_file) #endif { /* Variable near the bottom of the stack, and aligned appropriately commit 29058579e9f27872d47e9d5146dfd9ce79697a0d Author: Stefan Kangas Date: Mon Dec 16 00:18:18 2024 +0100 Prefer defvar-keymap in info.el * lisp/info.el (Info-mode-line-node-keymap, Info-link-keymap): Convert to defvar-keymap. diff --git a/lisp/info.el b/lisp/info.el index 9025fd13363..e590a2b7e87 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1817,12 +1817,10 @@ escaped (\\\",\\\\)." (Info-hide-cookies-node) (run-hooks 'Info-selection-hook))))) -(defvar Info-mode-line-node-keymap - (let ((map (make-sparse-keymap))) - (define-key map [mode-line mouse-1] 'Info-mouse-scroll-up) - (define-key map [mode-line mouse-3] 'Info-mouse-scroll-down) - map) - "Keymap to put on the Info node name in the mode line.") +(defvar-keymap Info-mode-line-node-keymap + :doc "Keymap to put on the Info node name in the mode line." + " " #'Info-mouse-scroll-up + " " #'Info-mouse-scroll-down) (defun Info-set-mode-line () (setq mode-line-buffer-identification @@ -4833,17 +4831,15 @@ the variable `Info-file-list-for-emacs'." "\\`%s' invokes an anonymous command defined with `lambda'" (key-description key)))))))) -(defvar Info-link-keymap - (let ((keymap (make-sparse-keymap))) - (define-key keymap [header-line down-mouse-1] 'mouse-drag-header-line) - (define-key keymap [header-line mouse-1] 'Info-mouse-follow-link) - (define-key keymap [header-line mouse-2] 'Info-mouse-follow-link) - (define-key keymap [mouse-2] 'Info-mouse-follow-link) - (define-key keymap [follow-link] 'mouse-face) - keymap) - "Keymap to put on Info links. +(defvar-keymap Info-link-keymap + :doc "Keymap to put on Info links. This is used for the \"Next\", \"Prev\", and \"Up\" links in the -first line or header line, and for breadcrumb links.") +first line or header line, and for breadcrumb links." + " " #'mouse-drag-header-line + " " #'Info-mouse-follow-link + " " #'Info-mouse-follow-link + "" #'Info-mouse-follow-link + "" 'mouse-face) (defun Info-breadcrumbs () (let ((nodes (Info-toc-nodes Info-current-file)) commit bef0d80be88906b66dec06970d7782f0f7b219c0 Author: Stefan Kangas Date: Mon Dec 16 00:01:43 2024 +0100 Move pure+side-effect-free declarations to byte-opt.el * src/json.c (syms_of_json): Move pure and side-effect-free declarations for json-serialize and json-parse-string from here... * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns): ...to here. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 0a89a33cbc3..d63051e8bca 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1789,6 +1789,8 @@ See Info node `(elisp) Integer Basics'." tool-bar-pixel-width window-system ;; fringe.c fringe-bitmaps-at-pos + ;; json.c + json-serialize json-parse-string ;; keyboard.c posn-at-point posn-at-x-y ;; keymap.c @@ -1979,6 +1981,8 @@ See Info node `(elisp) Integer Basics'." length> member memq memql nth nthcdr proper-list-p rassoc rassq safe-length string-bytes string-distance string-equal string-lessp string-search string-version-lessp take value< + ;; json.c + json-serialize json-parse-string ;; search.c regexp-quote ;; syntax.c diff --git a/src/json.c b/src/json.c index 282dca6e8ff..3368c52ef2a 100644 --- a/src/json.c +++ b/src/json.c @@ -1818,16 +1818,6 @@ syms_of_json (void) define_error (Qjson_escape_sequence_error, "invalid escape sequence", Qjson_parse_error); - DEFSYM (Qpure, "pure"); - DEFSYM (Qside_effect_free, "side-effect-free"); - - DEFSYM (Qjson_serialize, "json-serialize"); - DEFSYM (Qjson_parse_string, "json-parse-string"); - Fput (Qjson_serialize, Qpure, Qt); - Fput (Qjson_serialize, Qside_effect_free, Qt); - Fput (Qjson_parse_string, Qpure, Qt); - Fput (Qjson_parse_string, Qside_effect_free, Qt); - DEFSYM (QCobject_type, ":object-type"); DEFSYM (QCarray_type, ":array-type"); DEFSYM (QCnull_object, ":null-object"); commit 465544eb556777f16415c10e7607f7b72ec5a2b5 Author: Daniel Mendler Date: Sun Dec 15 10:57:59 2024 +0100 completion-eager-display: Use buffer content instead of INITIAL-INPUT * lisp/minibuffer.el (completing-read-default): Use the minibuffer content instead of handling INITIAL-INPUT directly. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index dfc62c25f38..91495f9f941 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -4857,8 +4857,10 @@ See `completing-read' for the meaning of the arguments." ;; `completion-eager-display' is t or if eager display ;; has been requested by the completion table. (when completion-eager-display - (let* ((md (completion-metadata (or initial-input "") - collection predicate)) + (let* ((md (completion-metadata + (buffer-substring-no-properties + (minibuffer-prompt-end) (point)) + collection predicate)) (fun (completion-metadata-get md 'eager-display))) (when (or fun (eq completion-eager-display t)) (funcall (if (functionp fun) commit 7930fe2f44f50b6a7abf5fbe1218dcc15e85b28d Author: Vitaliy Chepelev Date: Tue Sep 24 04:25:13 2024 +0000 image-dired: Don't croak on file names with regexp characters * lisp/image/image-dired-dired.el (image-dired-mark-tagged-files): * lisp/image/image-dired-tags.el (image-dired-get-comment) (image-dired-write-comments, image-dired-list-tags) (image-dired-remove-tag, image-dired-write-tags): Quote file name for search-forward-regexp. (Bug#73445) Copyright-paperwork-exempt: yes diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el index 7219a106ca8..c4e82e906d1 100644 --- a/lisp/image/image-dired-dired.el +++ b/lisp/image/image-dired-dired.el @@ -383,7 +383,7 @@ matching tag will be marked in the Dired buffer." (file-name-directory curr-file))) (setq curr-file (file-name-nondirectory curr-file)) (goto-char (point-min)) - (when (search-forward-regexp (format "\\s %s[*@]?$" curr-file) nil t) + (when (search-forward-regexp (format "\\s %s[*@]?$" (regexp-quote curr-file)) nil t) (setq hits (+ hits 1)) (dired-mark 1)))) (message "%d files with matching tag marked" hits))) diff --git a/lisp/image/image-dired-tags.el b/lisp/image/image-dired-tags.el index 54595adc147..828372e008a 100644 --- a/lisp/image/image-dired-tags.el +++ b/lisp/image/image-dired-tags.el @@ -79,7 +79,7 @@ FILE-TAGS is an alist in the following form: (setq file (car elt) tag (cdr elt)) (goto-char (point-min)) - (if (search-forward-regexp (format "^%s.*$" file) nil t) + (if (search-forward-regexp (format "^%s.*$" (regexp-quote file)) nil t) (progn (setq end (point)) (beginning-of-line) @@ -103,7 +103,7 @@ FILES can be a name of a single file (a string) or a list of file names." (error "Files must be a string or a list of strings!"))) (dolist (file files) (goto-char (point-min)) - (when (search-forward-regexp (format "^%s;" file) nil t) + (when (search-forward-regexp (format "^%s;" (regexp-quote file)) nil t) (end-of-line) (setq end (point)) (beginning-of-line) @@ -125,7 +125,7 @@ Value is a list of all tags for FILE." (image-dired-sane-db-file) (image-dired--with-db-file (let (end (tags "")) - (when (search-forward-regexp (format "^%s" file) nil t) + (when (search-forward-regexp (format "^%s" (regexp-quote file)) nil t) (end-of-line) (setq end (point)) (beginning-of-line) @@ -179,7 +179,7 @@ FILE-COMMENTS is an alist on the following form: (setq file (car elt) comment (cdr elt)) (goto-char (point-min)) - (if (search-forward-regexp (format "^%s.*$" file) nil t) + (if (search-forward-regexp (format "^%s.*$" (regexp-quote file)) nil t) (progn (setq end (point)) (beginning-of-line) @@ -236,7 +236,7 @@ Optionally use old comment from FILE as initial value." (image-dired-sane-db-file) (image-dired--with-db-file (let (end comment-beg-pos comment-end-pos comment) - (when (search-forward-regexp (format "^%s" file) nil t) + (when (search-forward-regexp (format "^%s" (regexp-quote file)) nil t) (end-of-line) (setq end (point)) (beginning-of-line) commit 32060cef1cb58e53896f4fea82d2d30d35501d93 Author: Stefan Kangas Date: Sun Dec 15 19:15:55 2024 +0100 ; * lisp/widget.el: Delete commented out code. diff --git a/lisp/widget.el b/lisp/widget.el index 11954378af1..8f5ee116f24 100644 --- a/lisp/widget.el +++ b/lisp/widget.el @@ -1,6 +1,6 @@ ;;; widget.el --- a library of user interface components -*- lexical-binding: t; -*- ;; -;; Copyright (C) 1996-1997, 2001-2024 Free Software Foundation, Inc. +;; Copyright (C) 1996-2024 Free Software Foundation, Inc. ;; ;; Author: Per Abrahamsen ;; Keywords: help, extensions, faces, hypermedia @@ -32,43 +32,10 @@ ;;; Code: -;; Doing this is unnecessary in Emacs 20. Kept as dummy in case -;; external libraries call it. We save a kb or two of purespace by -;; dummying-out such definitions generally. (defmacro define-widget-keywords (&rest _keys) - ;; ;; Don't use backquote, since that makes trouble trying to - ;; ;; re-bootstrap from just the .el files. - ;; (list 'eval-and-compile - ;; (list 'let (list (list 'keywords (list 'quote keys))) - ;; (list 'while 'keywords - ;; (list 'or (list 'boundp (list 'car 'keywords)) - ;; (list 'set (list 'car 'keywords) (list 'car 'keywords))) - ;; (list 'setq 'keywords (list 'cdr 'keywords))))) (declare (obsolete nil "27.1") (indent defun)) nil) -;;(define-widget-keywords :documentation-indent -;; :complete-function :complete :button-overlay -;; :field-overlay -;; :documentation-shown :button-prefix -;; :button-suffix :mouse-down-action :glyph-up :glyph-down :glyph-inactive -;; :prompt-internal :prompt-history :prompt-match -;; :prompt-value :deactivate :active -;; :inactive :activate :sibling-args :delete-button-args -;; :insert-button-args :append-button-args :button-args -;; :tag-glyph :off-glyph :on-glyph :valid-regexp -;; :secret :sample-face :sample-face-get :case-fold -;; :create :convert-widget :format :value-create :offset :extra-offset -;; :tag :doc :from :to :args :value :action -;; :value-set :value-delete :match :parent :delete :menu-tag-get -;; :value-get :choice :void :menu-tag :on :off :on-type :off-type -;; :notify :entry-format :button :children :buttons :insert-before -;; :delete-at :format-handler :widget :value-pos :value-to-internal -;; :indent :size :value-to-external :validate :error :directory -;; :must-match :type-error :value-inline :inline :match-inline :greedy -;; :button-face-get :button-face :value-face :keymap :entry-from -;; :entry-to :help-echo :documentation-property :tab-order) - (defun define-widget (name class doc &rest args) "Define a new widget type named NAME from CLASS. @@ -84,7 +51,6 @@ create identical widgets: The third argument DOC is a documentation string for the widget." (declare (doc-string 3) (indent defun)) - ;; (unless (or (null doc) (stringp doc)) (error "Widget documentation must be nil or a string")) (put name 'widget-type (cons class args)) commit 3c247f86b7639995c8ce2627049bcc91452d2cca Author: kobarity Date: Sun Dec 15 23:02:51 2024 +0900 Fix hangs caused by unbalanced braces in Python f-strings * lisp/progmodes/python.el (python--font-lock-f-strings): Temporarily bind forward-sexp-function to nil when calling 'up-list'. (Bug#74738) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5729b12573f..493eab5e611 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -623,7 +623,8 @@ the {...} holes that appear within f-strings." (forward-char 1) ;Just skip over {{ (let ((beg (match-beginning 0)) (end (condition-case nil - (let ((parse-sexp-ignore-comments)) + (let ((forward-sexp-function) + (parse-sexp-ignore-comments)) (up-list 1) (min send (point))) (scan-error send)))) commit 75e3ea042393581c2082dc5c89628c544f2de948 Merge: 4d602beea14 7dcc0598716 Author: Eli Zaretskii Date: Sun Dec 15 07:46:22 2024 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 4d602beea14695e859d8a62f81d5e37ecb609842 Merge: 77f73abd92f 567566ca081 Author: Eli Zaretskii Date: Sat Dec 14 16:41:22 2024 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 77f73abd92f1a627ddec0648dcfe14e56b525f4d Author: Richard Lawrence Date: Fri Dec 13 10:41:02 2024 +0100 Check for presuppositions in `calendar-date-is-valid-p' Do not signal an error in `calendar-date-is-valid-p' if passed a value which is not a three-element list of integers. Signaling an error makes the function unusable as a predicate for valid date values. (Bug#74848) * lisp/calendar/calendar.el (calendar-date-is-valid-p): Add the check that input is a 3-element list. * test/lisp/calendar/calendar-tests.el: New file with tests. diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 345687d1775..7c883617aca 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -2459,19 +2459,22 @@ Returns the corresponding Gregorian date." (defun calendar-date-is-valid-p (date) "Return t if DATE is a valid date." - (let ((month (calendar-extract-month date)) - (day (calendar-extract-day date)) - (year (calendar-extract-year date))) - (and (<= 1 month) (<= month 12) - ;; (calendar-read-date t) used to return a date with day = nil. - ;; Should not be valid (?), since many funcs prob assume integer. - ;; (calendar-read-date 'noday) returns (month year), which - ;; currently results in calendar-extract-year returning nil. - day year (<= 1 day) (<= day (calendar-last-day-of-month month year)) - ;; BC dates left as non-valid, to suppress errors from - ;; complex holiday algorithms not suitable for years BC. - ;; Note there are side effects on calendar navigation. - (<= 1 year)))) + (when (and (listp date) + (length= date 3)) + (let ((month (calendar-extract-month date)) + (day (calendar-extract-day date)) + (year (calendar-extract-year date))) + (and (integerp month) (integerp day) (integerp year) + (<= 1 month) (<= month 12) + ;; (calendar-read-date t) used to return a date with day = nil. + ;; Should not be valid (?), since many funcs prob assume integer. + ;; (calendar-read-date 'noday) returns (month year), which + ;; currently results in calendar-extract-year returning nil. + day year (<= 1 day) (<= day (calendar-last-day-of-month month year)) + ;; BC dates left as non-valid, to suppress errors from + ;; complex holiday algorithms not suitable for years BC. + ;; Note there are side effects on calendar navigation. + (<= 1 year))))) (defun calendar-date-equal (date1 date2) "Return t if the DATE1 and DATE2 are the same." diff --git a/test/lisp/calendar/calendar-tests.el b/test/lisp/calendar/calendar-tests.el new file mode 100644 index 00000000000..c41f14d3b54 --- /dev/null +++ b/test/lisp/calendar/calendar-tests.el @@ -0,0 +1,34 @@ +;;; calendar-tests.el --- tests for calendar/calendar.el -*- lexical-binding:t -*- + +;; Copyright (C) 2024 Free Software Foundation, Inc. + +;; Author: Richard Lawrence + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'calendar) + +(ert-deftest calendar-test-validity-predicate () + (should (eq (calendar-date-is-valid-p nil) nil)) + (should (eq (calendar-date-is-valid-p "invalid") nil)) + (should (eq (calendar-date-is-valid-p (list 1 2)) nil)) + (should (eq (calendar-date-is-valid-p (list 5 1 2025)) t))) + +(provide 'calendar-tests) +;;; calendar-tests.el ends here