commit 0ebedd0119c1bc3c1f55e873385a01e97f102766 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sun Jun 25 08:25:13 2023 +0300 ; * doc/lispintro/emacs-lisp-intro.texi (car & cdr): Fix typo. diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 90eb92ca7ea..fce7583fe91 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -6827,7 +6827,7 @@ car & cdr However, lists in Lisp are built using a lower-level structure known as ``cons cells'' (@pxref{List Implementation}), in which there is no -such thing as ``first'' or ``rest,''and the @sc{car} and the @sc{cdr} +such thing as ``first'' or ``rest'', and the @sc{car} and the @sc{cdr} are symmetrical. Lisp does not try to hide the existence of cons cells, and programs do use them for things other than lists. For this reason, the names are helpful for reminding programmers that commit 188c90c7c111dbbdc3edd29c23b59ade26f97bfd Author: Richard M. Stallman Date: Sat Jun 24 19:19:53 2023 -0400 Clarify list terminology * doc/lispintro/emacs-lisp-intro.texi (Lists diagrammed): Mention "cons cell". Add index entries. (car & cdr): Simplify etymology of `car' and `cdr'. Explain why for some purposes they are better than `first' and `rest'. Mention cons cells. diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 37ef6133fb4..90eb92ca7ea 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -6761,16 +6761,13 @@ Strange Names abbreviation of the word ``construct''. The origins of the names for @code{car} and @code{cdr}, on the other hand, are esoteric: @code{car} is an acronym from the phrase ``Contents of the Address part of the -Register''; and @code{cdr} (pronounced ``could-er'') is an acronym from -the phrase ``Contents of the Decrement part of the Register''. These -phrases refer to specific pieces of hardware on the very early -computer on which the original Lisp was developed. Besides being -obsolete, the phrases have been completely irrelevant for more than 25 -years to anyone thinking about Lisp. Nonetheless, although a few -brave scholars have begun to use more reasonable names for these -functions, the old terms are still in use. In particular, since the -terms are used in the Emacs Lisp source code, we will use them in this -introduction. +Register''; and @code{cdr} (pronounced ``could-er'') is an acronym +from the phrase ``Contents of the Decrement part of the Register''. +These phrases refer to the IBM 704 computer on which the original Lisp +was developed. + +The IBM 704 is a footnote in history, but these names are now beloved +traditions of Lisp. @node car & cdr @section @code{car} and @code{cdr} @@ -6791,9 +6788,6 @@ car & cdr After evaluating the expression, @code{rose} will appear in the echo area. -Clearly, a more reasonable name for the @code{car} function would be -@code{first} and this is often suggested. - @code{car} does not remove the first item from the list; it only reports what it is. After @code{car} has been applied to a list, the list is still the same as it was. In the jargon, @code{car} is @@ -6825,6 +6819,22 @@ car & cdr not, the Lisp interpreter would try to evaluate the list by calling @code{rose} as a function. In this example, we do not want to do that. +For operating on lists, the names @code{first} and @code{rest} would +make more sense than the names @code{car} and @code{cdr}. Indeed, +some programmers define @code{first} and @code{rest} as aliases for +@code{car} and @code{cdr}, then write @code{first} and @code{rest} in +their code. + +However, lists in Lisp are built using a lower-level structure known +as ``cons cells'' (@pxref{List Implementation}), in which there is no +such thing as ``first'' or ``rest,''and the @sc{car} and the @sc{cdr} +are symmetrical. Lisp does not try to hide the existence of cons +cells, and programs do use them for things other than lists. For this +reason, the names are helpful for reminding programmers that +@code{car} and @code{cdr} are in fact symmetrical, despite the +asymmetrical way they are used in lists. + +@ignore Clearly, a more reasonable name for @code{cdr} would be @code{rest}. (There is a lesson here: when you name new functions, consider very @@ -6834,6 +6844,7 @@ car & cdr not use them, you would have a hard time reading the code; but do, please, try to avoid using these terms yourself. The people who come after you will be grateful to you.) +@end ignore When @code{car} and @code{cdr} are applied to a list made up of symbols, such as the list @code{(pine fir oak maple)}, the element of the list @@ -9429,13 +9440,15 @@ Lists diagrammed @unnumberedsec Lists diagrammed @end ifnottex -For example, the list @code{(rose violet buttercup)} has three elements, -@samp{rose}, @samp{violet}, and @samp{buttercup}. In the computer, the -electronic address of @samp{rose} is recorded in a segment of computer -memory along with the address that gives the electronic address of where -the atom @samp{violet} is located; and that address (the one that tells -where @samp{violet} is located) is kept along with an address that tells -where the address for the atom @samp{buttercup} is located. +For example, the list @code{(rose violet buttercup)} has three +elements, @samp{rose}, @samp{violet}, and @samp{buttercup}. In the +computer, the electronic address of @samp{rose} is recorded in a +segment of computer memory called a @dfn{cons cell} (because it's what +the function @code{cons} actually creates). That cons cell also holds +the address of a second cons cell, whose @sc{car} is the atom +@samp{violet}; and that address (the one that tells where to find +@samp{violet}) is kept along with the address of a third cons cell +which holds the address for the atom @samp{buttercup}. @need 1200 This sounds more complicated than it is and is easier seen in a diagram: @@ -9652,6 +9665,8 @@ Lists diagrammed address-boxes, the first of which holds the address of @code{violet}, and the second of which holds the address of @code{buttercup}. +@cindex dotted pair +@cindex cons cell A pair of address-boxes is called a @dfn{cons cell} or @dfn{dotted pair}. @xref{Cons Cell Type, , Cons Cell and List Types, elisp, The GNU Emacs Lisp Reference Manual}, and @ref{Dotted Pair Notation, , Dotted Pair commit e85ebb3d82466c5838e9c6836e6d8b5c8d0a7c33 Author: Stefan Monnier Date: Sat Jun 24 17:53:41 2023 -0400 (macroexp--unfold-lambda): Obey the lexbind semantics While at it, rework the code so as not to rely on an intermediate rewriting of (funcall (lambda ..) ...) to ((lambda ..) ...) since that forms is deprecated. * lisp/emacs-lisp/byte-opt.el (byte-optimize-funcall): Unfold lambdas instead of turning them into the deprecated ((lambda ..) ..). (byte-optimize-form-code-walker): Don't unfold ((lambda ..) ..) any more. (byte-compile-inline-expand): Revert to non-optimized call if the unfolding can't be optimized. * lisp/emacs-lisp/bytecomp.el (byte-compile-form): Don't unfold ((lambda ..) ..) any more. * lisp/emacs-lisp/cl-macs.el (cl--slet): Remove workaround. * lisp/emacs-lisp/disass.el (disassemble): Make sure the code is compiled with its own `lexical-binding` value. * lisp/emacs-lisp/macroexp.el (macroexp--unfold-lambda): Make it work both for ((lambda ..) ..) and for (funcall #'(lambda ..) ..). Be careful not to move dynbound vars from `lambda` to `let`. (macroexp--expand-all): Unfold (funcall #'(lambda ..) ..) instead of turning it into ((lambda ..) ..). Don't unfold ((lambda ..) ..) any more. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 307e3841e9b..26a1dc4a103 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -167,8 +167,8 @@ byte-compile-inline-expand ((or `(lambda . ,_) `(closure . ,_)) ;; While byte-compile-unfold-bcf can inline dynbind byte-code into ;; letbind byte-code (or any other combination for that matter), we - ;; can only inline dynbind source into dynbind source or letbind - ;; source into letbind source. + ;; can only inline dynbind source into dynbind source or lexbind + ;; source into lexbind source. ;; When the function comes from another file, we byte-compile ;; the inlined function first, and then inline its byte-code. ;; This also has the advantage that the final code does not @@ -176,7 +176,10 @@ byte-compile-inline-expand ;; the build more reproducible. (if (eq fn localfn) ;; From the same file => same mode. - (macroexp--unfold-lambda `(,fn ,@(cdr form))) + (let* ((newform `(,fn ,@(cdr form))) + (unfolded (macroexp--unfold-lambda newform))) + ;; Use the newform only if it could be optimized. + (if (eq unfolded newform) form unfolded)) ;; Since we are called from inside the optimizer, we need to make ;; sure not to propagate lexvar values. (let ((byte-optimize--lexvars nil) @@ -452,13 +455,6 @@ byte-optimize-form-code-walker `(progn ,@(byte-optimize-body env t)) `(,fn ,vars ,(mapcar #'byte-optimize-form env) . ,rest))) - (`((lambda . ,_) . ,_) - (let ((newform (macroexp--unfold-lambda form))) - (if (eq newform form) - ;; Some error occurred, avoid infinite recursion. - form - (byte-optimize-form newform for-effect)))) - (`(setq ,var ,expr) (let ((lexvar (assq var byte-optimize--lexvars)) (value (byte-optimize-form expr nil))) @@ -1412,15 +1408,15 @@ byte-optimize-not (defun byte-optimize-funcall (form) - ;; (funcall #'(lambda ...) ...) -> ((lambda ...) ...) + ;; (funcall #'(lambda ...) ...) -> (let ...) ;; (funcall #'SYM ...) -> (SYM ...) ;; (funcall 'SYM ...) -> (SYM ...) - (let* ((fn (nth 1 form)) - (head (car-safe fn))) - (if (or (eq head 'function) - (and (eq head 'quote) (symbolp (nth 1 fn)))) - (cons (nth 1 fn) (cdr (cdr form))) - form))) + (pcase form + (`(,_ #'(lambda . ,_) . ,_) + (macroexp--unfold-lambda form)) + (`(,_ ,(or `#',f `',(and f (pred symbolp))) . ,actuals) + `(,f ,@actuals)) + (_ form))) (defun byte-optimize-apply (form) (let ((len (length form))) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 0d878846304..64a57948017 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3556,12 +3556,6 @@ byte-compile-form ((and (byte-code-function-p (car form)) (memq byte-optimize '(t lap))) (byte-compile-unfold-bcf form)) - ((and (eq (car-safe (car form)) 'lambda) - ;; if the form comes out the same way it went in, that's - ;; because it was malformed, and we couldn't unfold it. - (not (eq form (setq form (macroexp--unfold-lambda form))))) - (byte-compile-form form byte-compile--for-effect) - (setq byte-compile--for-effect nil)) ((byte-compile-normal-call form))) (if byte-compile--for-effect (byte-compile-discard)) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 540bcc7f3b3..1de5409f7ee 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -251,10 +251,8 @@ cl--slet (if (macroexp--dynamic-variable-p (car binding)) (setq dyn t))) (cond (dyn - ;; FIXME: We use `identity' to obfuscate the code enough to - ;; circumvent the known bug in `macroexp--unfold-lambda' :-( - `(funcall (identity (lambda (,@(mapcar #'car bindings)) - ,@(macroexp-unprogn body))) + `(funcall (lambda (,@(mapcar #'car bindings)) + ,@(macroexp-unprogn body)) ,@(mapcar #'cadr bindings))) ((null (cdr bindings)) (macroexp-let* bindings body)) diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el index 9dd08d00920..dd59a2e02e1 100644 --- a/lisp/emacs-lisp/disass.el +++ b/lisp/emacs-lisp/disass.el @@ -63,16 +63,19 @@ disassemble (list (intern (completing-read (format-prompt "Disassemble function" fn) obarray 'fboundp t nil nil def)) nil 0 t))) - (if (and (consp object) (not (functionp object))) - (setq object `(lambda () ,object))) - (or indent (setq indent 0)) ;Default indent to zero - (save-excursion - (if (or interactive-p (null buffer)) - (with-output-to-temp-buffer "*Disassemble*" - (set-buffer "*Disassemble*") - (disassemble-internal object indent (not interactive-p))) - (set-buffer buffer) - (disassemble-internal object indent nil))) + (let ((lb lexical-binding)) + (if (and (consp object) (not (functionp object))) + (setq object `(lambda () ,object))) + (or indent (setq indent 0)) ;Default indent to zero + (save-excursion + (if (or interactive-p (null buffer)) + (with-output-to-temp-buffer "*Disassemble*" + (set-buffer "*Disassemble*") + (let ((lexical-binding lb)) + (disassemble-internal object indent (not interactive-p)))) + (set-buffer buffer) + (let ((lexical-binding lb)) + (disassemble-internal object indent nil))))) nil) (declare-function native-comp-unit-file "data.c") diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index f3d0804323e..290bf1c933a 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -244,68 +244,64 @@ macroexp-macroexpand new-form))) (defun macroexp--unfold-lambda (form &optional name) - ;; In lexical-binding mode, let and functions don't bind vars in the same way - ;; (let obey special-variable-p, but functions don't). But luckily, this - ;; doesn't matter here, because function's behavior is underspecified so it - ;; can safely be turned into a `let', even though the reverse is not true. (or name (setq name "anonymous lambda")) - (let* ((lambda (car form)) - (values (cdr form)) - (arglist (nth 1 lambda)) - (body (cdr (cdr lambda))) - optionalp restp - bindings) - (if (and (stringp (car body)) (cdr body)) - (setq body (cdr body))) - (if (and (consp (car body)) (eq 'interactive (car (car body)))) - (setq body (cdr body))) - ;; FIXME: The checks below do not belong in an optimization phase. - (while arglist - (cond ((eq (car arglist) '&optional) - ;; ok, I'll let this slide because funcall_lambda() does... - ;; (if optionalp (error "Multiple &optional keywords in %s" name)) - (if restp (error "&optional found after &rest in %s" name)) - (if (null (cdr arglist)) - (error "Nothing after &optional in %s" name)) - (setq optionalp t)) - ((eq (car arglist) '&rest) - ;; ...but it is by no stretch of the imagination a reasonable - ;; thing that funcall_lambda() allows (&rest x y) and - ;; (&rest x &optional y) in arglists. - (if (null (cdr arglist)) - (error "Nothing after &rest in %s" name)) - (if (cdr (cdr arglist)) - (error "Multiple vars after &rest in %s" name)) - (setq restp t)) - (restp - (setq bindings (cons (list (car arglist) - (and values (cons 'list values))) - bindings) - values nil)) - ((and (not optionalp) (null values)) - (setq arglist nil values 'too-few)) - (t - (setq bindings (cons (list (car arglist) (car values)) - bindings) - values (cdr values)))) - (setq arglist (cdr arglist))) - (if values - (macroexp-warn-and-return - (format-message - (if (eq values 'too-few) - "attempt to open-code `%s' with too few arguments" - "attempt to open-code `%s' with too many arguments") - name) - form nil nil arglist) - - ;; The following leads to infinite recursion when loading a - ;; file containing `(defsubst f () (f))', and then trying to - ;; byte-compile that file. - ;;(setq body (mapcar 'byte-optimize-form body))) - - (if bindings - `(let ,(nreverse bindings) . ,body) - (macroexp-progn body))))) + (pcase form + ((or `(funcall (function ,lambda) . ,actuals) `(,lambda . ,actuals)) + (let* ((formals (nth 1 lambda)) + (body (cdr (macroexp-parse-body (cddr lambda)))) + optionalp restp + (dynboundarg nil) + bindings) + ;; FIXME: The checks below do not belong in an optimization phase. + (while formals + (if (macroexp--dynamic-variable-p (car formals)) + (setq dynboundarg t)) + (cond ((eq (car formals) '&optional) + ;; ok, I'll let this slide because funcall_lambda() does... + ;; (if optionalp (error "Multiple &optional keywords in %s" name)) + (if restp (error "&optional found after &rest in %s" name)) + (if (null (cdr formals)) + (error "Nothing after &optional in %s" name)) + (setq optionalp t)) + ((eq (car formals) '&rest) + ;; ...but it is by no stretch of the imagination a reasonable + ;; thing that funcall_lambda() allows (&rest x y) and + ;; (&rest x &optional y) in formalss. + (if (null (cdr formals)) + (error "Nothing after &rest in %s" name)) + (if (cdr (cdr formals)) + (error "Multiple vars after &rest in %s" name)) + (setq restp t)) + (restp + (setq bindings (cons (list (car formals) + (and actuals (cons 'list actuals))) + bindings) + actuals nil)) + ((and (not optionalp) (null actuals)) + (setq formals nil actuals 'too-few)) + (t + (setq bindings (cons (list (car formals) (car actuals)) + bindings) + actuals (cdr actuals)))) + (setq formals (cdr formals))) + (cond + (actuals + (macroexp-warn-and-return + (format-message + (if (eq actuals 'too-few) + "attempt to open-code `%s' with too few arguments" + "attempt to open-code `%s' with too many arguments") + name) + form nil nil formals)) + ;; In lexical-binding mode, let and functions don't bind vars in + ;; the same way (let obey special-variable-p, but functions + ;; don't). So if one of the vars is declared as dynamically scoped, we + ;; can't just convert the call to `let'. + ;; FIXME: We should α-rename the affected args and then use `let'. + (dynboundarg form) + (bindings `(let ,(nreverse bindings) . ,body)) + (t (macroexp-progn body))))) + (_ (error "Not an unfoldable form: %S" form)))) (defun macroexp--dynamic-variable-p (var) "Whether the variable VAR is dynamically scoped. @@ -437,27 +433,22 @@ macroexp--expand-all (setq args (cddr args))) (cons 'progn (nreverse assignments)))))) (`(,(and fun `(lambda . ,_)) . ,args) - ;; Embedded lambda in function position. - ;; If the byte-optimizer is loaded, try to unfold this, - ;; i.e. rewrite it to (let () ). We'd do it in the optimizer - ;; anyway, but doing it here (i.e. earlier) can sometimes avoid the - ;; creation of a closure, thus resulting in much better code. - (let ((newform (macroexp--unfold-lambda form))) - (if (eq newform form) - ;; Unfolding failed for some reason, avoid infinite recursion. - (macroexp--cons (macroexp--all-forms fun 2) - (macroexp--all-forms args) - form) - (macroexp--expand-all newform)))) + (macroexp--cons (macroexp--all-forms fun 2) + (macroexp--all-forms args) + form)) (`(funcall ,exp . ,args) (let ((eexp (macroexp--expand-all exp)) (eargs (macroexp--all-forms args))) - ;; Rewrite (funcall #'foo bar) to (foo bar), in case `foo' - ;; has a compiler-macro, or to unfold it. (pcase eexp + ;; Rewrite (funcall #'foo bar) to (foo bar), in case `foo' + ;; has a compiler-macro, or to unfold it. ((and `#',f - (guard (not (or (special-form-p f) (macrop f))))) ;; bug#46636 + (guard (and (symbolp f) + ;; bug#46636 + (not (or (special-form-p f) (macrop f)))))) (macroexp--expand-all `(,f . ,eargs))) + (`#'(lambda . ,_) + (macroexp--unfold-lambda `(,fn ,eexp . ,eargs))) (_ `(,fn ,eexp . ,eargs))))) (`(funcall . ,_) form) ;bug#53227 (`(,func . ,_) commit f559bd1248a265662665c462b750eb5fc64dd811 Author: Stefan Monnier Date: Sat Jun 24 11:44:32 2023 -0400 * lisp/emacs-lisp/cl-macs.el (cl--slet): Unbreak bootstrap diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 4caa573ea9d..540bcc7f3b3 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -245,17 +245,20 @@ cl--bind-lets (defun cl--slet (bindings body) "Like `cl--slet*' but for \"parallel let\"." - (cond - ((seq-some (lambda (binding) (macroexp--dynamic-variable-p (car binding))) - bindings) - ;; FIXME: We use `identity' to obfuscate the code enough to - ;; circumvent the known bug in `macroexp--unfold-lambda' :-( - `(funcall (identity (lambda (,@(mapcar #'car bindings)) - ,@(macroexp-unprogn body))) - ,@(mapcar #'cadr bindings))) - ((null (cdr bindings)) - (macroexp-let* bindings body)) - (t `(let ,bindings ,@(macroexp-unprogn body))))) + (let ((dyn nil)) ;Is there a var declared as dynbound among the bindings? + ;; `seq-some' lead to bootstrap problems. + (dolist (binding bindings) + (if (macroexp--dynamic-variable-p (car binding)) (setq dyn t))) + (cond + (dyn + ;; FIXME: We use `identity' to obfuscate the code enough to + ;; circumvent the known bug in `macroexp--unfold-lambda' :-( + `(funcall (identity (lambda (,@(mapcar #'car bindings)) + ,@(macroexp-unprogn body))) + ,@(mapcar #'cadr bindings))) + ((null (cdr bindings)) + (macroexp-let* bindings body)) + (t `(let ,bindings ,@(macroexp-unprogn body)))))) (defun cl--slet* (bindings body) "Like `macroexp-let*' but uses static scoping for all the BINDINGS." commit 9c2cbfa49db96eae95bb40c5fc3ce7f09781a97d Author: kobarity Date: Sun Jun 18 23:47:25 2023 +0900 Fix Python indentation of continuation lines within parens * lisp/progmodes/python.el (python-indent-context): Add a new indent context `:inside-paren-continuation-line'. (python-indent--calculate-indentation): Use the new indent context. * test/lisp/progmodes/python-tests.el (python-indent-pep8-2) (python-indent-pep8-3) (python-indent-inside-paren-1) (python-indent-inside-paren-2) (python-indent-inside-paren-3) (python-indent-inside-paren-6) (python-indent-after-backslash-2): Change to use the new indent context. (python-indent-inside-paren-8) (python-indent-inside-paren-9): New tests. (Bug#63959) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 26dafde7591..50d712ebb0c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1406,6 +1406,10 @@ python-indent-context - Point is inside a paren from a block start followed by some items on the same line. - START is the first non space char position *after* the open paren. +:inside-paren-continuation-line + - Point is on a continuation line inside a paren. + - START is the position where the previous line (excluding lines + for inner parens) starts. :after-backslash - Fallback case when point is after backslash. @@ -1460,7 +1464,21 @@ python-indent-context (= (line-number-at-pos) (progn (python-util-forward-comment) - (line-number-at-pos)))))))) + (line-number-at-pos))))))) + (continuation-start + (when start + (save-excursion + (forward-line -1) + (back-to-indentation) + ;; Skip inner parens. + (cl-loop with prev-start = (python-syntax-context 'paren) + while (and prev-start (>= prev-start start)) + if (= prev-start start) + return (point) + else do (goto-char prev-start) + (back-to-indentation) + (setq prev-start + (python-syntax-context 'paren))))))) (when start (cond ;; Current line only holds the closing paren. @@ -1476,6 +1494,9 @@ python-indent-context (back-to-indentation) (python-syntax-closing-paren-p)) (cons :inside-paren-at-closing-nested-paren start)) + ;; This line is a continuation of the previous line. + (continuation-start + (cons :inside-paren-continuation-line continuation-start)) ;; This line starts from an opening block in its own line. ((save-excursion (goto-char start) @@ -1591,7 +1612,8 @@ python-indent--calculate-indentation (`(,(or :after-line :after-comment :inside-string - :after-backslash) . ,start) + :after-backslash + :inside-paren-continuation-line) . ,start) ;; Copy previous indentation. (goto-char start) (current-indentation)) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 9323f72f384..54e32cbf07b 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -683,7 +683,7 @@ python-indent-pep8-2 (should (= (python-indent-calculate-indentation) 8)) (python-tests-look-at "var_four):") (should (eq (car (python-indent-context)) - :inside-paren-newline-start-from-block)) + :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 8)) (python-tests-look-at "print (var_one)") (should (eq (car (python-indent-context)) @@ -707,8 +707,8 @@ python-indent-pep8-3 (should (eq (car (python-indent-context)) :inside-paren-newline-start)) (should (= (python-indent-calculate-indentation) 4)) (python-tests-look-at "var_three, var_four)") - (should (eq (car (python-indent-context)) :inside-paren-newline-start)) - (should (= (python-indent-calculate-indentation) 4)))) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) + (should (= (python-indent-calculate-indentation) 2)))) (ert-deftest python-indent-hanging-close-paren () "Like first pep8 case, but with hanging close paren." ;; See Bug#20742. @@ -864,7 +864,7 @@ python-indent-inside-paren-1 (should (eq (car (python-indent-context)) :inside-paren-newline-start)) (should (= (python-indent-calculate-indentation) 4)) (python-tests-look-at "{") - (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 4)) (python-tests-look-at "'objlist': [") (should (eq (car (python-indent-context)) :inside-paren-newline-start)) @@ -876,20 +876,20 @@ python-indent-inside-paren-1 (should (eq (car (python-indent-context)) :inside-paren-newline-start)) (should (= (python-indent-calculate-indentation) 16)) (python-tests-look-at "'name': 'first',") - (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 16)) (python-tests-look-at "},") (should (eq (car (python-indent-context)) :inside-paren-at-closing-nested-paren)) (should (= (python-indent-calculate-indentation) 12)) (python-tests-look-at "{") - (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 12)) (python-tests-look-at "'pk': 2,") (should (eq (car (python-indent-context)) :inside-paren-newline-start)) (should (= (python-indent-calculate-indentation) 16)) (python-tests-look-at "'name': 'second',") - (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 16)) (python-tests-look-at "}") (should (eq (car (python-indent-context)) @@ -933,7 +933,7 @@ python-indent-inside-paren-2 (should (eq (car (python-indent-context)) :inside-paren)) (should (= (python-indent-calculate-indentation) 9)) (python-tests-look-at "{'pk': 2,") - (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 8)) (python-tests-look-at "'name': 'second'}") (should (eq (car (python-indent-context)) :inside-paren)) @@ -966,10 +966,10 @@ python-indent-inside-paren-3 (should (eq (car (python-indent-context)) :inside-paren)) (should (= (python-indent-calculate-indentation) 8)) (forward-line 1) - (should (eq (car (python-indent-context)) :inside-paren)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 8)) (forward-line 1) - (should (eq (car (python-indent-context)) :inside-paren)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 8)))) (ert-deftest python-indent-inside-paren-4 () @@ -1023,7 +1023,7 @@ python-indent-inside-paren-6 (should (eq (car (python-indent-context)) :inside-paren)) (should (= (python-indent-calculate-indentation) 11)) (forward-line 1) - (should (eq (car (python-indent-context)) :inside-paren)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 11)))) (ert-deftest python-indent-inside-paren-7 () @@ -1034,6 +1034,71 @@ python-indent-inside-paren-7 ;; This signals an error if the test fails (should (eq (car (python-indent-context)) :inside-paren-newline-start)))) +(ert-deftest python-indent-inside-paren-8 () + "Test for Bug#63959." + (python-tests-with-temp-buffer + " +for a in [ # comment + 'some', # Manually indented. + 'thing']: # Respect indentation of the previous line. +" + (python-tests-look-at "for a in [ # comment") + (should (eq (car (python-indent-context)) :no-indent)) + (should (= (python-indent-calculate-indentation) 0)) + (forward-line 1) + (should (eq (car (python-indent-context)) + :inside-paren-newline-start-from-block)) + (should (= (python-indent-calculate-indentation) 8)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) + (should (= (python-indent-calculate-indentation) 10)))) + +(ert-deftest python-indent-inside-paren-9 () + "Test `:inside-paren-continuation-line'." + (python-tests-with-temp-buffer + " +a = ((( + 1, 2), + 3), # Do not respect the indentation of the previous line + 4) # Do not respect the indentation of the previous line +b = (( + 1, 2), # Manually indented + 3, # Do not respect the indentation of the previous line + 4, # Respect the indentation of the previous line + 5, # Manually indented + 6) # Respect the indentation of the previous line +" + (python-tests-look-at "a = (((") + (should (eq (car (python-indent-context)) :no-indent)) + (should (= (python-indent-calculate-indentation) 0)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (= (python-indent-calculate-indentation) 4)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren)) + (should (= (python-indent-calculate-indentation) 6)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren)) + (should (= (python-indent-calculate-indentation) 5)) + (forward-line 1) + (should (eq (car (python-indent-context)) :after-line)) + (should (= (python-indent-calculate-indentation) 0)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (= (python-indent-calculate-indentation) 4)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren)) + (should (= (python-indent-calculate-indentation) 5)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) + (should (= (python-indent-calculate-indentation) 5)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) + (should (= (python-indent-calculate-indentation) 5)) + (forward-line 1) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) + (should (= (python-indent-calculate-indentation) 8)))) + (ert-deftest python-indent-inside-paren-block-1 () "`python-indent-block-paren-deeper' set to nil (default). See Bug#62696." @@ -1271,7 +1336,7 @@ python-indent-after-backslash-2 (should (eq (car (python-indent-context)) :inside-paren-newline-start)) (should (= (python-indent-calculate-indentation) 27)) (python-tests-look-at "status='bought'") - (should (eq (car (python-indent-context)) :inside-paren-newline-start)) + (should (eq (car (python-indent-context)) :inside-paren-continuation-line)) (should (= (python-indent-calculate-indentation) 27)) (python-tests-look-at ") \\") (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren)) commit 5b7e999e24f6cd446961ac441f69af021528623b Author: Eli Zaretskii Date: Sat Jun 24 14:58:44 2023 +0300 ; Fix documentation of last change * lisp/net/eww.el (eww-copy-alternate-url): Doc fix. * etc/NEWS: * doc/misc/eww.texi (Basics): Minor wording and punctuation fixes. (Bug#64126) diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index cff48bd601e..b67624af9f8 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -118,7 +118,7 @@ Basics @findex eww-copy-alternate-url @kindex A The @kbd{A} command (@code{eww-copy-alternate-url}) copies the URL -of an alternate link of the current page into the kill ring. If the +of an alternate link on the current page into the kill ring. If the page specifies multiple alternate links, this command prompts for one of them in the minibuffer, with completion. Alternate links are references that an @acronym{HTML} page may include to point to other @@ -127,7 +127,7 @@ Basics translated versions and to @acronym{RSS} feeds. Alternate links appear in the @samp{} section of @acronym{HTML} pages as @samp{} elements with @samp{rel} attribute equal to -@samp{``alternate''}, they are part of the page's metadata and are not +@samp{``alternate''}; they are part of the page's metadata and are not visible in its rendered content. @findex eww-open-in-new-buffer diff --git a/etc/NEWS b/etc/NEWS index 0f674c6465f..3061a147b26 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -268,7 +268,7 @@ bookmark URIs. +++ *** New command 'eww-copy-alternate-url'. -It copies an alternate link to the page currently visited in EWW into +It copies an alternate link on the page currently visited in EWW into the kill ring. Alternate links are optional metadata that HTML pages use for linking to their alternative representations, such as translated versions or associated RSS feeds. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 89f7ba37cc1..2e743751427 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2643,8 +2643,9 @@ eww-read-alternate-url (caar alternates))))) (defun eww-copy-alternate-url () - "Copy an alternate URL of the current page into the kill ring. - + "Copy the alternate URL of the current page into the kill ring. +If there are multiple alternate links on the current page, prompt +for one in the minibuffer, with completion. Alternate links are references that an HTML page may include to point to its alternative representations, such as a translated version or an RSS feed." commit dfba4347c71d70b8357979ff0fb4bb070b0ed60c Author: Eshel Yaron Date: Sat Jun 17 13:48:51 2023 +0300 New command 'eww-copy-alternate-url' This adds a new command to EWW that copies an alternate link to the currently visited page into the kill ring. This is useful for subscribing to website feeds, etc. * lisp/net/eww.el (eww--alternate-urls, eww-read-alternate-url): New functions. (eww-copy-alternate-url): New command. (eww-mode-map): Bind it to 'A'. * doc/misc/eww.texi (Basics): Document it. * etc/NEWS: Announce it. (Bug#64126) diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index c02e9db11c9..cff48bd601e 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi @@ -115,6 +115,21 @@ Basics @kbd{w} calls @code{eww-copy-page-url}, which will copy the current page's URL to the kill ring instead. +@findex eww-copy-alternate-url +@kindex A + The @kbd{A} command (@code{eww-copy-alternate-url}) copies the URL +of an alternate link of the current page into the kill ring. If the +page specifies multiple alternate links, this command prompts for one +of them in the minibuffer, with completion. Alternate links are +references that an @acronym{HTML} page may include to point to other +documents that act as its alternative representations. Notably, +@acronym{HTML} pages can use alternate links to point to their +translated versions and to @acronym{RSS} feeds. Alternate links +appear in the @samp{} section of @acronym{HTML} pages as +@samp{} elements with @samp{rel} attribute equal to +@samp{``alternate''}, they are part of the page's metadata and are not +visible in its rendered content. + @findex eww-open-in-new-buffer @kindex M-RET The @kbd{M-@key{RET}} command (@code{eww-open-in-new-buffer}) opens the diff --git a/etc/NEWS b/etc/NEWS index 467ac3ee587..0f674c6465f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -266,6 +266,13 @@ The interactive minibuffer prompt when invoking 'eww' now provides completions from 'eww-suggest-uris'. 'eww-suggest-uris' now includes bookmark URIs. ++++ +*** New command 'eww-copy-alternate-url'. +It copies an alternate link to the page currently visited in EWW into +the kill ring. Alternate links are optional metadata that HTML pages +use for linking to their alternative representations, such as +translated versions or associated RSS feeds. + ** go-ts-mode +++ diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 61f0f47373d..89f7ba37cc1 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1086,6 +1086,7 @@ eww-mode-map "&" #'eww-browse-with-external-browser "d" #'eww-download "w" #'eww-copy-page-url + "A" #'eww-copy-alternate-url "C" #'url-cookie-list "v" #'eww-view-source "R" #'eww-readable @@ -2576,4 +2577,82 @@ eww-bookmark-jump (provide 'eww) +;;; Alternate links (RSS and Atom feeds, etc.) + +(defun eww--alternate-urls (dom &optional base) + "Return an alist of alternate links in DOM. + +Each element is a list of the form (URL TYPE TITLE) where URL is +the href attribute of the link expanded relative to BASE, TYPE is +its type attribute, and TITLE is its title attribute. If any of +these attributes is absent, the corresponding element is nil." + (let ((alternates + (seq-filter + (lambda (attrs) (string= (alist-get 'rel attrs) + "alternate")) + (mapcar #'dom-attributes (dom-by-tag dom 'link))))) + (mapcar (lambda (alternate) + (list (url-expand-file-name (alist-get 'href alternate) + base) + (alist-get 'type alternate) + (alist-get 'title alternate))) + alternates))) + +(defun eww-read-alternate-url () + "Get the URL of an alternate link of this page. + +If there is just one alternate link, return its URL. If there +are multiple alternate links, prompt for one in the minibuffer +with completion. If there are none, return nil." + (when-let ((alternates (eww--alternate-urls + (plist-get eww-data :dom) + (plist-get eww-data :url)))) + (let ((url-max-width + (seq-max (mapcar #'string-pixel-width + (mapcar #'car alternates)))) + (title-max-width + (seq-max (mapcar #'string-pixel-width + (mapcar #'caddr alternates)))) + (sep-width (string-pixel-width " "))) + (if (cdr alternates) + (let ((completion-extra-properties + (list :annotation-function + (lambda (feed) + (let* ((attrs (alist-get feed + alternates + nil + nil + #'string=)) + (type (car attrs)) + (title (cadr attrs))) + (concat + (propertize " " 'display + `(space :align-to + (,(+ sep-width + url-max-width)))) + title + (when type + (concat + (propertize " " 'display + `(space :align-to + (,(+ (* 2 sep-width) + url-max-width + title-max-width)))) + "[" type "]")))))))) + (completing-read "Alternate URL: " alternates nil t)) + (caar alternates))))) + +(defun eww-copy-alternate-url () + "Copy an alternate URL of the current page into the kill ring. + +Alternate links are references that an HTML page may include to +point to its alternative representations, such as a translated +version or an RSS feed." + (interactive nil eww-mode) + (if-let ((url (eww-read-alternate-url))) + (progn + (kill-new url) + (message "Copied %s to kill ring" url)) + (user-error "No alternate links found on this page!"))) + ;;; eww.el ends here commit 8e8667246a4c06c8362515cbd6bead889babb748 Merge: 35d2fe176cb d0147ff9e50 Author: Eli Zaretskii Date: Sat Jun 24 07:13:42 2023 -0400 Merge from origin/emacs-29 d0147ff9e50 * lisp/emacs-lisp/shortdoc.el: More and better `substring... fa06249a9fb Fix "C-x RET r" when the new encoding is UTF 679e9d7c56e ; Mention MinGW64 GCC 13.1 problems in PROBLEMS fdc1a12ed1a Fix "vc-print-log does not erase buffer" and associated p... d507aa7336b Add selector_expression indentation rule 1f664a0af75 Add "nixd" LSP server to Eglot e962cf4ba72 Fix building --with-native-compilation=aot from release t... 4ca371e9cc7 Fix bug#64152 (Minibuffer sometimes goes "modal") a0ccf1859cc Disable target-async by default in gdb-mi.el 2bad5829ff7 Revert "Fix parsing of dn line if WITHDN is non-nil" 7637e361d3b Don't truncate filenames with "emacs.el" in them 2591eb1190a Improve documentation of 'minibuffer-message' 6f211bc57b9 Eglot: again fix positions of coinciding inlay hint overl... a24e9e3fee5 ; Update ChangeLog.4 and etc/AUTHORS. commit 35d2fe176cb438d55552cacbdf25c3692c054d51 Merge: 5fa9458511a c9022d69218 Author: Eli Zaretskii Date: Sat Jun 24 06:57:26 2023 -0400 ; Merge from origin/emacs-29 The following commits were skipped: c9022d69218 * lisp/ldefs-boot.el: Regenerate. f690827fa50 Bump Emacs version to 29.0.92 commit 5fa9458511a17ff79a822e5cf8cc00f7bfb89364 Merge: ff5caf68c93 8f62e7b85f6 Author: Eli Zaretskii Date: Sat Jun 24 06:57:25 2023 -0400 Merge from origin/emacs-29 8f62e7b85f6 Describe primarily the Emacs s-exp dialect for treesit qu... eacd75df4e4 ; Improve documentation of overlay priorities b3f11e94fad Fix documentation of :predicate in 'define-globalized-min... commit ff5caf68c936ec90825efc4fd878d13703fb0400 Merge: 6d55d93379f 02f0be03017 Author: Eli Zaretskii Date: Sat Jun 24 06:57:25 2023 -0400 ; Merge from origin/emacs-29 The following commit was skipped: 02f0be03017 Revert "Fix some tree-sitter :match regexps" commit d0147ff9e507cc4e99e0574eab106f95c8e9df1f Author: Mattias Engdegård Date: Fri Jun 23 19:42:44 2023 +0200 * lisp/emacs-lisp/shortdoc.el: More and better `substring` examples. Suggested by Juri Linkov. diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index c49960c2ee6..871233097a7 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -187,8 +187,10 @@ string :eval (format "This number is %d" 4)) "Manipulating Strings" (substring - :eval (substring "foobar" 0 3) - :eval (substring "foobar" 3)) + :eval (substring "abcde" 1 3) + :eval (substring "abcde" 2) + :eval (substring "abcde" 1 -1) + :eval (substring "abcde" -4 4)) (string-limit :eval (string-limit "foobar" 3) :eval (string-limit "foobar" 3 t) commit fa06249a9fbb0b0b67eb0d88cdb70b61723e67ed Author: Eli Zaretskii Date: Sat Jun 24 11:49:14 2023 +0300 Fix "C-x RET r" when the new encoding is UTF * src/fileio.c (Finsert_file_contents): Update point of 'conversion_buffer' before decoding the last block. (Bug#64253) diff --git a/src/fileio.c b/src/fileio.c index b50b3c6b935..995e4142f58 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4463,6 +4463,8 @@ because (1) it preserves some marker positions (in unchanged portions if (unprocessed > 0) { + BUF_TEMP_SET_PT (XBUFFER (conversion_buffer), + BUF_Z (XBUFFER (conversion_buffer))); coding.mode |= CODING_MODE_LAST_BLOCK; decode_coding_c_string (&coding, (unsigned char *) read_buf, unprocessed, conversion_buffer); commit 6d55d93379fa531f81327be6e506610474846758 Author: Stephen Berman Date: Sat Jun 24 10:45:10 2023 +0200 Apply quote substitution to popup choice menus * lisp/wid-edit.el (widget-choose): Iteratively apply substitute-command-keys to choice item text before building popup or text buffer menu. Also fix two unnecessary uses of let*. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index cafd0ad0a4d..234f3d9b74d 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -281,71 +281,79 @@ widget-choose If ITEMS has simple item definitions, then this function returns the VALUE of the chosen element. If ITEMS is a keymap, then the return value is the symbol in the key vector, as in the argument of `define-key'." - (cond ((and (< (length items) widget-menu-max-size) - event (display-popup-menus-p)) - ;; Mouse click. - (if (keymapp items) - ;; Modify the keymap prompt, and then restore the old one, if any. - (let ((prompt (keymap-prompt items))) - (unwind-protect - (progn - (setq items (delete prompt items)) - (push title (cdr items)) - ;; Return just the first element of the list of events. - (car (x-popup-menu event items))) - (setq items (delete title items)) - (when prompt - (push prompt (cdr items))))) - (x-popup-menu event (list title (cons "" items))))) - ((or widget-menu-minibuffer-flag - (> (length items) widget-menu-max-shortcuts)) - (when (keymapp items) - (setq items (widget--simplify-menu items))) - ;; Read the choice of name from the minibuffer. - (setq items (cl-remove-if 'stringp items)) - (let ((val (completing-read (concat title ": ") items nil t))) - (if (stringp val) - (let ((try (try-completion val items))) - (when (stringp try) - (setq val try)) - (cdr (assoc val items)))))) - (t - (when (keymapp items) - (setq items (widget--simplify-menu items))) - ;; Construct a menu of the choices - ;; and then use it for prompting for a single character. - (let* ((next-digit ?0) - alist choice some-choice-enabled value) - (with-current-buffer (get-buffer-create " widget-choose") - (erase-buffer) - (insert "Available choices:\n\n") - (while items - (setq choice (pop items)) - (when (consp choice) - (let* ((name (substitute-command-keys (car choice))) - (function (cdr choice))) - (insert (format "%c = %s\n" next-digit name)) - (push (cons next-digit function) alist) - (setq some-choice-enabled t))) - ;; Allocate digits to disabled alternatives - ;; so that the digit of a given alternative never varies. - (setq next-digit (1+ next-digit))) - (insert "\nC-g = Quit") - (goto-char (point-min)) - (forward-line)) - (or some-choice-enabled - (error "None of the choices is currently meaningful")) - (save-window-excursion - ;; Select window to be able to scroll it from minibuffer - (with-selected-window - (display-buffer (get-buffer " widget-choose") - '(display-buffer-in-direction - (direction . bottom) - (window-height . fit-window-to-buffer))) - (setq value (read-char-choice - (format "%s: " title) - (mapcar #'car alist))))) - (cdr (assoc value alist)))))) + ;; Apply quote substitution to customize choice menu item text, + ;; whether it occurs in a widget buffer or in a popup menu. + (let ((items (mapc (lambda (x) + (when (consp x) + (dotimes (i (1- (length x))) + (when (char-or-string-p (nth i x)) + (setcar (nthcdr i x) + (substitute-command-keys + (car (nthcdr i x)))))))) + items))) + (cond ((and (< (length items) widget-menu-max-size) + event (display-popup-menus-p)) + ;; Mouse click. + (if (keymapp items) + ;; Modify the keymap prompt, and then restore the old one, if any. + (let ((prompt (keymap-prompt items))) + (unwind-protect + (progn + (setq items (delete prompt items)) + (push title (cdr items)) + ;; Return just the first element of the list of events. + (car (x-popup-menu event items))) + (setq items (delete title items)) + (when prompt + (push prompt (cdr items))))) + (x-popup-menu event (list title (cons "" items))))) + ((or widget-menu-minibuffer-flag + (> (length items) widget-menu-max-shortcuts)) + (when (keymapp items) + (setq items (widget--simplify-menu items))) + ;; Read the choice of name from the minibuffer. + (setq items (cl-remove-if 'stringp items)) + (let ((val (completing-read (concat title ": ") items nil t))) + (if (stringp val) + (let ((try (try-completion val items))) + (when (stringp try) + (setq val try)) + (cdr (assoc val items)))))) + (t + (when (keymapp items) + (setq items (widget--simplify-menu items))) + ;; Construct a menu of the choices + ;; and then use it for prompting for a single character. + (let ((next-digit ?0) + alist choice some-choice-enabled value) + (with-current-buffer (get-buffer-create " widget-choose") + (erase-buffer) + (insert "Available choices:\n\n") + (while items + (setq choice (pop items)) + (when (consp choice) + (insert (format "%c = %s\n" next-digit (car choice))) + (push (cons next-digit (cdr choice)) alist) + (setq some-choice-enabled t)) + ;; Allocate digits to disabled alternatives + ;; so that the digit of a given alternative never varies. + (setq next-digit (1+ next-digit))) + (insert "\nC-g = Quit") + (goto-char (point-min)) + (forward-line)) + (or some-choice-enabled + (error "None of the choices is currently meaningful")) + (save-window-excursion + ;; Select window to be able to scroll it from minibuffer + (with-selected-window + (display-buffer (get-buffer " widget-choose") + '(display-buffer-in-direction + (direction . bottom) + (window-height . fit-window-to-buffer))) + (setq value (read-char-choice + (format "%s: " title) + (mapcar #'car alist))))) + (cdr (assoc value alist))))))) ;;; Widget text specifications. ;; commit 679e9d7c56e2296e3a218290d941e28002bf7722 Author: Eli Zaretskii Date: Sat Jun 24 10:23:07 2023 +0300 ; Mention MinGW64 GCC 13.1 problems in PROBLEMS * etc/PROBLEMS: Mention the problems building with MinGW64 GCC 13.1. (Bug#63365) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index e5baa8ee18a..80b3b9945c4 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -3422,6 +3422,39 @@ See https://lists.gnu.org/r/emacs-devel/2010-07/msg01266.html +*** Building the MS-Windows port with native compilation fails + +This is known to happen when using MinGW64 GCC 13.1, and seems to +affect byte-compilation: the built Emacs crashes while byte-compiling +some Lisp files. (This doesn't happen when building a release +tarball, because all the Lisp files are already byte-compiled there, +but then Emacs could crash later when you use it to byte-compile your +or third-party Lisp packages.) + +The reason seems to be specific to MS-Windows or the MinGW64 port of +GCC 13.1, and is somehow related to optimizations in this GCC version. +There are several known workarounds: + + . Use non-default optimization flags. For example, configuring the + build like this will avoid the problem: + + CFLAGS='-O1 -gdwarf-4 -g3' ./configure ... + + (replace the ellipsis "..." with the rest of 'configure' options + and arguments). + + . Prevent GCC from performing a specific optimization: + + CFLAGS='-O2 -gdwarf-4 -g3 -fno-optimize-sibling-calls' ./configure ... + + This is actually a variant of the previous workaround, except that + it allows you to have almost the full set of optimizations used by + -O2. + + . Downgrade to GCC 12.x. + + . Build Emacs without native compilation. + *** Building the native MS-Windows port fails due to unresolved externals The linker error messages look like this: commit fdc1a12ed1a2ceaebf21ec68752e85dd4527ceab Author: Dmitry Gutov Date: Sat Jun 24 05:57:18 2023 +0300 Fix "vc-print-log does not erase buffer" and associated problems * lisp/vc/vc.el (vc-deduce-fileset): Make sure to retain the buffer switch (if it did), bug#63949. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 1144a23f317..410fe5c01e1 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1121,10 +1121,15 @@ vc-deduce-fileset the returned list. BEWARE: this function may change the current buffer." - (with-current-buffer (or (buffer-base-buffer) (current-buffer)) - (vc-deduce-fileset-1 not-state-changing - allow-unregistered - state-model-only-files))) + (let (new-buf res) + (with-current-buffer (or (buffer-base-buffer) (current-buffer)) + (setq res + (vc-deduce-fileset-1 not-state-changing + allow-unregistered + state-model-only-files)) + (setq new-buf (current-buffer))) + (set-buffer new-buf) + res)) (defun vc-deduce-fileset-1 (not-state-changing allow-unregistered commit 77c2f05d773271cb59ebfd994b06a4075cacbfa8 Author: Michael Albinus Date: Fri Jun 23 21:26:14 2023 +0200 Extend Tramp kubernetes method * doc/misc/tramp.texi (Inline methods): Adapt kubernetes method. * etc/NEWS: Describe changes in Tramp kubernetes method. * lisp/net/tramp-container.el (tramp-kubernetes-context) (tramp-kubernetes-namespace): New defcustoms. (tramp-kubernetes--completion-function): Extend for CONTAINER.POD syntax. (tramp-kubernetes--host-name-regexp): New defconst. (tramp-kubernetes--container, tramp-kubernetes--pod) (tramp-kubernetes--current-context): New defuns. (tramp-kubernetes--current-context-data): Simplify. (tramp-kubernetes--context-namespace): New defun. (tramp-methods) : Respect container, context and namespace. (Bug#59797) (tramp-container-connection-local-default-kubernetes-variables): New defconst. Set respective connection-local variables. * lisp/net/tramp-sh.el (tramp-config-check): New variable. (tramp-open-connection-setup-interactive-shell): Use it. * lisp/net/tramp.el (tramp-methods): Adapt docstring. (tramp-extra-expand-args): New defvar. (tramp-expand-args): Use it. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index eb5c418728e..01f46865a39 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -922,8 +922,15 @@ Inline methods @cindex @option{kubernetes} method Integration for containers in Kubernetes pods. The host name is a pod -name returned by @samp{kubectl get pods}. The first container in a -pod is used. +name returned by @samp{kubectl get pods}, or +@samp{@var{container}.@var{pod}} if an explicit container name shall +be used. Otherwise, the first container in a pod is used. + +@vindex tramp-kubernetes-context +@vindex tramp-kubernetes-namespace +If another Kubernetes context or namespace shall be used, configure +the user options @code{tramp-kubernetes-context} and +@code{tramp-kubernetes-namespace}. This method does not support user names. diff --git a/etc/NEWS b/etc/NEWS index 88d432960f3..467ac3ee587 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -224,6 +224,14 @@ point is not in a comment or a string. It is by default bound to They allow accessing system containers provided by Toolbox or sandboxes provided by Flatpak. ++++ +*** Connection method "kubernetes" supports now optional container name. +The host name for Kubernetes connections can be of kind [CONTAINER.]POD, +in order to specify a dedicated container. If there is just the pod +name, the first container in the pod is taken. The new user options +'tramp-kubernetes-context' and 'tramp-kubernetes-namespace' allow to +access pods with different context or namespace but the default one. + +++ *** Rename 'tramp-use-ssh-controlmaster-options' to 'tramp-use-connection-share'. The old name still exists as obsolete variable alias. This user diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el index 473cb1c54b8..6e8d28a3016 100644 --- a/lisp/net/tramp-container.el +++ b/lisp/net/tramp-container.el @@ -37,19 +37,20 @@ ;; C-x C-f /podman:USER@CONTAINER:/path/to/file ;; ;; Where: -;; USER is the user on the container to connect as (optional) -;; CONTAINER is the container to connect to +;; USER is the user on the container to connect as (optional). +;; CONTAINER is the container to connect to. ;; ;; ;; ;; Open file in a Kubernetes container: ;; -;; C-x C-f /kubernetes:POD:/path/to/file +;; C-x C-f /kubernetes:[CONTAINER.]POD:/path/to/file ;; ;; Where: -;; POD is the pod to connect to. -;; By default, the first container in that pod will be -;; used. +;; POD is the pod to connect to. +;; CONTAINER is the container to connect to (optional). +;; By default, the first container in that pod will +;; be used. ;; ;; Completion for POD and accessing it operate in the current ;; namespace, use this command to change it: @@ -63,7 +64,7 @@ ;; C-x C-f /toolbox:CONTAINER:/path/to/file ;; ;; Where: -;; CONTAINER is the container to connect to (optional) +;; CONTAINER is the container to connect to (optional). ;; ;; If the container is not running, it is started. If no container is ;; specified, the default Toolbox container is used. @@ -106,6 +107,20 @@ tramp-kubernetes-program :type '(choice (const "kubectl") (string))) +(defcustom tramp-kubernetes-context nil + "Context of Kubernetes. +If it is nil, the default context will be used." + :group 'tramp + :version "30.1" + :type '(choice (const :tag "Use default" nil) + (string))) + +(defcustom tramp-kubernetes-namespace "default" + "Namespace of Kubernetes." + :group 'tramp + :version "30.1" + :type 'string) + ;;;###tramp-autoload (defcustom tramp-toolbox-program "toolbox" "Name of the Toolbox client program." @@ -172,29 +187,83 @@ tramp-kubernetes--completion-function see its function help for a description of the format." (when-let ((default-directory tramp-compat-temporary-file-directory) (raw-list (shell-command-to-string - (concat tramp-kubernetes-program - " get pods --no-headers " - "-o custom-columns=NAME:.metadata.name"))) - (names (split-string raw-list "\n" 'omit))) - (mapcar (lambda (name) (list nil name)) (delq nil names)))) + (concat + tramp-kubernetes-program " " + (tramp-kubernetes--context-namespace nil) + " get pods --no-headers" + ;; We separate pods by "|". Inside a pod, + ;; its name is separated from the containers + ;; by ":". Containers are separated by ",". + " -o jsonpath='{range .items[*]}{\"|\"}{.metadata.name}" + "{\":\"}{range .spec.containers[*]}{.name}{\",\"}" + "{end}{end}'"))) + (lines (split-string raw-list "|" 'omit))) + (let (names) + (dolist (line lines) + (setq line (split-string line ":" 'omit)) + ;; Pod name. + (push (car line) names) + ;; Container names. + (dolist (elt (split-string (cadr line) "," 'omit)) + (push (concat elt "." (car line)) names))) + (mapcar (lambda (name) (list nil name)) (delq nil names))))) + +(defconst tramp-kubernetes--host-name-regexp + (rx (? (group (regexp tramp-host-regexp)) ".") + (group (regexp tramp-host-regexp))) + "The CONTAINER.POD syntax of kubernetes host names in Tramp.") + +;;;###tramp-autoload +(defun tramp-kubernetes--container (vec) + "Extract the container name from a kubernetes host name in VEC." + (or (let ((host (tramp-file-name-host vec))) + (and (string-match tramp-kubernetes--host-name-regexp host) + (match-string 1 host))) + "")) + +;;;###tramp-autoload +(defun tramp-kubernetes--pod (vec) + "Extract the pod name from a kubernetes host name in VEC." + (or (let ((host (tramp-file-name-host vec))) + (and (string-match tramp-kubernetes--host-name-regexp host) + (match-string 2 host))) + "")) + +(defun tramp-kubernetes--current-context (vec) + "Return Kubernetes current context. +Obey `tramp-kubernetes-context'" + (or tramp-kubernetes-context + (with-tramp-connection-property nil "current-context" + (with-temp-buffer + (when (zerop + (tramp-call-process + vec tramp-kubernetes-program nil t nil + "config" "current-context")) + (goto-char (point-min)) + (buffer-substring (point) (line-end-position))))))) (defun tramp-kubernetes--current-context-data (vec) "Return Kubernetes current context data as JSON string." - (with-temp-buffer - (when (zerop - (tramp-call-process - vec tramp-kubernetes-program nil t nil - "config" "current-context")) - (goto-char (point-min)) - (let ((current-context (buffer-substring (point) (line-end-position)))) - (erase-buffer) - (when (zerop - (tramp-call-process - vec tramp-kubernetes-program nil t nil - "config" "view" "-o" - (format - "jsonpath='{.contexts[?(@.name == \"%s\")]}'" current-context))) - (buffer-string)))))) + (when-let ((current-context (tramp-kubernetes--current-context vec))) + (with-temp-buffer + (when (zerop + (tramp-call-process + vec tramp-kubernetes-program nil t nil + "config" "view" "-o" + (format + "jsonpath='{.contexts[?(@.name == \"%s\")]}'" current-context))) + (buffer-string))))) + +;;;###tramp-autoload +(defun tramp-kubernetes--context-namespace (vec) + "The kubectl options for context and namespace." + (mapconcat + #'identity + `(,(when-let ((context (tramp-kubernetes--current-context vec))) + (format "--context=%s" context)) + ,(when tramp-kubernetes-namespace + (format "--namespace=%s" tramp-kubernetes-namespace))) + " ")) ;;;###tramp-autoload (defun tramp-toolbox--completion-function (&rest _args) @@ -275,12 +344,13 @@ tramp-default-remote-shell (add-to-list 'tramp-methods `(,tramp-kubernetes-method (tramp-login-program ,tramp-kubernetes-program) - (tramp-login-args (("exec") + (tramp-login-args (("%x") ; context and namespace. + ("exec") + ("-c" "%a") ; container. ("%h") ("-it") ("--") ("%l"))) - (tramp-config-check tramp-kubernetes--current-context-data) (tramp-direct-async (,tramp-default-remote-shell "-c")) (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-login ("-l")) @@ -334,6 +404,23 @@ tramp-default-remote-shell ;; Default connection-local variables for Tramp. + (defconst tramp-container-connection-local-default-kubernetes-variables + '((tramp-config-check . tramp-kubernetes--current-context-data) + ;; This variable will be eval'ed in `tramp-expand-args'. + (tramp-extra-expand-args + . (?a (tramp-kubernetes--container (car tramp-current-connection)) + ?h (tramp-kubernetes--pod (car tramp-current-connection)) + ?x (tramp-kubernetes--context-namespace (car tramp-current-connection))))) + "Default connection-local variables for remote kubernetes connections.") + + (connection-local-set-profile-variables + 'tramp-container-connection-local-default-kubernetes-profile + tramp-container-connection-local-default-kubernetes-variables) + + (connection-local-set-profiles + `(:application tramp :protocol ,tramp-kubernetes-method) + 'tramp-container-connection-local-default-kubernetes-profile) + (defconst tramp-container-connection-local-default-flatpak-variables `((tramp-remote-path . ,(cons "/app/bin" tramp-remote-path))) "Default connection-local variables for remote flatpak connections.") diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index da34f31fea6..d8231bd5bd2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4324,6 +4324,14 @@ tramp-barf-if-no-shell-prompt (apply #'tramp-error-with-buffer (tramp-get-connection-buffer vec) vec 'file-error error-args))))) +(defvar tramp-config-check nil + "A function to be called with one argument, VEC. +It should return a string which is used to check, whether the +configuration of the remote host has been changed (which would +require to flush the cache data). This string is kept as +connection property \"config-check-data\". +This variable is intended as connection-local variable.") + (defun tramp-open-connection-setup-interactive-shell (proc vec) "Set up an interactive shell. Mainly sets the prompt and the echo correctly. PROC is the shell @@ -4370,7 +4378,7 @@ tramp-open-connection-setup-interactive-shell vec "uname" (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) (config-check-function - (tramp-get-method-parameter vec 'tramp-config-check)) + (buffer-local-value 'tramp-config-check (process-buffer proc))) (old-config-check (and config-check-function (tramp-get-connection-property vec "config-check-data"))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e7928e4e1f4..cbd4e1611eb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -300,13 +300,6 @@ tramp-methods and container methods do. If it is a list of strings, they are used to construct the remote command. - * `tramp-config-check' - A function to be called with one argument, VEC. It should - return a string which is used to check, whether the - configuration of the remote host has been changed (which - would require to flush the cache data). This string is kept - as connection property \"config-check-data\". - * `tramp-copy-program' This specifies the name of the program to use for remotely copying the file; this might be the absolute filename of scp or the name of @@ -4954,14 +4947,30 @@ tramp-compute-multi-hops ;; Result. target-alist)) +(defvar tramp-extra-expand-args nil + "Method specific arguments.") + (defun tramp-expand-args (vec parameter &rest spec-list) "Expand login arguments as given by PARAMETER in `tramp-methods'. PARAMETER is a symbol like `tramp-login-args', denoting a list of list of strings from `tramp-methods', containing %-sequences for -substitution. SPEC-LIST is a list of char/value pairs used for -`format-spec-make'." +substitution. +SPEC-LIST is a list of char/value pairs used for +`format-spec-make'. It is appended by `tramp-extra-expand-args', +a connection-local variable." (let ((args (tramp-get-method-parameter vec parameter)) - (spec (apply 'format-spec-make spec-list))) + (extra-spec-list + (mapcar + #'eval + (buffer-local-value + 'tramp-extra-expand-args (tramp-get-connection-buffer vec)))) + spec) + ;; Merge both spec lists. Remove duplicate entries. + (while spec-list + (unless (member (car spec-list) extra-spec-list) + (setq extra-spec-list (append (take 2 spec-list) extra-spec-list))) + (setq spec-list (cddr spec-list))) + (setq spec (apply #'format-spec-make extra-spec-list)) ;; Expand format spec. (flatten-tree (mapcar commit 1c499c18afd6a709272fe60a540a27093e589fff Author: Michael Albinus Date: Fri Jun 23 21:15:13 2023 +0200 ; * etc/NEWS: Fix typos. diff --git a/etc/NEWS b/etc/NEWS index b37b9877d79..88d432960f3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -402,17 +402,18 @@ name as a string. The new function completion based on dictionaries that the server supports. ** Pp -*** New 'pp-default-function' custom variable replaces 'pp-use-max-width'. + +*** New 'pp-default-function' user option replaces 'pp-use-max-width'. *** New default pretty printing function, which tries to obey 'fill-column'. -*** 'pp-to-string' takes an additional 'pp-function' argument. -This arg specifies the prettifying algorithm to use. +*** 'pp-to-string' takes an additional PP-FUNCTION argument. +This argument specifies the prettifying algorithm to use. ** Emacs Lisp mode --- -*** ',@' now has 'prefix' syntax +*** ',@' now has 'prefix' syntax. Previously, the '@' character, which normally has 'symbol' syntax, would combine with a following Lisp symbol and interfere with symbol searching. @@ -478,7 +479,7 @@ hooks named after the feature name, like 'esh-mode-unload-hook'. +++ ** Regexp zero-width assertions followed by operators are better defined. -Previously, regexps such as "xy\\B*" would have ill-defined behaviour. +Previously, regexps such as "xy\\B*" would have ill-defined behavior. Now any operator following a zero-width assertion applies to that assertion only (which is useless). For historical compatibility, an operator character following '^' or '\`' becomes literal, but we commit e2ee646b162b87e832c8032b9d90577bd21f21f8 Author: Stefan Monnier Date: Fri Jun 23 11:37:12 2023 -0400 cl-defsubst: Use static scoping for args * lisp/emacs-lisp/cl-macs.el (cl--slet): New function, partly extracted from `cl--slet*`. (cl--slet*): Use it. (cl--defsubst-expand): Use it to fix bug#47552. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-defstruct-dynbound-label): New test. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 007be1c9b08..4caa573ea9d 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -243,17 +243,24 @@ cl--bind-defs (defvar cl--bind-enquote) ;Non-nil if &cl-quote was in the formal arglist! (defvar cl--bind-lets) (defvar cl--bind-forms) +(defun cl--slet (bindings body) + "Like `cl--slet*' but for \"parallel let\"." + (cond + ((seq-some (lambda (binding) (macroexp--dynamic-variable-p (car binding))) + bindings) + ;; FIXME: We use `identity' to obfuscate the code enough to + ;; circumvent the known bug in `macroexp--unfold-lambda' :-( + `(funcall (identity (lambda (,@(mapcar #'car bindings)) + ,@(macroexp-unprogn body))) + ,@(mapcar #'cadr bindings))) + ((null (cdr bindings)) + (macroexp-let* bindings body)) + (t `(let ,bindings ,@(macroexp-unprogn body))))) + (defun cl--slet* (bindings body) "Like `macroexp-let*' but uses static scoping for all the BINDINGS." - (pcase-exhaustive bindings - ('() body) - (`((,var ,exp) . ,bindings) - (let ((rest (cl--slet* bindings body))) - (if (macroexp--dynamic-variable-p var) - ;; FIXME: We use `identity' to obfuscate the code enough to - ;; circumvent the known bug in `macroexp--unfold-lambda' :-( - `(funcall (identity (lambda (,var) ,@(macroexp-unprogn rest))) ,exp) - (macroexp-let* `((,var ,exp)) rest)))))) + (if (null bindings) body + (cl--slet `(,(car bindings)) (cl--slet* (cdr bindings) body)))) (defun cl--transform-lambda (form bind-block) "Transform a function form FORM of name BIND-BLOCK. @@ -349,8 +356,7 @@ cl--transform-lambda (list '&rest (car (pop cl--bind-lets)))))))) `((,@(nreverse simple-args) ,@rest-args) ,@header - ;; Make sure that function arguments are unconditionally statically - ;; scoped (bug#47552). + ;; Function arguments are unconditionally statically scoped (bug#47552). ,(cl--slet* cl--bind-lets (macroexp-progn `(,@(nreverse cl--bind-forms) @@ -2910,9 +2916,10 @@ cl-defsubst (cl-defun ,name ,args ,@body)))) (defun cl--defsubst-expand (argns body _simple whole _unsafe &rest argvs) - (if (and whole (not (cl--safe-expr-p (cons 'progn argvs)))) + (if (and whole (not (cl--safe-expr-p (macroexp-progn argvs)))) whole - `(let ,(cl-mapcar #'list argns argvs) ,body))) + ;; Function arguments are unconditionally statically scoped (bug#47552). + (cl--slet (cl-mapcar #'list argns argvs) body))) ;;; Structures. diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 44fc7264a0a..01ca56386e3 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -803,18 +803,28 @@ cl-case-no-warning (macroexpand form) (should (string-empty-p messages)))))))) +(defvar cl--test-a) + (ert-deftest cl-&key-arguments () (cl-flet ((fn (&key x) x)) (should-error (fn :x)) (should (eq (fn :x :a) :a))) ;; In ELisp function arguments are always statically scoped (bug#47552). - (defvar cl--test-a) (let ((cl--test-a 'dyn) ;; FIXME: How do we silence the "Lexical argument shadows" warning? (f (cl-function (lambda (&key cl--test-a b) (list cl--test-a (symbol-value 'cl--test-a) b))))) (should (equal (funcall f :cl--test-a 'lex :b 2) '(lex dyn 2))))) +(cl-defstruct cl--test-s + cl--test-a b) +(ert-deftest cl-defstruct-dynbound-label-47552 () + "Check that labels can have the same name as dynbound vars." + (let ((cl--test-a 'dyn)) + (let ((x (make-cl--test-s :cl--test-a 4 :b cl--test-a))) + (should (cl--test-s-p x)) + (should (equal (cl--test-s-cl--test-a x) 4)) + (should (equal (cl--test-s-b x) 'dyn))))) ;;; cl-macs-tests.el ends here commit 37a09a4c00e5f78c27f64ea09ec076838a1a3d47 Author: Stefan Monnier Date: Fri Jun 23 10:45:49 2023 -0400 cl-defun/cl-struct: Use static scoping for function args * lisp/emacs-lisp/cl-macs.el (cl--slet*): New function. (cl--transform-lambda): Use it to fix bug#47552. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-&key-arguments): Add test. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 0b09cd7d225..007be1c9b08 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -243,6 +243,18 @@ cl--bind-defs (defvar cl--bind-enquote) ;Non-nil if &cl-quote was in the formal arglist! (defvar cl--bind-lets) (defvar cl--bind-forms) +(defun cl--slet* (bindings body) + "Like `macroexp-let*' but uses static scoping for all the BINDINGS." + (pcase-exhaustive bindings + ('() body) + (`((,var ,exp) . ,bindings) + (let ((rest (cl--slet* bindings body))) + (if (macroexp--dynamic-variable-p var) + ;; FIXME: We use `identity' to obfuscate the code enough to + ;; circumvent the known bug in `macroexp--unfold-lambda' :-( + `(funcall (identity (lambda (,var) ,@(macroexp-unprogn rest))) ,exp) + (macroexp-let* `((,var ,exp)) rest)))))) + (defun cl--transform-lambda (form bind-block) "Transform a function form FORM of name BIND-BLOCK. BIND-BLOCK is the name of the symbol to which the function will be bound, @@ -337,10 +349,12 @@ cl--transform-lambda (list '&rest (car (pop cl--bind-lets)))))))) `((,@(nreverse simple-args) ,@rest-args) ,@header - ,(macroexp-let* cl--bind-lets - (macroexp-progn - `(,@(nreverse cl--bind-forms) - ,@body))))))) + ;; Make sure that function arguments are unconditionally statically + ;; scoped (bug#47552). + ,(cl--slet* cl--bind-lets + (macroexp-progn + `(,@(nreverse cl--bind-forms) + ,@body))))))) ;;;###autoload (defmacro cl-defun (name args &rest body) diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index a4bc8d542d4..44fc7264a0a 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -806,7 +806,15 @@ cl-case-no-warning (ert-deftest cl-&key-arguments () (cl-flet ((fn (&key x) x)) (should-error (fn :x)) - (should (eq (fn :x :a) :a)))) + (should (eq (fn :x :a) :a))) + ;; In ELisp function arguments are always statically scoped (bug#47552). + (defvar cl--test-a) + (let ((cl--test-a 'dyn) + ;; FIXME: How do we silence the "Lexical argument shadows" warning? + (f (cl-function (lambda (&key cl--test-a b) + (list cl--test-a (symbol-value 'cl--test-a) b))))) + (should (equal (funcall f :cl--test-a 'lex :b 2) '(lex dyn 2))))) + ;;; cl-macs-tests.el ends here commit d507aa7336b0a295a1fde1676c1606ae7f836a95 Author: Theodor Thornhill Date: Fri Jun 23 15:37:04 2023 +0200 Add selector_expression indentation rule * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): New rule. diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 698c6424ea2..f8e65131e0c 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -79,6 +79,7 @@ go-ts-mode--indent-rules ((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset) ((parent-is "default_case") parent-bol go-ts-mode-indent-offset) ((parent-is "expression_case") parent-bol go-ts-mode-indent-offset) + ((parent-is "selector_expression") parent-bol go-ts-mode-indent-offset) ((parent-is "expression_switch_statement") parent-bol 0) ((parent-is "field_declaration_list") parent-bol go-ts-mode-indent-offset) ((parent-is "import_spec_list") parent-bol go-ts-mode-indent-offset) commit 01ce70cea9b62185beb9b7a8c52381ea148d98d0 Author: Eli Zaretskii Date: Fri Jun 23 13:50:15 2023 +0300 Revert "Avoid header line with some empty non-nil formats" This reverts commit 4f66cbbfe520ee31ef26676e09a926217d9736fe. This is part of removing the recently-added feature whereby certain non-nil values of 'header-line-format' could signal that the header line shall not be displayed. The feature is being reverted because its advantages are very minor, whereas the complications it causes are serious. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 3bb3ae9b939..cdbda5503b7 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2597,15 +2597,6 @@ Header Lines line. @end defvar -Emacs displays the header line for a window unless -@code{header-line-format} is either @code{nil}, or it's a list whose -@sc{car} is a symbol, and either that symbol is @code{:eval} and the -second list element evaluates to @code{nil} or the symbol's value as a -variable is @code{nil} or void. Note that there are other possible -values @code{header-line-format} that result in an empty header line -(for example, @code{""}), but all other values tell Emacs to display a -header line, whether or not it is empty. - If @code{display-line-numbers-mode} is turned on in a buffer (@pxref{Display Custom, display-line-numbers-mode,, emacs, The GNU Emacs Manual}), the buffer text is indented on display by the amount diff --git a/etc/NEWS b/etc/NEWS index 422e1ec585e..b37b9877d79 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -476,14 +476,6 @@ hooks named after the feature name, like 'esh-mode-unload-hook'. +++ ** 'copy-tree' now copies records when its optional 2nd argument is non-nil. -+++ -** Certain values of 'header-line-format' now inhibit empty header line. -Emacs now avoids displaying a header line, instead of displaying an -empty one, when 'header-line-format' is a list whose 'car' is a -symbol, and either that symbol is ':eval' and the second element of -the list evaluates to 'nil' or the symbol's value as a variable is -'nil' or void. - +++ ** Regexp zero-width assertions followed by operators are better defined. Previously, regexps such as "xy\\B*" would have ill-defined behaviour. diff --git a/src/lisp.h b/src/lisp.h index 2978de962d9..2bfcd1a1983 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4174,7 +4174,6 @@ verify (FLT_RADIX == 2 || FLT_RADIX == 16); extern void syms_of_xdisp (void); extern void init_xdisp (void); extern Lisp_Object safe_eval (Lisp_Object); -extern Lisp_Object safe_eval_inhibit_quit (Lisp_Object); extern bool pos_visible_p (struct window *, ptrdiff_t, int *, int *, int *, int *, int *, int *); diff --git a/src/window.c b/src/window.c index 164af6f67f0..1a53e466dfb 100644 --- a/src/window.c +++ b/src/window.c @@ -5470,48 +5470,6 @@ window_wants_mode_line (struct window *w) } -/** - * null_header_line_format: - * - * Return non-zero when header line format FMT indicates that the - * header line should not be displayed at all. - * - * This is when FMT is nil, or if FMT is a cons cell and either its - * car is a symbol whose value as a variable is nil or void, or its - * car is the symbol ':eval' and its cadr evaluates to nil. - */ -static bool -null_header_line_format (Lisp_Object fmt, struct frame * f) -{ - Lisp_Object car; - Lisp_Object val; - - if (NILP (fmt)) - return true; - - if (CONSP (fmt)) - { - car = XCAR (fmt); - if (SYMBOLP (car)) - { - if (EQ (car, QCeval)) - { - val = safe_eval_inhibit_quit (XCAR (XCDR (fmt))); - if (!FRAME_LIVE_P (f)) - signal_error (":eval deleted the frame being displayed", fmt); - return NILP (val); - } - val = find_symbol_value (car); - return (SYMBOLP (car) - && (EQ (val, Qunbound) - || NILP (val))); - } - } - - return false; -} - - /** * window_wants_header_line: * @@ -5532,16 +5490,12 @@ window_wants_header_line (struct window *w) Lisp_Object window_header_line_format = window_parameter (w, Qheader_line_format); - struct frame * f = WINDOW_XFRAME(w); - return (WINDOW_LEAF_P (w) && !MINI_WINDOW_P (w) && !WINDOW_PSEUDO_P (w) && !EQ (window_header_line_format, Qnone) - && (!null_header_line_format (window_header_line_format, f) - || !null_header_line_format (BVAR (XBUFFER (WINDOW_BUFFER (w)), - header_line_format), - f)) + && (!NILP (window_header_line_format) + || !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), header_line_format))) && (WINDOW_PIXEL_HEIGHT (w) > (window_wants_mode_line (w) ? 2 * WINDOW_FRAME_LINE_HEIGHT (w) diff --git a/src/xdisp.c b/src/xdisp.c index 4a48b93b29e..85ece901111 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3074,12 +3074,6 @@ safe__eval (bool inhibit_quit, Lisp_Object sexpr) return safe__call1 (inhibit_quit, Qeval, sexpr); } -Lisp_Object -safe_eval_inhibit_quit (Lisp_Object sexpr) -{ - return safe__eval (true, sexpr); -} - /* Call function FN with two arguments ARG1 and ARG2. Return the result, or nil if something went wrong. */ commit accff13e646c06f3ce526b62c5ca81a76361da6e Author: Eli Zaretskii Date: Fri Jun 23 13:47:53 2023 +0300 Revert "; Fix last change" This reverts commit 05c2be28a3e97bd920d0bf8c8b59ec682a420cce. This is part of removing the recently-added feature whereby certain non-nil values of 'header-line-format' could signal that the header line shall not be displayed. The feature is being reverted because its advantages are very minor, whereas the complications it causes are serious. diff --git a/src/window.c b/src/window.c index 58f98e78354..164af6f67f0 100644 --- a/src/window.c +++ b/src/window.c @@ -5474,14 +5474,14 @@ window_wants_mode_line (struct window *w) * null_header_line_format: * * Return non-zero when header line format FMT indicates that the - * header line should not be displayed at all, for windows on frame F. + * header line should not be displayed at all. * * This is when FMT is nil, or if FMT is a cons cell and either its * car is a symbol whose value as a variable is nil or void, or its * car is the symbol ':eval' and its cadr evaluates to nil. */ static bool -null_header_line_format (Lisp_Object fmt, struct frame *f) +null_header_line_format (Lisp_Object fmt, struct frame * f) { Lisp_Object car; Lisp_Object val; @@ -5532,7 +5532,7 @@ window_wants_header_line (struct window *w) Lisp_Object window_header_line_format = window_parameter (w, Qheader_line_format); - struct frame *f = WINDOW_XFRAME(w); + struct frame * f = WINDOW_XFRAME(w); return (WINDOW_LEAF_P (w) && !MINI_WINDOW_P (w) @@ -5540,7 +5540,8 @@ window_wants_header_line (struct window *w) && !EQ (window_header_line_format, Qnone) && (!null_header_line_format (window_header_line_format, f) || !null_header_line_format (BVAR (XBUFFER (WINDOW_BUFFER (w)), - header_line_format), f)) + header_line_format), + f)) && (WINDOW_PIXEL_HEIGHT (w) > (window_wants_mode_line (w) ? 2 * WINDOW_FRAME_LINE_HEIGHT (w) commit ddf508e8acbe7ad29879dd0a5e341a6acea5c772 Author: Eli Zaretskii Date: Fri Jun 23 13:47:33 2023 +0300 Revert "; Fix coding style in just installed change" This reverts commit 229f0b8dd3b92827b6e0c6fc105508e8b80858f5. This is part of removing the recently-added feature whereby certain non-nil values of 'header-line-format' could signal that the header line shall not be displayed. The feature is being reverted because its advantages are very minor, whereas the complications it causes are serious. diff --git a/src/window.c b/src/window.c index 801da24ffbf..58f98e78354 100644 --- a/src/window.c +++ b/src/window.c @@ -5529,10 +5529,10 @@ null_header_line_format (Lisp_Object fmt, struct frame *f) bool window_wants_header_line (struct window *w) { - Lisp_Object window_header_line_format - = window_parameter (w, Qheader_line_format); + Lisp_Object window_header_line_format = + window_parameter (w, Qheader_line_format); - struct frame *f = WINDOW_XFRAME (w); + struct frame *f = WINDOW_XFRAME(w); return (WINDOW_LEAF_P (w) && !MINI_WINDOW_P (w) commit 7c41dcde1c65969702b31b3e65df175984111901 Author: Eli Zaretskii Date: Fri Jun 23 13:47:05 2023 +0300 Revert "; * src/window.c (window_wants_header_line): Shut up bogus GCC warning." This reverts commit ef8485ad05dd9200b68ea8141fd44c7b976140cd. This is part of removing the recently-added feature whereby certain non-nil values of 'header-line-format' could signal that the header line shall not be displayed. The feature is being reverted because its advantages are very minor, whereas the complications it causes are serious. diff --git a/src/window.c b/src/window.c index e56dad63a70..801da24ffbf 100644 --- a/src/window.c +++ b/src/window.c @@ -5533,14 +5533,13 @@ window_wants_header_line (struct window *w) = window_parameter (w, Qheader_line_format); struct frame *f = WINDOW_XFRAME (w); - Lisp_Object wbuffer = WINDOW_BUFFER (w); - return (BUFFERP (wbuffer) + return (WINDOW_LEAF_P (w) && !MINI_WINDOW_P (w) && !WINDOW_PSEUDO_P (w) && !EQ (window_header_line_format, Qnone) && (!null_header_line_format (window_header_line_format, f) - || !null_header_line_format (BVAR (XBUFFER (wbuffer), + || !null_header_line_format (BVAR (XBUFFER (WINDOW_BUFFER (w)), header_line_format), f)) && (WINDOW_PIXEL_HEIGHT (w) > (window_wants_mode_line (w) commit c964dd0820bfdc5bdc354145ceec868e2854dc95 Author: Eli Zaretskii Date: Fri Jun 23 13:44:59 2023 +0300 Revert "Avoid infinite recursion in 'window_wants_header_line'" This reverts commit 3de8ed09ab46b9922e15aaf0cc8884b41087c996. This is part of removing the recently-added feature whereby certain non-nil values of 'header-line-format' could signal that the header line shall not be displayed. The feature is being reverted because its advantages are very minor, whereas the complications it causes are serious. diff --git a/src/window.c b/src/window.c index fa024b6d2d8..e56dad63a70 100644 --- a/src/window.c +++ b/src/window.c @@ -5469,7 +5469,6 @@ window_wants_mode_line (struct window *w) && WINDOW_PIXEL_HEIGHT (w) > WINDOW_FRAME_LINE_HEIGHT (w)); } -static int header_line_eval_called = 0; /** * null_header_line_format: @@ -5497,18 +5496,9 @@ null_header_line_format (Lisp_Object fmt, struct frame *f) { if (EQ (car, QCeval)) { - if (header_line_eval_called > 0) - return false; - eassert (header_line_eval_called == 0); - header_line_eval_called++; val = safe_eval_inhibit_quit (XCAR (XCDR (fmt))); - header_line_eval_called--; - eassert (header_line_eval_called == 0); if (!FRAME_LIVE_P (f)) - { - header_line_eval_called = 0; - signal_error (":eval deleted the frame being displayed", fmt); - } + signal_error (":eval deleted the frame being displayed", fmt); return NILP (val); } val = find_symbol_value (car); commit 1f664a0af758b2d458d9c7edf063adf5de8be7c4 Author: Eli Zaretskii Date: Thu Jun 22 19:33:31 2023 +0300 Add "nixd" LSP server to Eglot * lisp/progmodes/eglot.el (eglot-server-programs): Add "nixd". Patch by Brian Leung . (Bug#64214) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 00f2e547e05..890f1e91b86 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -230,7 +230,7 @@ eglot-server-programs . ,(eglot-alternatives '("digestif" "texlab"))) (erlang-mode . ("erlang_ls" "--transport" "stdio")) ((yaml-ts-mode yaml-mode) . ("yaml-language-server" "--stdio")) - (nix-mode . ,(eglot-alternatives '("nil" "rnix-lsp"))) + (nix-mode . ,(eglot-alternatives '("nil" "rnix-lsp" "nixd"))) (gdscript-mode . ("localhost" 6008)) ((fortran-mode f90-mode) . ("fortls")) (futhark-mode . ("futhark" "lsp")) commit e962cf4ba726943b0f4ea57e1d740742e7618e3a Author: Eli Zaretskii Date: Thu Jun 22 14:03:17 2023 +0300 Fix building --with-native-compilation=aot from release tarball * lisp/Makefile.in (%.eln): Pattern rule for AOT native compilation. (compile-eln-targets, compile-eln-aot): New targets for AOT native compilation. * src/Makefile.in (../native-lisp): If NATIVE_COMPILATION_AOT is set, also native-compile all the other Lisp files. (Bug#64167) diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 1e0935f565f..0a534a278f7 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -436,6 +436,42 @@ trampolines: $(emacs) -l comp -f comp-compile-all-trampolines endif +.PHONY: compile-eln-targets compile-eln-aot + +# ELNDONE is defined by ../src/Makefile, as the list of preloaded +# *.eln files, which are therefore already compiled by the time +# compile-eln-aot is called. +ifeq ($(NATIVE_COMPILATION_AOT),yes) +%.eln: %.el + $(AM_V_ELN)$(emacs) $(BYTE_COMPILE_FLAGS) \ + -l comp -f byte-compile-refresh-preloaded \ + --eval '(batch-native-compile t)' $< + +compile-eln-targets: $(filter-out $(ELNDONE),$(TARGETS)) +else +compile-eln-targets: +endif + +# This is called from ../src/Makefile when building a release tarball +# configured --with-native-compilation=aot. +compile-eln-aot: + @(cd $(lisp) && \ + els=`echo "${SUBDIRS_REL} " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \ + for el in $$els; do \ + test -f $$el || continue; \ + test -f $${el}c || continue; \ + GREP_OPTIONS= grep '^;.*[^a-zA-Z]no-byte-compile: *t' $$el > /dev/null && \ + continue; \ + GREP_OPTIONS= grep '^;.*[^a-zA-Z]no-native-compile: *t' $$el > /dev/null && \ + continue; \ + echo "$${el}n"; \ + done | xargs $(XARGS_LIMIT) echo) | \ + while read chunk; do \ + $(MAKE) compile-eln-targets \ + TARGETS="$$chunk" ELNDONE="$(ELNDONE)"; \ + done + + .PHONY: backup-compiled-files compile-after-backup # Backup compiled Lisp files in elc.tar.gz. If that file already diff --git a/src/Makefile.in b/src/Makefile.in index c29c3750e59..9bc53c072ea 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -872,6 +872,11 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) $(lisp: ## native-lisp where the *.eln files will be produced, and the exact ## names of those *.eln files, cannot be known in advance; we must ask ## Emacs to produce them. +## If AOT native compilation is requested, we additionally +## native-compile all the *.el files in ../lisp that need to be +## compiled and haven't yet been compiled. ELDONE holds the list +## of *.el files that were already native-compiled. +NATIVE_COMPILATION_AOT = @NATIVE_COMPILATION_AOT@ ../native-lisp: | $(pdmp) @if test ! -d $@; then \ mkdir $@ && $(MAKE) $(AM_V_NO_PD) $(elnlisp); \ @@ -882,6 +887,9 @@ ../native-lisp: --bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR) \ && cp -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT) \ && cp -f $(pdmp) $(bootstrap_pdmp); \ + if test $(NATIVE_COMPILATION_AOT) = yes; then \ + $(MAKE) $(AM_V_NO_PD) -C ../lisp compile-eln-aot EMACS="../src/emacs$(EXEEXT)" ELNDONE="$(addprefix %,$(notdir $(elnlisp))))"; \ + fi; \ fi endif commit 4ca371e9cc7178572cc25cbe47371c0075405ff7 Author: Alan Mackenzie Date: Wed Jun 21 14:23:14 2023 +0000 Fix bug#64152 (Minibuffer sometimes goes "modal") In particular, when a frame has no minibuffer and is using that of a different "normal" frame, C-x 5 o, etc., and GUI operations fail. Fix by partially reverting the commit from 2022-07-07 15:38:09 +0000 "Remove obscure, obsolete code from do_switch_frame". As a consequent change, also revert the commit from 2022-07-08 20:19:03 +0000 "Remove now unused parameter TRACK from do_switch_frame". * src/frame.c (do_switch_frame): Restore the TRACK parameter. Restore the code which redirects the frame focus when a new frame gets selected. * src/frame.c (Fselect_frame, Fhandle_switch_frame) (delete_frame) * src/keyboard.c (quit_throw_to_read_char) * src/lisp.h (do_switch_frame prototype) * src/minibuf.c (read_minibuf_unwind) * src/window.c (Fset_window_configuration): Restore the TRACK argument to do_switch_frame. * src/xterm.c (x_try_restore_frame): Add a zero TRACK argument to do_switch_frame. diff --git a/src/frame.c b/src/frame.c index 38a6583605c..fc6a3459482 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1444,6 +1444,10 @@ DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame, If FRAME is a switch-frame event `(switch-frame FRAME1)', use FRAME1 as frame. + If TRACK is non-zero and the frame that currently has the focus + redirects its focus to the selected frame, redirect that focused + frame's focus to FRAME instead. + FOR_DELETION non-zero means that the selected frame is being deleted, which includes the possibility that the frame's terminal is dead. @@ -1451,7 +1455,7 @@ DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame, The value of NORECORD is passed as argument to Fselect_window. */ Lisp_Object -do_switch_frame (Lisp_Object frame, int for_deletion, Lisp_Object norecord) +do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object norecord) { struct frame *sf = SELECTED_FRAME (), *f; @@ -1473,6 +1477,44 @@ do_switch_frame (Lisp_Object frame, int for_deletion, Lisp_Object norecord) else if (f == sf) return frame; + /* If the frame with GUI focus has had it's Emacs focus redirected + toward the currently selected frame, we should change the + redirection to point to the newly selected frame. This means + that if the focus is redirected from a minibufferless frame to a + surrogate minibuffer frame, we can use `other-window' to switch + between all the frames using that minibuffer frame, and the focus + redirection will follow us around. This code is necessary when + we have a minibufferless frame using the MB in another (normal) + frame (bug#64152) (ACM, 2023-06-20). */ +#ifdef HAVE_WINDOW_SYSTEM + if (track && FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->get_focus_frame) + { + Lisp_Object gfocus; /* The frame which still has focus on the + current terminal, according to the GUI + system. */ + Lisp_Object focus; /* The frame to which Emacs has redirected + the focus from `gfocus'. This might be a + frame with a minibuffer when `gfocus' + doesn't have a MB. */ + + gfocus = FRAME_TERMINAL (f)->get_focus_frame (f); + if (FRAMEP (gfocus)) + { + focus = FRAME_FOCUS_FRAME (XFRAME (gfocus)); + if (FRAMEP (focus) && XFRAME (focus) == SELECTED_FRAME ()) + /* Redirect frame focus also when FRAME has its minibuffer + window on the selected frame (see Bug#24500). + + Don't do that: It causes redirection problem with a + separate minibuffer frame (Bug#24803) and problems + when updating the cursor on such frames. + || (NILP (focus) + && EQ (FRAME_MINIBUF_WINDOW (f), sf->selected_window))) */ + Fredirect_frame_focus (gfocus, frame); + } + } +#endif /* HAVE_X_WINDOWS */ + if (!for_deletion && FRAME_HAS_MINIBUF_P (sf)) resize_mini_window (XWINDOW (FRAME_MINIBUF_WINDOW (sf)), 1); @@ -1574,7 +1616,7 @@ DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 2, "e", /* Do not select a tooltip frame (Bug#47207). */ error ("Cannot select a tooltip frame"); else - return do_switch_frame (frame, 0, norecord); + return do_switch_frame (frame, 1, 0, norecord); } DEFUN ("handle-switch-frame", Fhandle_switch_frame, @@ -1590,7 +1632,7 @@ DEFUN ("handle-switch-frame", Fhandle_switch_frame, kset_prefix_arg (current_kboard, Vcurrent_prefix_arg); run_hook (Qmouse_leave_buffer_hook); - return do_switch_frame (event, 0, Qnil); + return do_switch_frame (event, 0, 0, Qnil); } DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0, @@ -2108,7 +2150,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) Fraise_frame (frame1); #endif - do_switch_frame (frame1, 1, Qnil); + do_switch_frame (frame1, 0, 1, Qnil); sf = SELECTED_FRAME (); } else diff --git a/src/keyboard.c b/src/keyboard.c index b1ccf4acde4..99f886821e2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11561,7 +11561,7 @@ quit_throw_to_read_char (bool from_signal) if (FRAMEP (internal_last_event_frame) && !EQ (internal_last_event_frame, selected_frame)) do_switch_frame (make_lispy_switch_frame (internal_last_event_frame), - 0, Qnil); + 0, 0, Qnil); sys_longjmp (getcjmp, 1); } diff --git a/src/lisp.h b/src/lisp.h index 9c02d975a74..bf91a1559bf 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4878,7 +4878,7 @@ fast_c_string_match_ignore_case (Lisp_Object regexp, /* Defined in frame.c. */ extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); -extern Lisp_Object do_switch_frame (Lisp_Object, int, Lisp_Object); +extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object); extern Lisp_Object get_frame_param (struct frame *, Lisp_Object); extern void frames_discard_buffer (Lisp_Object); extern void init_frame_once (void); diff --git a/src/minibuf.c b/src/minibuf.c index bcb7eb9375d..6e54d8c3ba5 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1125,8 +1125,8 @@ read_minibuf_unwind (void) found: if (!EQ (exp_MB_frame, saved_selected_frame) && !NILP (exp_MB_frame)) - do_switch_frame (exp_MB_frame, 0, Qt); /* This also sets - minibuf_window */ + do_switch_frame (exp_MB_frame, 0, 0, Qt); /* This also sets + minibuf_window */ /* To keep things predictable, in case it matters, let's be in the minibuffer when we reset the relevant variables. Don't depend on @@ -1238,7 +1238,7 @@ read_minibuf_unwind (void) /* Restore the selected frame. */ if (!EQ (exp_MB_frame, saved_selected_frame) && !NILP (exp_MB_frame)) - do_switch_frame (saved_selected_frame, 0, Qt); + do_switch_frame (saved_selected_frame, 0, 0, Qt); } /* Replace the expired minibuffer in frame exp_MB_frame with the next less diff --git a/src/window.c b/src/window.c index 0efd6813f8d..1dc977626b3 100644 --- a/src/window.c +++ b/src/window.c @@ -7399,7 +7399,7 @@ DEFUN ("set-window-configuration", Fset_window_configuration, do_switch_frame (NILP (dont_set_frame) ? data->selected_frame : old_frame - , 0, Qnil); + , 0, 0, Qnil); } FRAME_WINDOW_CHANGE (f) = true; diff --git a/src/xterm.c b/src/xterm.c index e981a36fa9c..5840b15bcb7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -25792,7 +25792,7 @@ x_try_restore_frame (void) FOR_EACH_FRAME (tail, frame) { - if (!NILP (do_switch_frame (frame, 1, Qnil))) + if (!NILP (do_switch_frame (frame, 0, 1, Qnil))) return; } } commit a0ccf1859cc636998403c52cb25d5aaf43744d47 Author: Eli Zaretskii Date: Wed Jun 21 16:10:52 2023 +0300 Disable target-async by default in gdb-mi.el * lisp/progmodes/gdb-mi.el (gdb-non-stop-setting): Disable until bug#63084 is fixed. (Bug#64186) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 27f04e07e80..4ad73823b64 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -453,7 +453,9 @@ gdb-debug-log-max (const :tag "Unlimited" nil)) :version "22.1") -(defcustom gdb-non-stop-setting (not (eq system-type 'windows-nt)) +;; This is disabled by default because we don't really support +;; asynchronous execution of the debuggee; see bug#63084. FIXME. +(defcustom gdb-non-stop-setting nil "If non-nil, GDB sessions are expected to support the non-stop mode. When in the non-stop mode, stopped threads can be examined while other threads continue to execute. @@ -468,7 +470,7 @@ gdb-non-stop-setting GDB session needs to be restarted for this setting to take effect." :type 'boolean :group 'gdb-non-stop - :version "26.1") + :version "29.1") (defcustom gdb-debuginfod-enable-setting ;; debuginfod servers are only for ELF executables, and elfutils, of commit 2bad5829ff76538774676f7274f40ce7baf04c73 Author: Filipp Gunbin Date: Tue Jun 20 18:25:24 2023 +0300 Revert "Fix parsing of dn line if WITHDN is non-nil" This reverts commits 71b27779a9a and d2246b26275, because they change the return value of "ldap-search" in an incompatible way. The fix (a different one) will be done on master instead (bug#64089). diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index 8897c3b6d54..78405414a28 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -703,17 +703,7 @@ ldap-search-internal (while (progn (skip-chars-forward " \t\n") (not (eobp))) - ;; Ignore first (dn) line if WITHDN equals nil. If WITHDN - ;; is non-nil, check syntax of the line and split it into a - ;; pair as expected by `ldap-decode-attribute' (Bug#64089). - ;; If the syntax is wrong, better throw an error here, since - ;; otherwise `ldap-decode-attribute' would throw a much less - ;; comprehensible error later. - (cond ((not withdn)) - ((looking-at "dn[=:\t ]+\\(.*\\)$") - (setq dn (list "dn" (match-string 1)))) - (t (error "Incorrect dn line \"%s\" in ldapsearch result" - (buffer-substring (point) (line-end-position))))) + (setq dn (buffer-substring (point) (line-end-position))) (forward-line 1) (while (looking-at "^\\([A-Za-z][-A-Za-z0-9]*\ \\|[0-9]+\\(?:\\.[0-9]+\\)*\\)\\(;[-A-Za-z0-9]+\\)*[=:\t ]+\ commit 7637e361d3baeefc7e6ab147ccfccfcc774dcd01 Author: Eli Zaretskii Date: Tue Jun 20 16:35:09 2023 +0300 Don't truncate filenames with "emacs.el" in them * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol): Avoid false positives when looking for "emacs.el" matches the likes of "emacs.elpa". (Bug#64143) diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index f9f919afb1b..bf890fc35a9 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -407,7 +407,7 @@ find-function-search-for-symbol (setq library (substring library 0 (match-beginning 1)))) ;; Strip extension from .emacs.el to make sure symbol is searched in ;; .emacs too. - (when (string-match "\\.emacs\\(.el\\)" library) + (when (string-match "\\.emacs\\(.el\\)\\'" library) (setq library (substring library 0 (match-beginning 1)))) (let* ((filename (find-library-name library)) (regexp-symbol (cdr (assq type find-function-regexp-alist)))) commit 2591eb1190a24074357a2f178bc02ddc86c94b43 Author: Eli Zaretskii Date: Tue Jun 20 15:31:57 2023 +0300 Improve documentation of 'minibuffer-message' * doc/lispref/minibuf.texi (Minibuffer Misc): Clarify that 'minibuffer-message' behaves like 'message' if called from a buffer that is not a minibuffer. * lisp/minibuffer.el (minibuffer-message) (set-minibuffer-message, clear-minibuffer-message): Doc fixes. (Bug#64165) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 9a386ff310d..52eea3b9535 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2805,13 +2805,23 @@ Minibuffer Misc @vindex minibuffer-message-timeout @defun minibuffer-message string &rest args -This function displays @var{string} temporarily at the end of the -minibuffer text, for a few seconds, or until the next input event -arrives, whichever comes first. The variable -@code{minibuffer-message-timeout} specifies the number of seconds to -wait in the absence of input. It defaults to 2. If @var{args} is -non-@code{nil}, the actual message is obtained by passing @var{string} -and @var{args} through @code{format-message}. @xref{Formatting Strings}. +This function is like @code{message} (@pxref{Displaying Messages}), +but it displays the messages specially when the user types in the +minibuffer, typically because Emacs prompted the user for some input. +When the minibuffer is the current buffer, this function displays the +message specified by @var{string} temporarily at the end of the +minibuffer text, and thus avoids hiding the minibuffer text by the +echo-area display of the message. It leaves the message on display +for a few seconds, or until the next input event arrives, whichever +comes first. The variable @code{minibuffer-message-timeout} specifies +the number of seconds to wait in the absence of input. It defaults to +2. If @var{args} is non-@code{nil}, the actual message is obtained by +passing @var{string} and @var{args} through @code{format-message}. +@xref{Formatting Strings}. + +If called when the minibuffer is not the current buffer, this function +just calls @code{message}, and thus @var{string} will be shown in the +echo-area. @end defun @deffn Command minibuffer-inactive-mode diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 41eb95fd20f..4aa1ab3e890 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -715,11 +715,21 @@ minibuffer-message-properties "Text properties added to the text shown by `minibuffer-message'.") (defun minibuffer-message (message &rest args) - "Temporarily display MESSAGE at the end of the minibuffer. -The text is displayed for `minibuffer-message-timeout' seconds, -or until the next input event arrives, whichever comes first. -Enclose MESSAGE in [...] if this is not yet the case. -If ARGS are provided, then pass MESSAGE through `format-message'." + "Temporarily display MESSAGE at the end of minibuffer text. +This function is designed to be called from the minibuffer, i.e., +when Emacs prompts the user for some input, and the user types +into the minibuffer. If called when the current buffer is not +the minibuffer, this function just calls `message', and thus +displays MESSAGE in the echo-area. +When called from the minibuffer, this function displays MESSAGE +at the end of minibuffer text for `minibuffer-message-timeout' +seconds, or until the next input event arrives, whichever comes first. +It encloses MESSAGE in [...] if it is not yet enclosed. +The intent is to show the message without hiding what the user typed. +If ARGS are provided, then the function first passes MESSAGE +through `format-message'. +If some of the minibuffer text has the `minibuffer-message' text +property, MESSAGE is shown at that position instead of EOB." (if (not (minibufferp (current-buffer) t)) (progn (if args @@ -796,7 +806,7 @@ minibuffer--message-overlay-pos (next-single-property-change pt 'minibuffer-message nil (point-max))))) (defun set-minibuffer-message (message) - "Temporarily display MESSAGE at the end of the minibuffer. + "Temporarily display MESSAGE at the end of the active minibuffer window. If some part of the minibuffer text has the `minibuffer-message' property, the message will be displayed before the first such character, instead of at the end of the minibuffer. @@ -954,7 +964,7 @@ set-multi-message multi-message-separator))) (defun clear-minibuffer-message () - "Clear minibuffer message. + "Clear message temporarily shown in the minibuffer. Intended to be called via `clear-message-function'." (when (not noninteractive) (when (timerp minibuffer-message-timer) commit 6f211bc57b922d55c9452bbfa7d01e50e82da25f Author: João Távora Date: Mon Jun 19 23:31:03 2023 +0100 Eglot: again fix positions of coinciding inlay hint overlays (bug#64101) This bug originated from the previous fix, and is reproducible on non Mac OS platforms, as long as the very latest version (at time of writing) of the rust-analyzer server is used. * lisp/progmodes/eglot.el (eglot--update-hints-1): Reverse priorities when pegging overlays after (i.e. when before-string is used). diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 352a6ffd6b0..00f2e547e05 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3644,7 +3644,7 @@ eglot--update-hints-1 (if peg-after-p (make-overlay (point) (1+ (point)) nil t) (make-overlay (1- (point)) (point) nil nil nil))) - (do-it (label lpad rpad i) + (do-it (label lpad rpad i n) (let* ((firstp (zerop i)) (tweak-cursor-p (and firstp peg-after-p)) (ov (make-ov)) @@ -3657,18 +3657,18 @@ eglot--update-hints-1 (1 'eglot-type-hint-face) (2 'eglot-parameter-hint-face) (_ 'eglot-inlay-hint-face)))) - (overlay-put ov 'priority i) + (overlay-put ov 'priority (if peg-after-p i (- n i))) (overlay-put ov 'eglot--inlay-hint t) (overlay-put ov 'evaporate t) (overlay-put ov 'eglot--overlay t)))) - (if (stringp label) (do-it label left-pad right-pad 0) + (if (stringp label) (do-it label left-pad right-pad 0 1) (cl-loop for i from 0 for ldetail across label do (eglot--dbind ((InlayHintLabelPart) value) ldetail (do-it value (and (zerop i) left-pad) (and (= i (1- (length label))) right-pad) - i))))))))) + i (length label)))))))))) (jsonrpc-async-request (eglot--current-server-or-lose) :textDocument/inlayHint commit a24e9e3fee59435422af0473b7ec585de2c13b4e (tag: refs/tags/emacs-29.0.92) Author: Eli Zaretskii Date: Sun Jun 18 07:15:29 2023 -0400 ; Update ChangeLog.4 and etc/AUTHORS. diff --git a/ChangeLog.4 b/ChangeLog.4 index 2ce1351286e..b8efa20cdf9 100644 --- a/ChangeLog.4 +++ b/ChangeLog.4 @@ -1,3 +1,1000 @@ +2023-06-18 Mattias Engdegård + + Describe primarily the Emacs s-exp dialect for treesit queries + + * doc/lispref/parsing.texi (Pattern Matching, Multiple Languages): + Writing tree-sitter queries as Emacs s-expressions is much more + convenient than using the native query notation inside a string, + so it makes sense to base the documentation on the former dialect + (bug#64017). + +2023-06-18 Eli Zaretskii + + Fix documentation of :predicate in 'define-globalized-minor-mode' + + * doc/lispref/modes.texi (Defining Minor Modes): + * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): + Document that :predicate creates a customizable user option. + (Bug#64048) + +2023-06-17 Basil L. Contovounesios + + Revert "Fix some tree-sitter :match regexps" + + This reverts commit 95091b77f0bbb2ae1aa94ef4a413626e7d434d58 + of 2023-06-17, mistakenly pushed to emacs-29. + + The patch will be installed on master instead, and backported later, + after Emacs 29.1 is released (bug#64019). + + Do not merge to master. + +2023-06-17 Michael Albinus + + Require ls-lisp in Tramp only when needed + + * lisp/net/tramp-compat.el (ls-lisp): Require only on MS Windows. + (Bug#64124) + + * lisp/net/tramp-sh.el (ls-lisp-use-insert-directory-program): Declare. + (tramp-sh-handle-insert-directory): Simplify. + + * lisp/net/tramp.el (ls-lisp-use-insert-directory-program): Declare. + (tramp-handle-insert-directory): Require ls-lisp. Simplify. + +2023-06-17 Alan Mackenzie + + After minibuffer action, don't make the minibuffer current + + This fixes bug#63967. + + * src/minibuf.c (minibuffer_unwind): After restoring the next + minibuffer outwards to the mini window (when + enable-recursive-minibuffers is non-nil), don't call + Fset_frame_selected_window, which used to set the current + window to be the mini window. + +2023-06-17 Basil L. Contovounesios + + Fix some tree-sitter :match regexps + + The shy groups were caught by modified versions of the GNU ELPA + packages xr and relint: + - https://github.com/mattiase/xr/pull/6 + - https://github.com/mattiase/relint/pull/14 + + * lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Quote special + character in regexp. + * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): + * lisp/progmodes/js.el (js--plain-method-re): + (js--treesit-font-lock-settings): + * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): + * lisp/progmodes/typescript-ts-mode.el + (typescript-ts-mode--font-lock-settings): Replace character + alternative [\\d], which matches '\' or 'd', with the most likely + intention [0-9]. Fix shy groups mistyped as optional colons. + Remove unneeded numbered :match group in rust-ts-mode (bug#64019). + +2023-06-17 João Távora + + Eglot: fix relative position of coinciding inlay hint overlays (bug#64101) + + Only seems to happen on certain platforms, like Mac OS. Reason + unknown reason so far, but this defensive fix seems safe. + + * lisp/progmodes/eglot.el (eglot--update-hints-1): Explicitly put + priority in inlay hint overalys. + +2023-06-17 Eli Zaretskii + + Fix documentation of comment-dwim (bug#64104) + + * lisp/newcomment.el (comment-dwim): Doc fix. + + * doc/emacs/programs.texi (Comment Commands): More accurate + description of what 'M-;' does when there's no active region. + +2023-06-17 Jens Schmidt + + Fix parsing of dn line if WITHDN is non-nil + + Function `ldap-search' errors out with `wrong-type-argument listp' + when called with WITHDN non-nil. + * lisp/net/ldap.el (ldap-search-internal): Parse the dn line + correctly so that `ldap-search' can grok it. (Bug#64089) + +2023-06-15 Andreas Schwab + + * doc/misc/calc.texi (Advanced Math Functions): Correct calc + algebraic syntax. + +2023-06-15 Eli Zaretskii + + Consider 'dired-kill-when-opening-new-dired-buffer' in mouse clicks + + * lisp/dired.el (dired-mouse-find-file): Honor the value of + 'dired-kill-when-opening-new-dired-buffer'. (Bug#64079) + +2023-06-15 Eli Zaretskii + + Fix Gamma function definition in calc.texi + + * doc/misc/calc.texi (Advanced Math Functions): Fix definition + of Gamma function. Use @sup in @infoline lines. (Bug#64077) + +2023-06-15 Eli Zaretskii + + Fix subscripts in the Calc manual + + * doc/misc/calc.texi (Musical Notes): Use @sub instead of TeX-only + '_' notation. For the details, see the discussion in + https://lists.gnu.org/archive/html/emacs-devel/2023-06/msg00096.html. + +2023-06-15 Eli Zaretskii + + Improve documentation of 'declare' forms + + * lisp/simple.el (read-extended-command-predicate): Mention the + '(declare completion ...' form in the doc string. + + * doc/lispref/functions.texi (Declare Form): Clarify + 'completion-predicate' and 'modes'; add cross-references. + (Bug#64045) + +2023-06-13 Basil L. Contovounesios + + Improve tree-sitter docs + + * doc/lispref/positions.texi (List Motion): Incorporate more + accurate description of treesit-defun-type-regexp from + '(elisp) Tree-sitter Major Modes', replacing that duplicate + entry (bug#64018). + + * doc/lispref/parsing.texi (Parsing Program Source) + (Language Grammar, Using Parser, Retrieving Nodes) + (Accessing Node Information, Pattern Matching, Multiple Languages): + (Tree-sitter Major Modes): + * doc/lispref/modes.texi (Parser-based Font Lock): Improve wording, + grammar, punctuation, and markup. Fix typos. + (Parser-based Indentation): Ditto. Document indent rule presets + field-is, catch-all, nth-sibling, grand-parent, and + great-grand-parent. + + * lisp/treesit.el (treesit-simple-indent-presets): Mention field-is, + catch-all, nth-sibling, grand-parent, great-grand-parent in + docstring. + (treesit-major-mode-setup, treesit-explore-mode): Improve + docstring/commentary grammar. + +2023-06-13 Basil L. Contovounesios + + Fix some Texinfo markup in manuals + + * doc/emacs/macos.texi (Mac / GNUstep Customization): + * doc/lispintro/emacs-lisp-intro.texi (condition-case): + * doc/lispref/control.texi (pcase Macro): + * doc/lispref/debugging.texi (Internals of Debugger): + * doc/lispref/internals.texi (Building Emacs): + * doc/lispref/modes.texi (Imenu): + (Parser-based Font Lock, Parser-based Indentation): + * doc/lispref/parsing.texi (Retrieving Nodes, Tree-sitter C API): + * doc/lispref/processes.texi (Network, Bindat Types): + * doc/lispref/searching.texi (Rx Functions): + * doc/lispref/text.texi (Replacing): + * doc/lispref/windows.texi (Textual Scrolling): + * doc/misc/calc.texi (Killing From Stack, Customizing Calc): + * doc/misc/cc-mode.texi (Misc Font Locking, List Line-Up): + * doc/misc/ede.texi (ede-cpp-root-project) + (ede-proj-target-makefile, ede-sourcecode): + * doc/misc/ert.texi (Running Tests in Batch Mode): + * doc/misc/eudc.texi (Emacs-only Configuration, The Server Hotlist): + * doc/misc/eww.texi (Advanced): + * doc/misc/flymake.texi (Starting Flymake) + (Proc customization variables): + * doc/misc/tramp.texi (File name completion): + * doc/misc/gnus.texi (Summary Buffer Lines, Gnus Registry Setup) + (Fancy splitting to parent, Customizing the IMAP Connection) + (Mail Source Specifiers, Agent as Cache): Consistently mark up nil + and t as @code. Also fix the markup and wording of some surrounding + text (bug#64016). + + * doc/lispref/display.texi (SVG Images, Icons): + * doc/lispref/modes.texi (Customizing Keywords): Prefer ASCII + apostrophe over Unicode right single quotation mark. + +2023-06-13 Basil L. Contovounesios + + Fix bol/bos anchors in tree-sitter :match regexps + + Further regexp fixes to follow separately (bug#64019#29). + + * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): + * lisp/progmodes/cmake-ts-mode.el + (cmake-ts-mode--font-lock-settings): + * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): + * lisp/progmodes/js.el (js--treesit-font-lock-settings): + * lisp/progmodes/python.el (python--treesit-settings): + * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): + * lisp/progmodes/sh-script.el (sh-mode--treesit-settings): + * lisp/progmodes/typescript-ts-mode.el + (typescript-ts-mode--font-lock-settings): + * test/src/treesit-tests.el (treesit-query-api): Anchor :match + regexps at beginning/end of string, not line. + +2023-06-12 Stefan Monnier + + * lisp/subr.el (with-restriction): Tweak indent rule + +2023-06-12 Eli Zaretskii + + Fix setting region in the minibuffer + + * lisp/minibuffer.el (minibuffer-beginning-of-buffer): Fix setting + region. (Bug#64022) + +2023-06-12 Michael Albinus + + Fix setting $DBUS_SESSION_BUS_ADDRESS after Emacs has started + + * doc/misc/dbus.texi (Alternative Buses): Explain using + $DBUS_SESSION_BUS_ADDRESS after Emacs has started. + + * src/dbusbind.c (XD_DBUS_VALIDATE_BUS_ADDRESS): Use egetenv. + +2023-06-11 Eli Zaretskii + + Fix tex-mode display-buffer issues + + * lisp/window.el (display-tex-shell-buffer-action): New defcustom. + * lisp/textmodes/tex-mode.el (tex-display-shell) + (tex-cmd-doc-view, tex-recenter-output-buffer): Use it. + (Bug#63956) + +2023-06-10 Morgan Smith + + Add test for when 'completion-auto-help' is 'visible' + + * test/lisp/minibuffer-tests.el (completion-auto-help-test): Add + test for when 'completion-auto-help' is 'visible'. Also test + for successful completion message. (Bug#63913) + +2023-06-10 Eli Zaretskii + + Avoid errors in 'apropos-documentation' after 'eval-buffer' + + * lisp/apropos.el (apropos--map-preloaded-atoms): Support the case + where an element of 'load-history' has nil as its car. (Bug#63881) + +2023-06-10 Daniel Martín + + Mention indent-rigidly in the Emacs manual + + * doc/emacs/indent.texi (Indentation Commands): Rewrite the first + sentence of 'C-x TAB' to mention the command that it executes, and + without using passive voice. (Bug#63997) + +2023-06-10 Morgan Smith + + Don't ding when completion succeeded + + * lisp/minibuffer.el (minibuffer-completion-help): Ensure 'ding' + is not called on a successful completion. Ensure 'ding' is not + called on a failure if 'completion-fail-discreetly' is set. + Also change "No completions" to "No match" as that is what is + used elsewhere. (Bug#63913) + +2023-06-09 Eli Zaretskii + + Improve documentation of color-related functions + + * doc/lispref/frames.texi (Color Names): Document + 'color-name-to-rgb' and 'color-dark-p'. + +2023-06-08 Eli Zaretskii + + Revert "* package.el (package--get-activatable-pkg): Prefer source packages" + + This reverts commit fb87d5008e21d1bc03547c1edf2280fb4cb8311e. + It caused problems when new versions of packages are installed + without deleting old versions. (Bug#63757) + +2023-06-08 Michael Albinus + + Fix connection-local user options handling (bug#63300) + + * lisp/files-x.el (connection-local-set-profiles) + (connection-local-set-profile-variables): Avoid saving the changed + user option to file unless triggered explicitly by user. (Bug#63300) + +2023-06-08 Eli Zaretskii + + Document 'startup-redirect-eln-cache' + + * doc/lispref/compile.texi (Native Compilation) + (Native-Compilation Functions): Document + 'startup-redirect-eln-cache'. + + * etc/PROBLEMS: Fix last change. + * etc/NEWS: Mark 'startup-redirect-eln-cache' as documented. + +2023-06-06 Andrea Corallo + + Fix `emacs-lisp-native-compile-and-load' for C-h f (bug#58314) + + * lisp/emacs-lisp/comp.el (comp-write-bytecode-file): New function + spilling code from `batch-byte+native-compile'. + (batch-byte+native-compile): Make use of. + * lisp/progmodes/elisp-mode.el + (emacs-lisp-native-compile-and-load): Produce the elc file and ask + to have it loaded. + +2023-06-06 Theodor Thornhill + + Add 'infer' as a keyword to typescript-ts-mode (bug#63880) + + * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--keywords): + New keyword. + +2023-06-04 Philip Kaludercic + + Revert changes to the order in which package descs are loaded + + * lisp/emacs-lisp/package.el (package-load-all-descriptors): Remove + NOSORT argument to 'directory-files', reverting back to the behaviour + as of Emacs 28. (Bug#63757) + +2023-06-04 Spencer Baugh + + Handle point in last file-name component in minibuffer completion + + This is a followup to commit e338a8ac41d4a9fd798dda90275abe75ac071335 + (Handle point not at EOB in minibuffer-choose-completion). + That commit added a heuristic, but the heuristic was insufficient: + It still had the original wrong behavior when completing the last + file-name component (i.e., the completion category is 'file' and + there's no slash after point). This patch makes the heuristic + cover that case as well. + * lisp/minibuffer.el (minibuffer-next-completion) + (minibuffer-choose-completion): If in file completion and there's no + slash after point, clear what's after point when we complete. + (Bug#62700) + +2023-06-03 Eli Zaretskii + + Avoid asking redundant question in emacsbug.el + + * lisp/mail/emacsbug.el (report-emacs-bug-hook): Don't ask the + question about saving email setup if we cannot save it anyway. + (Bug#63816) + +2023-06-03 Michael Albinus + + * test/infra/Dockerfile.emba (emacs-base): Don't install gawk. + +2023-06-03 Dmitry Gutov + + typescript-ts-mode: Add a rule for function_signature + + * lisp/progmodes/typescript-ts-mode.el + (typescript-ts-mode--font-lock-settings): + Add a rule for function_signature (bug#63867) + +2023-06-03 Mattias Engdegård + + * admin/unidata/emoji-zwj.awk: Avoid sprint buffer overflow + + Some AWK implementations have a fixed buffer for sprintf; for mawk the + default size is 8192 bytes. Hoist a string concatenation from + a sprintf call to avoid running into that limit. See discussion at + https://lists.gnu.org/archive/html/emacs-devel/2023-06/msg00090.html . + + (cherry picked from commit b5f17fe07c6624380ba8d0c7a400a6b89f225209) + +2023-06-03 Йордан Миладинов (tiny change) + + Fix apostrophe handling in rust-ts-mode and go-ts-mode (Bug#63708) + + * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--syntax-propertize): + Treat apostrophes as strings if used to define character literals. + Treat LT and GT as pairs if used to define type parameters (formerly + they were treated as pairs only for type arguments). + * lisp/progmodes/go-ts-mode.el (go-ts-mode--syntax-table): Treat + apostrophes as strings if used to define rune literals. + +2023-06-03 Michael Albinus + + * test/infra/Dockerfile.emba (emacs-base): Install also gawk. + +2023-06-03 Eli Zaretskii + + Fix 'python-util-clone-local-variables' + + * lisp/progmodes/python.el (python-util-clone-local-variables): + Avoid signaling an error when a local variable is unbound. + Patch by Ernesto Alfonso . (Bug#63818) + +2023-06-03 kobarity + + Revert "Enhance Python font-lock to support multilines" + + This reverts commit 4915ca5dd4245a909c046e6691e8d4a1919890c8. + + We have found that there are performance issues when editing a large + file. The issue can be reproduced as follows: + + 1. emacs -Q + 2. Open large Python file (e.g. turtle.py in Python) + 3. Near the top of the buffer, enter open paren and some characters. + + The above commit extends the region to be font-locked using + `python-nav-end-of-statement'. However, if there are unbalanced + parens, it may move point to the end of the buffer. This causes + almost the entire buffer to be font-locked, which is not acceptable + for large files. + +2023-06-03 Eli Zaretskii + + Fix typo in calc.texi + + * doc/misc/calc.texi (Programming Tutorial): Fix a typo. + Suggested by Vladimir Nikishkin . + +2023-06-02 Jonas Bernoulli + + Update to Transient v0.4.1 + +2023-06-02 Eli Zaretskii + + Avoid errors in 'delete-forward-char' deleting static compositions + + * lisp/simple.el (delete-forward-char): Fix recognition of static + compositions. (Bug#63837) + +2023-06-02 Robert Pluim + + Make VS-15 and VS-16 compositions work correctly + + There is a conflict between forward matching and backward matching + composition rules involving the same codepoint, which can cause the + backward matching ones not to be invoked. Ensure that VS-15 (U+FE0E) + and VS-16 (U+FE0F) are composed by forward matching rules instead in + order to avoid this issue. + + * admin/unidata/emoji-zwj.awk: Add rules for CHAR+VS-15 and CHAR+VS-16. + * lisp/composite.el: remove backward matching rule for VS-15. (Bug#63731) + +2023-06-01 Dmitry Gutov + + Fix project-name for vc-aware backend in non-file buffers + + * lisp/progmodes/project.el (project-name): Make sure + project-vc-name is picked up from dir-locals in all + non-file-visiting buffers too (mentioned in bug#63469). + +2023-05-31 Theodor Thornhill + + Add type_predicate 'is' as keyword in typescript-ts-mode (bug#63810) + + * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--keywords): + New keyword 'is'. + +2023-05-31 Eli Zaretskii + + Fix infloop in info-look.el + + * lisp/info-look.el (info-lookup-guess-gdb-script-symbol): Fix + infloop when there are no completions. (Bug#63808) + +2023-05-31 Stephen Berman + + Fix several todo-mode.el item editing bugs (bug#63811) + + * lisp/calendar/todo-mode.el (todo-insert-item--basic): With + insertion type 'here', ensure item is inserted on the todo-mode + line where the command was invoked. + (todo-edit-item--cat, todo-edit-item--pos): New variables. + (todo-edit-item--text): Restrict the scope of nil-valued + buffer-read-only to the functions that change buffer text. If + user moved point while editing a single-line todo item or a done + item comment, or while inserting a done item comment, restore + point, and for comments, make sure the done items section is + displayed. For multiline items, set the new variables so + todo-edit-quit can use them. + (todo-edit-quit): Use the values of the new variables to restore + point in the todo-mode buffer if it had been moved while editing. + (todo-edit-item--header): Avoid clobbering match data when editing + a todo item header. + +2023-05-31 Randy Taylor + + dockerfile-ts-mode: Prevent empty categories in imenu (Bug#63759) + + * lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode--imenu): + Don't include empty categories. + +2023-05-31 Jens Schmidt + + Brush up doc strings and terminology in plstore.el + + * lisp/plstore.el (plstore-encoded, plstore-passphrase-callback-function) + (plstore--init-from-buffer, plstore-revert, plstore-close) + (plstore--merge-secret, plstore--decrypt, plstore--match, plstore-find) + (plstore-get, plstore-put, plstore-delete, plstore--insert-buffer) + (plstore-save, plstore--encode, plstore--decode) + (plstore--write-contents-functions, plstore-mode-decoded) + (plstore-mode): Brush up doc strings and documentation in general. + Fix terminology, in particular spurious occurences of all uppercase + "PLSTORE". (Bug#63627) + +2023-05-31 Jens Schmidt + + Add internal documentation on plstore.el + + * lisp/plstore.el: Add internal documentation and some words of + warning in the user documentation. (Bug#63627) + +2023-05-30 Theodor Thornhill + + Add compact_constructor_declaration font-locking to java-ts-mode + + * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): + New pattern. + +2023-05-29 Juri Linkov + + * lisp/tmm.el (tmm-completion-delete-prompt): Add more checks (bug#63754). + + In case when 'completions-header-format' is nil, the first 'mouse-face' + property is at the beginning of the buffer. So first use 'get-text-property' + at point-min. + +2023-05-29 Eli Zaretskii + + Allow to disable the DWIMish behavior of 'x' in package menu + + * lisp/emacs-lisp/package.el + (package-menu-use-current-if-no-marks): New defcustom. + (package-menu-execute): Use it. (Bug#62563) + + * etc/NEWS: Announce the new option. + +2023-05-29 Robert Pluim + + Allow dired to invoke secondary browser + + 'browse-url-of-dired-file' always invokes the primary browser, but + sometimes it's handy to call a different browser, which is why + 'browse-url-secondary-browser-function' exists. + + * lisp/net/browse-url.el (browse-url-of-dired-file): Call + 'browse-url-secondary-browser-function' when invoked with a prefix + argument. + * etc/NEWS: Announce the change. + +2023-05-29 Robert Pluim + + Add a binding for enriched-toggle-markup + + * lisp/textmodes/enriched.el (enriched-mode-map): Bind + 'enriched-toggle-markup' to 'M-o m'. + * etc/NEWS: Announce the change. + +2023-05-29 Eli Zaretskii + + Fix order of tmm-menubar when 'tmm-mid-prompt' is nil + + * lisp/tmm.el (tmm-prompt): Reverse 'tmm-km-list' when + 'tmm-mid-prompt' is nil, to present the menu in the correct order. + Suggested by Thiago Melo . + +2023-05-29 Michael Albinus + + Fix regression when saving tramp-default-proxies-alist (Do not merge) + + * lisp/net/tramp.el (tramp-add-hops): Suppress `signal-hook-function'. + Save `tramp-default-proxies-alist' only when changed. + +2023-05-28 Yuan Fu + + Save the tree-sitter grammar recipe when installing a grammar + + Raised in bug#63750, but not the main subject of it. + + * lisp/treesit.el (treesit-install-language-grammar): Save the recipe + to treesit-language-source-alist when installation is successful. + +2023-05-28 Robert Pluim + + Add instructions and test file for VS-15/VS-16 + + * admin/notes/unicode: Add instructions for emoji-variation-sequences.txt + * admin/unidata/emoji-variation-sequences.txt: New file, imported from + Unicode 15. + +2023-05-28 Michael Heerdegen + + A better fix for "Fix cancellation of Wdired" + + * lisp/wdired.el (wdired-abort-changes): Call + `dired-build-subdir-alist' instead of `dired-revert'. + (Bug#63676) + +2023-05-27 Eli Zaretskii + + Fix tmm-menubar when 'tmm-completion-prompt' is nil + + * lisp/tmm.el (tmm-prompt): Handle nil value of 'tmm-mid-prompt'. + (tmm-completion-delete-prompt): Don't rely on the exact text of + the completion heading line, as it is now a customizable format + string, and can be nil, meaning no heading line is inserted at + all. Instead, search for the first character of the menu based on + text properties used for it. (Bug#63754) + +2023-05-26 kobarity + + Use 'font-lock-extend-region-functions' in python-mode + + * lisp/progmodes/python.el (python-font-lock-extend-region): Change + arguments and return value for 'font-lock-extend-region-functions'. + (python-mode): Change from + 'font-lock-extend-after-change-region-function' to + 'font-lock-extend-region-functions'. (Bug#63622) + +2023-05-26 kobarity + + Fix python-info-docstring-p + + * lisp/progmodes/python.el (python-info-docstring-p): Stop using + python-rx string-delimiter. + + * test/lisp/progmodes/python-tests.el + (python-font-lock-escape-sequence-bytes-newline) + (python-font-lock-escape-sequence-hex-octal) + (python-font-lock-escape-sequence-unicode) + (python-font-lock-raw-escape-sequence): Mark as expected failures + until another bug in 'python-info-docstring-p' is corrected. + (python-info-docstring-p-7): New test. (Bug#63622) + +2023-05-26 Eli Zaretskii + + Fix cancellation of Wdired + + * lisp/wdired.el (wdired-abort-changes): Call 'dired-revert'. + Patch by Stephen Berman . (Bug#63676) + +2023-05-26 Mattias Engdegård + + Handle #@00 in new reader in a compatible way (bug#63722) + + This was a regression from Emacs 28. + + * src/lread.c (skip_lazy_string, read0): Make #@00 read as nil, which + is a quirk from the old reader that we preserve for compatibility. + * test/src/lread-tests.el (lread-skip-to-eof): Verify it. + + Reported by Richard Newton. + +2023-05-25 Po Lu + + Don't mark selection request events + + * src/pgtkterm.c (mark_pgtkterm): Prevent crash by not marking + selection request events, which don't have Lisp_Object members. + +2023-05-25 Po Lu + + Disable cairo-xcb support by default + + * INSTALL (--with-cairo-xcb): Document new option. + * configure.ac (USE_CAIRO_XCB): Implement new option. + +2023-05-25 Juri Linkov + + * lisp/progmodes/project.el: Move :safe from defcustom to autoload (bug#63469) + + (project-vc-ignores, project-vc-merge-submodules) + (project-vc-include-untracked, project-vc-name) + (project-vc-extra-root-markers, project-kill-buffers-display-buffer-list): + Autoload the line that puts 'safe-local-variable' property on defcustom symbol + instead of using the :safe keyword. + +2023-05-25 Juri Linkov + + * lisp/vc/vc-annotate.el (vc-annotate-mode-menu): Quote vc-annotate-backend. + + When unquoted it might get the nil value when vc-annotate.el is loaded + in non-vc-controlled buffer (bug#63689). + +2023-05-25 Juri Linkov + + Add vc-create/switch/print-branch to menu and update documentation (bug#63690) + + * doc/emacs/maintaining.texi (VC Change Log): + Add 'C-x v b l' (vc-print-branch-log). + (Creating Branches): Add @kindex and @findex for vc-create-branch. + (Switching Branches): Add @kindex and @findex for vc-switch-branch. + + * lisp/vc/vc-hooks.el (vc-menu-map): Add menu items for new + commands vc-create-branch and vc-switch-branch, and also + vc-print-branch-log. + + * lisp/vc/vc.el (vc-print-branch-log): Improve docstring. + +2023-05-25 Eli Zaretskii + + Fix rare crashes in 'try_window_reusing_current_matrix' + + * src/xdisp.c (try_window_reusing_current_matrix): Make sure we + never use a mode-line glyph row to start displaying scrolled-in + rows. (Bug#63711) + +2023-05-25 Michael Albinus + + Make last Tramp change less invasive + + * lisp/net/tramp.el (tramp-dissect-file-name): Revert last change. + (tramp-handle-file-name-as-directory) + (tramp-handle-file-name-directory): Let-bind `tramp-default-proxies-alist'. + +2023-05-23 Eli Zaretskii + + Fix 'use-dialog-box-p' and friends + + * lisp/subr.el (use-dialog-box-p): Use dialog boxes also when + invoked from some window-system gesture. (Bug#63655) + (y-or-n-p): Fix the description in the doc string of conditions + under which a dialog box will be used. + + * src/fns.c (Fyes_or_no_p): Use the same condition for dialog + boxes as in 'use-dialog-box-p'. Fix the description in the doc + string of conditions under which a dialog box will be used. + + * doc/lispref/minibuf.texi (Multiple Queries, Yes-or-No Queries): + Fix the description of conditions under which a dialog box will be + used. + +2023-05-23 Stefan Monnier + + Avoid duplicates when adding package dirs to load-path + + Do not merge to master, we're going to delete this code there. + + * lisp/emacs-lisp/package.el (package-activate-1): Check if the path + we're about to add is already in 'load-path', since package autoload + files have been updating 'load-path' for a decade. + +2023-05-23 Robert Pluim + + Avoid duplicate load-path entry when generating package autoloads + + 'file-name-directory' produces a path ending in '/', so that needs to be + run through 'directory-file-name' to avoid duplicate entries in + 'load-path'. (Bug#63625) + + * lisp/emacs-lisp/package.el (package-generate-autoloads): Call + 'directory-file-name' on the directory of 'load-file-name'. + +2023-05-23 Eli Zaretskii + + Disable loading SQLite3 extensions when SQLite3 version is too old + + * src/sqlite.c (HAVE_LOAD_EXTENSION): Define to 1 only if + enabling/disabling extension loading is supported as well. + (load_dll_functions, Fsqlite_load_extension): Condition on + HAVE_LOAD_EXTENSION, not on HAVE_SQLITE3_LOAD_EXTENSION. + (Bug#63653) + +2023-05-22 Eli Zaretskii + + Fix visiting HTML files encoded in iso-2022 variants + + * lisp/international/mule.el (sgml-xml-auto-coding-function) + (sgml-html-meta-auto-coding-function): Handle coding-systems whose + coding-system-type is iso-2022. (Bug#63644) + +2023-05-22 Eli Zaretskii + + Support 'isearch-allow-scroll' in 'pixel-scroll-precision-mode' + + * lisp/pixel-scroll.el (pixel-scroll-precision) + (pixel-scroll-down, pixel-scroll-up): Put the 'scroll-command' + property on these commands. (Bug#63640) + +2023-05-22 Andreas Schwab + + shr: allow moving between adjacent anchors + + * lisp/net/shr.el (shr-urlify): Put shr-tab-stop only over first + position. + +2023-05-22 Michael Albinus + + Fix multihop file name expansion in Tramp + + * lisp/net/tramp.el (tramp-dissect-file-name): Set hop to nil if + NODEFAULT. (Bug#63578) + +2023-05-21 Jens Schmidt + + Remove obsolete information from Gnus manual + + The Gnus manual was still referencing long-removed external + marks in section "Archiving Mails". Without external marks, + that section is almost pointless, so remove it completely. + * doc/misc/gnus.texi (Archiving Mail): Remove section. + (Top, Browsing the Web): Remove references to "Archiving + Mail". (Bug#63497) + +2023-05-21 Jens Schmidt + + Preserve mark in comint-history-isearch + + This preserves mark in `comint-history-isearch-backward' and + friends, which tend to set the mark on completion of the isearch + to unexpected positions. + * lisp/comint.el (comint-history-isearch-end): Set `isearch-opoint' + to point. (Bug#63616) + +2023-05-20 Liu Hui + + Fix systemd unit completion for old versions of systemd + + * lisp/pcmpl-linux.el (pcmpl-linux--systemd-units): Use '--no-legend' + for compatibility with older versions of systemctl. (Bug#63411) + +2023-05-20 Eli Zaretskii + + Fix Skeletons menu-bar menu in Python modes + + * lisp/progmodes/python.el (python-mode, python-ts-mode): Call + 'python-skeleton-add-menu-items' here, not in 'python-base-mode', + since the "Python" menu is not yet set up in the latter. + (Bug#63598) + +2023-05-20 Eli Zaretskii + + Fix loading SQLite extensions + + * src/sqlite.c (sqlite3_db_config) [WINDOWSNT]: Load from the DLL. + (Fsqlite_load_extension): Use 'sqlite3_db_config' to enable and + disable loading of extensions. Add a few free extensions to the + allow-list. Fix testing for the ".dll" extension. (Bug#63590) + + * test/src/sqlite-tests.el (sqlite-load-extension): Fix the test + to require successful load if the extension does exist. + +2023-05-20 Mattias Engdegård + + * etc/NEWS: Note dotimes loop variable scoping change (bug#63586) + +2023-05-20 Yuan Fu + + Fix c-ts-mode--top-level-declarator + + * lisp/progmodes/c-ts-mode.el: + (c-ts-mode--top-level-declarator): Don't use treesit-node-match-p. + +2023-05-19 Yuan Fu + + Improve c-ts-mode font-lock for function names (bug#63390) + + When a function definition has preproc directives in its body, it + can't correctly parse into a function_definition. This fix tries to + recognize this case and highlight the function_declarator correctly. + + * lisp/progmodes/c-ts-mode.el: + (c-ts-mode--font-lock-settings): New rule. + (c-ts-mode--top-level-declarator): New function. + +2023-05-19 Juri Linkov + + * lisp/tab-bar.el: Don't use 'minibuffer-selected-window' (bug#62427). + + (tab-bar-select-tab, tab-bar-new-tab-to): + Use 'window-minibuffer-p' instead of 'minibuffer-selected-window'. + And switch to 'get-mru-window' instead of 'minibuffer-selected-window'. + +2023-05-19 Juri Linkov + + Split windows horizontally in places that use split to create a new window. + + * lisp/tab-bar.el (tab-bar-new-tab-to): + * lisp/window.el (window-state-put): + To create a new window, split horizontally instead of vertically. + Use 'window-safe-min-width' for the SIZE arg of 'split-window'. + (bug#62592) + +2023-05-18 Yuan Fu + + Fix tree-sitter test (bug#63481) + + * test/src/treesit-tests.el (treesit-basic-parsing): Latest json + parser doesn't return an error on empty buffer or multiple objects + anymore [1]. + + https://github.com/tree-sitter/tree-sitter-json/commit/40a81c01a40ac48744e0c8ccabbaba1920441199 + +2023-05-18 Aaron Jensen + + Attempt to fix redisplay problems on macOS + + * src/nsterm.m (ns_scroll_run): Attempt to fix redisplay + artifacts. (Bug#63187) + +2023-05-18 Jens Schmidt (tiny change) + + Clarify misleading comment in isearch.el + + Clarify a misleading comment in isearch.el as to whether frame events + should exit an isearch or not (Bug#62032, Bug#41338 for background + information). + * lisp/isearch.el (isearch-mode-map): Replace the misleading comment. + (Bug#62032) + +2023-05-18 Eli Zaretskii + + Improve documentation of package-menu commands + + * doc/emacs/package.texi (Package Menu): Document that some + package-menu filters accept lists of values interactively. + + * lisp/emacs-lisp/package.el (package-menu-execute) + (package-menu-hide-package, package-menu-describe-package) + (package-menu-mark-delete, package-menu-mark-install) + (package-menu-mark-unmark, package-menu-backup-unmark) + (package-menu-quick-help, package-menu-get-status) + (package-menu--find-upgrades, package-menu-mark-upgrades) + (package-menu-filter-by-archive) + (package-menu-filter-by-description) + (package-menu-filter-by-keyword) + (package-menu-filter-by-name-or-description) + (package-menu-filter-by-name, package-menu-filter-by-status) + (package-menu-filter-by-version, package-menu-filter-marked) + (package-menu-describe-package): Doc fixes. + +2023-05-17 Basil L. Contovounesios + + Fix M-x completion-predicate under python-ts-mode + + * lisp/progmodes/python.el (python--completion-predicate) + (python-shell--completion-predicate): Filter M-x completion based on + python-base-mode instead of python-mode. This allows for + python-ts-mode as well (bug#63552). + +2023-05-17 Andrea Corallo + + * Account for `byte-compile-warnings' during native compilation (bug#63302). + + * lisp/emacs-lisp/comp.el (comp-final, comp-run-async-workers): + Forward `byte-compile-warnings' to child processes. + +2023-05-16 Philip Kaludercic + + Avoid duplicate VC packages in 'package-selected-packages' + + * lisp/emacs-lisp/package-vc.el (package-vc--unpack-1): Check if + 'package-selected-packages' already contains the package name. + (bug#63338) + +2023-05-15 Juri Linkov + + * lisp/tab-bar.el (tab-bar-new-tab-to): Set 'window-side' to nil (bug#62427). + + This is still needed for the case when tab-bar-new-tab-choice is 'window'. + +2023-05-14 Kyle Meyer + + Update to Org 9.6.6 + +2023-05-14 Eli Zaretskii + + Bump Emacs version for next pretest + + * README: + * configure.ac: + * nt/README.W32: + * msdos/sed2v2.inp: Bump Emacs version to 29.0.91. + 2023-05-14 Gabriel do Nascimento Ribeiro Ignore current-prefix-arg in async-shell-command @@ -115654,7 +116651,7 @@ This file records repository revisions from commit f2ae39829812098d8269eafbc0fcb98959ee5bb7 (exclusive) to -commit ce7d18cbc07886b0d62110a6d26e25271017cd2a (inclusive). +commit 8f62e7b85f69bb4026e9cf2971668b0d77077792 (inclusive). See ChangeLog.3 for earlier changes. ;; Local Variables: diff --git a/etc/AUTHORS b/etc/AUTHORS index 05c6ac03bac..9bd490dd3f8 100644 --- a/etc/AUTHORS +++ b/etc/AUTHORS @@ -9,7 +9,7 @@ Aaron Ecay: changed ob-R.el ob-core.el org-src.el ox-latex.el nsterm.m ob-awk.el ob-exp.el ob-python.el ob-tangle.el org-bibtex.el org-id.el org.el org.texi package.el paren.el -Aaron Jensen: changed frameset.el nsterm.m xdisp-tests.el xdisp.c +Aaron Jensen: changed nsterm.m frameset.el xdisp-tests.el xdisp.c Info.plist.in flyspell.el icomplete.el mouse.el server.el systhread.c w32term.c xterm.c @@ -297,7 +297,7 @@ Andrea Corallo: wrote comp-cstr-tests.el comp-cstr.el comp-tests.el comp.el and changed comp.c pdumper.c lread.c bytecomp.el startup.el configure.ac comp.h loadup.el lisp.h data.c alloc.c emacs.c .gitlab-ci.yml - cl-macs.el nadvice.el comp-test-funcs.el elisp-mode.el lisp/Makefile.in + cl-macs.el elisp-mode.el nadvice.el comp-test-funcs.el lisp/Makefile.in subr.el Makefile.in advice.el and 70 other files André A. Gomes: changed ispell.el @@ -347,7 +347,7 @@ Andreas Rottmann: changed emacsclient.1 emacsclient.c misc.texi server.el Andreas Schwab: changed configure.ac lisp.h xdisp.c process.c alloc.c coding.c Makefile.in emacs.c files.el fileio.c keyboard.c fns.c lread.c xterm.c src/Makefile.in editfns.c print.c eval.c font.c xfns.c sysdep.c - and 662 other files + and 663 other files Andreas Seltenreich: changed nnweb.el gnus.texi message.el gnus-sum.el gnus.el nnslashdot.el gnus-srvr.el gnus-util.el mm-url.el mm-uu.el @@ -577,10 +577,9 @@ Bartosz Duszel: changed allout.el bib-mode.el cc-cmds.el hexl.el icon.el xscheme.el Basil L. Contovounesios: changed simple.el subr.el message.el eww.el - custom.el bibtex.el text.texi gnus-sum.el modes.texi customize.texi - files.texi gnus-group.el gnus-win.el gravatar.el internals.texi json.el - map.el shr.el subr-tests.el window.c battery-tests.el - and 324 other files + modes.texi custom.el text.texi bibtex.el gnus-sum.el internals.texi + customize.texi display.texi files.texi gnus-group.el gnus-win.el + gnus.texi gravatar.el js.el json.el map.el shr.el and 345 other files Bastian Beischer: changed semantic/complete.el calc-yank.el include.el mru-bookmark.el refs.el senator.el @@ -1191,7 +1190,7 @@ Daniel Martín: changed c-ts-mode.el nsterm.m shortdoc.el ns-win.el simple.el diff-mode-tests.el erc.texi files.el files.texi indent.erts msdos-xtra.texi progmodes/python.el search.texi .lldbinit basic.texi c-ts-mode-tests.el cmacexp.el compilation.txt compile-tests.el - compile.texi configure.ac and 42 other files + compile.texi configure.ac and 43 other files Daniel McClanahan: changed lisp-mode.el @@ -1663,7 +1662,7 @@ and co-wrote help-tests.el and changed xdisp.c display.texi w32.c msdos.c simple.el w32fns.c files.el fileio.c keyboard.c emacs.c text.texi w32term.c dispnew.c configure.ac frames.texi w32proc.c files.texi xfaces.c window.c - dispextern.h lisp.h and 1327 other files + dispextern.h lisp.h and 1329 other files Eliza Velasquez: changed server.el @@ -2687,6 +2686,8 @@ and changed mml-sec.el gnus-util.el message.texi mml-smime.el mml1991.el Jens Petersen: wrote find-func.el and changed mule-cmds.el pcmpl-rpm.el +Jens Schmidt: changed plstore.el comint.el gnus.texi isearch.el ldap.el + Jens Toivo Berger Thielemann: changed word-help.el Jens-Ulrik Holger Petersen: changed cus-edit.el ffap.el find-func.el @@ -3121,7 +3122,7 @@ Juri Linkov: wrote compose.el emoji.el files-x.el misearch.el repeat-tests.el replace-tests.el tab-bar-tests.el tab-bar.el tab-line.el and changed isearch.el simple.el info.el replace.el dired.el dired-aux.el - minibuffer.el progmodes/grep.el subr.el window.el vc.el mouse.el + minibuffer.el progmodes/grep.el window.el subr.el vc.el mouse.el outline.el diff-mode.el repeat.el image-mode.el files.el menu-bar.el search.texi startup.el progmodes/compile.el and 472 other files @@ -3584,7 +3585,7 @@ Lin Sun: changed calc.el package.el Lin Zhou: changed w32fns.c w32term.h -Liu Hui: changed eglot.el +Liu Hui: changed eglot.el pcmpl-linux.el Lixin Chin: changed bibtex.el @@ -3962,7 +3963,7 @@ Mattias Engdegård: changed byte-opt.el rx.el bytecomp.el bytecomp-tests.el rx-tests.el searching.texi fns.c subr.el bytecode.c eval.c calc-tests.el lread.c progmodes/compile.el lisp.h files.el fns-tests.el print.c autorevert.el gdb-mi.el alloc.c - regex-emacs-tests.el and 675 other files + regex-emacs-tests.el and 677 other files Mattias M: changed asm-mode-tests.el asm-mode.el @@ -4006,9 +4007,9 @@ Michael Albinus: wrote autorevert-tests.el dbus-tests.el dbus.el and co-wrote tramp-cache.el tramp-sh.el tramp.el and changed tramp.texi tramp-adb.el trampver.el trampver.texi dbusbind.c files.el ange-ftp.el files.texi file-notify-tests.el dbus.texi - gitlab-ci.yml autorevert.el tramp-fish.el kqueue.c os.texi - Dockerfile.emba tramp-gw.el test/Makefile.in README shell.el - tramp-imap.el and 308 other files + gitlab-ci.yml autorevert.el tramp-fish.el kqueue.c Dockerfile.emba + os.texi tramp-gw.el test/Makefile.in README shell.el files-x.el + and 308 other files Michael Ben-Gershon: changed acorn.h configure.ac riscix1-1.h riscix1-2.h unexec.c @@ -4254,7 +4255,8 @@ Mon Key: changed animate.el imap.el syntax.el Morgan J. Smith: changed gnus-group-tests.el -Morgan Smith: changed image-dired.el vc-git.el window.el +Morgan Smith: changed image-dired.el minibuffer-tests.el minibuffer.el + vc-git.el window.el Morten Welinder: wrote [many MS-DOS files] arc-mode.el desktop.el dosfns.c internal.el msdos.h pc-win.el @@ -4936,8 +4938,8 @@ Randall Smith: changed dired.el Randal Schwartz: wrote pp.el -Randy Taylor: changed build.sh eglot.el batch.sh rust-ts-mode.el - dockerfile-ts-mode.el go-ts-mode.el c-ts-mode.el cmake-ts-mode.el +Randy Taylor: changed build.sh eglot.el batch.sh dockerfile-ts-mode.el + rust-ts-mode.el go-ts-mode.el c-ts-mode.el cmake-ts-mode.el cus-theme.el font-lock.el java-ts-mode.el js.el json-ts-mode.el modes.texi progmodes/python.el project.el sh-script.el typescript-ts-mode.el yaml-ts-mode.el @@ -5084,10 +5086,10 @@ Robert P. Goldman: changed org.texi ob-exp.el org.el ox-latex.el Robert Pluim: wrote nsm-tests.el and changed configure.ac process.c blocks.awk keymap.el font.c - network-stream-tests.el processes.texi custom.texi ftfont.c gtkutil.c - process-tests.el vc-git.el emoji-zwj.awk terminal.c unicode + network-stream-tests.el processes.texi custom.texi emoji-zwj.awk + ftfont.c gtkutil.c process-tests.el unicode vc-git.el terminal.c char-fold.el gnutls.el keymaps.texi network-stream.el nsm.el nsterm.m - and 188 other files + and 191 other files Robert Thorpe: changed cus-start.el indent.el rmail.texi @@ -5484,8 +5486,8 @@ Skip Collins: changed w32fns.c w32term.c w32term.h Sławomir Nowaczyk: changed emacs.py progmodes/python.el TUTORIAL.pl flyspell.el ls-lisp.el w32proc.c -Spencer Baugh: changed data-tests.el alloc.c autorevert.el mini.texi - minibuffer.el processes.texi +Spencer Baugh: changed data-tests.el minibuffer.el alloc.c autorevert.el + mini.texi processes.texi Spencer Thomas: changed dabbrev.el emacsclient.c gnus.texi server.el unexcoff.c @@ -5530,7 +5532,7 @@ and co-wrote font-lock.el gitmerge.el pcvs.el and changed subr.el simple.el keyboard.c bytecomp.el cl-macs.el files.el lisp.h vc.el xdisp.c alloc.c eval.c buffer.c sh-script.el progmodes/compile.el tex-mode.el keymap.c window.c help-fns.el lread.c - lisp-mode.el newcomment.el and 1660 other files + lisp-mode.el package.el and 1660 other files Stefano Facchini: changed gtkutil.c @@ -6436,7 +6438,7 @@ Zoran Milojevic: changed avoid.el Дядов Васил Стоянов: changed org-docview.el -Йордан Миладинов: changed cyrillic.el +Йордан Миладинов: changed cyrillic.el go-ts-mode.el rust-ts-mode.el समीर सिंह Sameer Singh: wrote indonesian.el misc-lang.el philippine.el and changed fontset.el HELLO language/indian.el quail/indian.el loadup.el commit c9022d69218003db699251cbe876f69fcda49386 Author: Eli Zaretskii Date: Sun Jun 18 07:14:46 2023 -0400 * lisp/ldefs-boot.el: Regenerate. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 9e1adab3192..8f8a30d0382 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -2428,7 +2428,12 @@ browse-url-default-handlers (fn &optional BUFFER)" t) (autoload 'browse-url-of-dired-file "browse-url" "\ -In Dired, ask a WWW browser to display the file named on this line." t) +In Dired, ask a WWW browser to display the file named on this line. +With prefix arg, use the secondary browser instead (e.g. EWW if +`browse-url-secondary-browser-function' is set to +`eww-browse-url'. + +(fn &optional SECONDARY)" t) (autoload 'browse-url-of-region "browse-url" "\ Use a web browser to display the current region. See `browse-url' for details. @@ -8243,14 +8248,17 @@ 'define-global-minor-mode and that should try to turn MODE on if applicable for that buffer. Each of KEY VALUE is a pair of CL-style keyword arguments. -The :predicate argument specifies in which major modes should the +The :predicate key specifies in which major modes should the globalized minor mode be switched on. The value should be t (meaning switch on the minor mode in all major modes), nil (meaning don't switch on in any major mode), a list of modes (meaning switch on only in those modes and their descendants), or a list (not MODES...), meaning switch on in any major mode except MODES. The value can also mix all of these forms, see the info node `Defining Minor Modes' for -details. +details. The :predicate key causes the macro to create a user option +named the same as MODE, but ending with \"-modes\" instead of \"-mode\". +That user option can then be used to customize in which modes this +globalized minor mode will be switched on. As the minor mode defined by this function is always global, any :global keyword is ignored. Other keywords have the same meaning as in `define-minor-mode', @@ -22465,7 +22473,7 @@ "opascal" ;;; Generated autoloads from org/org.el -(push (purecopy '(org 9 6 5)) package--builtin-versions) +(push (purecopy '(org 9 6 6)) package--builtin-versions) (autoload 'org-babel-do-load-languages "org" "\ Load the languages defined in `org-babel-load-languages'. @@ -24519,7 +24527,7 @@ "pixel-scroll" (fn FILE)") (autoload 'plstore-mode "plstore" "\ -Major mode for editing PLSTORE files. +Major mode for editing plstore files. (fn)" t) (register-definition-prefixes "plstore" '("plstore-")) @@ -25225,6 +25233,11 @@ "ede/proj-shared" of the project instance object. (fn &optional MAYBE-PROMPT DIRECTORY)") +(put 'project-vc-ignores 'safe-local-variable #'listp) +(put 'project-vc-merge-submodules 'safe-local-variable #'booleanp) +(put 'project-vc-include-untracked 'safe-local-variable #'booleanp) +(put 'project-vc-name 'safe-local-variable #'stringp) +(put 'project-vc-extra-root-markers 'safe-local-variable (lambda (val) (and (listp val) (not (memq nil (mapcar #'stringp val)))))) (defvar project-prefix-map (let ((map (make-sparse-keymap))) (define-key map "!" 'project-shell-command) (define-key map "&" 'project-async-shell-command) (define-key map "f" 'project-find-file) (define-key map "F" 'project-or-external-find-file) (define-key map "b" 'project-switch-to-buffer) (define-key map "s" 'project-shell) (define-key map "d" 'project-find-dir) (define-key map "D" 'project-dired) (define-key map "v" 'project-vc-dir) (define-key map "c" 'project-compile) (define-key map "e" 'project-eshell) (define-key map "k" 'project-kill-buffers) (define-key map "p" 'project-switch-project) (define-key map "g" 'project-find-regexp) (define-key map "G" 'project-or-external-find-regexp) (define-key map "r" 'project-query-replace-regexp) (define-key map "x" 'project-execute-extended-command) (define-key map "\2" 'project-list-buffers) map) "\ Keymap for project commands.") (define-key ctl-x-map "p" project-prefix-map) @@ -25374,6 +25387,7 @@ project-prefix-map ARG, show only buffers that are visiting files. (fn &optional ARG)" t) +(put 'project-kill-buffers-display-buffer-list 'safe-local-variable #'booleanp) (autoload 'project-kill-buffers "project" "\ Kill the buffers belonging to the current project. Two buffers belong to the same project if their project @@ -32942,7 +32956,9 @@ "tree-widget" Interactively, if `treesit-language-source-alist' doesn't already have data for building the grammar for LANG, prompt for its -repository URL and the C/C++ compiler to use. +repository URL and the C/C++ compiler to use. The recipe built +by the prompts are saved for the current session if the +installation is successful and the grammar is loadable. This command requires Git, a C compiler and (sometimes) a C++ compiler, and the linker to be installed and on PATH. It also requires that the @@ -34392,35 +34408,58 @@ 'vc-resolve-conflicts (autoload 'vc-create-tag "vc" "\ Descending recursively from DIR, make a tag called NAME. For each registered file, the working revision becomes part of -the named configuration. If the prefix argument BRANCHP is -given, the tag is made as a new branch and the files are -checked out in that new branch. +the configuration identified by the tag. +If BRANCHP is non-nil (interactively, the prefix argument), the +tag NAME is a new branch, and the files are checked out and +updated to reflect their revisions on that branch. +In interactive use, DIR is `default-directory' for repository-granular +VCSes (all the modern decentralized VCSes belong to this group), +otherwise the command will prompt for DIR. (fn DIR NAME BRANCHP)" t) (autoload 'vc-create-branch "vc" "\ -Descending recursively from DIR, make a branch called NAME. -After a new branch is made, the files are checked out in that new branch. -Uses `vc-create-tag' with the non-nil arg `branchp'. +Make a branch called NAME in directory DIR. +After making the new branch, check out the branch, i.e. update the +files in the tree to their revisions on the branch. + +Interactively, prompt for the NAME of the branch. + +With VCSes that maintain version information per file, this command also +prompts for the directory DIR whose files, recursively, will be tagged +with the NAME of new branch. For VCSes that maintain version +information for the entire repository (all the modern decentralized +VCSes belong to this group), DIR is always the `default-directory'. + +Finally, this command might prompt for the branch or tag from which to +start (\"fork\") the new branch, with completion candidates including +all the known branches and tags in the repository. + +This command invokes `vc-create-tag' with the non-nil BRANCHP argument. (fn DIR NAME)" t) (autoload 'vc-retrieve-tag "vc" "\ -For each file in or below DIR, retrieve their tagged version NAME. +For each file in or below DIR, retrieve their version identified by tag NAME. NAME can name a branch, in which case this command will switch to the named branch in the directory DIR. Interactively, prompt for DIR only for VCS that works at file level; -otherwise use the repository root of the current buffer. +otherwise use the root directory of the current buffer's VC tree. If NAME is empty, it refers to the latest revisions of the current branch. If locking is used for the files in DIR, then there must not be any locked files at or below DIR (but if NAME is empty, locked files are allowed and simply skipped). -If the prefix argument BRANCHP is given, switch the branch -and check out the files in that branch. +If BRANCHP is non-nil (interactively, the prefix argument), switch to the +branch and check out and update the files to their version on that branch. This function runs the hook `vc-retrieve-tag-hook' when finished. (fn DIR NAME &optional BRANCHP)" t) (autoload 'vc-switch-branch "vc" "\ Switch to the branch NAME in the directory DIR. -If NAME is empty, it refers to the latest revisions of the current branch. +If NAME is empty, it refers to the latest revision of the current branch. +Interactively, prompt for DIR only for VCS that works at file level; +otherwise use the root directory of the current buffer's VC tree. +Interactively, prompt for the NAME of the branch. +After switching to the branch, check out and update the files to their +version on that branch. Uses `vc-retrieve-tag' with the non-nil arg `branchp'. (fn DIR NAME)" t) @@ -34453,7 +34492,8 @@ 'vc-resolve-conflicts (fn &optional LIMIT REVISION)" t) (autoload 'vc-print-branch-log "vc" "\ -Show the change log for BRANCH root in a window. +Show the change log for BRANCH in another window. +The command prompts for the branch whose change log to show. (fn BRANCH)" t) (autoload 'vc-log-incoming "vc" "\ @@ -37181,6 +37221,7 @@ "zone" ;; version-control: never ;; no-update-autoloads: t ;; no-byte-compile: t +;; no-native-compile: t ;; coding: utf-8-emacs-unix ;; End: commit f690827fa503c3974317c6f82e9cd46ce86fa11b Author: Eli Zaretskii Date: Sun Jun 18 06:47:21 2023 -0400 Bump Emacs version to 29.0.92 * README: * configure.ac: * nt/README.W32: * msdos/sed2v2.inp: Bump version to 29.0.92. diff --git a/README b/README index fda74c12925..8187d95df3f 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ Copyright (C) 2001-2023 Free Software Foundation, Inc. See the end of the file for license conditions. -This directory tree holds version 29.0.91 of GNU Emacs, the extensible, +This directory tree holds version 29.0.92 of GNU Emacs, the extensible, customizable, self-documenting real-time display editor. The file INSTALL in this directory says how to build and install GNU diff --git a/configure.ac b/configure.ac index 7ded5289d31..19575e80cf4 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_PREREQ([2.65]) dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el. -AC_INIT([GNU Emacs], [29.0.91], [bug-gnu-emacs@gnu.org], [], +AC_INIT([GNU Emacs], [29.0.92], [bug-gnu-emacs@gnu.org], [], [https://www.gnu.org/software/emacs/]) dnl Set emacs_config_options to the options of 'configure', quoted for the shell, diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index e950d6f23ac..c26b79ca7db 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -67,7 +67,7 @@ /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/ /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/ /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/ -/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.0.91"/ +/^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION "29.0.92"/ /^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/ /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/ /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/ diff --git a/nt/README.W32 b/nt/README.W32 index 288e1e398a5..18b6efb30cd 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -1,7 +1,7 @@ Copyright (C) 2001-2023 Free Software Foundation, Inc. See the end of the file for license conditions. - Emacs version 29.0.91 for MS-Windows + Emacs version 29.0.92 for MS-Windows This README file describes how to set up and run a precompiled distribution of the latest version of GNU Emacs for MS-Windows. You commit 8f62e7b85f69bb4026e9cf2971668b0d77077792 Author: Mattias Engdegård Date: Sun Jun 18 10:37:53 2023 +0200 Describe primarily the Emacs s-exp dialect for treesit queries * doc/lispref/parsing.texi (Pattern Matching, Multiple Languages): Writing tree-sitter queries as Emacs s-expressions is much more convenient than using the native query notation inside a string, so it makes sense to base the documentation on the former dialect (bug#64017). diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 3906ca0118a..9e1df07d25c 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -1084,9 +1084,9 @@ Pattern Matching @defun treesit-query-capture node query &optional beg end node-only This function matches patterns in @var{query} within @var{node}. The -argument @var{query} can be either a string, an s-expression, or a -compiled query object. For now, we focus on the string syntax; -s-expression syntax and compiled queries are described at the end of +argument @var{query} can be either an s-expression, a string, or a +compiled query object. For now, we focus on the s-expression syntax; +string syntax and compiled queries are described at the end of the section. The argument @var{node} can also be a parser or a language symbol. A @@ -1118,8 +1118,8 @@ Pattern Matching @example @group (setq query - "(binary_expression - (number_literal) @@number-in-exp) @@biexp") + '((binary_expression + (number_literal) @@number-in-exp) @@biexp) @end group @end example @@ -1140,8 +1140,8 @@ Pattern Matching @example @group (setq query - "(binary_expression) @@biexp - (number_literal) @@number @@biexp") + '((binary_expression) @@biexp + (number_literal) @@number @@biexp) @end group @end example @@ -1199,23 +1199,23 @@ Pattern Matching @subheading Quantify node @cindex quantify node, tree-sitter -Tree-sitter recognizes quantification operators @samp{*}, @samp{+}, -and @samp{?}. Their meanings are the same as in regular expressions: -@samp{*} matches the preceding pattern zero or more times, @samp{+} -matches one or more times, and @samp{?} matches zero or one times. +Tree-sitter recognizes quantification operators @samp{:*}, @samp{:+}, +and @samp{:?}. Their meanings are the same as in regular expressions: +@samp{:*} matches the preceding pattern zero or more times, @samp{:+} +matches one or more times, and @samp{:?} matches zero or one times. For example, the following pattern matches @code{type_declaration} nodes that have @emph{zero or more} @code{long} keywords. @example -(type_declaration "long"*) @@long-type +(type_declaration "long" :*) @@long-type @end example The following pattern matches a type declaration that may or may not have a @code{long} keyword: @example -(type_declaration "long"?) @@long-type +(type_declaration "long" :?) @@long-type @end example @subheading Grouping @@ -1225,15 +1225,14 @@ Pattern Matching express a comma-separated list of identifiers, one could write @example -(identifier) ("," (identifier))* +(identifier) ("," (identifier)) :* @end example @subheading Alternation Again, similar to regular expressions, we can express ``match any one -of these patterns'' in a pattern. The syntax is a list of patterns -enclosed in square brackets. For example, to capture some keywords in -C, the pattern would be +of these patterns'' in a pattern. The syntax is a vector of patterns. +For example, to capture some keywords in C, the pattern would be @example @group @@ -1248,7 +1247,7 @@ Pattern Matching @subheading Anchor -The anchor operator @samp{.} can be used to enforce juxtaposition, +The anchor operator @code{:anchor} can be used to enforce juxtaposition, i.e., to enforce two things to be directly next to each other. The two ``things'' can be two nodes, or a child and the end of its parent. For example, to capture the first child, the last child, or two @@ -1257,19 +1256,19 @@ Pattern Matching @example @group ;; Anchor the child with the end of its parent. -(compound_expression (_) @@last-child .) +(compound_expression (_) @@last-child :anchor) @end group @group ;; Anchor the child with the beginning of its parent. -(compound_expression . (_) @@first-child) +(compound_expression :anchor (_) @@first-child) @end group @group ;; Anchor two adjacent children. (compound_expression (_) @@prev-child - . + :anchor (_) @@next-child) @end group @end example @@ -1285,8 +1284,8 @@ Pattern Matching @example @group ( - (array . (_) @@first (_) @@last .) - (#equal @@first @@last) + (array :anchor (_) @@first (_) @@last :anchor) + (:equal @@first @@last) ) @end group @end example @@ -1294,22 +1293,22 @@ Pattern Matching @noindent tree-sitter only matches arrays where the first element is equal to the last element. To attach a predicate to a pattern, we need to -group them together. A predicate always starts with a @samp{#}. -Currently there are three predicates: @code{#equal}, @code{#match}, -and @code{#pred}. +group them together. Currently there are three predicates: +@code{:equal}, @code{:match}, and @code{:pred}. -@deffn Predicate equal arg1 arg2 +@deffn Predicate :equal arg1 arg2 Matches if @var{arg1} is equal to @var{arg2}. Arguments can be either strings or capture names. Capture names represent the text that the captured node spans in the buffer. @end deffn -@deffn Predicate match regexp capture-name +@deffn Predicate :match regexp capture-name Matches if the text that @var{capture-name}'s node spans in the buffer -matches regular expression @var{regexp}. Matching is case-sensitive. +matches regular expression @var{regexp}, given as a string literal. +Matching is case-sensitive. @end deffn -@deffn Predicate pred fn &rest nodes +@deffn Predicate :pred fn &rest nodes Matches if function @var{fn} returns non-@code{nil} when passed each node in @var{nodes} as arguments. @end deffn @@ -1318,23 +1317,23 @@ Pattern Matching the same pattern. Indeed, it makes little sense to refer to capture names in other patterns. -@heading S-expression patterns +@heading String patterns -@cindex tree-sitter patterns as sexps -@cindex patterns, tree-sitter, in sexp form -Besides strings, Emacs provides an s-expression based syntax for -tree-sitter patterns. It largely resembles the string-based syntax. -For example, the following query +@cindex tree-sitter patterns as strings +@cindex patterns, tree-sitter, in string form +Besides s-expressions, Emacs allows the tree-sitter's native query +syntax to be used by writing them as strings. It largely resembles +the s-expression syntax. For example, the following query @example @group (treesit-query-capture - node "(addition_expression - left: (_) @@left - \"+\" @@plus-sign - right: (_) @@right) @@addition + node '((addition_expression + left: (_) @@left + "+" @@plus-sign + right: (_) @@right) @@addition - [\"return\" \"break\"] @@keyword") + ["return" "break"] @@keyword)) @end group @end example @@ -1344,52 +1343,53 @@ Pattern Matching @example @group (treesit-query-capture - node '((addition_expression - left: (_) @@left - "+" @@plus-sign - right: (_) @@right) @@addition + node "(addition_expression + left: (_) @@left + \"+\" @@plus-sign + right: (_) @@right) @@addition - ["return" "break"] @@keyword)) + [\"return\" \"break\"] @@keyword") @end group @end example -Most patterns can be written directly as strange but nevertheless -valid s-expressions. Only a few of them need modification: +Most patterns can be written directly as s-expressions inside a string. +Only a few of them need modification: @itemize @item -Anchor @samp{.} is written as @code{:anchor}. +Anchor @code{:anchor} is written as @samp{.}. @item -@samp{?} is written as @samp{:?}. +@samp{:?} is written as @samp{?}. @item -@samp{*} is written as @samp{:*}. +@samp{:*} is written as @samp{*}. @item -@samp{+} is written as @samp{:+}. +@samp{:+} is written as @samp{+}. @item -@code{#equal} is written as @code{:equal}. In general, predicates -change their @samp{#} to @samp{:}. +@code{:equal}, @code{:match} and @code{:pred} are written as +@code{#equal}, @code{#match} and @code{#pred}, respectively. +In general, predicates change their @samp{:} to @samp{#}. @end itemize For example, @example @group -"( - (compound_expression . (_) @@first (_)* @@rest) - (#match \"love\" @@first) - )" +'(( + (compound_expression :anchor (_) @@first (_) :* @@rest) + (:match "love" @@first) + )) @end group @end example @noindent -is written in s-expression syntax as +is written in string form as @example @group -'(( - (compound_expression :anchor (_) @@first (_) :* @@rest) - (:match "love" @@first) - )) +"( + (compound_expression . (_) @@first (_)* @@rest) + (#match \"love\" @@first) + )" @end group @end example @@ -1413,7 +1413,7 @@ Pattern Matching @end defun @defun treesit-query-language query -This function return the language of @var{query}. +This function returns the language of @var{query}. @end defun @defun treesit-query-expand query @@ -1605,7 +1605,7 @@ Multiple Languages (setq css-range (treesit-query-range 'html - "(style_element (raw_text) @@capture)")) + '((style_element (raw_text) @@capture)))) (treesit-parser-set-included-ranges css css-range) @end group @@ -1614,7 +1614,7 @@ Multiple Languages (setq js-range (treesit-query-range 'html - "(script_element (raw_text) @@capture)")) + '((script_element (raw_text) @@capture)))) (treesit-parser-set-included-ranges js js-range) @end group @end example commit eacd75df4e475c3d2483c64f32e3edb3be5c7785 Author: Eli Zaretskii Date: Sun Jun 18 09:13:02 2023 +0300 ; Improve documentation of overlay priorities * doc/lispref/display.texi (Overlay Properties): Don't advise against using overlay property values that are cons cells. (Bug#64101) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 9b6e4f609bf..e229935170f 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -1792,34 +1792,43 @@ Overlay Properties @table @code @item priority @kindex priority @r{(overlay property)} -This property's value determines the priority of the overlay. -If you want to specify a priority value, use either @code{nil} -(or zero), or a positive integer. Any other value has undefined behavior. +This property's value determines the priority of the overlay. If you +want to specify a priority value, use either @code{nil} (or zero), or +a positive integer, or a cons of two values. Any other value triggers +undefined behavior. The priority matters when two or more overlays cover the same character and both specify the same property with different values; -the one whose @code{priority} value is larger overrides the other. +the one whose @code{priority} value is higher overrides the other. (For the @code{face} property, the higher priority overlay's value -does not completely override the other value; instead, its face -attributes override the face attributes of the @code{face} property -whose priority is lower.) If two overlays have the same priority -value, and one is nested in the other, then the inner one will prevail -over the outer one. If neither is nested in the other then you should -not make assumptions about which overlay will prevail. +does not completely override the other value; instead, its individual +face attributes override the corresponding face attributes of the +@code{face} property whose priority is lower.) If two overlays have +the same priority value, and one is ``nested'' in the other (i.e., +covers fewer buffer or string positions), then the inner one will +prevail over the outer one. If neither is nested in the other then +you should not make assumptions about which overlay will prevail. + +When a Lisp program puts overlays with defined priorities on text that +might have overlays without priorities, this could cause undesirable +results, because any overlay with a positive priority value will +override all the overlays without a priority. Since most Emacs +features that use overlays don't specify priorities for their +overlays, integer priorities should be used with care. Instead of +using integer priorities and risk overriding other overlays, you can +use priority values of the form @w{@code{(@var{primary} . @var{secondary})}}, +where the @var{primary} value is used as described above, and +@var{secondary} is the fallback value used when @var{primary} and the +nesting considerations fail to resolve the precedence between +overlays. In particular, priority value @w{@code{(nil . @var{n})}}, +with @var{n} a positive integer, allows to have the overlays ordered +by priority when necessary without completely overriding other +overlays. Currently, all overlays take priority over text properties. -Note that Emacs sometimes uses non-numeric priority values for some of -its internal overlays, so do not try to do arithmetic on the priority -of an overlay (unless it is one that you created). In particular, the -overlay used for showing the region uses a priority value of the form -@w{@code{(@var{primary} . @var{secondary})}}, where the @var{primary} -value is used as described above, and @var{secondary} is the fallback -value used when @var{primary} and the nesting considerations fail to -resolve the precedence between overlays. However, you are advised not -to design Lisp programs based on this implementation detail; if you -need to put overlays in priority order, use the @var{sorted} argument -of @code{overlays-at}. @xref{Finding Overlays}. +If you need to put overlays in priority order, use the @var{sorted} +argument of @code{overlays-at}. @xref{Finding Overlays}. @item window @kindex window @r{(overlay property)} @@ -3329,8 +3338,8 @@ Displaying Faces specified by the @code{mouse-face} property instead. @xref{Overlay Properties}. -When multiple overlays cover one character, an overlay with higher -priority overrides those with lower priority. @xref{Overlays}. +When multiple overlays cover the same character, an overlay with +higher priority overrides those with lower priority. @xref{Overlays}. @item If the text contains a @code{face} or @code{mouse-face} property, commit b3f11e94fad97144c4bd01c0d6e729d27bc7bfc7 Author: Eli Zaretskii Date: Sun Jun 18 08:50:54 2023 +0300 Fix documentation of :predicate in 'define-globalized-minor-mode' * doc/lispref/modes.texi (Defining Minor Modes): * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Document that :predicate creates a customizable user option. (Bug#64048) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 3eb61b4d565..4a54d6ec290 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1888,11 +1888,14 @@ Defining Minor Modes @code{-modes} instead of @code{-mode} at the end, i.e.@: @code{@var{global-mode}s}. This variable will be used in a predicate function that determines whether the minor mode should be activated in -a particular major mode. Valid values of @code{:predicate} include -@code{t} (use in all major modes), @code{nil} (don't use in any major -modes), or a list of mode names, optionally preceded with @code{not} -(as in @w{@code{(not @var{mode-name} @dots{})}}). These elements can -be mixed, as shown in the following examples. +a particular major mode, and users can customize the value of the +variable to control the modes in which the minor mode will be switched +on. Valid values of @code{:predicate} (and thus valid values of the +user option it creates) include @code{t} (use in all major modes), +@code{nil} (don't use in any major modes), or a list of mode names, +optionally preceded with @code{not} (as in @w{@code{(not +@var{mode-name} @dots{})}}). These elements can be mixed, as shown in +the following examples. @example (c-mode (not mail-mode message-mode) text-mode) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 22ea12f0960..98c211325ab 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -450,14 +450,17 @@ define-globalized-minor-mode and that should try to turn MODE on if applicable for that buffer. Each of KEY VALUE is a pair of CL-style keyword arguments. -The :predicate argument specifies in which major modes should the +The :predicate key specifies in which major modes should the globalized minor mode be switched on. The value should be t (meaning switch on the minor mode in all major modes), nil (meaning don't switch on in any major mode), a list of modes (meaning switch on only in those modes and their descendants), or a list (not MODES...), meaning switch on in any major mode except MODES. The value can also mix all of these forms, see the info node `Defining Minor Modes' for -details. +details. The :predicate key causes the macro to create a user option +named the same as MODE, but ending with \"-modes\" instead of \"-mode\". +That user option can then be used to customize in which modes this +globalized minor mode will be switched on. As the minor mode defined by this function is always global, any :global keyword is ignored. Other keywords have the same meaning as in `define-minor-mode', commit 02f0be03017f7f07f37d541a5c665995f1494a84 Author: Basil L. Contovounesios Date: Sat Jun 17 20:39:16 2023 +0100 Revert "Fix some tree-sitter :match regexps" This reverts commit 95091b77f0bbb2ae1aa94ef4a413626e7d434d58 of 2023-06-17, mistakenly pushed to emacs-29. The patch will be installed on master instead, and backported later, after Emacs 29.1 is released (bug#64019). Do not merge to master. diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 7f2fc4188a3..463872dcbc8 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -168,7 +168,7 @@ java-ts-mode--font-lock-settings :override t :feature 'constant `(((identifier) @font-lock-constant-face - (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) + (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face)) [(true) (false)] @font-lock-constant-face) :language 'java :override t diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 48fecf69537..414b6eb2baf 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -106,7 +106,7 @@ js--opt-cpp-start (defconst js--plain-method-re (concat "^\\s-*?\\(" js--dotted-name-re "\\)\\.prototype" - "\\.\\(" js--name-re "\\)\\s-*?=\\s-*?\\(\\(?:async[ \t\n]+\\)function\\)\\_>") + "\\.\\(" js--name-re "\\)\\s-*?=\\s-*?\\(\\(:?async[ \t\n]+\\)function\\)\\_>") "Regexp matching an explicit JavaScript prototype \"method\" declaration. Group 1 is a (possibly-dotted) class name, group 2 is a method name, and group 3 is the `function' keyword.") @@ -3493,7 +3493,7 @@ js--treesit-font-lock-settings :language 'javascript :feature 'constant '(((identifier) @font-lock-constant-face - (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) + (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face)) [(true) (false) (null)] @font-lock-constant-face) @@ -3612,7 +3612,7 @@ js--treesit-font-lock-settings :feature 'number '((number) @font-lock-number-face ((identifier) @font-lock-number-face - (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face))) + (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face))) :language 'javascript :feature 'operator diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 4b951f7606f..91d65a2777b 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1021,7 +1021,7 @@ ruby-ts--s-p-query (:match "\\`\\$[#\"'`:?]" @global_var)) ;; ?' ?" ?` are character literals. ((character) @char - (:match "\\`\\?[#\"'`:?]" @char)) + (:match "\\`?[#\"'`:?]" @char)) ;; Symbols like :+, :<=> or :foo=. ((simple_symbol) @symbol (:match "\\s." @symbol)) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 999c1d7ae96..b55af0b49e3 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -143,7 +143,7 @@ rust-ts-mode--font-lock-settings eol)) @font-lock-builtin-face))) ((identifier) @font-lock-type-face - (:match "\\`\\(?:Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face))) + (:match "\\`\\(:?Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face))) :language 'rust :feature 'comment @@ -232,12 +232,9 @@ rust-ts-mode--font-lock-settings (type_identifier) @font-lock-type-face ((scoped_identifier name: (identifier) @rust-ts-mode--fontify-tail)) ((scoped_identifier path: (identifier) @font-lock-type-face) - (:match ,(rx bos - (or "u8" "u16" "u32" "u64" "u128" "usize" - "i8" "i16" "i32" "i64" "i128" "isize" - "char" "str") - eos) - @font-lock-type-face)) + (:match + "\\`\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)\\'" + @font-lock-type-face)) ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope)) ((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope)) (type_identifier) @font-lock-type-face) @@ -252,7 +249,7 @@ rust-ts-mode--font-lock-settings :feature 'constant `((boolean_literal) @font-lock-constant-face ((identifier) @font-lock-constant-face - (:match "\\`[A-Z][0-9A-Z_]*\\'" @font-lock-constant-face))) + (:match "\\`[A-Z][A-Z\\d_]*\\'" @font-lock-constant-face))) :language 'rust :feature 'variable diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 68aefd90f92..5df34de0472 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -153,7 +153,7 @@ typescript-ts-mode--font-lock-settings :language language :feature 'constant `(((identifier) @font-lock-constant-face - (:match "\\`[A-Z_][0-9A-Z_]*\\'" @font-lock-constant-face)) + (:match "\\`[A-Z_][A-Z_\\d]*\\'" @font-lock-constant-face)) [(true) (false) (null)] @font-lock-constant-face) :language language @@ -311,7 +311,7 @@ typescript-ts-mode--font-lock-settings :feature 'number `((number) @font-lock-number-face ((identifier) @font-lock-number-face - (:match "\\`\\(?:NaN\\|Infinity\\)\\'" @font-lock-number-face))) + (:match "\\`\\(:?NaN\\|Infinity\\)\\'" @font-lock-number-face))) :language language :feature 'operator