diff --git a/admin/notes/documentation b/admin/notes/documentation index d355ad06412..f6fa321b217 100644 --- a/admin/notes/documentation +++ b/admin/notes/documentation @@ -106,7 +106,7 @@ For instance, this anywhere in sight is too confusing. may not need mentioning, because --daemon will give an error message -saying it is not implemented, and other cases aren't affected. +saying it's not implemented, and other cases aren't affected. The kind of change for which the user really needs help from Antinews is where a feature works _differently_ in the previous version. @@ -164,5 +164,3 @@ like subr.el, which are not quoted. Call 'emacs-news-view-mode'. Lisp symbols and Info manual links shall be decorated, and clicking on them shall lead to the respective Help buffer or Info node. - -*** Do not use "it's", "you're" and alike. diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index d103e7f961f..785322118f9 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1523,10 +1523,11 @@ on the current line if no files are marked. and their version control statuses. It lists files in the current directory (the one specified when you called @kbd{C-x v d}) and its subdirectories, but only those with a noteworthy status. Files -that are up-to-date (i.e., the same as in the repository) are -omitted. If all the files in a subdirectory are up-to-date, the +that are up-to-date (i.e., the same as in the repository) or ignored +are omitted. If all the files in a subdirectory are up-to-date, the subdirectory is not listed either. As an exception, if a file has -become up-to-date as a direct result of a VC command, it is listed. +become up-to-date as a direct result of a VC command, it is listed by +default. Here is an example of a VC Directory buffer listing: @@ -1565,6 +1566,16 @@ systems can show other statuses. For instance, CVS shows the been applied to the work file. RCS and SCCS show the name of the user locking a file as its status. +@vindex vc-dir-auto-hide-up-to-date + As mentioned above, by default files and directories which become +up-to-date or ignored after the VC Directory buffer is first displayed +stay displayed. To automatically remove such files from display, +customize the variable @code{vc-dir-auto-hide-up-to-date} to the value +@code{t}. You can also customize it to the value @code{revert}, in +which case such files will be removed only when you refresh the VC +Directory display, e.g., by typing @kbd{g} (@pxref{VC Directory +Commands}). + @ifnottex On CVS, the @code{vc-dir} command normally contacts the repository, which may be on a remote machine, to check for updates. If you change @@ -1595,7 +1606,7 @@ cases Emacs must occasionally fetch from the remote repository in order to determine the count. If your connection to the remote repository is slow then this may cause unacceptable slowdowns in refreshing the VC Directory buffer. If this affects you, you can customize -@code{vc-dir-show-outgoing-count} to nil to disable the unpushed +@code{vc-dir-show-outgoing-count} to @code{nil} to disable the unpushed revisions count altogether. You can also set this on a per-repository basis using directory local variables (@pxref{Directory Variables}). @@ -1674,9 +1685,6 @@ the VC Directory buffer (@code{vc-dir-root-next-action}). This is like @w{@kbd{C-x v v}} (@pxref{Basic VC Editing}) except that it ignores any marks and the position of point. -@item q -Quit the VC Directory buffer, and bury it (@code{quit-window}). - @item u Unmark the file or directory on the current line. If the region is active, unmark all the files in the region (@code{vc-dir-unmark}). @@ -1691,6 +1699,12 @@ files and directories. Hide files with @samp{up-to-date} or @samp{ignored} status (@code{vc-dir-hide-up-to-date}). With a prefix argument, hide items whose state is that of the item at point. + +@item g +Refresh the VC Directory buffer display (@code{revert-buffer}). + +@item q +Quit the VC Directory buffer, and bury it (@code{quit-window}). @end table @findex vc-dir-mark diff --git a/etc/PROBLEMS b/etc/PROBLEMS index b619c6e7f37..655bfd6c173 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -136,6 +136,9 @@ result in an endless loop. If you need Emacs to be able to recover from closing displays, compile it with the Lucid toolkit instead of GTK. +One possible mitigation for the problem is described in +https://debbugs.gnu.org/81124 + ** Emacs compiled with GTK+ 3 crashes when run under some X servers. This happens when the X server does not provide certain display features that the underlying GTK+ 3 toolkit assumes. For example, this diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index e0da2c88121..cb8e045d6f3 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -902,7 +902,7 @@ quote_argument_len (HSOCKET s, const char *str, ptrdiff_t len) static void quote_argument (HSOCKET s, const char *str) { - return quote_argument_len (s, str, strlen (str)); + quote_argument_len (s, str, strlen (str)); } /* The inverse of quote_argument. Remove quoting in string STR by diff --git a/lisp/emacs-lisp/comp-run.el b/lisp/emacs-lisp/comp-run.el index f329d627392..64e20327906 100644 --- a/lisp/emacs-lisp/comp-run.el +++ b/lisp/emacs-lisp/comp-run.el @@ -203,9 +203,10 @@ LOAD and SELECTOR work as described in `native--compile-async'." ;; because power users often configure their batteries ;; to stop charging at less than 100% as a way to ;; extend the lifetime of their battery hardware. - (string= (cdr (assq ?b res)) "+") - (member (cdr (assq ?B res)) '("charging" "pending-charge")) - (not (string= (cdr (assq ?B res)) "discharging"))))))) + ;; Further discussion in bug#80922. + (and (not (equal (cdr (assq ?b res)) "+")) + (not (member (cdr (assq ?B res)) + '("charging" "pending-charge"))))))))) (defvar comp-files-queue () "List of Emacs Lisp files to be compiled.") diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 1f9d1310782..e317b0f13cd 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -843,8 +843,11 @@ directly." ((string-match "text/" content-type) (setq type 'text)) ((string-match "image/\\(.*\\)" content-type) - (setq type (image-supported-file-p - (concat "." (match-string 1 content-type)))) + (let ((fnext (match-string 1 content-type))) + ;; Ask about SVG support when Content-type is image/svg+xml. + (if (equal fnext "svg+xml") + (setq fnext "svg")) + (setq type (image-supported-file-p (concat "." fnext)))) (when (and type rmail-mime-show-images (not (eq rmail-mime-show-images 'button)) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index b1c5e6e5180..00ce306ba67 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -5005,11 +5005,6 @@ usual. Returns (ALL PAT PREFIX SUFFIX)." (prefix (substring beforepoint 0 (car bounds))) (suffix (substring afterpoint (cdr bounds))) (pat2 (substring pat (car bounds) (+ point (cdr bounds)))) - (completion-regexp-list - (cons (mapconcat (lambda (c) (regexp-quote (char-to-string c))) - pat2 - ".*") - completion-regexp-list)) (all (all-completions prefix table pred)) (all (if (zerop (length pat2)) all diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index c8120d5752c..d08615446a1 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1475,7 +1475,9 @@ in your init files, or customize `treesit-enabled-modes'." :group 'c :after-hook (c-ts-mode-set-modeline) - (when (treesit-ensure-installed 'c) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'c) + (treesit-ready-p 'c)) ;; Create an "for-each" parser, see `c-ts-mode--emacs-set-ranges' ;; for more. (when c-ts-mode-emacs-sources-support @@ -1554,7 +1556,9 @@ recommended to enable `electric-pair-mode' with this mode." :group 'c++ :after-hook (c-ts-mode-set-modeline) - (when (treesit-ensure-installed 'cpp) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'cpp) + (treesit-ready-p 'cpp)) (let ((primary-parser (treesit-parser-create 'cpp))) ;; Syntax. diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index d8873191d61..6abd92b5e1a 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -220,7 +220,9 @@ Return nil if there is no name or if NODE is not a defun node." :group 'cmake :syntax-table cmake-ts-mode--syntax-table - (when (treesit-ensure-installed 'cmake) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'cmake) + (treesit-ready-p 'cmake)) (setq treesit-primary-parser (treesit-parser-create 'cmake)) ;; Comments. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index aaad8622c95..fbcdc6b5124 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -421,6 +421,20 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) nil (1 compilation-error-face)) + ;; This must precede the `gnu' rule or the latter would match instead. + (rust + ,(rx bol (or (group-n 1 "error") (group-n 2 "warning") (group-n 3 "note")) + (? "[" (+ (in "A-Z" "0-9")) "]") ":" (* nonl) + "\n" (+ " ") "-->" + " " (group-n 4 (+ nonl)) ; file + ":" (group-n 5 (+ (in "0-9"))) ; line + ":" (group-n 6 (+ (in "0-9")))) ; column + 4 5 6 (2 . 3) + nil + (1 compilation-error-face) + (2 compilation-warning-face) + (3 compilation-info-face)) + ;; Tested with Lua 5.1, 5.2, 5.3, 5.4, and LuaJIT 2.1. (lua ,(rx bol @@ -582,19 +596,6 @@ during global destruction\\.$\\)" 1 2) "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil nil) - (rust - ,(rx bol (or (group-n 1 "error") (group-n 2 "warning") (group-n 3 "note")) - (? "[" (+ (in "A-Z" "0-9")) "]") ":" (* nonl) - "\n" (+ " ") "-->" - " " (group-n 4 (+ nonl)) ; file - ":" (group-n 5 (+ (in "0-9"))) ; line - ":" (group-n 6 (+ (in "0-9")))) ; column - 4 5 6 (2 . 3) - nil - (1 compilation-error-face) - (2 compilation-warning-face) - (3 compilation-info-face)) - (rxp "^\\(?:Error\\|Warnin\\(g\\)\\):.*\n.* line \\([0-9]+\\) char\ \\([0-9]+\\) of file://\\(.+\\)" diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index 1d42c239b84..b97ec89b99a 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -167,7 +167,9 @@ Return nil if there is no name or if NODE is not a stage node." :group 'dockerfile :syntax-table dockerfile-ts-mode--syntax-table - (when (treesit-ensure-installed 'dockerfile) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'dockerfile) + (treesit-ready-p 'dockerfile)) (setq treesit-primary-parser (treesit-parser-create 'dockerfile)) ;; Comments. diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index 9514d6bdc91..9bda7f0046f 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -737,7 +737,9 @@ Return nil if NODE is not a defun node or doesn't have a name." (add-hook 'post-self-insert-hook #'elixir-ts--electric-pair-string-delimiter 'append t) - (when (treesit-ensure-installed 'elixir) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'elixir) + (treesit-ready-p 'elixir)) (setq-local treesit-primary-parser (treesit-parser-create 'elixir)) @@ -762,7 +764,9 @@ Return nil if NODE is not a defun node or doesn't have a name." (setq-local treesit-defun-name-function #'elixir-ts--defun-name) ;; Embedded Heex. - (when (treesit-ensure-installed 'heex) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'heex) + (treesit-ready-p 'heex)) (require 'heex-ts-mode) (treesit-parser-create 'heex) diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 76de7c9b41b..8de6d0e0700 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -287,7 +287,9 @@ :group 'go :syntax-table go-ts-mode--syntax-table - (when (treesit-ensure-installed 'go) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'go) + (treesit-ready-p 'go)) (setq treesit-primary-parser (treesit-parser-create 'go)) ;; Comments. @@ -608,7 +610,9 @@ what the parent of the node would be if it were a node." :group 'go :syntax-table go-mod-ts-mode--syntax-table - (when (treesit-ensure-installed 'gomod) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'gomod) + (treesit-ready-p 'gomod)) (setq treesit-primary-parser (treesit-parser-create 'gomod)) ;; Comments. @@ -712,7 +716,9 @@ what the parent of the node would be if it were a node." "Major mode for editing go.work files, powered by tree-sitter." :group 'go - (when (treesit-ensure-installed 'gowork) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'gowork) + (treesit-ready-p 'gowork)) (setq treesit-primary-parser (treesit-parser-create 'gowork)) ;; Comments. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 72a05a082bb..a5ba32d26e8 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1120,6 +1120,8 @@ list is empty)." (defvar grep-edit-mode-hook nil "Hooks run when changing to Grep-Edit mode.") +(defvar grep-edit-original-mode-map nil) + (defun grep-edit-mode () "Major mode for editing *grep* buffers. In this mode, changes to the *grep* buffer are applied to the @@ -1140,6 +1142,7 @@ The only editable texts in a Grep-Edit buffer are the match results." (error "Not a Grep buffer")) (when (get-buffer-process (current-buffer)) (error "Cannot switch when grep is running")) + (setq-local grep-edit-original-mode-map (current-local-map)) (use-local-map grep-edit-mode-map) (grep-edit--prepare-buffer) (setq buffer-read-only nil) @@ -1159,7 +1162,7 @@ The only editable texts in a Grep-Edit buffer are the match results." (unless (derived-mode-p 'grep-edit-mode) (error "Not a Grep-Edit buffer")) (remove-hook 'after-change-functions #'occur-after-change-function t) - (use-local-map grep-mode-map) + (use-local-map grep-edit-original-mode-map) (setq buffer-read-only t) (setq major-mode 'grep-mode) (setq mode-name "Grep") diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index d756224f371..e8fec8b0469 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -201,7 +201,9 @@ Return nil if NODE is not a defun node or doesn't have a name." "Major mode for editing HEEx, powered by tree-sitter." :group 'heex-ts - (when (treesit-ensure-installed 'heex) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'heex) + (treesit-ready-p 'heex)) (setq treesit-primary-parser (treesit-parser-create 'heex)) ;; Comments @@ -236,7 +238,9 @@ Return nil if NODE is not a defun node or doesn't have a name." (setq-local treesit-font-lock-feature-list heex-ts--font-lock-feature-list) - (when (treesit-ensure-installed 'elixir) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'elixir) + (treesit-ready-p 'elixir)) (require 'elixir-ts-mode) (treesit-parser-create 'elixir) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e7e5bd901e1..3f2deca317c 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -4041,7 +4041,9 @@ See `treesit-thing-settings' for more information.") \\" :group 'js :syntax-table js-mode-syntax-table - (when (treesit-ensure-installed 'javascript) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'javascript) + (treesit-ready-p 'javascript)) ;; Borrowed from `js-mode'. (setq-local prettify-symbols-alist js--prettify-symbols-alist) (setq-local parse-sexp-ignore-comments t) @@ -4073,7 +4075,9 @@ See `treesit-thing-settings' for more information.") (setq-local treesit-font-lock-settings (js--treesit-font-lock-settings)) (setq-local treesit-font-lock-feature-list js--treesit-font-lock-feature-list) - (when (treesit-ensure-installed 'jsdoc) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'jsdoc) + (treesit-ready-p 'jsdoc)) (setq-local treesit-range-settings (treesit-range-rules :embed 'jsdoc diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 8d726b9b15b..2963d5a96af 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -675,7 +675,9 @@ Calls REPORT-FN directly." :syntax-table lua-ts--syntax-table (use-local-map lua-ts-mode-map) - (when (treesit-ensure-installed 'lua) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'lua) + (treesit-ready-p 'lua)) (setq treesit-primary-parser (treesit-parser-create 'lua)) ;; Comments. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ad0e84bf74f..86336979067 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7477,9 +7477,11 @@ implementations: `python-mode' and `python-ts-mode'." \\{python-ts-mode-map}" :syntax-table python-mode-syntax-table - (when (if (fboundp 'treesit-ensure-installed) ; Emacs 31 - (treesit-ensure-installed 'python) - (treesit-ready-p 'python)) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (if (fboundp 'treesit-ensure-installed) ; Emacs 31 + (treesit-ensure-installed 'python) + t) + (treesit-ready-p 'python)) (setq treesit-primary-parser (treesit-parser-create 'python)) (setq-local treesit-font-lock-feature-list '(( comment definition) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 9bc4324ff66..dee82f934ce 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -557,7 +557,9 @@ See `prettify-symbols-compose-predicate'." :group 'rust :syntax-table rust-ts-mode--syntax-table - (when (treesit-ensure-installed 'rust) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'rust) + (treesit-ready-p 'rust)) (setq treesit-primary-parser (treesit-parser-create 'rust)) ;; Syntax. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8479c3cfd9a..4d025eeb18d 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1583,7 +1583,9 @@ with your script for an edit-interpret-debug cycle." This mode automatically falls back to `sh-mode' if the buffer is not written in Bash or sh." :syntax-table sh-mode-syntax-table - (when (treesit-ensure-installed 'bash) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'bash) + (treesit-ready-p 'bash)) (sh-set-shell "bash" nil nil) (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index c9d1d1eff4d..61e281310aa 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -701,7 +701,9 @@ This mode is intended to be inherited by concrete major modes." :group 'typescript :syntax-table typescript-ts-mode--syntax-table - (when (treesit-ensure-installed 'typescript) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'typescript) + (treesit-ready-p 'typescript)) (setq treesit-primary-parser (treesit-parser-create 'typescript)) ;; Indent. @@ -757,7 +759,9 @@ at least 3 (which is the default value)." :group 'typescript :syntax-table typescript-ts-mode--syntax-table - (when (treesit-ensure-installed 'tsx) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'tsx) + (treesit-ready-p 'tsx)) (setq treesit-primary-parser (treesit-parser-create 'tsx)) ;; Comments. diff --git a/lisp/replace.el b/lisp/replace.el index 48e158de531..4bb91fbd6a0 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -369,6 +369,8 @@ should a regexp." (replace--region-filter (funcall region-extract-function 'bounds))) :highlight (and query-replace-lazy-highlight (not no-highlight)) + :lax-whitespace (if regexp-flag replace-regexp-lax-whitespace + replace-lax-whitespace) :regexp regexp-flag :regexp-function (or replace-regexp-function delimited-flag diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 355555df090..12632e24e0e 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1888,7 +1888,9 @@ can also be used to fill comments. \\{css-mode-map}" :syntax-table css-mode-syntax-table - (when (treesit-ensure-installed 'css) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'css) + (treesit-ready-p 'css)) ;; Borrowed from `css-mode'. (setq-local syntax-propertize-function css-syntax-propertize-function) diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index c1ccdf2ec5f..270cb388971 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -911,6 +911,7 @@ region, instead of just filling the current paragraph." (fill-comment-paragraph justify))) ;; 4. If it all fails, default to the good ol' text paragraph filling. (let ((before (point)) + (paragraph-start-orig paragraph-start) (paragraph-start paragraph-start) ;; Fill prefix used for filling the paragraph. fill-pfx) @@ -933,6 +934,18 @@ region, instead of just filling the current paragraph." (setq fill-pfx "") (let ((end (point)) (beg (progn (fill-forward-paragraph -1) (point)))) + ;; If the paragraph starts with a comment line preceding point + ;; on a non-comment line, skip such comment lines, so they + ;; are not filled together (bug#80449). + (when (and fill-paragraph-handle-comment comment-start-skip + (< beg before)) + (save-excursion + (goto-char beg) + (when (looking-at paragraph-start-orig) + (goto-char (1+ (match-end 0)))) + (when (looking-at comment-start-skip) + (forward-line 1) + (setq beg (point))))) (goto-char before) (setq fill-pfx (if use-hard-newlines diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el index 2a1c62b87e4..d53d74e220a 100644 --- a/lisp/textmodes/mhtml-ts-mode.el +++ b/lisp/textmodes/mhtml-ts-mode.el @@ -511,7 +511,9 @@ Powered by tree-sitter." ;; jsdoc is not mandatory for js-ts-mode, so we respect this by ;; adding jsdoc range rules only when jsdoc is available. - (when (treesit-ensure-installed 'jsdoc) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'jsdoc) + (treesit-ready-p 'jsdoc)) (setq-local c-ts-common--comment-regexp js--treesit-jsdoc-comment-regexp)) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index d3f09526b90..63e3f60edd9 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -138,7 +138,9 @@ Return nil if there is no name or if NODE is not a defun node." :group 'toml-mode :syntax-table toml-ts-mode--syntax-table - (when (treesit-ensure-installed 'toml) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'toml) + (treesit-ready-p 'toml)) (setq treesit-primary-parser (treesit-parser-create 'toml)) ;; Comments diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index c1521c82c22..5afd4d2d111 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -262,7 +262,9 @@ Calls REPORT-FN directly." :group 'yaml :syntax-table yaml-ts-mode--syntax-table - (when (treesit-ensure-installed 'yaml) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'yaml) + (treesit-ready-p 'yaml)) (setq treesit-primary-parser (treesit-parser-create 'yaml)) ;; Comments. diff --git a/lisp/treesit-x.el b/lisp/treesit-x.el index 9d0541b458c..86eb417c7b5 100644 --- a/lisp/treesit-x.el +++ b/lisp/treesit-x.el @@ -142,7 +142,9 @@ of `define-treesit-generic-mode'. ;;;###autoload (defun treesit-generic-mode-setup (lang) "Go into the treesit generic mode MODE." - (when (treesit-ensure-installed lang) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed lang) + (treesit-ready-p lang)) (setq treesit-primary-parser (treesit-parser-create lang)) (when-let* ((query (treesit-generic-mode-font-lock-query lang))) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index ce512c6db33..0be1b326d6c 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -826,9 +826,12 @@ should be shown to the user." ;; Authorization header field. (url-http-handle-authentication nil)) ('payment-required ; 402 - ;; This code is reserved for future use - (url-mark-buffer-as-dead buffer) - (error "Somebody wants you to give them money")) + ;; This code is "reserved for future use", but in the + ;; mean time websites have been seen to use it, for + ;; instance anti-bot challenges requiring the "payment" + ;; of a click of a button to prove the visitor is human, + ;; so we no longer raise an `error' here. + t) ('forbidden ; 403 ;; The server understood the request, but is refusing to ;; fulfill it. Authorization will not help and the request diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 2d6f8ee97d0..c79ac50cfc3 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -161,17 +161,23 @@ proceed to mark and unmark other entries, without asking." :version "31.1") (defcustom vc-dir-auto-hide-up-to-date nil - "If non-nil, VC-Dir automatically hides \\+`up-to-date' and \\+`ignored' items. + "Whether VC-Dir automatically removes \\+`up-to-date'/\\+`ignored' files from display. -If the value of this variable is the symbol `revert', \ -\\\\[revert-buffer] in VC-Dir -buffers also does \\[vc-dir-hide-up-to-date]. \ -That is, refreshing the VC-Dir buffer also hides -\\+`up-to-date' and \\+`ignored' items. +If the value is nil, files shown in the VC-Dir buffer will remain on +display if they become \\+`up-to-date' or \\+`ignored'. +If the value is t, files are automatically removed from display when +they become \\+`up-to-date' or \\+`ignored'. +If the value is the symbol `revert', any displayed files that +are \\+`up-to-date' or \\+`ignored' are removed from display +by \\\\[revert-buffer], but they are not automatically removed +when they become \\+`up-to-date' or \\+`ignored'. That is, +refreshing the VC-Dir buffer hides \\+`up-to-date' and \\+`ignored' +files when the value is the symbol `revert'. +Any other value is treated as t. + +VC-Dir never shows \\+`up-to-date' and \\+`ignored' files when the +directory is first displayed. -If the value of this variable is any other non-nil value, then in -addition, hide items whenever their state would change to -\\+`up-to-date' or \\+`ignored'. You can still use `vc-dir-show-fileentry' to manually add an entry for an \\+`up-to-date' or \\+`ignored' file." :type 'boolean diff --git a/src/minibuf.c b/src/minibuf.c index c716ac0d811..745a71a63fc 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2364,6 +2364,22 @@ STR the i-th character of PAT matched. */) if (patlen == 0 || strlen == 0 || size > FLEX_MAX_MATRIX_SIZE) return Qnil; + /* Also bail if PAT is not a subsequence of STR so bail "cheaply" + before the O(N*M) DP algorithm. Walking both strings + byte-by-byte for this purpose (and only for case-sensitive common + case) should be valid even for multibyte strings. */ + if (!completion_ignore_case) + { + const unsigned char *p = SDATA (pat); + const unsigned char *s = SDATA (str); + int pi = 0; + for (int si = 0; si < strlen && pi < patlen; si++) + if (s[si] == p[pi]) + pi++; + if (pi < patlen) + return Qnil; + } + /* Initialize M and D with positive infinity... */ for (int j = 0; j < size; j++) M[j] = D[j] = pos_inf; diff --git a/test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts b/test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts new file mode 100644 index 00000000000..c7c9e96ea50 --- /dev/null +++ b/test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts @@ -0,0 +1,37 @@ +Point-Char: | + +Name: fill-paragraph-handle-comment - non-comment line before comment line +Code: + (lambda () + (setq-local comment-start "# ") + (setq-local fill-paragraph-handle-comment t) + (setq-local fill-column 42) + (fill-paragraph)) + +=-= + +this is not part of the comment this is not part of the comment| +# this is a comment this is a comment this is a comment + +=-= + +this is not part of the comment this is +not part of the comment +# this is a comment this is a comment this is a comment + +=-=-= + +Name: fill-paragraph-handle-comment - non-comment line after comment line + +=-= + +# this is a comment this is a comment this is a comment +this is not part of the comment this is not part of the comment| + +=-= + +# this is a comment this is a comment this is a comment +this is not part of the comment this is +not part of the comment + +=-=-= diff --git a/test/lisp/textmodes/fill-tests.el b/test/lisp/textmodes/fill-tests.el index 2bb9d3ea163..c37a879b4b2 100644 --- a/test/lisp/textmodes/fill-tests.el +++ b/test/lisp/textmodes/fill-tests.el @@ -163,6 +163,10 @@ eius. Foo"))) (skip-unless (functionp 'markdown-mode)) (ert-test-erts-file (ert-resource-file "fill-paragraph-semlf-markdown-mode.erts"))) +(ert-deftest fill-test-fill-paragraph-handle-comment () + "Test the `fill-paragraph-handle-comment' variable." + (ert-test-erts-file (ert-resource-file "fill-paragraph-handle-comment.erts"))) + (provide 'fill-tests) ;;; fill-tests.el ends here diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 3048cada03d..9b964e41995 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -89,6 +89,7 @@ process to complete." (should (string= (buffer-string) "arg1=\"x &y\", arg2=\n")))))) (ert-deftest process-test-stderr-buffer () + :tags (if (getenv "EMACS_EMBA_CI") '(:unstable)) (skip-unless (executable-find "bash")) (with-timeout (60 (ert-fail "Test timed out")) (let* ((stdout-buffer (generate-new-buffer "*stdout*"))