commit 80dcd78ff1fce3241043edf1951289eef0bf50c9 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sun Nov 27 10:06:02 2022 +0200 ; Fix recent documentation changes in treesit.el * lisp/treesit.el (treesit-font-lock-level) (treesit-font-lock-recompute-features): Doc fixes. diff --git a/lisp/treesit.el b/lisp/treesit.el index ab00b0e8a7..bae44f6b0a 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -521,21 +521,22 @@ 'treesit-font-lock-error 'treesit-error) (defvar-local treesit-font-lock-level 3 - "The decoration level used by tree-sitter fontification. + "Decoration level to be used by tree-sitter fontifications. + Major modes categorize their fontification features into levels, -from 1 being the absolute minimal, to 4 being maximally -fontified. +from 1 which is the absolute minimum, to 4 that yields the maximum +fontifications. Level 1 usually contains only comments and definitions. Level 2 usually adds keywords, strings, constants, types, etc. Level 3 usually represents a full-blown fontification, including assignment, constants, numbers, properties, etc. -Level 4 fontifies everything that can be fontified: delimiters, +Level 4 adds everything else that can be fontified: delimiters, operators, brackets, all functions and variables, etc. In addition to the decoration level, individual features can be -turned on/off by `treesit-font-lock-recompute-features'. Changes -to this variable also requires calling +turned on/off by calling `treesit-font-lock-recompute-features'. +Changing the decoration level requires calling `treesit-font-lock-recompute-features' to have an effect.") (defvar-local treesit--font-lock-query-expand-range (cons 0 0) @@ -735,12 +736,12 @@ treesit-font-lock-recompute-features If both ADD-LIST and REMOVE-LIST are omitted, recompute each feature according to `treesit-font-lock-feature-list' and -`treesit-font-lock-level'. Let N be the value of -`treesit-font-lock-level', features in the first N sublists of -`treesit-font-lock-feature-list' are enabled, and other features -are disabled. +`treesit-font-lock-level'. If the value of `treesit-font-lock-level', +is N, then the features in the first N sublists of +`treesit-font-lock-feature-list' are enabled, and the rest of +the features are disabled. -ADD-LIST and REMOVE-LIST are each a list of feature symbols. The +ADD-LIST and REMOVE-LIST are lists of feature symbols. The same feature symbol cannot appear in both lists; the function signals the `treesit-font-lock-error' error if that happens." (when-let ((intersection (cl-intersection add-list remove-list))) commit c3240ca540baa21d017512e8b2fcbdcbade08864 Author: Eli Zaretskii Date: Sun Nov 27 09:58:02 2022 +0200 ; * lisp/progmodes/sh-script.el (sh--redirect-bash-ts-mode): Doc fix. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index fee86dde7b..408ebfc045 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1628,7 +1628,7 @@ bash-ts-mode (defvar sh--redirect-recursing nil) (defun sh--redirect-bash-ts-mode (oldfn) - "Redirect to `sh-mode' if the current file is not written in Bash. + "Redirect to `sh-mode' if the current file is not written in Bash or sh. OLDFN should be `bash-ts-mode'." (let ((sh--redirect-recursing sh--redirect-recursing)) (funcall (if (or delay-mode-hooks sh--redirect-recursing) commit 40ff40198d817b1385694499a4dce9adb313ea6f Author: Theodor Thornhill Date: Sat Nov 26 21:12:51 2022 +0100 Add js-ts-mode to eglot-server-programs * lisp/progmodes/eglot.el (eglot-server-programs): Add js-ts-mode as an alternative. (Bug#59252) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 120d4feb95..7755353396 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -190,7 +190,7 @@ eglot-server-programs ((js-json-mode json-mode json-ts-mode) . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") ("json-languageserver" "--stdio")))) - ((js-mode typescript-ts-mode typescript-mode) + ((js-mode js-ts-mode typescript-ts-mode typescript-mode) . ("typescript-language-server" "--stdio")) ((bash-ts-mode sh-mode) . ("bash-language-server" "start")) ((php-mode phps-mode) commit 4a28f551490407ff2c9f5fd4ff0b86d311e2eb9c Author: Stefan Kangas Date: Sun Nov 27 07:29:54 2022 +0100 Improve describe-text-properties display * lisp/descr-text.el (describe-property-list): Don't propertize white space with the 'help-argument-name' face. This improves display slightly when that face has an underline. diff --git a/lisp/descr-text.el b/lisp/descr-text.el index 7fad031add..f2ffddcf70 100644 --- a/lisp/descr-text.el +++ b/lisp/descr-text.el @@ -77,8 +77,9 @@ describe-property-list (prin1-to-string (nth 0 b) t))))) (let ((key (nth 0 elt)) (value (nth 1 elt))) - (insert (propertize (format " %-20s " key) - 'face 'help-argument-name)) + (insert (format " %-20s " + (propertize (symbol-name key) + 'face 'help-argument-name))) (cond ((eq key 'category) (insert-text-button (symbol-name value) commit a3d8da24762bc7ecc5bad9275ecc0a6d5f3ac7c3 Author: Yuan Fu Date: Sat Nov 26 15:32:57 2022 -0800 Make typescript-ts-mode not fallback to js-mode 1. js-mode might not be able to handle typescript file 2. Now that we use separate modes for tree-sitter modes, not falling back makes tree-sitter modes more consistent * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Remove the fallback code. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index c7b332c614..8a9d540bd3 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -289,11 +289,7 @@ typescript-ts-mode :group 'typescript :syntax-table typescript-ts-mode--syntax-table - (cond - ;; `typescript-ts-mode' requires tree-sitter to work, so we don't check if - ;; user enables tree-sitter for it. - ((treesit-ready-p 'tsx) - ;; Tree-sitter. + (when (treesit-ready-p 'tsx) (treesit-parser-create 'tsx) ;; Comments. @@ -330,12 +326,8 @@ typescript-ts-mode ;; Which-func (use imenu). (setq-local which-func-functions nil) - (treesit-major-mode-setup)) + (treesit-major-mode-setup))) - ;; Elisp. - (t - (js-mode) - (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'")))) (provide 'typescript-ts-mode) commit 3fe5fc3dc164fbc12c7716d6b5430f2b85833290 Author: Yuan Fu Date: Sat Nov 26 15:31:48 2022 -0800 Make bash-ts-mode fall back to sh-mode if the file isn't in Bash * lisp/progmodes/sh-script.el (sh--guess-shell): Take out into a new function. (sh-base-mode): Use the new function. (bash-ts-mode): Update docstring. (sh--redirect-recursing): New variable. (sh--redirect-bash-ts-mode): New function. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index e11fb42fc8..fee86dde7b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1468,6 +1468,25 @@ sh-after-hack-local-variables (defvar sh-mode--treesit-settings) +(defun sh--guess-shell () + "Guess the shell used in the current buffer. +Return the name of the shell suitable for `sh-set-shell'." + (cond ((save-excursion + (goto-char (point-min)) + (looking-at auto-mode-interpreter-regexp)) + (match-string 2)) + ((not buffer-file-name) sh-shell-file) + ;; Checks that use `buffer-file-name' follow. + ((string-match "\\.m?spec\\'" buffer-file-name) "rpm") + ((string-match "[.]sh\\>" buffer-file-name) "sh") + ((string-match "[.]bash\\(rc\\)?\\>" buffer-file-name) "bash") + ((string-match "[.]ksh\\>" buffer-file-name) "ksh") + ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh") + ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh") + ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh") + ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh") + (t sh-shell-file))) + ;;;###autoload (define-derived-mode sh-base-mode prog-mode "Shell-script" "Generic major mode for editing shell scripts. @@ -1519,23 +1538,7 @@ sh-base-mode "\\"))) ;; Parse or insert magic number for exec, and set all variables depending ;; on the shell thus determined. - (sh-set-shell - (cond ((save-excursion - (goto-char (point-min)) - (looking-at auto-mode-interpreter-regexp)) - (match-string 2)) - ((not buffer-file-name) sh-shell-file) - ;; Checks that use `buffer-file-name' follow. - ((string-match "\\.m?spec\\'" buffer-file-name) "rpm") - ((string-match "[.]sh\\>" buffer-file-name) "sh") - ((string-match "[.]bash\\(rc\\)?\\>" buffer-file-name) "bash") - ((string-match "[.]ksh\\>" buffer-file-name) "ksh") - ((string-match "[.]mkshrc\\>" buffer-file-name) "mksh") - ((string-match "[.]t?csh\\(rc\\)?\\>" buffer-file-name) "csh") - ((string-match "[.]zsh\\(rc\\|env\\)?\\>" buffer-file-name) "zsh") - ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh") - (t sh-shell-file)) - nil nil) + (sh-set-shell (sh--guess-shell) nil nil) (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook #'sh-after-hack-local-variables nil t)) @@ -1605,7 +1608,9 @@ 'shell-script-mode ;;;###autoload (define-derived-mode bash-ts-mode sh-base-mode "Bash" - "Major mode for editing Bash shell scripts." + "Major mode for editing Bash shell scripts. +This mode automatically falls back to `sh-mode' if the buffer is +not written in Bash or sh." (when (treesit-ready-p 'bash) (setq-local treesit-font-lock-feature-list '(( comment function) @@ -1616,6 +1621,23 @@ bash-ts-mode sh-mode--treesit-settings) (treesit-major-mode-setup))) +(advice-add 'bash-ts-mode :around #'sh--redirect-bash-ts-mode + ;; Give it lower precedence than normal advice, so other + ;; advices take precedence over it. + '((depth . 50))) + +(defvar sh--redirect-recursing nil) +(defun sh--redirect-bash-ts-mode (oldfn) + "Redirect to `sh-mode' if the current file is not written in Bash. +OLDFN should be `bash-ts-mode'." + (let ((sh--redirect-recursing sh--redirect-recursing)) + (funcall (if (or delay-mode-hooks sh--redirect-recursing) + oldfn + (setq sh--redirect-recursing t) + (if (member (file-name-base (sh--guess-shell)) '("bash" "sh")) + oldfn + #'sh-mode))))) + (defun sh-font-lock-keywords (&optional keywords) "Function to get simple fontification based on `sh-font-lock-keywords'. This adds rules for comments and assignments." commit bd10c3cfa29af24295f067b08a0c9d6a4fd02736 Author: Jostein Kjønigsen Date: Fri Nov 25 20:15:06 2022 +0100 Correctly fontify types in typeof() expression in csharp-ts-mode * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): Add new pattern. diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index d794bc854f..a684e5d09d 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -812,7 +812,8 @@ csharp-ts-mode--font-lock-settings (cast_expression (identifier) @font-lock-type-face) ["operator"] @font-lock-type-face (type_parameter_constraints_clause - target: (identifier) @font-lock-type-face)) + target: (identifier) @font-lock-type-face) + (type_of_expression (identifier) @font-lock-type-face)) :language 'c-sharp :feature 'definition :override t commit 93c82209374581ae0d52681d56a7dc28e8279f98 Author: Yuan Fu Date: Sat Nov 26 15:05:57 2022 -0800 Reorganize treesit-font-lock-feaure-list's to the new level scheme * lisp/progmodes/c-ts-mode.el (c-ts-mode--base-mode) * lisp/progmodes/csharp-mode.el (csharp-ts-mode) * lisp/progmodes/java-ts-mode.el (java-ts-mode) * lisp/progmodes/js.el (js-ts-mode) * lisp/progmodes/python.el (python-ts-mode) * lisp/progmodes/sh-script.el (bash-ts-mode) * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Reorganized treesit-font-lock-feature-list. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index fc35d9aedd..086257483e 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -528,10 +528,10 @@ c-ts-mode--base-mode (setq-local which-func-functions nil) (setq-local treesit-font-lock-feature-list - '(( comment constant keyword literal preprocessor string) - ( assignment definition label property type) - ( delimiter error escape-sequence function - operator variable bracket)))) + '(( comment definition) + ( keyword preprocessor string type) + ( assignment constant escape-sequence label literal property ) + ( bracket delimiter error function operator variable)))) ;;;###autoload (define-derived-mode c-ts-mode c-ts-mode--base-mode "C" diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index a544a4b5cb..d794bc854f 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -974,9 +974,10 @@ csharp-ts-mode ;; Font-lock. (setq-local treesit-font-lock-settings csharp-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((comment keyword constant string) - (type definition expression literal attribute) - (bracket delimiter))) + '(( comment definition) + ( keyword string type) + ( attribute constant expression literal) + ( bracket delimiter))) ;; Imenu. (setq-local imenu-create-index-function #'csharp-ts-mode--imenu) diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index ee2934f53c..dd3d6d31e0 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -317,9 +317,10 @@ java-ts-mode ;; Font-lock. (setq-local treesit-font-lock-settings java-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((comment constant keyword string) - (annotation definition expression literal type) - (bracket delimiter operator))) + '(( comment definition ) + ( constant keyword string type) + ( annotation expression literal) + ( bracket delimiter operator))) ;; Imenu. (setq-local imenu-create-index-function #'java-ts-mode--imenu) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index da05b7b364..f2016deb5d 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3873,9 +3873,10 @@ js-ts-mode (setq-local treesit-font-lock-settings js--treesit-font-lock-settings) (setq-local treesit-font-lock-feature-list '(( comment declaration) - ( constant expression identifier keyword number string) - ( bracket delimiter escape-sequence jsx operator - pattern property))) + ( keyword string) + ( constant escape-sequence expression + identifier jsx number pattern property) + ( bracket delimiter operator))) ;; Imenu (setq-local imenu-create-index-function #'js--treesit-imenu) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9bbcac612f..acfee21135 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6615,11 +6615,11 @@ python-ts-mode (when (treesit-ready-p 'python) (treesit-parser-create 'python) (setq-local treesit-font-lock-feature-list - '(( comment string definition) - ( keyword builtin constant type) - ( assignment decorator escape-sequence - string-interpolation number property - operator bracket delimiter))) + '(( comment definition) + ( keyword string type) + ( assignment builtin constant decorator + escape-sequence number property string-interpolation ) + ( bracket delimiter operator))) (setq-local treesit-font-lock-settings python--treesit-settings) (setq-local imenu-create-index-function #'python-imenu-treesit-create-index) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 067aef8669..e11fb42fc8 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1608,10 +1608,10 @@ bash-ts-mode "Major mode for editing Bash shell scripts." (when (treesit-ready-p 'bash) (setq-local treesit-font-lock-feature-list - '(( comment function heredoc string) - ( command declaration-command keyword number variable) - ( bracket builtin-variable constant delimiter - misc-punctuation operator))) + '(( comment function) + ( command declaration-command keyword string) + ( builtin-variable constant heredoc number variable) + ( bracket delimiter misc-punctuation operator))) (setq-local treesit-font-lock-settings sh-mode--treesit-settings) (treesit-major-mode-setup))) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 763686bf66..c7b332c614 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -320,9 +320,10 @@ typescript-ts-mode ;; Font-lock. (setq-local treesit-font-lock-settings typescript-ts-mode--font-lock-settings) (setq-local treesit-font-lock-feature-list - '((comment declaration) - (constant expression identifier keyword number string) - (bracket delimiter jsx pattern property))) + '(( comment declaration) + ( keyword string) + ( constant expression identifier jsx number pattern property) + ( bracket delimiter))) ;; Imenu. (setq-local imenu-create-index-function #'js--treesit-imenu) commit 447b9d48d966561f9bf65cd3eb0e2c0e60f69d42 Author: Yuan Fu Date: Sat Nov 26 14:54:55 2022 -0800 Add treesit-font-lock-level This replaces font-lock-maximum-decoration and allows us to disable the busiest fontification level by default. * lisp/treesit.el (treesit-font-lock-level): New variable. (treesit-font-lock-feature-list) (treesit-font-lock-settings): Change docstring. (treesit-font-lock-recompute-features): Use the new variable. diff --git a/lisp/treesit.el b/lisp/treesit.el index b7da38becc..ab00b0e8a7 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -520,6 +520,24 @@ 'treesit-font-lock-error "Generic tree-sitter font-lock error" 'treesit-error) +(defvar-local treesit-font-lock-level 3 + "The decoration level used by tree-sitter fontification. +Major modes categorize their fontification features into levels, +from 1 being the absolute minimal, to 4 being maximally +fontified. + +Level 1 usually contains only comments and definitions. +Level 2 usually adds keywords, strings, constants, types, etc. +Level 3 usually represents a full-blown fontification, including +assignment, constants, numbers, properties, etc. +Level 4 fontifies everything that can be fontified: delimiters, +operators, brackets, all functions and variables, etc. + +In addition to the decoration level, individual features can be +turned on/off by `treesit-font-lock-recompute-features'. Changes +to this variable also requires calling +`treesit-font-lock-recompute-features' to have an effect.") + (defvar-local treesit--font-lock-query-expand-range (cons 0 0) "The amount to expand the start and end of the region when fontifying. This should be a cons cell (START . END). When fontifying a @@ -537,11 +555,10 @@ treesit-font-lock-feature-list "A list of lists of feature symbols. Use `treesit-font-lock-recompute-features' and -`font-lock-maximum-decoration' to configure enabled features. +`treesit-font-lock-level' to configure enabled features. Each sublist represents a decoration level. -`font-lock-maximum-decoration' controls which levels are -activated. +`treesit-font-lock-level' controls which levels are activated. Inside each sublist are feature symbols, which correspond to the :feature value of a query defined in `treesit-font-lock-rules'. @@ -575,8 +592,8 @@ treesit-font-lock-settings disable this SETTING, set ENABLE to nil. FEATURE is the \"feature name\" of the query. Users can control -which features are enabled with `font-lock-maximum-decoration' -and `treesit-font-lock-feature-list'. +which features are enabled with `treesit-font-lock-level' and +`treesit-font-lock-feature-list'. OVERRIDE is the override flag for this query. Its value can be t, nil, append, prepend, keep. See more in @@ -718,12 +735,10 @@ treesit-font-lock-recompute-features If both ADD-LIST and REMOVE-LIST are omitted, recompute each feature according to `treesit-font-lock-feature-list' and -`font-lock-maximum-decoration'. Let N be the value of -`font-lock-maximum-decoration', features in the first Nth sublist -of `treesit-font-lock-feature-list' are enabled, and the rest -features are disabled. If `font-lock-maximum-decoration' is t, -all features in `treesit-font-lock-feature-list' are enabled, and -the rest are disabled. +`treesit-font-lock-level'. Let N be the value of +`treesit-font-lock-level', features in the first N sublists of +`treesit-font-lock-feature-list' are enabled, and other features +are disabled. ADD-LIST and REMOVE-LIST are each a list of feature symbols. The same feature symbol cannot appear in both lists; the function @@ -732,8 +747,7 @@ treesit-font-lock-recompute-features (signal 'treesit-font-lock-error (list "ADD-LIST and REMOVE-LIST contain the same feature" intersection))) - (let* ((level (font-lock-value-in-major-mode - font-lock-maximum-decoration)) + (let* ((level treesit-font-lock-level) (base-features (cl-loop for idx = 0 then (1+ idx) for features in treesit-font-lock-feature-list commit cc086f37e89051f62538d5ead1c011580b667598 Author: Yuan Fu Date: Sat Nov 26 14:51:26 2022 -0800 Add default limit for tree-sitter recursive tree-traversing function This fixes bug#59426. * src/treesit.c (treesit_search_dfs) (treesit_build_sparse_tree): Remove no_limit parameter. (Ftreesit_search_forward, Ftreesit_induce_sparse_tree): Use default limit of 1000. * doc/lispref/parsing.texi (Retrieving Nodes): Update manual. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 0f6a99b299..3223875320 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -725,10 +725,11 @@ Retrieving Nodes By default, this function only traverses named nodes, but if @var{all} is non-@code{nil}, it traverses all the nodes. If @var{backward} is -non-@code{nil}, it traverses backwards (i.e., it visits the last child first -when traversing down the tree). If @var{limit} is non-@code{nil}, it -must be a number that limits the tree traversal to that many levels -down the tree. +non-@code{nil}, it traverses backwards (i.e., it visits the last child +first when traversing down the tree). If @var{limit} is +non-@code{nil}, it must be a number that limits the tree traversal to +that many levels down the tree. If @var{limit} is @code{nil}, it +defaults to 1000. @end defun @defun treesit-search-forward start predicate &optional backward all @@ -814,10 +815,11 @@ Retrieving Nodes @end group @end example -If @var{process-fn} is non-@code{nil}, instead of returning the matched -nodes, this function passes each node to @var{process-fn} and uses the -returned value instead. If non-@code{nil}, @var{limit} is the number of -levels to go down from @var{root}. +If @var{process-fn} is non-@code{nil}, instead of returning the +matched nodes, this function passes each node to @var{process-fn} and +uses the returned value instead. If non-@code{nil}, @var{limit} is +the number of levels to go down from @var{root}. If @var{limit} is +@code{nil}, it defaults to 1000. Each node in the returned tree looks like @w{@code{(@var{tree-sitter-node} . (@var{child} @dots{}))}}. The diff --git a/src/treesit.c b/src/treesit.c index ad7e43fbc5..6526896061 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -2644,19 +2644,18 @@ treesit_traverse_match_predicate (TSNode node, Lisp_Object pred, return true. If no node satisfies PRED, return FALSE. PARSER is the parser of ROOT. - LIMIT is the number of levels we descend in the tree. If NO_LIMIT - is true, LIMIT is ignored. FORWARD controls the direction in which - we traverse the tree, true means forward, false backward. If NAMED - is true, only traverse named nodes, if false, all nodes. If - SKIP_ROOT is true, don't match ROOT. */ + LIMIT is the number of levels we descend in the tree. FORWARD + controls the direction in which we traverse the tree, true means + forward, false backward. If NAMED is true, only traverse named + nodes, if false, all nodes. If SKIP_ROOT is true, don't match + ROOT. */ static bool treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser, - bool named, bool forward, ptrdiff_t limit, bool no_limit, + bool named, bool forward, ptrdiff_t limit, bool skip_root) { /* TSTreeCursor doesn't allow us to move backward, so we can't use - it. We could use limit == -1 to indicate no_limit == true, but - separating them is safer. */ + it. */ TSNode node = *root; if (!skip_root && treesit_traverse_match_predicate (node, pred, parser)) @@ -2665,7 +2664,7 @@ treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser, return true; } - if (!no_limit && limit <= 0) + if (limit <= 0) return false; else { @@ -2681,7 +2680,7 @@ treesit_search_dfs (TSNode *root, Lisp_Object pred, Lisp_Object parser, if (!ts_node_is_null (child) && treesit_search_dfs (&child, pred, parser, named, - forward, limit - 1, no_limit, false)) + forward, limit - 1, false)) { *root = child; return true; @@ -2757,7 +2756,8 @@ DEFUN ("treesit-search-subtree", By default, only traverse named nodes, but if ALL is non-nil, traverse all nodes. If BACKWARD is non-nil, traverse backwards. If LIMIT is -non-nil, only traverse nodes up to that number of levels down in the tree. +non-nil, only traverse nodes up to that number of levels down in the +tree. If LIMIT is nil, default to 1000. Return the first matched node, or nil if none matches. */) (Lisp_Object node, Lisp_Object predicate, Lisp_Object backward, @@ -2769,11 +2769,10 @@ DEFUN ("treesit-search-subtree", CHECK_SYMBOL (all); CHECK_SYMBOL (backward); - ptrdiff_t the_limit = 0; - bool no_limit = false; - if (NILP (limit)) - no_limit = true; - else + /* We use a default limit to 1000. See bug#59426 for the + discussion. */ + ptrdiff_t the_limit = 1000; + if (!NILP (limit)) { CHECK_FIXNUM (limit); the_limit = XFIXNUM (limit); @@ -2784,7 +2783,7 @@ DEFUN ("treesit-search-subtree", TSNode treesit_node = XTS_NODE (node)->node; Lisp_Object parser = XTS_NODE (node)->parser; if (treesit_search_dfs (&treesit_node, predicate, parser, NILP (all), - NILP (backward), the_limit, no_limit, false)) + NILP (backward), the_limit, false)) return make_treesit_node (parser, treesit_node); else return Qnil; @@ -2847,7 +2846,7 @@ DEFUN ("treesit-search-forward", static void treesit_build_sparse_tree (TSTreeCursor *cursor, Lisp_Object parent, Lisp_Object pred, Lisp_Object process_fn, - ptrdiff_t limit, bool no_limit, Lisp_Object parser) + ptrdiff_t limit, Lisp_Object parser) { TSNode node = ts_tree_cursor_current_node (cursor); @@ -2866,8 +2865,7 @@ treesit_build_sparse_tree (TSTreeCursor *cursor, Lisp_Object parent, parent = this; } /* Go through each child. */ - if ((no_limit || limit > 0) - && ts_tree_cursor_goto_first_child (cursor)) + if (limit > 0 && ts_tree_cursor_goto_first_child (cursor)) { do { @@ -2875,7 +2873,7 @@ treesit_build_sparse_tree (TSTreeCursor *cursor, Lisp_Object parent, Then C compilers should be smart enough not to copy NODE to stack. */ treesit_build_sparse_tree (cursor, parent, pred, process_fn, - limit - 1, no_limit, parser); + limit - 1, parser); } while (ts_tree_cursor_goto_next_sibling (cursor)); /* Don't forget to come back to this node. */ @@ -2916,7 +2914,8 @@ DEFUN ("treesit-induce-sparse-tree", that case, instead of returning the matched nodes, pass each node to PROCESS-FN, and use its return value instead. -If non-nil, LIMIT is the number of levels to go down the tree from ROOT. +If non-nil, LIMIT is the number of levels to go down the tree from +ROOT. If LIMIT is nil, default to 1000. Each node in the returned tree looks like (NODE . (CHILD ...)). The root of this tree might be nil, if ROOT doesn't match PREDICATE. @@ -2935,11 +2934,11 @@ DEFUN ("treesit-induce-sparse-tree", if (!NILP (process_fn)) CHECK_TYPE (FUNCTIONP (process_fn), Qfunctionp, process_fn); - ptrdiff_t the_limit = 0; - bool no_limit = false; - if (NILP (limit)) - no_limit = true; - else + + /* We use a default limit to 1000. See bug#59426 for the + discussion. */ + ptrdiff_t the_limit = 1000; + if (!NILP (limit)) { CHECK_FIXNUM (limit); the_limit = XFIXNUM (limit); @@ -2951,7 +2950,7 @@ DEFUN ("treesit-induce-sparse-tree", Lisp_Object parser = XTS_NODE (root)->parser; Lisp_Object parent = Fcons (Qnil, Qnil); treesit_build_sparse_tree (&cursor, parent, predicate, process_fn, - the_limit, no_limit, parser); + the_limit, parser); Fsetcdr (parent, Fnreverse (Fcdr (parent))); if (NILP (Fcdr (parent))) return Qnil; commit d884b43634b149aa504bc204fdce9690a5a880d0 Author: Yuan Fu Date: Sat Nov 26 14:08:11 2022 -0800 Partially fix some python tests (bug#59477) This fixes python-font-lock-assignment-statement-multiline-1 python-font-lock-assignment-statement-multiline-2 python-font-lock-assignment-statement-multiline-3 python-font-lock-assignment-statement-multiline-4 python-font-lock-assignment-statement-multiline-5 python-font-lock-assignment-statement-multiline-6 but leaves python-tests--fill-long-first-line unfixed. * lisp/progmodes/python.el (python-mode): Add the missing setup. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2a7e8a4081..9bbcac612f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6598,7 +6598,9 @@ python-mode `(,python-font-lock-keywords nil nil nil nil (font-lock-syntactic-face-function - . python-font-lock-syntactic-face-function))) + . python-font-lock-syntactic-face-function) + (font-lock-extend-after-change-region-function + . python-font-lock-extend-region))) (setq-local syntax-propertize-function python-syntax-propertize-function) (setq-local imenu-create-index-function commit 14d54212ea46dbd8c950c9852318597e0e47908d Author: Jim Porter Date: Fri Nov 25 11:13:06 2022 -0800 Improve robustness of server.el tests * lisp/emacs-lisp/ert.el (ert--insert-infos): Allow 'message' to be a function that is called when inserting the info. (ert-info): Update docstring to describe using a function for MESSAGE-FORM. * lisp/server.el (server-start): Log when the server is starting. * test/lisp/server-tests.el (server-tests/can-create-frames-p): New constant. Use it to skip tests that need to create frames. (server-tests/start-emacsclient): Rename to... (server-tests/start-client): ... this, and set the process's buffer. (server-tests/with-server): Put the server file in a temporary directory so we don't conflict with real Emacs servers. (server-tests/with-client): New macro... (server-tests/server-start/stop-prompt-with-client) (server-tests/emacsclient/server-edit) (server-tests/emacsclient/create-frame) (server-tests/emacsclient/create-frame): ... use it. (server-tests/server-start/stop-prompt-with-client): Simplify. diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index c25ade22d6..67cbe62538 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -673,8 +673,11 @@ ert-info To be used within ERT tests. MESSAGE-FORM should evaluate to a string that will be displayed together with the test result if -the test fails. PREFIX-FORM should evaluate to a string as well -and is displayed in front of the value of MESSAGE-FORM." +the test fails. MESSAGE-FORM can also evaluate to a function; in +this case, it will be called when displaying the info. + +PREFIX-FORM should evaluate to a string as well and is displayed +in front of the value of MESSAGE-FORM." (declare (debug ((form &rest [sexp form]) body)) (indent 1)) `(let ((ert--infos (cons (cons ,prefix-form ,message-form) ert--infos))) @@ -1352,6 +1355,8 @@ ert--insert-infos (end nil)) (unwind-protect (progn + (when (functionp message) + (setq message (funcall message))) (insert message "\n") (setq end (point-marker)) (goto-char begin) diff --git a/lisp/server.el b/lisp/server.el index beb46853b7..2102f8569b 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -756,6 +756,7 @@ server-start :service server-file :plist '(:authenticated t))))) (unless server-process (error "Could not start server process")) + (server-log "Starting server") (process-put server-process :server-file server-file) (setq server-mode t) (push 'server-mode global-minor-modes) diff --git a/test/lisp/server-tests.el b/test/lisp/server-tests.el index 370cf86148..f8ecd046f2 100644 --- a/test/lisp/server-tests.el +++ b/test/lisp/server-tests.el @@ -22,45 +22,93 @@ (require 'ert) (require 'server) +(defconst server-tests/can-create-frames-p + (not (memq system-type '(windows-nt ms-dos))) + "Non-nil if we can create a new frame in the tests. +Some tests below need to create new frames for the emacsclient. +However, this doesn't work on all platforms. In particular, +MS-Windows fails to create frames from a batch Emacs session. In +cases like that, we just skip the test.") + +(defconst server-tests/max-wait-time 5 + "The maximum time to wait in `server-tests/wait-until', in seconds.") + (defconst server-tests/emacsclient (if installation-directory (expand-file-name "lib-src/emacsclient" installation-directory) "emacsclient") "The emacsclient binary to test.") -(defun server-tests/start-emacsclient (&rest args) +(defmacro server-tests/wait-until (form) + "Wait until FORM is non-nil, timing out and failing if it takes too long." + `(let ((start (current-time))) + (while (not ,form) + (when (> (float-time (time-since start)) + server-tests/max-wait-time) + (ert-fail (format "timed out waiting for %S to be non-nil" ',form))) + (sit-for 0.1)))) + +(defun server-tests/start-client (args) "Run emacsclient, passing ARGS as arguments to it." - (let ((socket-name (process-get server-process :server-file))) + (let ((server-file (process-get server-process :server-file)) + (buffer (generate-new-buffer "emacsclient"))) (make-process :name server-tests/emacsclient + :buffer buffer :command (append (list server-tests/emacsclient - "--socket-name" socket-name) + (if server-use-tcp + "--server-file" + "--socket-name") + server-file) args)))) (defmacro server-tests/with-server (&rest body) "Start the Emacs server, evaluate BODY, and then stop the server." (declare (indent 0)) - `(progn + ;; Override the `server-name' so that these tests don't interfere + ;; with any existing Emacs servers on the system. + `(let* ((temporary-file-directory (file-name-as-directory + (make-temp-file "server-tests" t))) + (server-name (expand-file-name + "test-server" temporary-file-directory)) + (server-log t)) (server-start) - (unwind-protect - (progn (should (processp server-process)) - ,@body) - (let ((inhibit-message t)) - (server-start t t)) - (should (null server-process)) - (should (null server-clients))))) - -(defconst server-tests/max-wait-time 5 - "The maximum time to wait in `server-tests/wait-until', in seconds.") - -(defmacro server-tests/wait-until (form) - "Wait until FORM is non-nil, timing out and failing if it takes too long." - `(let ((start (current-time))) - (while (not ,form) - (when (> (float-time (time-since start)) - server-tests/max-wait-time) - (ert-fail (format "timed out waiting for %S to be non-nil" ',form))) - (sit-for 0.1)))) + (ert-info ((lambda () + (with-current-buffer (get-buffer-create server-buffer) + (buffer-string))) + :prefix "Server logs: ") + (unwind-protect + (progn (should (processp server-process)) + ,@body) + (let ((inhibit-message t)) + (server-start t t)) + (delete-directory temporary-file-directory t) + (should (null server-process)) + (should (null server-clients)))))) + +(defmacro server-tests/with-client (client-symbol args exit-status &rest body) + "Start an Emacs client with ARGS and evaluate BODY. +This binds the client process to CLIENT-SYMBOL. If EXIT-STATUS is +non-nil, then after BODY is evaluated, make sure the client +process's status matches it." + (declare (indent 3)) + (let ((exit-status-symbol (make-symbol "exit-status")) + (starting-client-count-symbol (make-symbol "starting-client-count"))) + `(let ((,starting-client-count-symbol (length server-clients)) + (,exit-status-symbol ,exit-status) + (,client-symbol (server-tests/start-client ,args))) + (ert-info ((lambda () + (with-current-buffer (process-buffer ,client-symbol) + (buffer-string))) + :prefix "Client output: ") + (server-tests/wait-until + (or (= (length server-clients) + (1+ ,starting-client-count-symbol)) + (eq (process-status ,client-symbol) ,exit-status-symbol))) + ,@body + (when ,exit-status-symbol + (server-tests/wait-until (eq (process-status ,client-symbol) + ,exit-status-symbol))))))) (defvar server-tests/variable nil) @@ -78,58 +126,58 @@ server-tests/server-start/sets-minor-mode (ert-deftest server-tests/server-start/stop-prompt-with-client () "Ensure that stopping the server prompts when there are clients." + (skip-unless server-tests/can-create-frames-p) (server-tests/with-server - (let ((yes-or-no-p-called nil) - (emacsclient (server-tests/start-emacsclient "-c"))) - (server-tests/wait-until (length= (frame-list) 2)) - (cl-letf (((symbol-function 'yes-or-no-p) - (lambda (_prompt) - (setq yes-or-no-p-called t)))) + (server-tests/with-client emacsclient '("-c") 'exit + (should (length= (frame-list) 2)) + (cl-letf* ((yes-or-no-p-called nil) + ((symbol-function 'yes-or-no-p) + (lambda (_prompt) + (setq yes-or-no-p-called t)))) (server-start t) - (should yes-or-no-p-called)) - (server-tests/wait-until (eq (process-status emacsclient) 'exit))))) + (should yes-or-no-p-called))))) (ert-deftest server-tests/server-start/no-stop-prompt-without-client () "Ensure that stopping the server doesn't prompt when there are no clients." (server-tests/with-server - (let ((yes-or-no-p-called nil)) - (cl-letf (((symbol-function 'yes-or-no-p) - (lambda (_prompt) - (setq yes-or-no-p-called t)))) - (let ((inhibit-message t)) - (server-start t)) - (should-not yes-or-no-p-called))))) + (cl-letf* ((inhibit-message t) + (yes-or-no-p-called nil) + ((symbol-function 'yes-or-no-p) + (lambda (_prompt) + (setq yes-or-no-p-called t)))) + (server-start t) + (should-not yes-or-no-p-called)))) (ert-deftest server-tests/emacsclient/server-edit () "Test that calling `server-edit' from a client buffer exits the client." (server-tests/with-server - (let ((emacsclient (server-tests/start-emacsclient "file.txt"))) + (server-tests/with-client emacsclient '("file.txt") 'exit (server-tests/wait-until (get-buffer "file.txt")) (should (eq (process-status emacsclient) 'run)) - (should (length= server-clients 1)) (with-current-buffer "file.txt" - (server-edit)) - (server-tests/wait-until (eq (process-status emacsclient) 'exit))))) + (server-edit))))) (ert-deftest server-tests/emacsclient/create-frame () "Test that \"emacsclient -c\" creates a frame." - (server-tests/with-server - (let ((emacsclient (server-tests/start-emacsclient "-c"))) - (server-tests/wait-until (length= (frame-list) 2)) + (skip-unless server-tests/can-create-frames-p) + (let ((starting-frame-count (length (frame-list)))) + (server-tests/with-server + (server-tests/with-client emacsclient '("-c") nil + (should (length= (frame-list) (1+ starting-frame-count))) (should (eq (process-status emacsclient) 'run)) - (should (length= server-clients 1)) (should (eq (frame-parameter (car (frame-list)) 'client) (car server-clients))))) - ;; The client frame should go away after the server stops. - (should (length= (frame-list) 1))) + ;; The client frame should go away after the server stops. + (should (length= (frame-list) starting-frame-count)))) (ert-deftest server-tests/emacsclient/eval () "Test that \"emacsclient --eval\" works correctly." (server-tests/with-server (let ((value (random))) - (server-tests/start-emacsclient - "--eval" (format "(setq server-tests/variable %d)" value)) - (server-tests/wait-until (eq server-tests/variable value))))) + (server-tests/with-client emacsclient + (list "--eval" (format "(setq server-tests/variable %d)" value)) + 'exit + (should (= server-tests/variable value)))))) (ert-deftest server-tests/server-force-stop/keeps-frames () "Ensure that `server-force-stop' doesn't delete frames. See bug#58877. @@ -139,12 +187,14 @@ server-tests/server-force-stop/keeps-frames tests that `server-force-stop' doesn't delete frames (and even then, requires a few tricks to run as a regression test). So long as this works, the problem in bug#58877 shouldn't occur." - (let (terminal) + (skip-unless server-tests/can-create-frames-p) + (let ((starting-frame-count (length (frame-list))) + terminal) (unwind-protect (server-tests/with-server - (let ((emacsclient (server-tests/start-emacsclient "-c"))) - (server-tests/wait-until (length= (frame-list) 2)) + (server-tests/with-client emacsclient '("-c") 'exit (should (eq (process-status emacsclient) 'run)) + (should (length= (frame-list) (1+ starting-frame-count))) ;; Don't delete the terminal for the client; that would ;; kill its frame immediately too. (This is only an issue @@ -159,7 +209,7 @@ server-tests/server-force-stop/keeps-frames (server-force-stop)) ;; Ensure we didn't delete the frame. - (should (length= (frame-list) 2))) + (should (length= (frame-list) (1+ starting-frame-count)))) ;; Clean up after ourselves and delete the terminal. (when (and terminal (eq (terminal-live-p terminal) t) commit eb713a8fccc7f0512cfdbd5c520d4c856746a968 Author: Eric Abrahamsen Date: Sat Nov 26 12:12:50 2022 -0800 Remove mentions of create-directory nnmaildir setting * lisp/gnus/nnmaildir.el (nnmaildir-open-server): The 'create-directory server parameter should have been removed entirely, and supplanted by 'target-prefix. Remove check for old parameter. * doc/misc/gnus.texi (Maildir): Delete mention from manual. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index b0fef2b5b6..10f7bd94f7 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -16808,8 +16808,7 @@ Maildir Do @emph{not} use the same maildir both in @code{mail-sources} and as an @code{nnmaildir} group. The results might happen to be useful, but that would be by chance, not by design, and the results might be -different in the future. If your split rules create new groups, -remember to supply a @code{create-directory} server parameter. +different in the future. @end table @node nnmaildir Group Parameters diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 4d1ecbf864..faa288934d 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -670,7 +670,7 @@ nnmaildir-server-opened (defun nnmaildir-open-server (server-string &optional defs) (let ((server (alist-get server-string nnmaildir--servers nil nil #'equal)) - dir size x) + dir size x prefix) (catch 'return (if server (and (nnmaildir--srv-groups server) @@ -710,20 +710,11 @@ nnmaildir-open-server (car x) (setf (nnmaildir--srv-gnm server) t) (require 'nnmail)) - (setq x (assq 'target-prefix defs)) - (if x - (progn - (setq x (cadr x) - x (eval x t)) ;FIXME: Why `eval'? - (setf (nnmaildir--srv-target-prefix server) x)) - (setq x (assq 'create-directory defs)) - (if x - (progn - (setq x (cadr x) - x (eval x t) ;FIXME: Why `eval'? - x (file-name-as-directory x)) - (setf (nnmaildir--srv-target-prefix server) x)) - (setf (nnmaildir--srv-target-prefix server) ""))) + (setf prefix (cl-second (assq 'target-prefix defs)) + (nnmaildir--srv-target-prefix server) + (if prefix + (eval prefix t) + "")) (setf (nnmaildir--srv-groups server) (gnus-make-hashtable size)) (setq nnmaildir--cur-server server) commit b27e8f26284770162cc9e9d95d4d273902d35927 Author: Paul Eggert Date: Sat Nov 26 10:49:04 2022 -0800 Update from Gnulib by running admin/merge-gnulib diff --git a/build-aux/config.guess b/build-aux/config.guess index a419d8643b..980b020838 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-08-01' +timestamp='2022-09-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -966,6 +966,12 @@ main () GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; diff --git a/build-aux/config.sub b/build-aux/config.sub index fbaa37f235..baf1512b3c 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-08-01' +timestamp='2022-09-17' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -145,7 +145,7 @@ IFS= nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova*) + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) basic_machine=$field1 basic_os=$maybe_os ;; @@ -1341,6 +1341,10 @@ IFS= kernel=linux os=`echo "$basic_os" | sed -e 's|linux|gnu|'` ;; + managarm*) + kernel=managarm + os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` + ;; *) kernel= os=$basic_os @@ -1754,7 +1758,7 @@ kernel= | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ - | fiwix* ) + | fiwix* | mlibc* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) @@ -1762,6 +1766,9 @@ kernel= ;; none) ;; + kernel* ) + # Restricted further below + ;; *) echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 exit 1 @@ -1772,16 +1779,26 @@ kernel= # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ - | linux-musl* | linux-relibc* | linux-uclibc* ) + | linux-musl* | linux-relibc* | linux-uclibc* | linux-mlibc* ) ;; uclinux-uclibc* ) ;; - -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) + managarm-mlibc* | managarm-kernel* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; + -kernel* ) + echo "Invalid configuration \`$1': \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel* ) + echo "Invalid configuration \`$1': \`$kernel' does not support \`$os'." 1>&2 + exit 1 + ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 09f2d28c2f..cfc77a84ea 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2022-09-21.15} +\def\texinfoversion{2022-11-12.22} % % Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc. % @@ -2544,34 +2544,30 @@ \scriptfont\sffam=\sevensf } -% -% The font-changing commands (all called \...fonts) redefine the meanings -% of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs -% to also set the current \fam for math mode. Our \STYLE (e.g., \rm) -% commands hardwire \STYLEfont to set the current font. -% -% The fonts used for \ifont are for "math italics" (\itfont is for italics -% in regular text). \syfont is also used in math mode only. -% -% Each font-changing command also sets the names \lsize (one size lower) -% and \lllsize (three sizes lower). These relative commands are used -% in, e.g., the LaTeX logo and acronyms. -% -% This all needs generalizing, badly. + +% \defineassignfonts{SIZE} - +% Define sequence \assignfontsSIZE, which switches between font sizes +% by redefining the meanings of \STYLEfont. (Just \STYLE additionally sets +% the current \fam for math mode.) % +\def\defineassignfonts#1{% + \expandafter\edef\csname assignfonts#1\endcsname{% + \let\noexpand\rmfont\csname #1rm\endcsname + \let\noexpand\itfont\csname #1it\endcsname + \let\noexpand\slfont\csname #1sl\endcsname + \let\noexpand\bffont\csname #1bf\endcsname + \let\noexpand\ttfont\csname #1tt\endcsname + \let\noexpand\smallcaps\csname #1sc\endcsname + \let\noexpand\sffont \csname #1sf\endcsname + \let\noexpand\ifont \csname #1i\endcsname + \let\noexpand\syfont \csname #1sy\endcsname + \let\noexpand\ttslfont\csname #1ttsl\endcsname + } +} \def\assignfonts#1{% - \expandafter\let\expandafter\rmfont\csname #1rm\endcsname - \expandafter\let\expandafter\itfont\csname #1it\endcsname - \expandafter\let\expandafter\slfont\csname #1sl\endcsname - \expandafter\let\expandafter\bffont\csname #1bf\endcsname - \expandafter\let\expandafter\ttfont\csname #1tt\endcsname - \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname - \expandafter\let\expandafter\sffont \csname #1sf\endcsname - \expandafter\let\expandafter\ifont \csname #1i\endcsname - \expandafter\let\expandafter\syfont \csname #1sy\endcsname - \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname + \csname assignfonts#1\endcsname } \newif\ifrmisbold @@ -2595,12 +2591,21 @@ \csname\curfontstyle\endcsname }% +% Define the font-changing commands (all called \...fonts). +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used +% in, e.g., the LaTeX logo and acronyms. +% +% Note: The fonts used for \ifont are for "math italics" (\itfont is for +% italics in regular text). \syfont is also used in math mode only. +% \def\definefontsetatsize#1#2#3#4#5{% + \defineassignfonts{#1}% \expandafter\def\csname #1fonts\endcsname{% \def\curfontsize{#1}% \def\lsize{#2}\def\lllsize{#3}% \csname rmisbold#5\endcsname - \assignfonts{#1}% + \csname assignfonts#1\endcsname \resetmathfonts \setleading{#4}% }} @@ -2645,9 +2650,16 @@ % Check if we are currently using a typewriter font. Since all the % Computer Modern typewriter fonts have zero interword stretch (and % shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } +% this property, we can check that font parameter. #1 is what to +% print if we are indeed using \tt; #2 is what to print otherwise. +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + % Check if internal flag is clear, i.e. has not been @set. \def\ifflagclear#1#2#3{% @@ -2655,8 +2667,6 @@ #2\else#3\fi } - - { \catcode`\'=\active \catcode`\`=\active @@ -2672,33 +2682,28 @@ % lilypond developers report. xpdf does work with the regular 0x27. % \def\codequoteright{% - \ifmonospace - \ifflagclear{txicodequoteundirected}{% - \ifflagclear{codequoteundirected}{% - '% - }{\char'15 }% - }{\char'15 }% - \else - '% - \fi + \ifusingtt + {\ifflagclear{txicodequoteundirected}% + {\ifflagclear{codequoteundirected}% + {'}% + {\char'15 }}% + {\char'15 }}% + {'}% } -% + % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. +% \relax disables Spanish ligatures ?` and !` of \tt font. % \def\codequoteleft{% - \ifmonospace - \ifflagclear{txicodequotebacktick}{% - \ifflagclear{codequotebacktick}{% - % [Knuth] pp. 380,381,391 - % \relax disables Spanish ligatures ?` and !` of \tt font. - \relax`% - }{\char'22 }% - }{\char'22 }% - \else - \relax`% - \fi + \ifusingtt + {\ifflagclear{txicodequotebacktick}% + {\ifflagclear{codequotebacktick}% + {\relax`}% + {\char'22 }}% + {\char'22 }}% + {\relax`}% } % Commands to set the quote options. @@ -2817,20 +2822,29 @@ \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } +\newif\iffrenchspacing +\frenchspacingfalse + % Set sfcode to normal for the chars that usually have another value. % Can't use plain's \frenchspacing because it uses the `\x notation, and % sometimes \x has an active definition that messes things up. % \catcode`@=11 \def\plainfrenchspacing{% - \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m - \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m - \def\endofsentencespacefactor{1000}% for @. and friends + \iffrenchspacing\else + \frenchspacingtrue + \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m + \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m + \def\endofsentencespacefactor{1000}% for @. and friends + \fi } \def\plainnonfrenchspacing{% - \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 - \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 - \def\endofsentencespacefactor{3000}% for @. and friends + \iffrenchspacing + \frenchspacingfalse + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + \fi } \catcode`@=\other \def\endofsentencespacefactor{3000}% default @@ -3389,8 +3403,8 @@ \let\atchar=\@ % @{ @} @lbracechar{} @rbracechar{} all generate brace characters. -\def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}} -\def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}} +\def\lbracechar{{\ifusingtt{\char123}{\ensuremath\lbrace}}} +\def\rbracechar{{\ifusingtt{\char125}{\ensuremath\rbrace}}} \let\{=\lbracechar \let\}=\rbracechar @@ -3537,7 +3551,7 @@ % @pounds{} is a sterling sign, which Knuth put in the CM italic font. % -\def\pounds{\ifmonospace{\ecfont\char"BF}\else{\it\$}\fi} +\def\pounds{{\ifusingtt{\ecfont\char"BF}{\it\$}}} % @euro{} comes from a separate font, depending on the current style. % We use the free feym* fonts from the eurosym package by Henrik @@ -3651,18 +3665,17 @@ % hopefully nobody will notice/care. \edef\ecsize{\csname\curfontsize ecsize\endcsname}% \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}% - \ifmonospace - % typewriter: - \font\thisecfont = #1ctt\ecsize \space at \nominalsize - \else - \ifx\curfontstyle\bfstylename - % bold: - \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize - \else - % regular: - \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize - \fi - \fi + \ifusingtt + % typewriter: + {\font\thisecfont = #1ctt\ecsize \space at \nominalsize}% + % else + {\ifx\curfontstyle\bfstylename + % bold: + \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize + \else + % regular: + \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize + \fi}% \thisecfont } @@ -3678,7 +3691,10 @@ % @textdegree - the normal degrees sign. % -\def\textdegree{$^\circ$} +\def\textdegree{% + \ifmmode ^\circ + \else {\tcfont \char 176}% + \fi} % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 @@ -3695,11 +3711,11 @@ % only change font for tt for correct kerning and to avoid using % \ecfont unless necessary. \def\quotedblleft{% - \ifmonospace{\ecfont\char"10}\else{\char"5C}\fi + \ifusingtt{{\ecfont\char"10}}{{\char"5C}}% } \def\quotedblright{% - \ifmonospace{\ecfont\char"11}\else{\char`\"}\fi + \ifusingtt{{\ecfont\char"11}}{{\char`\"}}% } @@ -5257,7 +5273,10 @@ \xdef\trimmed{\segment}% \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}% \xdef\indexsortkey{\trimmed}% - \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi + \ifx\indexsortkey\empty + \message{Empty index sort key near line \the\inputlineno}% + \xdef\indexsortkey{ }% + \fi }\fi % % Append to \fullindexsortkey. @@ -6386,6 +6405,16 @@ \def\Yappendixkeyword{Yappendix} \def\Yomitfromtockeyword{Yomitfromtoc} % +% +% Definitions for @thischapter. These can be overridden in translation +% files. +\def\thischapterAppendix{% + \putwordAppendix{} \thischapternum: \thischaptername} + +\def\thischapterChapter{% + \putwordChapter{} \thischapternum: \thischaptername} +% +% \def\chapmacro#1#2#3{% \expandafter\ifx\thisenv\titlepage\else \checkenv{}% chapters, etc., should not start inside an environment. @@ -6408,22 +6437,14 @@ \xdef\currentchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\appendixletter}% - % \noexpand\putwordAppendix avoids expanding indigestible - % commands in some of the translations. - \gdef\noexpand\thischapter{\noexpand\putwordAppendix{} - \noexpand\thischapternum: - \noexpand\thischaptername}% + \let\noexpand\thischapter\noexpand\thischapterAppendix }% \else \toks0={#1}% \xdef\currentchapterdefs{% \gdef\noexpand\thischaptername{\the\toks0}% \gdef\noexpand\thischapternum{\the\chapno}% - % \noexpand\putwordChapter avoids expanding indigestible - % commands in some of the translations. - \gdef\noexpand\thischapter{\noexpand\putwordChapter{} - \noexpand\thischapternum: - \noexpand\thischaptername}% + \let\noexpand\thischapter\noexpand\thischapterChapter }% \fi\fi\fi % @@ -6509,6 +6530,12 @@ \def\subsubsecheadingskip{\subsecheadingskip} \def\subsubsecheadingbreak{\subsecheadingbreak} +% Definition for @thissection. This can be overridden in translation +% files. +\def\thissectionDef{% + \putwordSection{} \thissectionnum: \thissectionname} +% + % Print any size, any type, section title. % @@ -6550,11 +6577,7 @@ \xdef\currentsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% - % \noexpand\putwordSection avoids expanding indigestible - % commands in some of the translations. - \gdef\noexpand\thissection{\noexpand\putwordSection{} - \noexpand\thissectionnum: - \noexpand\thissectionname}% + \let\noexpand\thissection\noexpand\thissectionDef }% \fi \else @@ -6563,11 +6586,7 @@ \xdef\currentsectiondefs{% \gdef\noexpand\thissectionname{\the\toks0}% \gdef\noexpand\thissectionnum{#4}% - % \noexpand\putwordSection avoids expanding indigestible - % commands in some of the translations. - \gdef\noexpand\thissection{\noexpand\putwordSection{} - \noexpand\thissectionnum: - \noexpand\thissectionname}% + \let\noexpand\thissection\noexpand\thissectionDef }% \fi \fi\fi\fi @@ -7107,12 +7126,19 @@ \startsavinginserts \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt % we want these *outside*. + % + % Set paragraph width for text inside cartouche. There are + % left and right margins of 3pt each plus two vrules 0.4pt each. \cartinner=\hsize \advance\cartinner by-\lskip \advance\cartinner by-\rskip + \advance\cartinner by -6.8pt + % + % For drawing top and bottom of cartouche. Each corner char + % adds 6pt and we take off the width of a rule to line up with the + % right boundary perfectly. \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either - % side, and for 6pt waste from - % each corner char, and rule thickness + \advance\cartouter by 11.6pt + % \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip % % If this cartouche directly follows a sectioning command, we need the @@ -8405,21 +8431,21 @@ \ifcase\paramno % 0 \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup + \begingroup \noexpand\spaceisspace \noexpand\endlineisspace \noexpand\expandafter % skip any whitespace after the macro name. \expandafter\noexpand\csname\the\macname @@@\endcsname}% \expandafter\xdef\csname\the\macname @@@\endcsname{% - \egroup + \endgroup \noexpand\scanmacro{\macrobody}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup + \begingroup \noexpand\braceorline \expandafter\noexpand\csname\the\macname @@@\endcsname}% \expandafter\xdef\csname\the\macname @@@\endcsname##1{% - \egroup + \endgroup \noexpand\scanmacro{\macrobody}% }% \else % at most 9 @@ -8430,7 +8456,7 @@ % @MACNAME@@@ removes braces surrounding the argument list. % @MACNAME@@@@ scans the macro body with arguments substituted. \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup + \begingroup \noexpand\expandafter % This \expandafter skip any spaces after the \noexpand\macroargctxt % macro before we change the catcode of space. \noexpand\expandafter @@ -8444,7 +8470,7 @@ \expandafter\xdef \expandafter\expandafter \csname\the\macname @@@@\endcsname\paramlist{% - \egroup\noexpand\scanmacro{\macrobody}}% + \endgroup\noexpand\scanmacro{\macrobody}}% \else % 10 or more: \expandafter\xdef\csname\the\macname\endcsname{% \noexpand\getargvals@{\the\macname}{\argl}% @@ -8887,11 +8913,10 @@ \xrefprintnodename\printedrefname % \ifflagclear{txiomitxrefpg}{% - % But we always want a comma and a space: - ,\space - % + % We always want a comma + ,% % output the `page 3'. - \turnoffactive \putwordpage\tie\refx{#1-pg}% + \turnoffactive \putpageref{#1}% % Add a , if xref followed by a space \if\space\noexpand\tokenafterxref ,% \else\ifx\ \tokenafterxref ,% @TAB @@ -8907,6 +8932,10 @@ \endlink \endgroup} +% can be overridden in translation files +\def\putpageref#1{% + \space\putwordpage\tie\refx{#1-pg}} + % Output a cross-manual xref to #1. Used just above (twice). % % Only include the text "Section ``foo'' in" if the foo is neither @@ -9338,13 +9367,6 @@ \makevalueexpandable \ifvmode \imagevmodetrue - \else \ifx\centersub\centerV - % for @center @image, we need a vbox so we can have our vertical space - \imagevmodetrue - \vbox\bgroup % vbox has better behavior than vtop here - \fi\fi - % - \ifimagevmode \medskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space @@ -9356,14 +9378,17 @@ \vtop\bgroup \kern -\capheight \vskip-\parskip \fi % - % Enter horizontal mode so that indentation from an enclosing - % environment such as @quotation is respected. - % However, if we're at the top level, we don't want the - % normal paragraph indentation. - % On the other hand, if we are in the case of @center @image, we don't - % want to start a paragraph, which will create a hsize-width box and - % eradicate the centering. - \ifx\centersub\centerV \else \imageindent \fi + \ifx\centersub\centerV + % For @center @image, enter vertical mode and add vertical space + % Enter an extra \parskip because @center doesn't add space itself. + \vbox\bgroup\vskip\parskip\medskip\vskip\parskip + \else + % Enter horizontal mode so that indentation from an enclosing + % environment such as @quotation is respected. + % However, if we're at the top level, we don't want the + % normal paragraph indentation. + \imageindent + \fi % % Output the image. \ifpdf @@ -9388,7 +9413,10 @@ \egroup \medskip % space after a standalone image \fi - \ifx\centersub\centerV \egroup \fi + \ifx\centersub\centerV % @center @image + \medskip + \egroup % close \vbox + \fi \endgroup} @@ -10038,7 +10066,7 @@ \gdefchar^^ae{\v Z} \gdefchar^^af{\dotaccent Z} % - \gdefchar^^b0{\textdegree{}} + \gdefchar^^b0{\textdegree} \gdefchar^^b1{\ogonek{a}} \gdefchar^^b2{\ogonek{ }} \gdefchar^^b3{\l} @@ -10461,7 +10489,7 @@ \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}% \DeclareUnicodeCharacter{00AF}{\={ }}% % - \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}% + \DeclareUnicodeCharacter{00B0}{\textdegree} \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}% \DeclareUnicodeCharacter{00B2}{$^2$}% \DeclareUnicodeCharacter{00B3}{$^3$}% @@ -10965,7 +10993,7 @@ % \DeclareUnicodeCharacter{20AC}{\euro{}}% % - \DeclareUnicodeCharacter{2192}{\expansion{}}% + \DeclareUnicodeCharacter{2192}{\arrow}% \DeclareUnicodeCharacter{21D2}{\result{}}% % % Mathematical symbols @@ -11401,6 +11429,131 @@ \hfuzz = 1pt +\message{microtype,} + +% protrusion, from Thanh's protcode.tex. +\def\mtsetprotcode#1{% + \rpcode#1`\!=200 \rpcode#1`\,=700 \rpcode#1`\-=700 \rpcode#1`\.=700 + \rpcode#1`\;=500 \rpcode#1`\:=500 \rpcode#1`\?=200 + \rpcode#1`\'=700 + \rpcode#1 34=500 % '' + \rpcode#1 123=300 % -- + \rpcode#1 124=200 % --- + \rpcode#1`\)=50 \rpcode#1`\A=50 \rpcode#1`\F=50 \rpcode#1`\K=50 + \rpcode#1`\L=50 \rpcode#1`\T=50 \rpcode#1`\V=50 \rpcode#1`\W=50 + \rpcode#1`\X=50 \rpcode#1`\Y=50 \rpcode#1`\k=50 \rpcode#1`\r=50 + \rpcode#1`\t=50 \rpcode#1`\v=50 \rpcode#1`\w=50 \rpcode#1`\x=50 + \rpcode#1`\y=50 + % + \lpcode#1`\`=700 + \lpcode#1 92=500 % `` + \lpcode#1`\(=50 \lpcode#1`\A=50 \lpcode#1`\J=50 \lpcode#1`\T=50 + \lpcode#1`\V=50 \lpcode#1`\W=50 \lpcode#1`\X=50 \lpcode#1`\Y=50 + \lpcode#1`\v=50 \lpcode#1`\w=50 \lpcode#1`\x=50 \lpcode#1`\y=0 + % + \mtadjustprotcode#1\relax +} + +\newcount\countC +\def\mtadjustprotcode#1{% + \countC=0 + \loop + \ifcase\lpcode#1\countC\else + \mtadjustcp\lpcode#1\countC + \fi + \ifcase\rpcode#1\countC\else + \mtadjustcp\rpcode#1\countC + \fi + \advance\countC 1 + \ifnum\countC < 256 \repeat +} + +\newcount\countB +\def\mtadjustcp#1#2#3{% + \setbox\boxA=\hbox{% + \ifx#2\font\else#2\fi + \char#3}% + \countB=\wd\boxA + \multiply\countB #1#2#3\relax + \divide\countB \fontdimen6 #2\relax + #1#2#3=\countB\relax +} + +\ifx\XeTeXrevision\thisisundefined + \ifx\luatexversion\thisisundefined + \ifpdf % pdfTeX + \mtsetprotcode\textrm + \def\mtfontexpand#1{\pdffontexpand#1 20 20 1 autoexpand\relax} + \else % TeX + \def\mtfontexpand#1{} + \fi + \else % LuaTeX + \mtsetprotcode\textrm + \def\mtfontexpand#1{\expandglyphsinfont#1 20 20 1\relax} + \fi +\else % XeTeX + \mtsetprotcode\textrm + \def\mtfontexpand#1{} +\fi + + +\newif\ifmicrotype + +\def\microtypeON{% + \microtypetrue + % + \ifx\XeTeXrevision\thisisundefined + \ifx\luatexversion\thisisundefined + \ifpdf % pdfTeX + \pdfadjustspacing=2 + \pdfprotrudechars=2 + \fi + \else % LuaTeX + \adjustspacing=2 + \protrudechars=2 + \fi + \else % XeTeX + \XeTeXprotrudechars=2 + \fi + % + \mtfontexpand\textrm + \mtfontexpand\textsl + \mtfontexpand\textbf +} + +\def\microtypeOFF{% + \microtypefalse + % + \ifx\XeTeXrevision\thisisundefined + \ifx\luatexversion\thisisundefined + \ifpdf % pdfTeX + \pdfadjustspacing=0 + \pdfprotrudechars=0 + \fi + \else % LuaTeX + \adjustspacing=0 + \protrudechars=0 + \fi + \else % XeTeX + \XeTeXprotrudechars=0 + \fi +} + +\microtypeON + +\parseargdef\microtype{% + \def\txiarg{#1}% + \ifx\txiarg\onword + \microtypeON + \else\ifx\txiarg\offword + \microtypeOFF + \else + \errhelp = \EMsimple + \errmessage{Unknown @microtype option `\txiarg', must be on|off}% + \fi\fi +} + + \message{and turning on texinfo input format.} \def^^L{\par} % remove \outer, so ^L can appear in an @comment @@ -11420,23 +11573,6 @@ \catcode`\|=\other \def\normalverticalbar{|} \catcode`\~=\other \def\normaltilde{~} -% This macro is used to make a character print one way in \tt -% (where it can probably be output as-is), and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} - -% Same as above, but check for italic font. Actually this also catches -% non-italic slanted fonts since it is impossible to distinguish them from -% italic fonts. But since this is only used by $ and it uses \sl anyway -% this is not a problem. -\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} - % Set catcodes for Texinfo file % Active characters for printing the wanted glyph. diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index 8c3d7f7cf8..870a663505 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -47,6 +47,7 @@ #else # define __canonicalize_file_name canonicalize_file_name # define __realpath realpath +# define __strdup strdup # include "pathmax.h" # define __faccessat faccessat # if defined _WIN32 && !defined __CYGWIN__ @@ -179,27 +180,16 @@ get_path_max (void) return path_max < 0 ? 1024 : path_max <= IDX_MAX ? path_max : IDX_MAX; } -/* Act like __realpath (see below), with an additional argument - rname_buf that can be used as temporary storage. - - If GCC_LINT is defined, do not inline this function with GCC 10.1 - and later, to avoid creating a pointer to the stack that GCC - -Wreturn-local-addr incorrectly complains about. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644 - Although the noinline attribute can hurt performance a bit, no better way - to pacify GCC is known; even an explicit #pragma does not pacify GCC. - When the GCC bug is fixed this workaround should be limited to the - broken GCC versions. */ -# if __GNUC_PREREQ (10, 1) -# if defined GCC_LINT || defined lint -__attribute__ ((__noinline__)) -# elif __OPTIMIZE__ && !__NO_INLINE__ -# define GCC_BOGUS_WRETURN_LOCAL_ADDR -# endif -# endif +/* Scratch buffers used by realpath_stk and managed by __realpath. */ +struct realpath_bufs +{ + struct scratch_buffer rname; + struct scratch_buffer extra; + struct scratch_buffer link; +}; + static char * -realpath_stk (const char *name, char *resolved, - struct scratch_buffer *rname_buf) +realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs) { char *dest; char const *start; @@ -224,12 +214,7 @@ realpath_stk (const char *name, char *resolved, return NULL; } - struct scratch_buffer extra_buffer, link_buffer; - scratch_buffer_init (&extra_buffer); - scratch_buffer_init (&link_buffer); - scratch_buffer_init (rname_buf); - char *rname_on_stack = rname_buf->data; - char *rname = rname_on_stack; + char *rname = bufs->rname.data; bool end_in_extra_buffer = false; bool failed = true; @@ -239,16 +224,16 @@ realpath_stk (const char *name, char *resolved, if (!IS_ABSOLUTE_FILE_NAME (name)) { - while (!__getcwd (rname, rname_buf->length)) + while (!__getcwd (bufs->rname.data, bufs->rname.length)) { if (errno != ERANGE) { dest = rname; goto error; } - if (!scratch_buffer_grow (rname_buf)) - goto error_nomem; - rname = rname_buf->data; + if (!scratch_buffer_grow (&bufs->rname)) + return NULL; + rname = bufs->rname.data; } dest = __rawmemchr (rname, '\0'); start = name; @@ -302,13 +287,13 @@ realpath_stk (const char *name, char *resolved, if (!ISSLASH (dest[-1])) *dest++ = '/'; - while (rname + rname_buf->length - dest + while (rname + bufs->rname.length - dest < startlen + sizeof dir_suffix) { idx_t dest_offset = dest - rname; - if (!scratch_buffer_grow_preserve (rname_buf)) - goto error_nomem; - rname = rname_buf->data; + if (!scratch_buffer_grow_preserve (&bufs->rname)) + return NULL; + rname = bufs->rname.data; dest = rname + dest_offset; } @@ -319,13 +304,13 @@ realpath_stk (const char *name, char *resolved, ssize_t n; while (true) { - buf = link_buffer.data; - idx_t bufsize = link_buffer.length; + buf = bufs->link.data; + idx_t bufsize = bufs->link.length; n = __readlink (rname, buf, bufsize - 1); if (n < bufsize - 1) break; - if (!scratch_buffer_grow (&link_buffer)) - goto error_nomem; + if (!scratch_buffer_grow (&bufs->link)) + return NULL; } if (0 <= n) { @@ -337,7 +322,7 @@ realpath_stk (const char *name, char *resolved, buf[n] = '\0'; - char *extra_buf = extra_buffer.data; + char *extra_buf = bufs->extra.data; idx_t end_idx IF_LINT (= 0); if (end_in_extra_buffer) end_idx = end - extra_buf; @@ -345,13 +330,13 @@ realpath_stk (const char *name, char *resolved, if (INT_ADD_OVERFLOW (len, n)) { __set_errno (ENOMEM); - goto error_nomem; + return NULL; } - while (extra_buffer.length <= len + n) + while (bufs->extra.length <= len + n) { - if (!scratch_buffer_grow_preserve (&extra_buffer)) - goto error_nomem; - extra_buf = extra_buffer.data; + if (!scratch_buffer_grow_preserve (&bufs->extra)) + return NULL; + extra_buf = bufs->extra.data; } if (end_in_extra_buffer) end = extra_buf + end_idx; @@ -403,20 +388,30 @@ realpath_stk (const char *name, char *resolved, error: *dest++ = '\0'; - if (resolved != NULL && dest - rname <= get_path_max ()) - rname = strcpy (resolved, rname); - -error_nomem: - scratch_buffer_free (&extra_buffer); - scratch_buffer_free (&link_buffer); - - if (failed || rname == resolved) + if (resolved != NULL) + { + /* Copy the full result on success or partial result if failure was due + to the path not existing or not being accessible. */ + if ((!failed || errno == ENOENT || errno == EACCES) + && dest - rname <= get_path_max ()) + { + strcpy (resolved, rname); + if (failed) + return NULL; + else + return resolved; + } + if (!failed) + __set_errno (ENAMETOOLONG); + return NULL; + } + else { - scratch_buffer_free (rname_buf); - return failed ? NULL : resolved; + if (failed) + return NULL; + else + return __strdup (bufs->rname.data); } - - return scratch_buffer_dupfree (rname_buf, dest - rname); } /* Return the canonical absolute name of file NAME. A canonical name @@ -433,12 +428,15 @@ realpath_stk (const char *name, char *resolved, char * __realpath (const char *name, char *resolved) { - #ifdef GCC_BOGUS_WRETURN_LOCAL_ADDR - #warning "GCC might issue a bogus -Wreturn-local-addr warning here." - #warning "See ." - #endif - struct scratch_buffer rname_buffer; - return realpath_stk (name, resolved, &rname_buffer); + struct realpath_bufs bufs; + scratch_buffer_init (&bufs.rname); + scratch_buffer_init (&bufs.extra); + scratch_buffer_init (&bufs.link); + char *result = realpath_stk (name, resolved, &bufs); + scratch_buffer_free (&bufs.link); + scratch_buffer_free (&bufs.extra); + scratch_buffer_free (&bufs.rname); + return result; } libc_hidden_def (__realpath) versioned_symbol (libc, __realpath, realpath, GLIBC_2_3); diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 04644bdabe..9af8fd0c57 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -222,6 +222,8 @@ DEFS = @DEFS@ DESLIB = @DESLIB@ DOCMISC_W32 = @DOCMISC_W32@ DUMPING = @DUMPING@ +DYNAMIC_LIB_SECONDARY_SUFFIX = @DYNAMIC_LIB_SECONDARY_SUFFIX@ +DYNAMIC_LIB_SUFFIX = @DYNAMIC_LIB_SUFFIX@ DYNLIB_OBJ = @DYNLIB_OBJ@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ @@ -953,6 +955,7 @@ MKDIR_P = @MKDIR_P@ MODULES_OBJ = @MODULES_OBJ@ MODULES_SECONDARY_SUFFIX = @MODULES_SECONDARY_SUFFIX@ MODULES_SUFFIX = @MODULES_SUFFIX@ +NATIVE_COMPILATION_AOT = @NATIVE_COMPILATION_AOT@ NEXT_ASSERT_H = @NEXT_ASSERT_H@ NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ @@ -1218,6 +1221,8 @@ TERMCAP_OBJ = @TERMCAP_OBJ@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ TOOLKIT_LIBW = @TOOLKIT_LIBW@ +TREE_SITTER_CFLAGS = @TREE_SITTER_CFLAGS@ +TREE_SITTER_LIBS = @TREE_SITTER_LIBS@ UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ @@ -1309,23 +1314,22 @@ gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31_CONDITION = @gl_GNULIB_ENABLE gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c_CONDITION = @gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c_CONDITION@ gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4_CONDITION = @gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4_CONDITION@ gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec_CONDITION = @gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec_CONDITION@ +gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9_CONDITION = @gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9_CONDITION@ gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c_CONDITION = @gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c_CONDITION@ gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1_CONDITION = @gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1_CONDITION@ gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_CONDITION = @gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_CONDITION@ gl_GNULIB_ENABLED_cloexec_CONDITION = @gl_GNULIB_ENABLED_cloexec_CONDITION@ gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b_CONDITION = @gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b_CONDITION@ gl_GNULIB_ENABLED_dirfd_CONDITION = @gl_GNULIB_ENABLED_dirfd_CONDITION@ -gl_GNULIB_ENABLED_dynarray_CONDITION = @gl_GNULIB_ENABLED_dynarray_CONDITION@ gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b_CONDITION = @gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b_CONDITION@ gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866_CONDITION = @gl_GNULIB_ENABLED_ef455225c00f5049c808c2eda3e76866_CONDITION@ gl_GNULIB_ENABLED_euidaccess_CONDITION = @gl_GNULIB_ENABLED_euidaccess_CONDITION@ +gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c_CONDITION = @gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c_CONDITION@ gl_GNULIB_ENABLED_getdtablesize_CONDITION = @gl_GNULIB_ENABLED_getdtablesize_CONDITION@ gl_GNULIB_ENABLED_getgroups_CONDITION = @gl_GNULIB_ENABLED_getgroups_CONDITION@ gl_GNULIB_ENABLED_lchmod_CONDITION = @gl_GNULIB_ENABLED_lchmod_CONDITION@ gl_GNULIB_ENABLED_open_CONDITION = @gl_GNULIB_ENABLED_open_CONDITION@ gl_GNULIB_ENABLED_rawmemchr_CONDITION = @gl_GNULIB_ENABLED_rawmemchr_CONDITION@ -gl_GNULIB_ENABLED_scratch_buffer_CONDITION = @gl_GNULIB_ENABLED_scratch_buffer_CONDITION@ -gl_GNULIB_ENABLED_stdckdint_CONDITION = @gl_GNULIB_ENABLED_stdckdint_CONDITION@ gl_GNULIB_ENABLED_strtoll_CONDITION = @gl_GNULIB_ENABLED_strtoll_CONDITION@ gl_GNULIB_ENABLED_utimens_CONDITION = @gl_GNULIB_ENABLED_utimens_CONDITION@ gl_LIBOBJDEPS = @gl_LIBOBJDEPS@ @@ -1770,43 +1774,6 @@ endif endif ## end gnulib module dup2 -## begin gnulib module dynarray -ifeq (,$(OMIT_GNULIB_MODULE_dynarray)) - -ifneq (,$(gl_GNULIB_ENABLED_dynarray_CONDITION)) -BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h - -malloc/dynarray.gl.h: malloc/dynarray.h - $(AM_V_GEN)$(MKDIR_P) 'malloc' - $(AM_V_at)$(SED_HEADER_STDOUT) \ - -e '/libc_hidden_proto/d' \ - $(srcdir)/malloc/dynarray.h > $@-t - $(AM_V_at)mv $@-t $@ -MOSTLYCLEANFILES += malloc/dynarray.gl.h malloc/dynarray.gl.h-t - -malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c - $(AM_V_GEN)$(MKDIR_P) 'malloc' - $(AM_V_at)$(SED_HEADER_STDOUT) \ - -e 's|||g' \ - -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \ - -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \ - -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' \ - -e 's|__glibc_likely|_GL_LIKELY|g' \ - -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ - $(srcdir)/malloc/dynarray-skeleton.c > $@-t - $(AM_V_at)mv $@-t $@ -MOSTLYCLEANFILES += malloc/dynarray-skeleton.gl.h malloc/dynarray-skeleton.gl.h-t - -libgnu_a_SOURCES += malloc/dynarray_at_failure.c malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c malloc/dynarray_resize.c malloc/dynarray_resize_clear.c - -endif -EXTRA_DIST += dynarray.h malloc/dynarray-skeleton.c malloc/dynarray.h - -EXTRA_libgnu_a_SOURCES += malloc/dynarray-skeleton.c - -endif -## end gnulib module dynarray - ## begin gnulib module eloop-threshold ifeq (,$(OMIT_GNULIB_MODULE_eloop-threshold)) @@ -2251,6 +2218,68 @@ EXTRA_DIST += $(top_srcdir)/build-aux/gitlog-to-changelog endif ## end gnulib module gitlog-to-changelog +## begin gnulib module glibc-internal/dynarray +ifeq (,$(OMIT_GNULIB_MODULE_glibc-internal/dynarray)) + +ifneq (,$(gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c_CONDITION)) +BUILT_SOURCES += malloc/dynarray.gl.h malloc/dynarray-skeleton.gl.h + +malloc/dynarray.gl.h: malloc/dynarray.h + $(AM_V_GEN)$(MKDIR_P) 'malloc' + $(AM_V_at)$(SED_HEADER_STDOUT) \ + -e '/libc_hidden_proto/d' \ + $(srcdir)/malloc/dynarray.h > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += malloc/dynarray.gl.h malloc/dynarray.gl.h-t + +malloc/dynarray-skeleton.gl.h: malloc/dynarray-skeleton.c + $(AM_V_GEN)$(MKDIR_P) 'malloc' + $(AM_V_at)$(SED_HEADER_STDOUT) \ + -e 's|||g' \ + -e 's|__attribute_maybe_unused__|_GL_ATTRIBUTE_MAYBE_UNUSED|g' \ + -e 's|__attribute_nonnull__|_GL_ATTRIBUTE_NONNULL|g' \ + -e 's|__attribute_warn_unused_result__|_GL_ATTRIBUTE_NODISCARD|g' \ + -e 's|__glibc_likely|_GL_LIKELY|g' \ + -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ + $(srcdir)/malloc/dynarray-skeleton.c > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += malloc/dynarray-skeleton.gl.h malloc/dynarray-skeleton.gl.h-t + +libgnu_a_SOURCES += malloc/dynarray_at_failure.c malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c malloc/dynarray_resize.c malloc/dynarray_resize_clear.c + +endif +EXTRA_DIST += dynarray.h malloc/dynarray-skeleton.c malloc/dynarray.h + +EXTRA_libgnu_a_SOURCES += malloc/dynarray-skeleton.c + +endif +## end gnulib module glibc-internal/dynarray + +## begin gnulib module glibc-internal/scratch_buffer +ifeq (,$(OMIT_GNULIB_MODULE_glibc-internal/scratch_buffer)) + +ifneq (,$(gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9_CONDITION)) +BUILT_SOURCES += malloc/scratch_buffer.gl.h + +malloc/scratch_buffer.gl.h: malloc/scratch_buffer.h + $(AM_V_GEN)$(MKDIR_P) 'malloc' + $(AM_V_at)$(SED_HEADER_STDOUT) \ + -e 's|__always_inline|inline _GL_ATTRIBUTE_ALWAYS_INLINE|g' \ + -e 's|__glibc_likely|_GL_LIKELY|g' \ + -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ + -e '/libc_hidden_proto/d' \ + $(srcdir)/malloc/scratch_buffer.h > $@-t + $(AM_V_at)mv $@-t $@ +MOSTLYCLEANFILES += malloc/scratch_buffer.gl.h malloc/scratch_buffer.gl.h-t + +libgnu_a_SOURCES += malloc/scratch_buffer_grow.c malloc/scratch_buffer_grow_preserve.c malloc/scratch_buffer_set_array_size.c + +endif +EXTRA_DIST += malloc/scratch_buffer.h scratch_buffer.h + +endif +## end gnulib module glibc-internal/scratch_buffer + ## begin gnulib module group-member ifeq (,$(OMIT_GNULIB_MODULE_group-member)) @@ -2736,31 +2765,6 @@ EXTRA_DIST += root-uid.h endif ## end gnulib module root-uid -## begin gnulib module scratch_buffer -ifeq (,$(OMIT_GNULIB_MODULE_scratch_buffer)) - -ifneq (,$(gl_GNULIB_ENABLED_scratch_buffer_CONDITION)) -BUILT_SOURCES += malloc/scratch_buffer.gl.h - -malloc/scratch_buffer.gl.h: malloc/scratch_buffer.h - $(AM_V_GEN)$(MKDIR_P) 'malloc' - $(AM_V_at)$(SED_HEADER_STDOUT) \ - -e 's|__always_inline|inline _GL_ATTRIBUTE_ALWAYS_INLINE|g' \ - -e 's|__glibc_likely|_GL_LIKELY|g' \ - -e 's|__glibc_unlikely|_GL_UNLIKELY|g' \ - -e '/libc_hidden_proto/d' \ - $(srcdir)/malloc/scratch_buffer.h > $@-t - $(AM_V_at)mv $@-t $@ -MOSTLYCLEANFILES += malloc/scratch_buffer.gl.h malloc/scratch_buffer.gl.h-t - -libgnu_a_SOURCES += malloc/scratch_buffer_dupfree.c malloc/scratch_buffer_grow.c malloc/scratch_buffer_grow_preserve.c malloc/scratch_buffer_set_array_size.c - -endif -EXTRA_DIST += malloc/scratch_buffer.h scratch_buffer.h - -endif -## end gnulib module scratch_buffer - ## begin gnulib module sig2str ifeq (,$(OMIT_GNULIB_MODULE_sig2str)) @@ -2916,7 +2920,6 @@ endif ## begin gnulib module stdckdint ifeq (,$(OMIT_GNULIB_MODULE_stdckdint)) -ifneq (,$(gl_GNULIB_ENABLED_stdckdint_CONDITION)) BUILT_SOURCES += $(STDCKDINT_H) # We need the following in order to create when the system @@ -2932,7 +2935,6 @@ stdckdint.h: $(top_builddir)/config.status endif MOSTLYCLEANFILES += stdckdint.h stdckdint.h-t -endif EXTRA_DIST += intprops-internal.h stdckdint.in.h endif diff --git a/lib/malloc/scratch_buffer.h b/lib/malloc/scratch_buffer.h index e4c5c8a85d..a9bdcadec2 100644 --- a/lib/malloc/scratch_buffer.h +++ b/lib/malloc/scratch_buffer.h @@ -132,20 +132,4 @@ scratch_buffer_set_array_size (struct scratch_buffer *buffer, (buffer, nelem, size)); } -/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block, - deallocating *BUFFER if it was heap-allocated. SIZE must be at - most *BUFFER's size. Return NULL (setting errno) on memory - exhaustion. */ -void *__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, - size_t size); -libc_hidden_proto (__libc_scratch_buffer_dupfree) - -/* Alias for __libc_scratch_dupfree. */ -static __always_inline void * -scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) -{ - void *r = __libc_scratch_buffer_dupfree (buffer, size); - return __glibc_likely (r != NULL) ? r : NULL; -} - #endif /* _SCRATCH_BUFFER_H */ diff --git a/lib/scratch_buffer.h b/lib/scratch_buffer.h index f4fe5e8d34..c0aa21630f 100644 --- a/lib/scratch_buffer.h +++ b/lib/scratch_buffer.h @@ -98,20 +98,10 @@ #define _GL_SCRATCH_BUFFER_H size_t nelem, size_t size); #endif -/* Return a copy of *BUFFER's first SIZE bytes as a heap-allocated block, - deallocating *BUFFER if it was heap-allocated. SIZE must be at - most *BUFFER's size. Return NULL (setting errno) on memory - exhaustion. */ -#if 0 -extern void *scratch_buffer_dupfree (struct scratch_buffer *buffer, - size_t size); -#endif - /* The implementation is imported from glibc. */ /* Avoid possible conflicts with symbols exported by the GNU libc. */ -#define __libc_scratch_buffer_dupfree gl_scratch_buffer_dupfree #define __libc_scratch_buffer_grow gl_scratch_buffer_grow #define __libc_scratch_buffer_grow_preserve gl_scratch_buffer_grow_preserve #define __libc_scratch_buffer_set_array_size gl_scratch_buffer_set_array_size diff --git a/lib/stat-time.h b/lib/stat-time.h index 6b0088e328..b661196ea5 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -20,9 +20,8 @@ #ifndef STAT_TIME_H #define STAT_TIME_H 1 -#include "intprops.h" - #include +#include #include #include #include @@ -232,7 +231,7 @@ stat_time_normalize (int result, _GL_UNUSED struct stat *st) /* Overflow is possible, as Solaris 11 stat can yield tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ - if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec)) + if (ckd_add (&ts->tv_sec, q, ts->tv_sec)) { errno = EOVERFLOW; return -1; diff --git a/m4/assert_h.m4 b/m4/assert_h.m4 index c1306daef4..e892ea2f01 100644 --- a/m4/assert_h.m4 +++ b/m4/assert_h.m4 @@ -57,5 +57,11 @@ AC_DEFUN && __GNUG__ < 6 && __clang_major__ < 6))) #include #undef/**/assert + /* Solaris 11.4 defines static_assert as a macro with 2 arguments. + We need it also to be invocable with a single argument. */ + #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus + #undef static_assert + #define static_assert _Static_assert + #endif #endif]) ]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index f1ac499132..1a8bf8b7cd 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -77,7 +77,6 @@ AC_DEFUN # Code from module dtoastr: # Code from module dtotimespec: # Code from module dup2: - # Code from module dynarray: # Code from module eloop-threshold: # Code from module environ: # Code from module errno: @@ -115,6 +114,8 @@ AC_DEFUN # Code from module gettime: # Code from module gettimeofday: # Code from module gitlog-to-changelog: + # Code from module glibc-internal/dynarray: + # Code from module glibc-internal/scratch_buffer: # Code from module group-member: # Code from module idx: # Code from module ieee754-h: @@ -159,7 +160,6 @@ AC_DEFUN # Code from module realloc-posix: # Code from module regex: # Code from module root-uid: - # Code from module scratch_buffer: # Code from module sig2str: # Code from module sigdescr_np: # Code from module signal-h: @@ -492,6 +492,14 @@ AC_DEFUN gl_CONDITIONAL_HEADER([stdalign.h]) AC_PROG_MKDIR_P gl_C_BOOL + AC_CHECK_HEADERS_ONCE([stdckdint.h]) + if test $ac_cv_header_stdckdint_h = yes; then + GL_GENERATE_STDCKDINT_H=false + else + GL_GENERATE_STDCKDINT_H=true + fi + gl_CONDITIONAL_HEADER([stdckdint.h]) + AC_PROG_MKDIR_P gl_STDDEF_H gl_STDDEF_H_REQUIRE_DEFAULTS gl_CONDITIONAL_HEADER([stddef.h]) @@ -620,12 +628,13 @@ AC_DEFUN gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b=false gl_gnulib_enabled_cloexec=false gl_gnulib_enabled_dirfd=false - gl_gnulib_enabled_dynarray=false gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c=false gl_gnulib_enabled_euidaccess=false gl_gnulib_enabled_getdtablesize=false gl_gnulib_enabled_getgroups=false gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false + gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c=false + gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9=false gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1=false gl_gnulib_enabled_lchmod=false gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b=false @@ -637,8 +646,6 @@ AC_DEFUN gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b=false gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=false gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=false - gl_gnulib_enabled_scratch_buffer=false - gl_gnulib_enabled_stdckdint=false gl_gnulib_enabled_strtoll=false gl_gnulib_enabled_utimens=false gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=false @@ -672,13 +679,6 @@ AC_DEFUN gl_gnulib_enabled_dirfd=true fi } - func_gl_gnulib_m4code_dynarray () - { - if ! $gl_gnulib_enabled_dynarray; then - AC_PROG_MKDIR_P - gl_gnulib_enabled_dynarray=true - fi - } func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c () { if ! $gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c; then @@ -735,6 +735,22 @@ AC_DEFUN gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true fi } + func_gl_gnulib_m4code_fd38c7e463b54744b77b98aeafb4fa7c () + { + if ! $gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c; then + AC_PROG_MKDIR_P + gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c=true + fi + } + func_gl_gnulib_m4code_8444034ea779b88768865bb60b4fb8c9 () + { + if ! $gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9; then + AC_PROG_MKDIR_P + gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9=true + func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 + func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4 + fi + } func_gl_gnulib_m4code_a9786850e999ae65a836a6041e8e5ed1 () { if ! $gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1; then @@ -751,9 +767,6 @@ AC_DEFUN if test $HAVE_GROUP_MEMBER = 0; then func_gl_gnulib_m4code_d3b2383720ee0e541357aa2aac598e2b fi - if test $HAVE_GROUP_MEMBER = 0; then - func_gl_gnulib_m4code_stdckdint - fi fi } func_gl_gnulib_m4code_lchmod () @@ -882,29 +895,6 @@ AC_DEFUN gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c=true fi } - func_gl_gnulib_m4code_scratch_buffer () - { - if ! $gl_gnulib_enabled_scratch_buffer; then - AC_PROG_MKDIR_P - gl_gnulib_enabled_scratch_buffer=true - func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866 - func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4 - fi - } - func_gl_gnulib_m4code_stdckdint () - { - if ! $gl_gnulib_enabled_stdckdint; then - AC_CHECK_HEADERS_ONCE([stdckdint.h]) - if test $ac_cv_header_stdckdint_h = yes; then - GL_GENERATE_STDCKDINT_H=false - else - GL_GENERATE_STDCKDINT_H=true - fi - gl_CONDITIONAL_HEADER([stdckdint.h]) - AC_PROG_MKDIR_P - gl_gnulib_enabled_stdckdint=true - fi - } func_gl_gnulib_m4code_strtoll () { if ! $gl_gnulib_enabled_strtoll; then @@ -935,10 +925,10 @@ AC_DEFUN func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c fi if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then - func_gl_gnulib_m4code_rawmemchr + func_gl_gnulib_m4code_8444034ea779b88768865bb60b4fb8c9 fi if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then - func_gl_gnulib_m4code_scratch_buffer + func_gl_gnulib_m4code_rawmemchr fi if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b @@ -992,7 +982,7 @@ AC_DEFUN func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7 fi if test $ac_use_included_regex = yes; then - func_gl_gnulib_m4code_dynarray + func_gl_gnulib_m4code_fd38c7e463b54744b77b98aeafb4fa7c fi if { test $HAVE_DECL_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes; then func_gl_gnulib_m4code_strtoll @@ -1013,12 +1003,13 @@ AC_DEFUN AM_CONDITIONAL([gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b], [$gl_gnulib_enabled_260941c0e5dc67ec9e87d1fb321c300b]) AM_CONDITIONAL([gl_GNULIB_ENABLED_cloexec], [$gl_gnulib_enabled_cloexec]) AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_dynarray], [$gl_gnulib_enabled_dynarray]) AM_CONDITIONAL([gl_GNULIB_ENABLED_925677f0343de64b89a9f0c790b4104c], [$gl_gnulib_enabled_925677f0343de64b89a9f0c790b4104c]) AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], [$gl_gnulib_enabled_euidaccess]) AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], [$gl_gnulib_enabled_getdtablesize]) AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups]) AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c], [$gl_gnulib_enabled_fd38c7e463b54744b77b98aeafb4fa7c]) + AM_CONDITIONAL([gl_GNULIB_ENABLED_8444034ea779b88768865bb60b4fb8c9], [$gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9]) AM_CONDITIONAL([gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1], [$gl_gnulib_enabled_a9786850e999ae65a836a6041e8e5ed1]) AM_CONDITIONAL([gl_GNULIB_ENABLED_lchmod], [$gl_gnulib_enabled_lchmod]) AM_CONDITIONAL([gl_GNULIB_ENABLED_e80bf6f757095d2e5fc94dafb8f8fc8b], [$gl_gnulib_enabled_e80bf6f757095d2e5fc94dafb8f8fc8b]) @@ -1030,8 +1021,6 @@ AC_DEFUN AM_CONDITIONAL([gl_GNULIB_ENABLED_d3b2383720ee0e541357aa2aac598e2b], [$gl_gnulib_enabled_d3b2383720ee0e541357aa2aac598e2b]) AM_CONDITIONAL([gl_GNULIB_ENABLED_61bcaca76b3e6f9ae55d57a1c3193bc4], [$gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4]) AM_CONDITIONAL([gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c], [$gl_gnulib_enabled_6099e9737f757db36c47fa9d9f02e88c]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_scratch_buffer], [$gl_gnulib_enabled_scratch_buffer]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_stdckdint], [$gl_gnulib_enabled_stdckdint]) AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll]) AM_CONDITIONAL([gl_GNULIB_ENABLED_utimens], [$gl_gnulib_enabled_utimens]) AM_CONDITIONAL([gl_GNULIB_ENABLED_682e609604ccaac6be382e4ee3a4eaec], [$gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec]) @@ -1320,7 +1309,6 @@ AC_DEFUN lib/malloc/dynarray_resize.c lib/malloc/dynarray_resize_clear.c lib/malloc/scratch_buffer.h - lib/malloc/scratch_buffer_dupfree.c lib/malloc/scratch_buffer_grow.c lib/malloc/scratch_buffer_grow_preserve.c lib/malloc/scratch_buffer_set_array_size.c diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index 0aa8c53f9e..8282a371e4 100644 --- a/m4/pthread_sigmask.m4 +++ b/m4/pthread_sigmask.m4 @@ -215,6 +215,7 @@ AC_DEFUN LIBS="$LIBS $LIBMULTITHREAD"]) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ +#include #include #include #include @@ -230,14 +231,16 @@ AC_DEFUN int main () { sigset_t set; - int pid = getpid (); + pid_t pid = getpid (); char command[80]; + if (LONG_MAX < pid) + return 6; signal (SIGINT, sigint_handler); sigemptyset (&set); sigaddset (&set, SIGINT); if (!(pthread_sigmask (SIG_BLOCK, &set, NULL) == 0)) return 1; - sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid); + sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid); if (!(system (command) == 0)) return 2; sleep (2); commit d440ca47ed6251f134e87386853798228983dd85 Author: Eli Zaretskii Date: Sat Nov 26 17:50:36 2022 +0200 ; * src/treesit.c: Fix typos and wording in comments. diff --git a/src/treesit.c b/src/treesit.c index c910aea1da..ad7e43fbc5 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -767,49 +767,49 @@ treesit_record_change (ptrdiff_t start_byte, ptrdiff_t old_end_byte, } } -/* Comment (ref:visible-beg-null) So the purpose of visible_beg/end - are to keep track of "which part of the buffer does the tree-sitter - tree sees", in order to update the tree correctly. Visible_beg/end - has two purposes: "clips" buffer changes within them, and translate - position in buffer to position in the tree (buf position - visi_beg - = tree position). +/* Comment (ref:visible-beg-null) The purpose of visible_beg/end is to + keep track of "which part of the buffer does the tree-sitter tree + see", in order to update the tree correctly. Visible_beg/end have + two purposes: they "clip" buffer changes within them, and they + translate positions in the buffer to positions in the tree + (buffer position - visible_beg = tree position). - Conceptually, visible_beg/end marks the visible region of the - buffer when we last reparsed. In between two reparse, we don't - really care if the visible region of the buffer changes. + Conceptually, visible_beg/end hold the visible region of the buffer + when we last reparsed. In-between two reparses, we don't really + care if the visible region of the buffer changes. Right before we reparse, we make tree-sitter's visible region - matches that of the buffer, and update visible_beg/end. + match that of the buffer, and update visible_beg/end. - That is, the whole purpose of visible_beg/end (and + That is, the whole purpose of visible_beg/end (and also of treesit_record_change and treesit_sync_visible_region) is to update the tree (by ts_tree_edit). So if the tree is NULL, visible_beg/end are considered uninitialized. Only when we already have a tree, do we need to keep track of position changes and - update it correctly, so it can be feed into ts_parser_parse as the - old tree, so that tree-sitter only parses the changed part (aka - incremental). + update it correctly, so it can be fed into ts_parser_parse as the + old tree, so that tree-sitter will only parse the changed part, + incrementally. In a nutshell, tree-sitter incremental parsing in Emacs looks like: - treesit_record_change(tree) \ - treesit_record_change(tree) | user edits buffer - ... / + treesit_record_change (tree) \ + treesit_record_change (tree) | user edits buffer + ... / - treesit_sync_visible_region(tree) \ treesit_ensure_parsed - ts_parser_parse(tree) -> tree / + treesit_sync_visible_region (tree) \ treesit_ensure_parsed + ts_parser_parse(tree) -> tree / - treesit_record_change(tree) \ - treesit_record_change(tree) | user edits buffer - ... / + treesit_record_change (tree) \ + treesit_record_change (tree) | user edits buffer + ... / and so on. */ /* Make sure the tree's visible range is in sync with the buffer's visible range, and PARSER's visible_beg and visible_end are in sync with BUF_BEGV_BYTE and BUG_ZV_BYTE. When calling this function you - must make sure the current buffer's size is not larger than - UINT32_MAX. Basically always call treesit_check_buffer_size before + must make sure the current buffer's size in bytes is not larger than + UINT32_MAX. Basically, always call treesit_check_buffer_size before this function. */ static void treesit_sync_visible_region (Lisp_Object parser) @@ -1413,7 +1413,7 @@ treesit_check_range_argument (Lisp_Object ranges) } /* Generate a list of ranges in Lisp from RANGES. Assumes tree-sitter - tree and the buffer has the same visible region (w.r.t narrowing). + tree and the buffer has the same visible region (wrt narrowing). This function doesn't take ownership of RANGES. BUFFER is used to convert between tree-sitter buffer offset and buffer position. */ static Lisp_Object commit a22671dbd03738ddf619161370fd2679e8a8ef46 Author: Juanma Barranquero Date: Sat Nov 26 15:34:07 2022 +0100 ; doc fix: Use w32-* names instead of obsolete ones * doc/emacs/msdos.texi (Text and Binary): Describe w32-(add|remove)-untranslated-fiesystem functions by their non-obsolete name. diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi index dd0787cd38..d55c751210 100644 --- a/doc/emacs/msdos.texi +++ b/doc/emacs/msdos.texi @@ -206,40 +206,40 @@ Text and Binary @code{dos2unix} program. @cindex untranslated file system -@findex add-untranslated-filesystem +@findex w32-add-untranslated-filesystem When you use NFS, Samba, or some other similar method to access file systems that reside on computers using GNU or Unix systems, Emacs should not perform end-of-line translation on any files in these file systems---not even when you create a new file. To request this, designate these file systems as @dfn{untranslated} file systems by -calling the function @code{add-untranslated-filesystem}. It takes one -argument: the file system name, including a drive letter and +calling the function @code{w32-add-untranslated-filesystem}. It takes +one argument: the file system name, including a drive letter and optionally a directory. For example, @example -(add-untranslated-filesystem "Z:") +(w32-add-untranslated-filesystem "Z:") @end example @noindent designates drive Z as an untranslated file system, and @example -(add-untranslated-filesystem "Z:\\foo") +(w32-add-untranslated-filesystem "Z:\\foo") @end example @noindent designates directory @file{\foo} on drive Z as an untranslated file system. - Most often you would use @code{add-untranslated-filesystem} in your + Most often you would use @code{w32-add-untranslated-filesystem} in your @file{.emacs} or @file{init.el} init file, or in @file{site-start.el} so that all the users at your site get the benefit of it. -@findex remove-untranslated-filesystem - To countermand the effect of @code{add-untranslated-filesystem}, use -the function @code{remove-untranslated-filesystem}. This function takes -one argument, which should be a string just like the one that was used -previously with @code{add-untranslated-filesystem}. +@findex w32-remove-untranslated-filesystem + To countermand the effect of @code{w32-add-untranslated-filesystem}, +use the function @code{w32-remove-untranslated-filesystem}. This +function takes one argument, which should be a string just like the +one that was used previously with @code{w32-add-untranslated-filesystem}. Designating a file system as untranslated does not affect character set conversion, only end-of-line conversion. Essentially, it directs commit bd5aa073d4d7223b229faf7a5e2731aa85cc1687 Author: Stefan Kangas Date: Sat Nov 26 15:47:33 2022 +0100 ; Don't mention Makefiles twice in `(emacs) Program Modes` * doc/emacs/programs.texi (Program Modes): Don't mention Makefiles twice. (Bug#59610) diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 0a05b71860..ba8475e86a 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -96,8 +96,8 @@ Program Modes Python, Ruby, Simula, SQL, Tcl, TypeScript, Verilog, and VHDL@. An alternative mode for Perl is called CPerl mode. Modes are also available for the scripting languages of the common GNU and Unix -shells, and MS-DOS/MS-Windows @samp{BAT} files, and for makefiles, -JSON, DNS master files, and various sorts of configuration files. +shells, and MS-DOS/MS-Windows @samp{BAT} files, JSON, DNS master +files, and various sorts of configuration files. Ideally, Emacs should have a major mode for each programming language that you might want to edit. If it doesn't have a mode for commit 6e824030131893c50c65a45d530ee38113708f45 Author: Xi Lu Date: Sat Nov 26 21:02:19 2022 +0800 ; Clean up unused function: cuserid * lib-src/ntlib.c (cuserid): Remove unused function. diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index ee21abc723..e0d5f0c6b8 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c @@ -138,15 +138,6 @@ getlogin (void) return NULL; } -char * -cuserid (char * s) -{ - char * name = getlogin (); - if (s) - return strcpy (s, name ? name : ""); - return name; -} - unsigned getuid (void) { diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h index 2cd2b1d107..ff85beeaa6 100644 --- a/lib-src/ntlib.h +++ b/lib-src/ntlib.h @@ -33,7 +33,6 @@ char *getwd (char *dir); int getppid (void); char * getlogin (void); -char * cuserid (char * s); unsigned getegid (void); unsigned getgid (void); int setuid (unsigned uid); commit 78ccae44474412fee13b50b391394f4c9bed84af Author: Stefan Kangas Date: Sat Nov 26 14:54:25 2022 +0100 ; * doc/emacs/programs.texi (Program Modes): Improve indexing. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index e18533b3b7..0a05b71860 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -83,6 +83,11 @@ Program Modes @cindex DNS mode @cindex Javascript mode @cindex Awk mode +@cindex C# mode +@cindex IDLWAVE mode +@cindex JSON mode +@cindex SQL mode +@cindex TypeScript mode Emacs has programming language modes for Lisp, Scheme, the Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++, C#, Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles, commit 9319c124c92503d12ba3bfea001a4b88eae4ed31 Author: Stefan Kangas Date: Sat Nov 26 14:27:53 2022 +0100 Mention new programming language support in manual * doc/emacs/programs.texi (Program Modes): Mention newly added support for C#, TypeScript and JSON. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index c7f497c652..e18533b3b7 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -84,15 +84,15 @@ Program Modes @cindex Javascript mode @cindex Awk mode Emacs has programming language modes for Lisp, Scheme, the -Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++, +Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++, C#, Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles, Metafont (@TeX{}'s companion for font creation), Modula2, Object Pascal, Objective-C, Octave, Pascal, Perl, Pike, PostScript, Prolog, -Python, Ruby, Simula, SQL, Tcl, Verilog, and VHDL@. An alternative -mode for Perl is called CPerl mode. Modes are also available for the -scripting languages of the common GNU and Unix shells, and -MS-DOS/MS-Windows @samp{BAT} files, and for makefiles, DNS master -files, and various sorts of configuration files. +Python, Ruby, Simula, SQL, Tcl, TypeScript, Verilog, and VHDL@. An +alternative mode for Perl is called CPerl mode. Modes are also +available for the scripting languages of the common GNU and Unix +shells, and MS-DOS/MS-Windows @samp{BAT} files, and for makefiles, +JSON, DNS master files, and various sorts of configuration files. Ideally, Emacs should have a major mode for each programming language that you might want to edit. If it doesn't have a mode for commit 65f355a0ad3f007987190b5852876246fcafa921 Author: Stefan Kangas Date: Sat Nov 26 10:24:20 2022 +0100 ; Fix typos diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index f86465fed7..e165adbb49 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi @@ -1045,7 +1045,7 @@ SASL @defopt erc-sasl-password As noted elsewhere, the @code{:password} parameter for @code{erc-tls} -was orignally intended for traditional ``server passwords,'' but these +was originally intended for traditional ``server passwords,'' but these aren't really used any more. As such, this option defaults to borrowing that parameter for its own uses, thus allowing you to call @code{erc-tls} with @code{:password} set to your NickServ password. diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index e82e72e8a3..a544a4b5cb 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -50,7 +50,7 @@ csharp (eval-and-compile (defconst csharp--regex-identifier "[A-Za-z][A-Za-z0-9_]*" - "Regex describing an dentifier in C#.") + "Regex describing an identifier in C#.") (defconst csharp--regex-identifier-matcher (concat "\\(" csharp--regex-identifier "\\)") diff --git a/test/lisp/erc/resources/base/local-modules/third.eld b/test/lisp/erc/resources/base/local-modules/third.eld index 060083656a..19bdd6efcc 100644 --- a/test/lisp/erc/resources/base/local-modules/third.eld +++ b/test/lisp/erc/resources/base/local-modules/third.eld @@ -35,7 +35,7 @@ (0.00 ":irc.foonet.org 324 tester` #chan +nt") (0.02 ":irc.foonet.org 329 tester` #chan 1668985854") (0.00 ":alice!~u@2fzfcku68ehqa.irc PRIVMSG #chan :bob: No remedy, my lord, when walls are so wilful to hear without warning.") - (0.01 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: Let our reciprocal vows be remembered. You have many opportunities to cut him off; if your will want not, time and place will be fruitfully offered. There is nothing done if he return the conqueror; then am I the prisoner, and his bed my gaol; from the loathed warmth whereof deliver me, and supply the place for your labour.")) + (0.01 ":bob!~u@2fzfcku68ehqa.irc PRIVMSG #chan :alice: Let our reciprocal vows be remembered. You have many opportunities to cut him off; if your will want not, time and place will be fruitfully offered. There is nothing done if he return the conqueror; then am I the prisoner, and his bed my gaol; from the loathed warmth whereof deliver me, and supply the place for your labor.")) ((quit 1 "QUIT :\2ERC\2") (0.03 ":tester`!~u@u9iqi96sfwk9s.irc QUIT :Quit")) commit 24c06a92e96e53438e45a9b5f7ae34647ab76643 Author: Augusto Stoffel Date: Tue Oct 11 20:21:34 2022 +0200 In project-find-file and the like, add absolute file name to history * lisp/progmodes/project.el (project--read-file-cpd-relative): Add absolute file name to history. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 71061e6139..5b8648031f 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -947,11 +947,15 @@ project--read-file-cpd-relative (_ (when included-cpd (setq substrings (cons "./" substrings)))) (new-collection (project--file-completion-table substrings)) - (res (project--completing-read-strict prompt - new-collection - predicate - hist mb-default))) - (concat common-parent-directory res))) + (relname (let ((history-add-new-input nil)) + (project--completing-read-strict prompt + new-collection + predicate + hist mb-default))) + (absname (expand-file-name relname common-parent-directory))) + (when (and hist history-add-new-input) + (add-to-history hist absname)) + absname)) (defun project--read-file-absolute (prompt all-files &optional predicate commit b84408647c43e9eed40b16153d0a0623dfa700c3 Author: Eli Zaretskii Date: Sat Nov 26 13:56:30 2022 +0200 Improve documentation of some posn-* functions * lisp/subr.el (posn-object-x-y): Doc fix. * doc/lispref/commands.texi (Click Events): More accurate documentation of what are DX and DY in POSITION. diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 377b433cae..662de29d45 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -1676,10 +1676,14 @@ Click Events this is @code{nil}. @item @var{dx}, @var{dy} -These are the pixel coordinates of the click, relative to the top left -corner of @var{object}, which is @code{(0 . 0)}. If @var{object} is -@code{nil}, which stands for a buffer, the coordinates are relative to -the top left corner of the character glyph clicked on. +These are the pixel offsets of the click relative to the top left +corner of the @var{object}'s glyph that is the nearest one to the +click. The relevant @var{object}s can be either a buffer, or a string, +or an image, see above. If @var{object} is @code{nil} or a string, +the coordinates are relative to the top left corner of the character +glyph clicked on. Note that the offsets are always zero on text-mode +frames, when @var{object} is @code{nil}, since each glyph there is +considered to have exactly 1x1 pixel dimensions. @item @var{width}, @var{height} If the click is on a character, either from buffer text or from diff --git a/lisp/subr.el b/lisp/subr.el index 261ec512d8..4f671de918 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1792,10 +1792,11 @@ posn-object (or (posn-image position) (posn-string position))) (defsubst posn-object-x-y (position) - "Return the x and y coordinates relative to the object of POSITION. + "Return the x and y coordinates relative to the glyph of object of POSITION. The return value has the form (DX . DY), where DX and DY are -given in pixels. POSITION should be a list of the form returned -by `event-start' and `event-end'." +given in pixels, and they are relative to the top-left corner of +the clicked glyph of object at POSITION. POSITION should be a +list of the form returned by `event-start' and `event-end'." (nth 8 position)) (defsubst posn-object-width-height (position) commit b3c9840066c90dfa051a9f525461914e92a4621d Merge: 4dec4aadf6 5281e85513 Author: Eli Zaretskii Date: Sat Nov 26 13:55:56 2022 +0200 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 4dec4aadf6e3c20aac0b19210e8ed9508cee9399 Author: Eli Zaretskii Date: Sat Nov 26 12:59:06 2022 +0200 Fix generation of autoloads on MS-Windows * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--file-load-name): Handle the case when FILE and OUTFILE don't share any common ancestor directory. (Bug#59507) diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index ecc5f7e47b..2dd04174f5 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -108,21 +108,26 @@ loaddefs-generate--file-load-name (let* ((name (file-relative-name file (file-name-directory outfile))) (names '()) (dir (file-name-directory outfile))) - ;; If `name' has directory components, only keep the - ;; last few that are really needed. - (while name - (setq name (directory-file-name name)) - (push (file-name-nondirectory name) names) - (setq name (file-name-directory name))) - (while (not name) - (cond - ((null (cdr names)) (setq name (car names))) - ((file-exists-p (expand-file-name "subdirs.el" dir)) - ;; FIXME: here we only check the existence of subdirs.el, - ;; without checking its content. This makes it generate wrong load - ;; names for cases like lisp/term which is not added to load-path. - (setq dir (expand-file-name (pop names) dir))) - (t (setq name (mapconcat #'identity names "/"))))) + ;; If `name' lives inside an ancestor directory of OUTFILE, only + ;; keep the last few leading directories that are really needed. + ;; (It will always live in an ancestor directory of OUTFILE on + ;; Posix systems, but on DOS/Windows it could not be, if FILE and + ;; OUTFILE are on different drives.) + (when (not (file-name-absolute-p name)) + (while name + (setq name (directory-file-name name)) + (push (file-name-nondirectory name) names) + (setq name (file-name-directory name))) + (while (not name) + (cond + ((null (cdr names)) (setq name (car names))) + ((file-exists-p (expand-file-name "subdirs.el" dir)) + ;; FIXME: here we only check the existence of subdirs.el, + ;; without checking its content. This makes it generate + ;; wrong load names for cases like lisp/term which is not + ;; added to load-path. + (setq dir (expand-file-name (pop names) dir))) + (t (setq name (mapconcat #'identity names "/")))))) (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name) (substring name 0 (match-beginning 0)) name))) commit 5281e85513bae95bd4a6fce59b6acd0343e3d6bc Author: Po Lu Date: Sat Nov 26 18:57:34 2022 +0800 Reduce wasted cycles in x*.c * src/xfns.c (compute_tip_xy, Fx_show_tip): * src/xselect.c (x_own_selection, x_get_local_selection) (x_clear_frame_selections): Call CAR and CDR, not Fcar and Fcdr. diff --git a/src/xfns.c b/src/xfns.c index fa2c0751d9..36b51a3011 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -8455,10 +8455,10 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, int min_x, min_y, max_x, max_y = -1; /* User-specified position? */ - left = Fcdr (Fassq (Qleft, parms)); - top = Fcdr (Fassq (Qtop, parms)); - right = Fcdr (Fassq (Qright, parms)); - bottom = Fcdr (Fassq (Qbottom, parms)); + left = CDR (Fassq (Qleft, parms)); + top = CDR (Fassq (Qtop, parms)); + right = CDR (Fassq (Qright, parms)); + bottom = CDR (Fassq (Qbottom, parms)); /* Move the tooltip window where the mouse pointer is. Resize and show it. */ @@ -8824,14 +8824,14 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, for (tail = parms; CONSP (tail); tail = XCDR (tail)) { elt = XCAR (tail); - parm = Fcar (elt); + parm = CAR (elt); /* The left, top, right and bottom parameters are handled by compute_tip_xy so they can be ignored here. */ if (!EQ (parm, Qleft) && !EQ (parm, Qtop) && !EQ (parm, Qright) && !EQ (parm, Qbottom)) { last = Fassq (parm, tip_last_parms); - if (NILP (Fequal (Fcdr (elt), Fcdr (last)))) + if (NILP (Fequal (CDR (elt), CDR (last)))) { /* We lost, delete the old tooltip. */ delete = true; @@ -8852,9 +8852,9 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, for (tail = tip_last_parms; CONSP (tail); tail = XCDR (tail)) { elt = XCAR (tail); - parm = Fcar (elt); + parm = CAR (elt); if (!EQ (parm, Qleft) && !EQ (parm, Qtop) && !EQ (parm, Qright) - && !EQ (parm, Qbottom) && !NILP (Fcdr (elt))) + && !EQ (parm, Qbottom) && !NILP (CDR (elt))) { /* We lost, delete the old tooltip. */ delete = true; @@ -8975,8 +8975,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, make_fixnum (w->pixel_height), Qnil, Qnil); /* Add the frame's internal border to calculated size. */ - width = XFIXNUM (Fcar (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); - height = XFIXNUM (Fcdr (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); + width = XFIXNUM (CAR (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); + height = XFIXNUM (CDR (size)) + 2 * FRAME_INTERNAL_BORDER_WIDTH (tip_f); /* Calculate position of tooltip frame. */ compute_tip_xy (tip_f, parms, dx, dy, width, height, &root_x, &root_y); diff --git a/src/xselect.c b/src/xselect.c index a381fa2352..844ef7220a 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -308,7 +308,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, /* We know it's not the CAR, so it's easy. */ Lisp_Object rest = dpyinfo->terminal->Vselection_alist; for (; CONSP (rest); rest = XCDR (rest)) - if (EQ (prev_value, Fcar (XCDR (rest)))) + if (EQ (prev_value, CAR (XCDR (rest)))) { XSETCDR (rest, XCDR (XCDR (rest))); break; @@ -369,7 +369,7 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, specbind (Qinhibit_quit, Qt); CHECK_SYMBOL (target_type); - handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist)); + handler_fn = CDR (Fassq (target_type, Vselection_converter_alist)); if (CONSP (handler_fn)) handler_fn = XCDR (handler_fn); @@ -1129,14 +1129,14 @@ x_clear_frame_selections (struct frame *f) while (CONSP (t->Vselection_alist) && EQ (frame, XCAR (XCDR (XCDR (XCDR (XCAR (t->Vselection_alist))))))) { - selection = Fcar (Fcar (t->Vselection_alist)); + selection = CAR (CAR (t->Vselection_alist)); if (!x_should_preserve_selection (selection)) /* Run the `x-lost-selection-functions' abnormal hook. */ CALLN (Frun_hook_with_args, Qx_lost_selection_functions, selection); else - lost = Fcons (Fcar (t->Vselection_alist), lost); + lost = Fcons (CAR (t->Vselection_alist), lost); tset_selection_alist (t, XCDR (t->Vselection_alist)); } commit 2eccd6eb5f30749fa63d7366b235356e7b4fdfcd Author: Michael Heerdegen Date: Sun Oct 23 03:29:44 2022 +0200 ; Fix some typos * doc/emacs/programs.texi (Programming Language Doc): * lisp/wid-edit.el (lazy): Fix typos. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 6abf29c009..c7f497c652 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1419,7 +1419,7 @@ Programming Language Doc This abnormal hook's value is a list of functions that can produce documentation for the symbol at point as appropriate for the current buffer's major-mode. These functions act as a collection of backends -for ElDoc. Major mode register their documentation lookup functions +for ElDoc. Major modes register their documentation lookup functions with ElDoc by adding their functions to the buffer-local value of this variable. @end vtable diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 4d9663cea9..cc7926c3c5 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3816,7 +3816,7 @@ 'lazy The :type parameter takes the same arguments as the defcustom parameter with the same name. -Most composite widgets, i.e. widgets containing other widgets, does +Most composite widgets, i.e. widgets containing other widgets, do not allow recursion. That is, when you define a new widget type, none of the inferior widgets may be of the same type you are currently defining. commit 34256906aa885d8929f17ab08b0748586b05ef06 Author: Eli Zaretskii Date: Sat Nov 26 10:55:49 2022 +0200 ; Add doc string to 'ucs-normalize-string' * lisp/international/ucs-normalize.el (ucs-normalize-string): Add a doc string. (Bug#59603) diff --git a/lisp/international/ucs-normalize.el b/lisp/international/ucs-normalize.el index bc32b4f073..b6545faf80 100644 --- a/lisp/international/ucs-normalize.el +++ b/lisp/international/ucs-normalize.el @@ -531,6 +531,7 @@ ucs-normalize-region ;; -------------------------------------------------------------------------------- (defmacro ucs-normalize-string (ucs-normalize-region) + "Normalize string STR using the function UCS-NORMALIZE-REGION." `(with-temp-buffer (insert str) (,ucs-normalize-region (point-min) (point-max)) commit 30d4011b8a43f29cdda2eeea95cce17fa1435bf1 Author: Stefan Kangas Date: Sat Nov 26 09:37:48 2022 +0100 Use substitute-command-keys in Info-index error * lisp/info.el (info--ensure-not-in-directory-node): New helper function using substitute-command-keys for error message. (Info-index, Info-virtual-index): Use it. diff --git a/lisp/info.el b/lisp/info.el index 8860a664bd..7d44a1cec1 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -3329,6 +3329,12 @@ Info-goto-index (or node (error "No index")) (Info-goto-node node))) +(defun info--ensure-not-in-directory-node () + (if (equal Info-current-file "dir") + (error (substitute-command-keys + (concat "The Info directory node has no index; " + "type \\[Info-menu] to select a manual"))))) + ;;;###autoload (defun Info-index (topic) "Look up a string TOPIC in the index for this manual and go to that entry. @@ -3342,15 +3348,13 @@ Info-index (Info-complete-menu-buffer (clone-buffer)) (Info-complete-nodes (Info-index-nodes)) (Info-history-list nil)) - (if (equal Info-current-file "dir") - (error "The Info directory node has no index; use m to select a manual")) + (info--ensure-not-in-directory-node) (unwind-protect (with-current-buffer Info-complete-menu-buffer (Info-goto-index) (completing-read "Index topic: " #'Info-complete-menu-item)) (kill-buffer Info-complete-menu-buffer))))) - (if (equal Info-current-file "dir") - (error "The Info directory node has no index; use m to select a manual")) + (info--ensure-not-in-directory-node) ;; Strip leading colon in topic; index format does not allow them. (if (and (stringp topic) (> (length topic) 0) @@ -3533,8 +3537,7 @@ Info-virtual-index (Info-complete-menu-buffer (clone-buffer)) (Info-complete-nodes (Info-index-nodes)) (Info-history-list nil)) - (if (equal Info-current-file "dir") - (error "The Info directory node has no index; use m to select a manual")) + (info--ensure-not-in-directory-node) (unwind-protect (with-current-buffer Info-complete-menu-buffer (Info-goto-index) commit 372f8c5bffd8c18c95900a1fb53eb992b8a493aa Author: Brian Leung Date: Fri Nov 25 18:16:52 2022 -0800 eglot-server-programs: ts-mode -> typescript-ts-mode * lisp/progmodes/eglot.el (eglot-server-programs): Fix name of 'typescript-ts-mode' after rename from 'ts-mode'. (Bug#59589) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index a0fb253e10..120d4feb95 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -190,7 +190,7 @@ eglot-server-programs ((js-json-mode json-mode json-ts-mode) . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") ("json-languageserver" "--stdio")))) - ((js-mode ts-mode typescript-mode) + ((js-mode typescript-ts-mode typescript-mode) . ("typescript-language-server" "--stdio")) ((bash-ts-mode sh-mode) . ("bash-language-server" "start")) ((php-mode phps-mode)