commit 7d246c359cf3d25cab5134076e393c4d25015827 (HEAD, refs/remotes/origin/master) Author: Mattias Engdegård Date: Mon May 1 19:08:12 2023 +0200 ; * lisp/progmodes/c-ts-mode.el: allow loading file without treesit diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 4971ed0b7c2..1f420689432 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1001,13 +1001,14 @@ c-ts-mode--for-each-tail-body-matcher (looking-at c-ts-mode--for-each-tail-regexp)))) (defvar c-ts-mode--emacs-c-range-query - (treesit-query-compile - 'emacs-c `(((declaration - type: (macro_type_specifier - name: (identifier) @_name) - @for-each-tail) - (:match ,c-ts-mode--for-each-tail-regexp - @_name)))) + (and (treesit-available-p) + (treesit-query-compile + 'emacs-c `(((declaration + type: (macro_type_specifier + name: (identifier) @_name) + @for-each-tail) + (:match ,c-ts-mode--for-each-tail-regexp + @_name))))) "Query that finds a FOR_EACH_* macro with an unbracketed body.") (defvar-local c-ts-mode--for-each-tail-ranges nil commit d01543f1147b3514fd06ffcdf4be64a6cabe0018 Author: Jim Porter Date: Mon May 1 09:49:39 2023 -0700 ; Use $GIT_DIR to find the .git directory inside our hooks This resolves an issue with running the hooks from a worktree. See . * build-aux/git-hooks/post-commit: * build-aux/git-hooks/pre-push: Use $GIT_DIR. diff --git a/build-aux/git-hooks/post-commit b/build-aux/git-hooks/post-commit index 68d9995d915..05f2d778b5c 100755 --- a/build-aux/git-hooks/post-commit +++ b/build-aux/git-hooks/post-commit @@ -42,4 +42,4 @@ else fi git rev-parse HEAD | $awk -v reason=post-commit \ - -f .git/hooks/commit-msg-files.awk + -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push index 8e8277cba4f..6ff59102fd7 100755 --- a/build-aux/git-hooks/pre-push +++ b/build-aux/git-hooks/pre-push @@ -83,4 +83,4 @@ $awk -v origin_name="$1" ' # Print every SHA after oldref, up to (and including) newref. system("git rev-list --first-parent --reverse " oldref ".." newref) } -' | $awk -v reason=pre-push -f .git/hooks/commit-msg-files.awk +' | $awk -v reason=pre-push -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk commit aa135e09b6735cd50742b1023fc901feb32e6a52 Author: Mattias Engdegård Date: Mon May 1 17:22:02 2023 +0200 Declare `cl-delete` to have important-return-value (bug#61730) * lisp/emacs-lisp/cl-macs.el: Set property on `cl-delete`. * lisp/progmodes/python.el (python-shell--add-to-path-with-priority): Prevent warning by cleaner code. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 04567917189..8fdafe18c50 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3683,8 +3683,7 @@ cl--compiler-macro-get cl-tree-equal ;; Functions that mutate and return a list. - ;;cl-delete - cl-delete-if cl-delete-if-not + cl-delete cl-delete-if cl-delete-if-not cl-delete-duplicates cl-nsubst cl-nsubst-if cl-nsubst-if-not cl-nsubstitute cl-nsubstitute-if cl-nsubstitute-if-not diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5bb15c60956..f9b645cc3df 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2720,8 +2720,7 @@ python-shell-output-filter-buffer (defmacro python-shell--add-to-path-with-priority (pathvar paths) "Modify PATHVAR and ensure PATHS are added only once at beginning." `(dolist (path (reverse ,paths)) - (cl-delete path ,pathvar :test #'string=) - (cl-pushnew path ,pathvar :test #'string=))) + (setq ,pathvar (cons path (cl-delete path ,pathvar :test #'string=))))) (defun python-shell-calculate-pythonpath () "Calculate the PYTHONPATH using `python-shell-extra-pythonpaths'." commit 7acb3f1c060872b1802e7548d991ca8a9f0fef01 Author: Mattias Engdegård Date: Mon May 1 15:55:32 2023 +0200 Add the function declaration and property `important-return-value` Now the declaration (declare (important-return-value t)) can be used to have the byte-compiler warn when the return value from a call is discarded (bug#61730). * lisp/emacs-lisp/bytecomp.el (byte-compile-form) (important-return-value-fns): Use the function property `important-return-value` instead of looking through a static list. * lisp/emacs-lisp/byte-run.el (byte-run--set-important-return-value) (defun-declarations-alist): New function declaration, setting the property of the same name. * lisp/emacs-lisp/cl-macs.el: * lisp/subr.el (assoc-default): Set the property. * doc/lispref/functions.texi (Declare Form): * doc/lispref/symbols.texi (Standard Properties): Document. * etc/NEWS: Announce. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 42441361fea..dc0d182d50d 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2631,6 +2631,12 @@ Declare Form the same as the @code{side-effect-free} property of the function's symbol, @pxref{Standard Properties}. +@item (important-return-value @var{val}) +If @var{val} is non-@code{nil}, the byte compiler will warn about +calls to this function that do not use the returned value. This is the +same as the @code{important-return-value} property of the function's +symbol, @pxref{Standard Properties}. + @item (speed @var{n}) Specify the value of @code{native-comp-speed} in effect for native compilation of this function (@pxref{Native-Compilation Variables}). diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index c6a0408abd1..34db0caf3a8 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -643,6 +643,12 @@ Standard Properties calls. In addition to byte compiler optimizations, this property is also used for determining function safety (@pxref{Function Safety}). +@item important-return-value +@cindex @code{important-return-value} property +A non-@code{nil} value makes the byte compiler warn about code that +calls the named function without using its returned value. This is +useful for functions where doing so is likely to be a mistake. + @item undo-inhibit-region If non-@code{nil}, the named function prevents the @code{undo} operation from being restricted to the active region, if @code{undo} is invoked diff --git a/etc/NEWS b/etc/NEWS index 87d312596cd..b989f80f3c3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -507,17 +507,26 @@ the warning name 'suspicious'. --- *** Warn about more ignored function return values. The compiler now warns when the return value from certain functions is -ignored. Example: +implicitly ignored. Example: (progn (nreverse my-list) my-list) will elicit a warning because it is usually pointless to call -'nreverse' on a list without using the returned value. To silence the -warning, make use of the value in some way, such as assigning it to a -variable. You can also wrap the function call in '(ignore ...)'. +'nreverse' on a list without using the returned value. -This warning can be suppressed using 'with-suppressed-warnings' with -the warning name 'ignored-return-value'. +To silence the warning, make use of the value in some way, such as +assigning it to a variable. You can also wrap the function call in +'(ignore ...)', or use 'with-suppressed-warnings' with the warning +name 'ignored-return-value'. + +The warning will only be issued for calls to functions declared +'important-return-value' or 'side-effect-free' (but not 'error-free'). + ++++ +** New function declaration and property 'important-return-value'. +The declaration '(important-return-value t)' sets the +'important-return-value' property which indicates that the function +return value should probably not be thrown away implicitly. +++ ** New function 'file-user-uid'. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index fd9913d1be8..5b415c5e1f4 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -145,6 +145,11 @@ 'byte-run--set-side-effect-free (list 'function-put (list 'quote f) ''side-effect-free (list 'quote val)))) +(defalias 'byte-run--set-important-return-value + #'(lambda (f _args val) + (list 'function-put (list 'quote f) + ''important-return-value (list 'quote val)))) + (put 'compiler-macro 'edebug-declaration-spec '(&or symbolp ("lambda" &define lambda-list lambda-doc def-body))) @@ -226,6 +231,8 @@ defun-declarations-alist (list 'side-effect-free #'byte-run--set-side-effect-free "If non-nil, calls can be ignored if their value is unused. If `error-free', drop calls even if `byte-compile-delete-errors' is nil.") + (list 'important-return-value #'byte-run--set-important-return-value + "If non-nil, warn about calls not using the returned value.") (list 'compiler-macro #'byte-run--set-compiler-macro) (list 'doc-string #'byte-run--set-doc-string) (list 'indent #'byte-run--set-indent) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index c84c70971b3..6c804056ee7 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3502,67 +3502,7 @@ byte-compile-form ;; so maybe we don't need to bother about it here? (setq form (cons 'progn (cdr form))) (setq handler #'byte-compile-progn)) - ((and (or sef - (memq (car form) - ;; FIXME: Use a function property (declaration) - ;; instead of this list. - '( - ;; Functions that are side-effect-free - ;; except for the behaviour of - ;; functions passed as argument. - mapcar mapcan mapconcat - cl-mapcar cl-mapcan cl-maplist cl-map cl-mapcon - cl-reduce - assoc assoc-default plist-get plist-member - cl-assoc cl-assoc-if cl-assoc-if-not - cl-rassoc cl-rassoc-if cl-rassoc-if-not - cl-member cl-member-if cl-member-if-not - cl-adjoin - cl-mismatch cl-search - cl-find cl-find-if cl-find-if-not - cl-position cl-position-if cl-position-if-not - cl-count cl-count-if cl-count-if-not - cl-remove cl-remove-if cl-remove-if-not - cl-member cl-member-if cl-member-if-not - cl-remove-duplicates - cl-subst cl-subst-if cl-subst-if-not - cl-substitute cl-substitute-if - cl-substitute-if-not - cl-sublis - cl-union cl-intersection - cl-set-difference cl-set-exclusive-or - cl-subsetp - cl-every cl-some cl-notevery cl-notany - cl-tree-equal - - ;; Functions that mutate and return a list. - cl-delete-if cl-delete-if-not - ;; `delete-dups' and `delete-consecutive-dups' - ;; never delete the first element so it's - ;; safe to ignore their return value, but - ;; this isn't the case with - ;; `cl-delete-duplicates'. - cl-delete-duplicates - cl-nsubst cl-nsubst-if cl-nsubst-if-not - cl-nsubstitute cl-nsubstitute-if - cl-nsubstitute-if-not - cl-nunion cl-nintersection - cl-nset-difference cl-nset-exclusive-or - cl-nreconc cl-nsublis - cl-merge - ;; It's safe to ignore the value of `sort' - ;; and `nreverse' when used on arrays, - ;; but most calls pass lists. - nreverse - sort cl-sort cl-stable-sort - - ;; Adding the following functions yields many - ;; positives; evaluate how many of them are - ;; false first. - - ;;delq delete cl-delete - ;;nconc plist-put - ))) + ((and (or sef (function-get (car form) 'important-return-value)) ;; Don't warn for arguments to `ignore'. (not (eq byte-compile--for-effect 'for-effect-no-warn)) (byte-compile-warning-enabled-p @@ -3598,6 +3538,26 @@ byte-compile-form (byte-compile-discard)) (pop byte-compile-form-stack))) +(let ((important-return-value-fns + '( + ;; These functions are side-effect-free except for the + ;; behaviour of functions passed as argument. + mapcar mapcan mapconcat + assoc plist-get plist-member + + ;; It's safe to ignore the value of `sort' and `nreverse' + ;; when used on arrays, but most calls pass lists. + nreverse sort + + ;; Adding these functions causes many warnings; + ;; evaluate how many of them are false first. + ;;delq delete + ;;nconc plist-put + ))) + (dolist (fn important-return-value-fns) + (put fn 'important-return-value t))) + + (defun byte-compile-normal-call (form) (when (and (symbolp (car form)) (byte-compile-warning-enabled-p 'callargs (car form))) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 5382e0a0a52..04567917189 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3657,6 +3657,46 @@ cl--compiler-macro-get '(cl-list* cl-acons cl-equalp cl-random-state-p copy-tree)) +;;; Things whose return value should probably be used. +(mapc (lambda (x) (function-put x 'important-return-value t)) + '( + ;; Functions that are side-effect-free except for the + ;; behaviour of functions passed as argument. + cl-mapcar cl-mapcan cl-maplist cl-map cl-mapcon + cl-reduce + cl-assoc cl-assoc-if cl-assoc-if-not + cl-rassoc cl-rassoc-if cl-rassoc-if-not + cl-member cl-member-if cl-member-if-not + cl-adjoin + cl-mismatch cl-search + cl-find cl-find-if cl-find-if-not + cl-position cl-position-if cl-position-if-not + cl-count cl-count-if cl-count-if-not + cl-remove cl-remove-if cl-remove-if-not + cl-remove-duplicates + cl-subst cl-subst-if cl-subst-if-not + cl-substitute cl-substitute-if cl-substitute-if-not + cl-sublis + cl-union cl-intersection cl-set-difference cl-set-exclusive-or + cl-subsetp + cl-every cl-some cl-notevery cl-notany + cl-tree-equal + + ;; Functions that mutate and return a list. + ;;cl-delete + cl-delete-if cl-delete-if-not + cl-delete-duplicates + cl-nsubst cl-nsubst-if cl-nsubst-if-not + cl-nsubstitute cl-nsubstitute-if cl-nsubstitute-if-not + cl-nunion cl-nintersection cl-nset-difference cl-nset-exclusive-or + cl-nreconc cl-nsublis + cl-merge + ;; It's safe to ignore the value of `cl-sort' and `cl-stable-sort' + ;; when used on arrays, but most calls pass lists. + cl-sort cl-stable-sort + )) + + ;;; Types and assertions. ;;;###autoload diff --git a/lisp/subr.el b/lisp/subr.el index 427014cedc3..1452a1117d3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -862,6 +862,7 @@ assoc-default If no element matches, the value is nil. If TEST is omitted or nil, `equal' is used." + (declare (important-return-value t)) (let (found (tail alist) value) (while (and tail (not found)) (let ((elt (car tail))) commit aa56253407eaa62fdfbc037d5b5a6b3c41e6796e Author: F. Jason Park Date: Fri Apr 28 07:01:14 2023 -0700 Compare case-folded nicks with erc-fill-wrap-merge * lisp/erc/erc-fill.el (erc-fill--wrap-continued-message-p): Downcase both current and previous speaker when comparing nicks. * test/lisp/erc/erc-fill-tests.el (erc-fill-wrap--merge): Add title-case nick to test. * test/lisp/erc/resources/fill/snapshots/merge-01-start.eld: Update snapshot. * test/lisp/erc/resources/fill/snapshots/merge-02-right.eld: Update snapshot. (Bug#60936) diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el index c29d292abce..7b6495f9f3f 100644 --- a/lisp/erc/erc-fill.el +++ b/lisp/erc/erc-fill.el @@ -363,7 +363,8 @@ erc-fill--wrap-continued-message-p erc-fill--wrap-max-lull)) (nick (buffer-substring-no-properties (1+ (point-min)) (- (point) 2))) - ((equal (car props) (erc-downcase nick))))) + (props) + ((erc-nick-equal-p (car props) nick)))) (set-marker erc-fill--wrap-last-msg (point-min)))) (defun erc-fill--wrap-stamp-insert-prefixed-date (args) diff --git a/test/lisp/erc/erc-fill-tests.el b/test/lisp/erc/erc-fill-tests.el index f249be8fb86..e8dd25e8ea1 100644 --- a/test/lisp/erc/erc-fill-tests.el +++ b/test/lisp/erc/erc-fill-tests.el @@ -203,18 +203,23 @@ erc-fill-wrap--merge (erc-fill-tests--wrap-populate (lambda () + (erc-update-channel-member + "#chan" "Dummy" "Dummy" t nil nil nil nil nil "fake" "~u" nil nil t) + ;; Set this here so that the first few messages are from 1970 (let ((erc-fill-tests--time-vals (lambda () 1680332400))) (erc-fill-tests--insert-privmsg "bob" "zero.") (erc-fill-tests--insert-privmsg "alice" "one.") (erc-fill-tests--insert-privmsg "alice" "two.") (erc-fill-tests--insert-privmsg "bob" "three.") - (erc-fill-tests--insert-privmsg "bob" "four.")) + (erc-fill-tests--insert-privmsg "bob" "four.") + (erc-fill-tests--insert-privmsg "Dummy" "five.") + (erc-fill-tests--insert-privmsg "Dummy" "six.")) (should (= erc-fill--wrap-value 27)) (erc-fill-tests--wrap-check-prefixes "*** " " " " " - " " " " " " " " " ") + " " " " " " " " " " " " " ") (erc-fill-tests--compare "merge-01-start") (ert-info ("Shift right by one (plus)") @@ -222,7 +227,7 @@ erc-fill-wrap--merge (should (= erc-fill--wrap-value 29)) (erc-fill-tests--wrap-check-prefixes "*** " " " " " - " " " " " " " " " ") + " " " " " " " " " " " " " ") (erc-fill-tests--compare "merge-02-right"))))) (ert-deftest erc-fill-wrap-visual-keys--body () diff --git a/test/lisp/erc/resources/fill/snapshots/merge-01-start.eld b/test/lisp/erc/resources/fill/snapshots/merge-01-start.eld index db3136a9d9e..88defb6c09e 100644 --- a/test/lisp/erc/resources/fill/snapshots/merge-01-start.eld +++ b/test/lisp/erc/resources/fill/snapshots/merge-01-start.eld @@ -1 +1 @@ -#("\n\n\n[Thu Jan 1 1970]\n*** This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.[00:00]\n bob: come, you are a tedious fool: to the purpose. What was done to Elbow's wife, that he hath cause to complain of? Come me to what was done to her.\n alice: Either your unparagoned mistress is dead, or she's outprized by a trifle.\n\n[Sat Apr 1 2023]\n zero.[07:00]\n one.\n two.\n three.\n four.\n" 2 21 (erc-timestamp 0 line-prefix (space :width (- 27 18)) field erc-timestamp) 21 183 (erc-timestamp 0 wrap-prefix #2=(space :width 27) line-prefix #3=(space :width (- 27 (4)))) 183 190 (erc-timestamp 0 field erc-timestamp wrap-prefix #2# line-prefix #3# display #1=(#6=(margin right-margin) #("[00:00]" 0 7 (display #1# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 190 191 (wrap-prefix #2# line-prefix #3#) 191 192 (erc-timestamp 0 wrap-prefix #2# line-prefix #4=(space :width (- 27 (8))) erc-command PRIVMSG) 192 197 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 197 199 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 199 202 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 202 315 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 315 316 (erc-timestamp 0 erc-command PRIVMSG) 316 348 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 348 349 (wrap-prefix #2# line-prefix #4#) 349 350 (erc-timestamp 0 wrap-prefix #2# line-prefix #5=(space :width (- 27 (6))) erc-command PRIVMSG) 350 353 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 353 355 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 355 360 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 360 435 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 435 436 (wrap-prefix #2# line-prefix #5#) 436 455 (erc-timestamp 1680332400 line-prefix (space :width (- 27 18)) field erc-timestamp) 455 456 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #8=(space :width (- 27 (6))) erc-command PRIVMSG) 456 459 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #8# erc-command PRIVMSG) 459 466 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #8# erc-command PRIVMSG) 466 473 (erc-timestamp 1680332400 field erc-timestamp wrap-prefix #2# line-prefix #8# display #7=(#6# #("[07:00]" 0 7 (display #7# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 473 474 (wrap-prefix #2# line-prefix #8#) 474 475 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9=(space :width (- 27 (8))) erc-command PRIVMSG) 475 480 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 480 486 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 486 487 (wrap-prefix #2# line-prefix #9#) 487 488 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10=(space :width (- 27 0)) display #11="" erc-command PRIVMSG) 488 493 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 493 495 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 495 499 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# erc-command PRIVMSG) 499 500 (wrap-prefix #2# line-prefix #10#) 500 501 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12=(space :width (- 27 (6))) erc-command PRIVMSG) 501 504 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 504 512 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 512 513 (wrap-prefix #2# line-prefix #12#) 513 514 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13=(space :width (- 27 0)) display #11# erc-command PRIVMSG) 514 517 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 517 519 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 519 524 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# erc-command PRIVMSG) 524 525 (wrap-prefix #2# line-prefix #13#)) \ No newline at end of file +#("\n\n\n[Thu Jan 1 1970]\n*** This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.[00:00]\n bob: come, you are a tedious fool: to the purpose. What was done to Elbow's wife, that he hath cause to complain of? Come me to what was done to her.\n alice: Either your unparagoned mistress is dead, or she's outprized by a trifle.\n\n[Sat Apr 1 2023]\n zero.[07:00]\n one.\n two.\n three.\n four.\n five.\n six.\n" 2 21 (erc-timestamp 0 line-prefix (space :width (- 27 18)) field erc-timestamp) 21 183 (erc-timestamp 0 wrap-prefix #2=(space :width 27) line-prefix #3=(space :width (- 27 (4)))) 183 190 (erc-timestamp 0 field erc-timestamp wrap-prefix #2# line-prefix #3# display #1=(#7=(margin right-margin) #("[00:00]" 0 7 (display #1# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 190 191 (wrap-prefix #2# line-prefix #3#) 191 192 (erc-timestamp 0 wrap-prefix #2# line-prefix #4=(space :width (- 27 (8))) erc-command PRIVMSG) 192 197 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 197 199 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 199 202 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 202 315 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 315 316 (erc-timestamp 0 erc-command PRIVMSG) 316 348 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 348 349 (wrap-prefix #2# line-prefix #4#) 349 350 (erc-timestamp 0 wrap-prefix #2# line-prefix #5=(space :width (- 27 (6))) erc-command PRIVMSG) 350 353 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 353 355 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 355 360 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 360 435 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 435 436 (wrap-prefix #2# line-prefix #5#) 436 455 (erc-timestamp 1680332400 line-prefix (space :width (- 27 18)) field erc-timestamp) 455 456 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6=(space :width (- 27 (6))) erc-command PRIVMSG) 456 459 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6# erc-command PRIVMSG) 459 466 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6# erc-command PRIVMSG) 466 473 (erc-timestamp 1680332400 field erc-timestamp wrap-prefix #2# line-prefix #6# display #8=(#7# #("[07:00]" 0 7 (display #8# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 473 474 (wrap-prefix #2# line-prefix #6#) 474 475 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9=(space :width (- 27 (8))) erc-command PRIVMSG) 475 480 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 480 486 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 486 487 (wrap-prefix #2# line-prefix #9#) 487 488 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10=(space :width (- 27 0)) display #11="" erc-command PRIVMSG) 488 493 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 493 495 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 495 499 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# erc-command PRIVMSG) 499 500 (wrap-prefix #2# line-prefix #10#) 500 501 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12=(space :width (- 27 (6))) erc-command PRIVMSG) 501 504 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 504 512 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 512 513 (wrap-prefix #2# line-prefix #12#) 513 514 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13=(space :width (- 27 0)) display #11# erc-command PRIVMSG) 514 517 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 517 519 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 519 524 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# erc-command PRIVMSG) 524 525 (wrap-prefix #2# line-prefix #13#) 525 526 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #14=(space :width (- 27 (8))) erc-command PRIVMSG) 526 531 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #14# erc-command PRIVMSG) 531 538 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #14# erc-command PRIVMSG) 538 539 (wrap-prefix #2# line-prefix #14#) 539 540 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15=(space :width (- 27 0)) display #11# erc-command PRIVMSG) 540 545 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15# display #11# erc-command PRIVMSG) 545 547 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15# display #11# erc-command PRIVMSG) 547 551 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15# erc-command PRIVMSG) 551 552 (wrap-prefix #2# line-prefix #15#)) \ No newline at end of file diff --git a/test/lisp/erc/resources/fill/snapshots/merge-02-right.eld b/test/lisp/erc/resources/fill/snapshots/merge-02-right.eld index fcb9e59b757..c5a9cbfc05d 100644 --- a/test/lisp/erc/resources/fill/snapshots/merge-02-right.eld +++ b/test/lisp/erc/resources/fill/snapshots/merge-02-right.eld @@ -1 +1 @@ -#("\n\n\n[Thu Jan 1 1970]\n*** This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.[00:00]\n bob: come, you are a tedious fool: to the purpose. What was done to Elbow's wife, that he hath cause to complain of? Come me to what was done to her.\n alice: Either your unparagoned mistress is dead, or she's outprized by a trifle.\n\n[Sat Apr 1 2023]\n zero.[07:00]\n one.\n two.\n three.\n four.\n" 2 21 (erc-timestamp 0 line-prefix (space :width (- 29 18)) field erc-timestamp) 21 183 (erc-timestamp 0 wrap-prefix #2=(space :width 29) line-prefix #3=(space :width (- 29 (4)))) 183 190 (erc-timestamp 0 field erc-timestamp wrap-prefix #2# line-prefix #3# display #1=(#6=(margin right-margin) #("[00:00]" 0 7 (display #1# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 190 191 (wrap-prefix #2# line-prefix #3#) 191 192 (erc-timestamp 0 wrap-prefix #2# line-prefix #4=(space :width (- 29 (8))) erc-command PRIVMSG) 192 197 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 197 199 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 199 202 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 202 315 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 315 316 (erc-timestamp 0 erc-command PRIVMSG) 316 348 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 348 349 (wrap-prefix #2# line-prefix #4#) 349 350 (erc-timestamp 0 wrap-prefix #2# line-prefix #5=(space :width (- 29 (6))) erc-command PRIVMSG) 350 353 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 353 355 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 355 360 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 360 435 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 435 436 (wrap-prefix #2# line-prefix #5#) 436 455 (erc-timestamp 1680332400 line-prefix (space :width (- 29 18)) field erc-timestamp) 455 456 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #8=(space :width (- 29 (6))) erc-command PRIVMSG) 456 459 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #8# erc-command PRIVMSG) 459 466 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #8# erc-command PRIVMSG) 466 473 (erc-timestamp 1680332400 field erc-timestamp wrap-prefix #2# line-prefix #8# display #7=(#6# #("[07:00]" 0 7 (display #7# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 473 474 (wrap-prefix #2# line-prefix #8#) 474 475 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9=(space :width (- 29 (8))) erc-command PRIVMSG) 475 480 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 480 486 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 486 487 (wrap-prefix #2# line-prefix #9#) 487 488 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10=(space :width (- 29 0)) display #11="" erc-command PRIVMSG) 488 493 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 493 495 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 495 499 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# erc-command PRIVMSG) 499 500 (wrap-prefix #2# line-prefix #10#) 500 501 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12=(space :width (- 29 (6))) erc-command PRIVMSG) 501 504 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 504 512 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 512 513 (wrap-prefix #2# line-prefix #12#) 513 514 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13=(space :width (- 29 0)) display #11# erc-command PRIVMSG) 514 517 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 517 519 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 519 524 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# erc-command PRIVMSG) 524 525 (wrap-prefix #2# line-prefix #13#)) \ No newline at end of file +#("\n\n\n[Thu Jan 1 1970]\n*** This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect.[00:00]\n bob: come, you are a tedious fool: to the purpose. What was done to Elbow's wife, that he hath cause to complain of? Come me to what was done to her.\n alice: Either your unparagoned mistress is dead, or she's outprized by a trifle.\n\n[Sat Apr 1 2023]\n zero.[07:00]\n one.\n two.\n three.\n four.\n five.\n six.\n" 2 21 (erc-timestamp 0 line-prefix (space :width (- 29 18)) field erc-timestamp) 21 183 (erc-timestamp 0 wrap-prefix #2=(space :width 29) line-prefix #3=(space :width (- 29 (4)))) 183 190 (erc-timestamp 0 field erc-timestamp wrap-prefix #2# line-prefix #3# display #1=(#7=(margin right-margin) #("[00:00]" 0 7 (display #1# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 190 191 (wrap-prefix #2# line-prefix #3#) 191 192 (erc-timestamp 0 wrap-prefix #2# line-prefix #4=(space :width (- 29 (8))) erc-command PRIVMSG) 192 197 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 197 199 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 199 202 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 202 315 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 315 316 (erc-timestamp 0 erc-command PRIVMSG) 316 348 (erc-timestamp 0 wrap-prefix #2# line-prefix #4# erc-command PRIVMSG) 348 349 (wrap-prefix #2# line-prefix #4#) 349 350 (erc-timestamp 0 wrap-prefix #2# line-prefix #5=(space :width (- 29 (6))) erc-command PRIVMSG) 350 353 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 353 355 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 355 360 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 360 435 (erc-timestamp 0 wrap-prefix #2# line-prefix #5# erc-command PRIVMSG) 435 436 (wrap-prefix #2# line-prefix #5#) 436 455 (erc-timestamp 1680332400 line-prefix (space :width (- 29 18)) field erc-timestamp) 455 456 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6=(space :width (- 29 (6))) erc-command PRIVMSG) 456 459 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6# erc-command PRIVMSG) 459 466 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #6# erc-command PRIVMSG) 466 473 (erc-timestamp 1680332400 field erc-timestamp wrap-prefix #2# line-prefix #6# display #8=(#7# #("[07:00]" 0 7 (display #8# isearch-open-invisible timestamp invisible timestamp font-lock-face erc-timestamp-face)))) 473 474 (wrap-prefix #2# line-prefix #6#) 474 475 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9=(space :width (- 29 (8))) erc-command PRIVMSG) 475 480 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 480 486 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #9# erc-command PRIVMSG) 486 487 (wrap-prefix #2# line-prefix #9#) 487 488 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10=(space :width (- 29 0)) display #11="" erc-command PRIVMSG) 488 493 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 493 495 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# display #11# erc-command PRIVMSG) 495 499 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #10# erc-command PRIVMSG) 499 500 (wrap-prefix #2# line-prefix #10#) 500 501 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12=(space :width (- 29 (6))) erc-command PRIVMSG) 501 504 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 504 512 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #12# erc-command PRIVMSG) 512 513 (wrap-prefix #2# line-prefix #12#) 513 514 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13=(space :width (- 29 0)) display #11# erc-command PRIVMSG) 514 517 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 517 519 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# display #11# erc-command PRIVMSG) 519 524 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #13# erc-command PRIVMSG) 524 525 (wrap-prefix #2# line-prefix #13#) 525 526 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #14=(space :width (- 29 (8))) erc-command PRIVMSG) 526 531 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #14# erc-command PRIVMSG) 531 538 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #14# erc-command PRIVMSG) 538 539 (wrap-prefix #2# line-prefix #14#) 539 540 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15=(space :width (- 29 0)) display #11# erc-command PRIVMSG) 540 545 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15# display #11# erc-command PRIVMSG) 545 547 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15# display #11# erc-command PRIVMSG) 547 551 (erc-timestamp 1680332400 wrap-prefix #2# line-prefix #15# erc-command PRIVMSG) 551 552 (wrap-prefix #2# line-prefix #15#)) \ No newline at end of file commit 605414d018da47f99dec5019142f584b6eb174c8 Author: Andrew G Cohen Date: Sun Apr 30 09:55:42 2023 +0800 Fix outgoing mime type regression (Bug#62815) * lisp/net/mailcap.el (mailcap-mime-extensions, mailcap-parse-mimetype-file, mailcap-mime-types): Don't regexp-quote mimetypes in a context where they should be strings. (mailcap--regexp-quote-type): Remove. diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index 10c5a7744c1..4d01737e3e6 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -979,7 +979,7 @@ mailcap-mime-extensions (".vox" . "audio/basic") (".vrml" . "x-world/x-vrml") (".wav" . "audio/x-wav") - (".xls" . "application/vnd\\.ms-excel") + (".xls" . "application/vnd.ms-excel") (".wrl" . "x-world/x-vrml") (".xbm" . "image/xbm") (".xpm" . "image/xpm") @@ -1051,8 +1051,7 @@ mailcap-parse-mimetype-file (setq save-pos (point)) (skip-chars-forward "^ \t\n") (downcase-region save-pos (point)) - (setq type (mailcap--regexp-quote-type - (buffer-substring save-pos (point)))) + (setq type (buffer-substring save-pos (point))) (while (not (eolp)) (skip-chars-forward " \t") (setq save-pos (point)) @@ -1065,12 +1064,6 @@ mailcap-parse-mimetype-file (setq mailcap-mime-extensions (append extns mailcap-mime-extensions) extns nil))))) -(defun mailcap--regexp-quote-type (type) - (if (not (string-search "/" type)) - type - (pcase-let ((`(,major ,minor) (split-string type "/"))) - (concat major "/" (regexp-quote minor))))) - (defun mailcap-extension-to-mime (extn) "Return the MIME content type of the file extensions EXTN." (mailcap-parse-mimetypes) @@ -1107,7 +1100,7 @@ mailcap-mime-types (dolist (info (cdr data)) (setq type (cdr (assq 'type (cdr info)))) (unless (string-search "*" type) - (push type res)))) + (push (string-replace "\\" "" type) res)))) (nreverse res))))) ;;; commit 30892cbd330ace125454a056ca86d85e2a860bf5 Author: João Távora Date: Sat Apr 29 20:47:24 2023 +0100 Eglot: bump to 1.15 * lisp/progmodes/eglot.el (Version): Bump to 1.15 * etc/EGLOT-NEWS: Update. diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 7369b3bf545..27796adef4b 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS @@ -17,6 +17,32 @@ This refers to https://github.com/joaotavora/eglot/issues/. That is, to look up issue github#1234, go to https://github.com/joaotavora/eglot/issues/1234. + +* Changes in Eglot 1.15 (29/4/2023) + +** Fix LSP "languageId" detection + +Many servers today support multiple languages, meaning they can handle +more than one file type in the same connection. This relies on the +client supplying a ':languageId' string. Previously, Eglot calculated +this string based on an imperfect heuristic and was often wrong. See +github#1206. + +** Fix problems with missing signature documentation (bug#62687) + +** Reworked 'eglot-imenu' + +Eglot's Imenu backend (used for M-x imenu among other extensions), has +been reworked. Most newer servers respond to +'textDocument/documentSymbol' with a vector of 'DocumentSymbol', not +'SymbolInformation'. It's not worth it trying to make the two formats +resemble each other. This also lays groundwork supporting a +forthcoming "breadcrumb" feature of bug#58431. + +** New command 'eglot-update' + +This allows users to easily update to the latest version of Eglot. + * Changes in Eglot 1.14 (3/4/2023) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 53bc25a1b7e..1e0bcd30485 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2018-2023 Free Software Foundation, Inc. -;; Version: 1.14 +;; Version: 1.15 ;; Author: João Távora ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot commit c604cb6a8a5ac4ca1cfb5e839ca6d7ad1d77b5b8 Author: João Távora Date: Sat Apr 29 20:46:12 2023 +0100 Eglot: unbreak for Emacs 26 Emacs 26 doesn't have newer progress-reporter-update. I think I'll start using compat.el soon. * lisp/progmodes/eglot.el (eglot--apply-text-edits): Unbreak for Emacs 26 which doesn't have newer progress-reporter-update. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 6ae27a13845..53bc25a1b7e 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2237,7 +2237,7 @@ eglot-handle-notification ((eq (car pr) 'eglot--mode-line-reporter) (setcdr (cddr pr) (list msg pcnt)) (force-mode-line-update t)) - (pr (progress-reporter-update pr pcnt msg))))) + (pr (eglot--reporter-update pr pcnt msg))))) (eglot--dbind ((WorkDoneProgress) kind title percentage message) value (pcase kind ("begin" @@ -3341,7 +3341,7 @@ eglot--apply-text-edits (save-restriction (narrow-to-region beg end) (replace-buffer-contents temp))) - (progress-reporter-update reporter (cl-incf done))))))) + (eglot--reporter-update reporter (cl-incf done))))))) (mapcar (eglot--lambda ((TextEdit) range newText) (cons newText (eglot--range-region range 'markers))) (reverse edits))) commit e03cfec0a455dd8c496d33c422c8edb9ac5a4005 Author: Wilhelm H Kirschbaum Date: Thu Apr 27 12:13:25 2023 +0200 Improve call indentation for elixir-ts-mode * lisp/progmodes/elixir-ts-mode.el (elixir-ts--indent-rules): Change match order. (Bug#63110) * test/lisp/progmodes/elixir-ts-mode-resources/indent.erts: Add test case. diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index 47f53043af3..7175fe4bff8 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -257,7 +257,6 @@ elixir-ts--indent-rules ((node-is "^stab_clause$") parent-bol ,offset) ((query ,elixir-ts--capture-operator-parent) grand-parent 0) ((node-is "^when$") parent 0) - ((node-is "^keywords$") parent-bol ,offset) ((parent-is "^body$") (lambda (node parent _) (save-excursion @@ -272,6 +271,7 @@ elixir-ts--indent-rules ,'elixir-ts--argument-indent-anchor ,'elixir-ts--argument-indent-offset) ;; Handle incomplete maps when parent is ERROR. + ((node-is "^keywords$") parent-bol ,offset) ((n-p-gp "^binary_operator$" "ERROR" nil) parent-bol 0) ;; When there is an ERROR, just indent to prev-line. ((parent-is "ERROR") prev-line ,offset) diff --git a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts index 4eb6e768b96..1f855d3c977 100644 --- a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts @@ -193,7 +193,19 @@ tuple = { } =-=-= -Name: Spec and method +Name: Call with keywords + +=-= +def foo() do + bar(:one, + :two, + one: 1, + two: 2 + ) +end +=-=-= + +Name: Call with @spec =-= @spec foobar( commit e0e93f7eecca4fc12ba898a9bc923566ff45c646 Author: Wilhelm H Kirschbaum Date: Thu Apr 27 11:39:39 2023 +0200 Add bitstring indentation and navigation for elixir-ts-mode * lisp/progmodes/elixir-ts-mode.el (elixir-ts--sexp-regexp): Add bistring. (elixir-ts--indent-rules): Handle bitstring indentation. (Bug#63109) * test/lisp/progmodes/elixir-ts-mode-resources/indent.erts: Add test case. diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index c58854c41c3..47f53043af3 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -89,7 +89,7 @@ elixir-ts--sexp-regexp (rx bol (or "call" "stab_clause" "binary_operator" "list" "tuple" "map" "pair" "sigil" "string" "atom" "alias" "arguments" "identifier" - "boolean" "quoted_content") + "boolean" "quoted_content" "bitstring") eol)) (defconst elixir-ts--test-definition-keywords @@ -231,6 +231,7 @@ elixir-ts--indent-rules ((node-is "^]$") ,'elixir-ts--parent-expression-start 0) ((node-is "^}$") ,'elixir-ts--parent-expression-start 0) ((node-is "^)$") ,'elixir-ts--parent-expression-start 0) + ((node-is "^>>$") ,'elixir-ts--parent-expression-start 0) ((node-is "^else_block$") grand-parent 0) ((node-is "^catch_block$") grand-parent 0) ((node-is "^rescue_block$") grand-parent 0) @@ -250,6 +251,7 @@ elixir-ts--indent-rules ,'elixir-ts--argument-indent-anchor ,'elixir-ts--argument-indent-offset) ((parent-is "^pair$") parent ,offset) + ((parent-is "^bitstring$") parent ,offset) ((parent-is "^map_content$") parent-bol 0) ((parent-is "^map$") ,'elixir-ts--parent-expression-start ,offset) ((node-is "^stab_clause$") parent-bol ,offset) diff --git a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts index 9ad604e5198..4eb6e768b96 100644 --- a/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/elixir-ts-mode-resources/indent.erts @@ -79,6 +79,18 @@ def foo() do end =-=-= +Name: Bitstring mulitline + +=-= +<<12, 22, +22, 32 + >> +=-= +<<12, 22, + 22, 32 +>> +=-=-= + Name: Block assignments =-= commit b408df11e350941eb099cde87d83340e8e7e0378 Author: Eli Zaretskii Date: Sat Apr 29 11:50:47 2023 +0300 Optimize search for composable characters in redisplay * src/composite.c (composition_compute_stop_pos): Accept new argument INCLUDE_STATIC, and look for potential static compositions only if this argument is non-zero. * src/xdisp.c: * src/composite.c: * src/indent.c: All callers adjusted. * src/xdisp.c (compute_stop_pos): Don't search for static compositions. Search for automatic compositions only after the iterator gets past the composition stop_pos computed last time. Use a better position for limiting search for automatic compositions. (Bug#62780) diff --git a/src/composite.c b/src/composite.c index 164eeb39598..34f369d167a 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1040,7 +1040,9 @@ inhibit_auto_composition (void) composition closest to CHARPOS is found, set cmp_it->stop_pos to the last character of the composition. STRING, if non-nil, is the string (as opposed to a buffer) whose characters should be - tested for being composable. + tested for being composable. INCLUDE_STATIC non-zero means + consider both static and automatic compositions; if zero, look + only for potential automatic compositions. If no composition is found, set cmp_it->ch to -2. If a static composition is found, set cmp_it->ch to -1. Otherwise, set @@ -1050,7 +1052,7 @@ inhibit_auto_composition (void) void composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, - Lisp_Object string) + Lisp_Object string, bool include_static) { ptrdiff_t start, end; int c; @@ -1084,8 +1086,10 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, cmp_it->stop_pos = endpos; if (charpos == endpos) return; + /* Look for static compositions. */ /* FIXME: Bidi is not yet handled well in static composition. */ - if (charpos < endpos + if (include_static + && charpos < endpos && find_composition (charpos, endpos, &start, &end, &prop, string) && start >= charpos && composition_valid_p (start, end, prop)) @@ -1106,6 +1110,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, bytepos = string_char_to_byte (string, charpos); } + /* Look for automatic compositions. */ start = charpos; if (charpos < endpos) { @@ -1285,7 +1290,8 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, { if (cmp_it->ch == -2) { - composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string); + composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string, + true); if (cmp_it->ch == -2 || cmp_it->stop_pos != charpos) /* The current position is not composed. */ return 0; @@ -1424,7 +1430,7 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, } if (cmp_it->reversed_p) endpos = -1; - composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string); + composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string, true); return 0; } diff --git a/src/composite.h b/src/composite.h index e81465d90cc..0f791c1ea62 100644 --- a/src/composite.h +++ b/src/composite.h @@ -348,7 +348,7 @@ #define LGLYPH_WADJUST(g) (VECTORP (LGLYPH_ADJUSTMENT (g)) \ extern void composition_compute_stop_pos (struct composition_it *, ptrdiff_t, ptrdiff_t, ptrdiff_t, - Lisp_Object); + Lisp_Object, bool); extern bool composition_reseat_it (struct composition_it *, ptrdiff_t, ptrdiff_t, ptrdiff_t, struct window *, signed char, struct face *, Lisp_Object); diff --git a/src/indent.c b/src/indent.c index 08d2bf5ea28..16285ce84e2 100644 --- a/src/indent.c +++ b/src/indent.c @@ -616,7 +616,7 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, memset (&cmp_it, 0, sizeof cmp_it); cmp_it.id = -1; - composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil); + composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil, true); /* Scan forward to the target position. */ while (scan < end) @@ -681,7 +681,7 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, { cmp_it.id = -1; composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, - Qnil); + Qnil, true); } else cmp_it.from = cmp_it.to; @@ -1290,7 +1290,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos, prev_tab_offset = tab_offset; memset (&cmp_it, 0, sizeof cmp_it); cmp_it.id = -1; - composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil); + composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil, true); unsigned short int quit_count = 0; @@ -1600,7 +1600,7 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos, { cmp_it.id = -1; composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, - Qnil); + Qnil, true); } else cmp_it.from = cmp_it.to; diff --git a/src/xdisp.c b/src/xdisp.c index 76d6592bf00..18ea042e212 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4056,7 +4056,7 @@ compute_stop_pos (struct it *it) { register INTERVAL iv, next_iv; Lisp_Object object, limit, position; - ptrdiff_t charpos, bytepos; + ptrdiff_t charpos, bytepos, cmp_limit_pos = -1; if (STRINGP (it->string)) { @@ -4126,7 +4126,10 @@ compute_stop_pos (struct it *it) } } if (found) - pos--; + { + pos--; + cmp_limit_pos = pos; + } else if (it->stop_charpos < endpos) pos = it->stop_charpos; else @@ -4184,14 +4187,25 @@ compute_stop_pos (struct it *it) } } - if (it->cmp_it.id < 0) + if (it->cmp_it.id < 0 + && (STRINGP (it->string) + || ((!it->bidi_p || it->bidi_it.scan_dir >= 0) + && it->cmp_it.stop_pos <= IT_CHARPOS (*it)))) { ptrdiff_t stoppos = it->end_charpos; + /* If we found, above, a buffer position that cannot be part of + an automatic composition, limit the search of composable + characters to that position. */ if (it->bidi_p && it->bidi_it.scan_dir < 0) stoppos = -1; + else if (cmp_limit_pos > 0) + stoppos = cmp_limit_pos; + /* Force composition_compute_stop_pos avoid the costly search + for static compositions, since those were already found by + looking at text properties, above. */ composition_compute_stop_pos (&it->cmp_it, charpos, bytepos, - stoppos, it->string); + stoppos, it->string, false); } eassert (STRINGP (it->string) @@ -7716,7 +7730,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, if (endpos > it->end_charpos) endpos = it->end_charpos; composition_compute_stop_pos (&it->cmp_it, charpos, -1, endpos, - it->string); + it->string, true); } CHECK_IT (it); } @@ -8404,7 +8418,7 @@ set_iterator_to_next (struct it *it, bool reseat_p) where to stop. */ stop = -1; composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), - IT_BYTEPOS (*it), stop, Qnil); + IT_BYTEPOS (*it), stop, Qnil, true); } } else @@ -8435,7 +8449,8 @@ set_iterator_to_next (struct it *it, bool reseat_p) if (it->bidi_it.scan_dir < 0) stop = -1; composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), - IT_BYTEPOS (*it), stop, Qnil); + IT_BYTEPOS (*it), stop, Qnil, + true); } } eassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it))); @@ -8591,7 +8606,7 @@ set_iterator_to_next (struct it *it, bool reseat_p) composition_compute_stop_pos (&it->cmp_it, IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), stop, - it->string); + it->string, true); } } else @@ -8628,7 +8643,7 @@ set_iterator_to_next (struct it *it, bool reseat_p) composition_compute_stop_pos (&it->cmp_it, IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), stop, - it->string); + it->string, true); } } } @@ -8879,7 +8894,7 @@ get_visually_first_element (struct it *it) if (it->bidi_it.scan_dir < 0) stop = -1; composition_compute_stop_pos (&it->cmp_it, charpos, bytepos, stop, - it->string); + it->string, true); } } commit 5c0f0751d0541bbdf0696ef3e76e2ad6562adcb9 Author: Jonas Bernoulli Date: Wed Mar 29 16:57:33 2023 +0200 Support displaying all package maintainers (Bug#62524) * lisp/emacs-lisp/package.el (describe-package-1): Use new :maintainers package extra property from "archive-contents", if non-nil. * (package-buffer-info): Fix docstring. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 0c5cd82ac62..6cb78801d7f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1224,8 +1224,8 @@ package-buffer-info :url website :keywords keywords :maintainer - ;; For backward compatibility, use a single string if there's only - ;; one maintainer (the most common case). + ;; For backward compatibility, use a single cons-cell if + ;; there's only one maintainer (the most common case). (let ((maints (lm-maintainers))) (if (cdr maints) maints (car maints))) :authors (lm-authors))))) @@ -2736,7 +2736,8 @@ describe-package-1 (status (if desc (package-desc-status desc) "orphan")) (incompatible-reason (package--incompatible-p desc)) (signed (if desc (package-desc-signed desc))) - (maintainer (cdr (assoc :maintainer extras))) + (maintainers (or (cdr (assoc :maintainers extras)) + (cdr (assoc :maintainer extras)))) (authors (cdr (assoc :authors extras))) (news (and-let* (pkg-dir ((not built-in)) @@ -2871,19 +2872,21 @@ describe-package-1 'action 'package-keyword-button-action) (insert " ")) (insert "\n")) - (when maintainer - (package--print-help-section "Maintainer") - (package--print-email-button maintainer)) - (when authors + (when maintainers + (unless (proper-list-p maintainers) + (setq maintainers (list maintainers))) (package--print-help-section - (if (= (length authors) 1) - "Author" - "Authors")) - (package--print-email-button (pop authors)) - ;; If there's more than one author, indent the rest correctly. - (dolist (name authors) - (insert (make-string 13 ?\s)) - (package--print-email-button name))) + (if (cdr maintainers) "Maintainers" "Maintainer")) + (dolist (maintainer maintainers) + (when (bolp) + (insert (make-string 13 ?\s))) + (package--print-email-button maintainer))) + (when authors + (package--print-help-section (if (cdr authors) "Authors" "Author")) + (dolist (author authors) + (when (bolp) + (insert (make-string 13 ?\s))) + (package--print-email-button author))) (let* ((all-pkgs (append (cdr (assq name package-alist)) (cdr (assq name package-archive-contents)) (let ((bi (assq name package--builtins))) commit e155df7da785df732d34c9437abd24252c5be9ae Merge: 6ebce84ff2b 212e30f6789 Author: Eli Zaretskii Date: Fri Apr 28 12:14:26 2023 -0400 Merge from origin/emacs-29 212e30f6789 ; Fix byte-compilation warnings in c-ts-mode.el 1f2214dabd0 Skip over whitespace in annotation-top-cont check (bug#63... 7e136c51f6f Update zh-CN tutorial translation d3ca0b3aa2e ; * lisp/progmodes/c-ts-mode.el: Fix comments and doc str... c6f15c24862 ; Fix last change. b9e06330f75 ; * etc/NEWS: Followup to bug#62720. b33d25f5967 ; Minor improvements in doc strings of package-upgrade co... c3a61870b94 Fix eglot.texi # Conflicts: # etc/NEWS commit 212e30f6789cd080a9428958872ffcaab6bf248a Author: Eli Zaretskii Date: Fri Apr 28 12:01:19 2023 -0400 ; Fix byte-compilation warnings in c-ts-mode.el * lisp/progmodes/c-ts-mode.el (treesit-parser-set-included-ranges) (treesit-query-compile): Declare treesit.c functions. (treesit-load-name-override-list): Defvar it. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 7a1ee66cb77..113f3b6ee84 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -80,6 +80,8 @@ (declare-function treesit-node-prev-sibling "treesit.c") (declare-function treesit-node-first-child-for-pos "treesit.c") (declare-function treesit-node-next-sibling "treesit.c") +(declare-function treesit-parser-set-included-ranges "treesit.c") +(declare-function treesit-query-compile "treesit.c") ;;; Custom variables @@ -1130,6 +1132,8 @@ c-ts-base-mode ( assignment constant escape-sequence label literal) ( bracket delimiter error function operator property variable)))) +(defvar treesit-load-name-override-list) + ;;;###autoload (define-derived-mode c-ts-mode c-ts-base-mode "C" "Major mode for editing C, powered by tree-sitter. commit 6ebce84ff2b4e488fbffaa0f7cc2b06580557bf7 Author: Mattias Engdegård Date: Fri Apr 28 15:03:47 2023 +0200 Use t for non-nil default values in boolean defcustom declarations * lisp/emulation/viper-ex.el (ex-unix-type-shell): * lisp/emulation/viper-init.el (viper-ms-style-os-p): * lisp/eshell/em-glob.el (eshell-glob-case-insensitive): * lisp/filecache.el (file-cache-ignore-case): * lisp/lpr.el (lpr-add-switches): * lisp/ls-lisp.el (ls-lisp-ignore-case): * lisp/mail/binhex.el (binhex-use-external): * lisp/progmodes/cperl-mode.el (cperl-electric-parens-mark): Normalise default values to nil or t. diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index 783c01058e2..ecbcace2dd4 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el @@ -294,7 +294,8 @@ ex-unix-type-shell "\\|" "bash$\\|bash.exe$" "\\)") - shell-file-name))) + shell-file-name) + t)) "Is the user using a unix-type shell under a non-OS?" :type 'boolean) diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index 986d1fe6bc6..c39e3cf5142 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el @@ -47,7 +47,8 @@ 'viper-device-type (defun viper-window-display-p () (and window-system (not (memq window-system '(tty stream pc))))) -(defcustom viper-ms-style-os-p (memq system-type '(ms-dos windows-nt)) +(defcustom viper-ms-style-os-p + (not (not (memq system-type '(ms-dos windows-nt)))) "Non-nil if Emacs is running under an MS-style OS: MS-DOS, or MS-Windows." :type 'boolean :tag "Is it Microsoft-made OS?" diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 9402df43065..d00f8c93cd1 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el @@ -79,7 +79,7 @@ eshell-glob-include-dot-dot :type 'boolean :group 'eshell-glob) -(defcustom eshell-glob-case-insensitive (eshell-under-windows-p) +(defcustom eshell-glob-case-insensitive (not (not (eshell-under-windows-p))) "If non-nil, glob pattern matching will ignore case." :type 'boolean :group 'eshell-glob) diff --git a/lisp/filecache.el b/lisp/filecache.el index c211a02b2d2..42225509eca 100644 --- a/lisp/filecache.el +++ b/lisp/filecache.el @@ -213,7 +213,7 @@ file-cache-case-fold-search :type 'boolean) (defcustom file-cache-ignore-case - (memq system-type '(ms-dos windows-nt cygwin)) + (not (not (memq system-type '(ms-dos windows-nt cygwin)))) "Non-nil means ignore case when checking completions in the file cache. Defaults to nil on DOS and Windows, and t on other systems." :type 'boolean) diff --git a/lisp/lpr.el b/lisp/lpr.el index af59a953f38..6b8343b695d 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el @@ -73,7 +73,8 @@ lpr-switches See `lpr-command'." :type '(repeat (string :tag "Argument"))) -(defcustom lpr-add-switches (memq system-type '(berkeley-unix gnu/linux)) +(defcustom lpr-add-switches + (not (not (memq system-type '(berkeley-unix gnu/linux)))) "Non-nil means construct `-T' and `-J' options for the printer program. These are made assuming that the program is `lpr'; if you are using some other incompatible printer program, diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 81ff14932c6..485ac4476ef 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el @@ -101,7 +101,7 @@ ls-lisp-emulation :group 'ls-lisp) (defcustom ls-lisp-ignore-case - (memq ls-lisp-emulation '(MS-Windows MacOS)) + (not (not (memq ls-lisp-emulation '(MS-Windows MacOS)))) "Non-nil causes ls-lisp alphabetic sorting to ignore case." :set-after '(ls-lisp-emulation) :type 'boolean diff --git a/lisp/mail/binhex.el b/lisp/mail/binhex.el index 4b903578a28..15f598fa224 100644 --- a/lisp/mail/binhex.el +++ b/lisp/mail/binhex.el @@ -49,7 +49,7 @@ binhex-decoder-switches :type '(repeat string)) (defcustom binhex-use-external - (executable-find binhex-decoder-program) + (not (not (executable-find binhex-decoder-program))) "Use external binhex program." :version "22.1" :type 'boolean) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index b6f0e9bca41..ed021a7ebc9 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -275,7 +275,7 @@ cperl-electric-parens :type '(choice (const null) boolean) :group 'cperl-affected-by-hairy) -(defcustom cperl-electric-parens-mark window-system +(defcustom cperl-electric-parens-mark (not (not window-system)) "Not-nil means that electric parens look for active mark. Default is yes if there is visual feedback on mark." :type 'boolean commit 1f2214dabd012cfa730e60a88d73aded53a2f53b Author: Theodor Thornhill Date: Fri Apr 28 14:00:35 2023 +0200 Skip over whitespace in annotation-top-cont check (bug#63141) * lisp/progmodes/csharp-mode.el (csharp-guess-basic-syntax): Make sure we skip over whitespace when looking for the next '['. diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 47cd13e7fdb..4f7cbc3d51d 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -468,7 +468,10 @@ csharp-guess-basic-syntax (save-excursion (goto-char (c-point 'iopl)) (and - (eq (char-after) ?\[) + (eq (save-excursion + (skip-chars-forward " \t\n") + (char-after)) + ?\[) (save-excursion (c-go-list-forward) (and (eq (char-before) ?\]) commit a57a8b75f50bca3b724d3f49c87aba7a9121bf13 Author: Po Lu Date: Fri Apr 28 14:43:31 2023 +0800 Make mode-line behavior better with grayscale visuals * lisp/faces.el (mode-line, mode-line-inactive) (mode-line-highlight): Enable gray faces on grayscale visuals. diff --git a/lisp/faces.el b/lisp/faces.el index 8bf7e4429d9..739e5bdf310 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2696,7 +2696,7 @@ mode-line-faces :version "22.1") (defface mode-line - '((((class color) (min-colors 88)) + '((((class color grayscale) (min-colors 88)) :box (:line-width -1 :style released-button) :background "grey75" :foreground "black") (t @@ -2719,11 +2719,11 @@ mode-line-active (defface mode-line-inactive '((default :inherit mode-line) - (((class color) (min-colors 88) (background light)) + (((class color grayscale) (min-colors 88) (background light)) :weight light :box (:line-width -1 :color "grey75" :style nil) :foreground "grey20" :background "grey90") - (((class color) (min-colors 88) (background dark) ) + (((class color grayscale) (min-colors 88) (background dark) ) :weight light :box (:line-width -1 :color "grey40" :style nil) :foreground "grey80" :background "grey30")) @@ -2733,7 +2733,7 @@ mode-line-inactive :group 'basic-faces) (defface mode-line-highlight - '((((supports :box t) (class color) (min-colors 88)) + '((((supports :box t) (class color grayscale) (min-colors 88)) :box (:line-width 2 :color "grey40" :style released-button)) (t :inherit highlight)) commit 7e136c51f6f7223dd022f646427315cbfb563c60 Author: Ruijie Yu Date: Wed Apr 19 10:36:22 2023 +0800 Update zh-CN tutorial translation * etc/tutorials/TUTORIAL.cn (INTRO): Additions from English version; say "interrupt" not "quit" a partially-entered command; fixed minor inconsistency (English says partially-entered command, Chinese used to say partially-executed command -- they are different); converted half-width square brackets containing translators' notes into full-width ones for consistency. (BASIC CURSOR CONTROL): mention that a word boundary for Chinese can also be space; fixed incorrect terminology (keyboard vs terminal); retain English term "terminal"; retain English term "prefix argument"; "most commands _interpret_ prefix args as repeat-count", not "explain"; ensure space is added on both ends of an English word. (WINDOWS): Clarify it is the digit 1 in C-x 1. (INSERTING AND DELETING): Mention the term "continuation line" and retain its English term, because this term is mentioned again later in the tutorial; avoid saying the name of "\\"; add description for "electric" and a rough translation; sync English for prefix argument for DEL and C-d; ensure that translators' notes are marked explicitly so; add indentation to the instruction about continuation lines; additional translations such as mentioning C--, etc. (FILES): Re-pluralize the heading; space around English words; describe what C-g cancels (the command) when entering file name; replace "search for" with "find"; minor rephrasing; explicit translator notes; fixed the write-file message to no longer contain ellipses (see src/fileio.c:5541). (BUFFERS): Re-pluralize the heading; mention that C-x C-b also shows buffer name; C-x s only looks for file-visiting buffers. (EXTENDING THE COMMAND SET): Include C-x s and C-x b in list of learned commands. (MODE LINE): Remove the dashes in description on the point location. (MULTIPLE WINDOWS): Mention the difference between frame and window; also add translator notes pointing to end of tutorial which contains a terminology list. (MULTIPLE FRAMES): Change the M-x commands to keybinds C-x 5 2 and C-x 5 0 to sync with English. (GETTING MORE HELP): Change C-h f to C-h x, to sync with English. (INSTALLING PACKAGES): Rephrase "available packages", used to say lit., "existing", now says lit., "installable"; consistently translate the term "package", and retain its English name. (TRANSLATION): Add my name as co-maintainer of this file. * etc/tutorials/TUTORIAL.translators (TUTORIAL.cn): Add my name as co-maintainer for TUTORIAL.cn. diff --git a/etc/tutorials/TUTORIAL.cn b/etc/tutorials/TUTORIAL.cn index 73df2cff4e7..e4c90102f53 100644 --- a/etc/tutorials/TUTORIAL.cn +++ b/etc/tutorials/TUTORIAL.cn @@ -15,10 +15,10 @@ META 键(有时候用 EDIT 或 ALT 来标示)。为了避免每次都要写 ESC 键。 重要提示:要退出 Emacs,请用 C-x C-c(两个连续的组合键)。 -要退出一个正在运行中的命令,请用 C-g。 +要中断一个正在输入的命令,请用 C-g。 下文中左边顶行的“>>”字样用来提示你尝试键盘命令。比如: <> -[本页当中特意留出一些空白是出于教学目的,请继续往后阅读] +【本页当中特意留出一些空白是出于教学目的,请继续往后阅读】 >> 现在输入 C-v (查看下一屏文字)移动到下一屏。 (别紧张,在输入字符 v 的同时注意要按住 CONTROL 键) 从现在开始,每读完当前一屏你都需要这样做一次。 @@ -26,12 +26,17 @@ META 键(有时候用 EDIT 或 ALT 来标示)。为了避免每次都要写 值得注意的是,当你从上一屏滚到下一屏时,中间会有两行的重复;这样做是为 了维持滚屏的连续性,方便你顺畅、连续地阅读。 +这是 Emacs 教程文本的一个经过少量修改的副本。不久后我们会让你尝试不同 +的命令来修改此文本。若你在我们提到这些命令前修改了文本,不要担心;这就 +叫做“编辑”,而这就是 Emacs 存在的根本原因。 + 用编辑器,开门第一件事就是学会在文字中移动。你已经知道了 C-v 可以向下移 动一屏,要往上移,请用 M-v (也就是按住 META 键,然后输入v,如果你没有 META、EDIT 或 ALT 键那么就先按 再按 v)。 >> 试试 M-v,然后再试试 C-v,来回遛几次。 +若你知道其他移动文本的方式,也可以在这里试试。 * 小结(SUMMARY) ----------------- @@ -101,7 +106,7 @@ P 代表 previous(上一行),N 代表 next(下一行),B 代表 backw 如果你嫌一个字符一个字符地挪光标太慢,你还可以一个词一个词地跳。M-f (META-f) 可以将光标往前移动一个词,而 M-b 则是往后移。【这里的“词”指 -英文单词,对中文来说,则是指移动到下一个标点符号。】 +英文单词,对中文来说,则是指移动到下一个空格或标点符号。】 >> 试试 M-f 和 M-b。 @@ -132,8 +137,8 @@ P 代表 previous(上一行),N 代表 next(下一行),B 代表 backw C-f 向右移动一个字符 C-b 向左移动一个字符 - M-f 向右移动一个词【对中文是移动到下一个标点符号】 - M-b 向左移动一个词【对中文是移动到上一个标点符号】 + M-f 向右移动一个词【对中文是移动到下一个空格或标点符号】 + M-b 向左移动一个词【对中文是移动到上一个空格或标点符号】 C-n 移动到下一行 C-p 移动到上一行 @@ -160,24 +165,25 @@ M-comma(META 逗号)。 然后再按几次 M-v 回到这里。 如果你的键盘上有方向键的话,也可以用它们来移动光标。不过我们有三个理由 -推荐你学习 C-b 、C-f 、C-n 、和 C-p:(1)它们在任何键盘上都能用。(2) -当你熟练使用 Emacs 之后,你会发现用这些组合键比用方向键要快得多,因为你 -的手不需要离开打字区。(3)一旦你习惯了使用这些组合键,你也可以很容易地 -适应其它更高级的光标移动命令。 - -大部分的 Emacs 命令接受数字参数,并且对于多数命令而言,这些数字参数的作 -用是指定命令的重复次数。为一个命令指定数字参数(也就是重复次数)的方法 -是:先输入 C-u,然后输入数字作为参数,最后再输入命令。如果你有META (或 -EDIT 或 ALT)键,那么还有另一种办法:按住 META 键不放,然后输入数字。不 -过我们还是建议你用 C-u,因为它在任何终端机上都能用。这种数字参数也称为 -“前缀参数”,意思是说这个参数是先于使用它的命令而输入的。 +推荐你学习 C-b 、C-f 、C-n 、和 C-p:(1)它们在任何终端(terminal)上 +都能用。(2)当你熟练使用 Emacs 之后,你会发现用这些组合键比用方向键要 +快得多,因为你的手不需要离开打字区。(3)一旦你习惯了使用这些组合键, +你也可以很容易地适应其它更高级的光标移动命令。 + +大部分的 Emacs 命令接受数字参数,并且对于多数命令而言,这些数字参数的 +作用是指定命令的重复次数。为一个命令指定数字参数(也就是重复次数)的方 +法是:先输入 C-u,然后输入数字作为参数,最后再输入命令。如果你有 +META(或EDIT 或 ALT)键,那么还有另一种办法:按住 META 键不放,然后输 +入数字。不过我们还是建议你用 C-u,因为它在任何终端上都能用。这种数字参 +数也称为“前缀参数”(prefix argument),意思是说这个参数是先于使用它的 +命令而输入的。 举例来说, C-u 8 C-f 会向前移动 8 个字符。 >> 为 C-n 或者 C-p 指定一个数字参数,这样你可以只用一个命令就把光标移动 到本行的附近。 -虽然大部分命令把数字参数解释为其重复次数,但是也有些命令例外,它们将数 +虽然大部分命令把数字参数解读为其重复次数,但是也有些命令例外,它们将数 字参数另做它用。比如有些命令(我们目前还没学到)仅仅将前缀参数作为一个 标志――只要给出有一个前缀参数,不管其值为何,它都会改变命令的功能。 @@ -189,7 +195,7 @@ EDIT 或 ALT)键,那么还有另一种办法:按住 META 键不放,然 这个命令应该已经将文字向上滚动了 8 行。如果你想将它再次地向下滚动,你可 以给定一个参数然后执行 M-v。 -如果你正在使用图形界面,比如 X 或者微软的 Windows,那么在 Emacs窗 +如果你正在使用图形界面,比如 X 或者微软的 Windows,那么在 Emacs 窗 口的一边应该有一个长方形的区域叫“滚动条”。你可以用鼠标操纵滚动条来滚动 文字。 @@ -235,8 +241,8 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面 C-x 1 只保留一个窗格(也就是关掉其它所有窗格)。 -也就是先按 CONTROL-x 然后再按 1。C-x 1 会保留光标所在的窗格,并将其扩大 -到整个屏幕,同时关掉所有其它的窗格。 +也就是先按 CONTROL-x 然后再按数字 1。C-x 1 会保留光标所在的窗格,并将 +其扩大到整个屏幕,同时关掉所有其它的窗格。 >> 把光标移到本行然后输入 C-u 0 C-l。 @@ -266,12 +272,13 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面 不用担心文件被修改,你做什么都没关系,这里就是专给你练习用的。 如果一行文字很长、超出了窗格的宽度,显示不下的部分会在紧邻的下一行继续 -显示。如果你使用的是图形界面,文本区域两边的狭窄区域(左右“边缘”)会出 -现小小的转弯箭头,表明这是某一行的接续显示。如果你使用的是文本终端,接 -续显示由屏幕最右边一列的一个反斜线(“\”)来表示。 +显示,称为接续行(continuation line)。如果你使用的是图形界面,文本区 +域两边的狭窄区域(左右“边缘”)会出现小小的转弯箭头,表明这是某一行的接 +续显示。如果你使用的是文本终端,接续显示由屏幕最右边一列的一个“\”来表 +示。 >> 输入文字,一直到屏幕的右边界,然后继续。 -你会看到一个接续行出现。 + 你会看到一个接续行出现。 >> 用 删掉一些文字,直到此行长度小于窗格宽度,接续行就消失了。 @@ -286,7 +293,9 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面 是一个特殊的键,因为按下这个键后,得到的可能不仅仅是一个换行 符。根据周围文本的不同,Emacs 可能会在换行符之后插入一些空白字符,这样, -当你在新的一行开始打字时,文本会自动与前一行对齐。 +当你在新的一行开始打字时,文本会自动与前一行对齐。我们称这种行为(在按 +这个按键时不只是插入其对应字符)为“electric”,可以理解为“通电的,自动 +的”。 >> 这是一个自动缩进的例子。 在这一行的末尾输入 。 @@ -338,7 +347,8 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面 了。】重新插入被移除的文字称为“召回(yank)”。一般而言,那些可能消除很 多文字的命令会把消除掉的文字记录下来(它们被设定成了“可召回”),而那些 只消除一个字符或者只消除空白的命令就不会记录被消除的内容(自然你也就无 -法召回了)。 +法召回了)。 和 C-d 在无前缀参数的情况下进行“删除”,而有前缀参数 +时则改用“移除”。 >> 移动光标到一非空白行的行头,然后输入 C-k 移除那一行上的文字。 @@ -350,10 +360,11 @@ Emacs 可以有多个“窗格”,每个窗格显示不同的文字。后面 C-k 会把两行以及它们的换行符移除;而如果只是输入 C-k 两次显然不是这个结 果。 -重新插入被移除的文字恢复的动作称为“召回(yanking)”。(就好像把别人从你身边 -移走的东西又猛力地拉回来。)你可以在你删除文字的地方召回,也可以在别的 -地方召回,还可以多次召回同样的文字以得到它的多个拷贝。很多其它的编辑器 -把移除和召回叫做“剪切”和“粘贴” (详情可见 Emacs 使用手册里的术语表)。 +【重新插入被移除的文字恢复的动作称为“召回(yanking)”,就好像把别人 +从你身边移走的东西又猛力地拉回来。】你可以在你删除文字的地方召回,也 +可以在别的地方召回,还可以多次召回同样的文字以得到它的多个拷贝。很多其 +它的编辑器把移除和召回叫做“剪切”和“粘贴” (详情可见 Emacs 使用手册里的 +术语表)。 召回的命令是 C-y。它会在光标所在处插入你最后移除的文字。 @@ -372,8 +383,8 @@ C-y 就可以把它们都召回。 C-y 可以召回最近一次移除的内容,那如何召回前几次移除的内容呢?它们当然 没有丢,你可以用 M-y 来召回它们。在用 C-y 召回最近移除的文字之后,紧接 着再按 M-y 就可以召回再前一次被移除的内容,再按一次 M-y 又可以召回再上 -一次的……连续使用 M-y 直到找到你想要召回的东西,然后什么也不用做,继续 -编辑就行了。 +一次的内容……连续使用 M-y 直到找到你想要召回的东西,然后什么也不用做, +继续编辑就行了。 如果连续按 M-y 很多次,你可能会回到起始点,也就是最近移除的文字。 【看得出这实际上是一个环。】 @@ -401,14 +412,16 @@ C-/,你会把以前的命令也依次撤销。 >> 用 C-k 将这一行移除,然后输入 C-/ ,它会再次出现。 -C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多次输入。在 -某些终端上,输入 C-/ 实际上向 Emacs 发送的是 C-_ 。 -另外, C-x u 和 C-/ 完全一样,但是按起来有些麻烦。 +C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多次输入。在某些 +终端上,你可以不按 shift 键(即 C--)。在某些终端上,输入 C-/ 实际上向 +Emacs 发送的是 C-_ 。另外, C-x u 和 C-/ 完全一样,但是按起来有些麻烦。 数字参数对于 C-/ 、 C-_ 和 C-x u 的意义是执行撤销的重复次数。 +你可以撤销文字的删除,就像你能撤销文字的移除一样。删除与移除的区别只在 +于你是否能召回被影响的文字;对于撤销来说没有区别。 -* 文件(FILE) +* 文件(FILES) -------------- 想保存工作成果就要记得存盘,否则一旦退出 Emacs 你编辑的文字就会丢失。要 @@ -424,7 +437,7 @@ C-_ 也是撤销命令;它的作用跟 C-/ 一样,但是它比较容易多 在屏幕的下方,你应该能够看到头部有短线“-”的一行,行首通常是一些诸如“ -:--- TUTORIAL.cn”的文字,这些文字代表了你当前正在访问的文件。比如你现 在正在访问的文件是对 Emacs 快速指南的一份临时拷贝,叫做“TUTORIAL.cn”。 -每当Emacs 寻找到一个文件,文件名就会出现在这个位置。 +每当 Emacs 寻找到一个文件,文件名就会出现在这个位置。 寻找文件的命令有一个特点,那就是你必须给出文件名。我们称这个命令“读入 了一个参数”(在这里,这个参数显然就是文件名)。在你输入这条命令之后: @@ -435,14 +448,14 @@ Emacs 会提示你输入文件名。你输入的文件名会出现在屏幕最 行被称为小缓冲(minibuffer),在小缓冲里你可以使用通常的 Emacs 编辑命令 来编辑文件名。 -在小缓冲里输入文件名(其实输入其它东西也一样)时可以用 C-g 取消。 +在小缓冲里输入文件名(其实输入其它东西也一样)时可以用 C-g 取消这个命令。 >> 输入 C-x C-f,然后输入 C-g 这会关掉小缓冲,同时也会取消使用小缓冲的 C-x C-f 命令。 - 当然了,你也没有找任何文件。 + 当然了,你也没有找到任何文件。 -用 结束文件名的输入。之后,小缓冲会消失,C-x C-f 将会去寻找你 -指定的文件。小缓冲在 C-x C-f 命令结束之后也会消失。 +当你写完要寻找的文件名时,用 结束文件名的输入。之后,小缓冲会 +消失,C-x C-f 将会去寻找你指定的文件。 文件被显示在了屏幕上,你可以开始编辑了。存盘用这条命令: @@ -453,20 +466,21 @@ Emacs 会提示你输入文件名。你输入的文件名会出现在屏幕最 【对许多人来说,这是一个烦人的特性,关掉文件备份可以用如下命令: M-x customize-variable make-backup-files 】 -存盘结束后,Emacs 会显示写入文件的文件名。你最好养成经常存盘的习惯,这 -可以减少系统崩溃和死机给你带来的损失(也可参见下面的“自动保存”一节)。 +存盘结束后,Emacs 会显示写入文件的文件名。【你最好养成经常存盘的习惯, +这可以减少系统崩溃和死机给你带来的损失(也可参见下面的“自动保存”一 +节)。】 >> 输入 C-x C-s TUTORIAL.cn 。 这将会把该指南保存为一个名为 TUTORIAL.cn 的文件,并且在屏幕的下方显 - 示一条消息:“Wrote ...TUTORIAL.cn”。 + 示一条消息:“Wrote TUTORIAL.cn”。 你不但可以寻找一个已有的文件来查看或编辑,还可以寻找一个不存在的文件。 -实际上这正是 Emacs 创建新文件的方法:找到不存在的新文件。事实上,只有 -在存盘的时候,Emacs 才会真正创建这个文件。而在这之后的一切就跟编辑一个 -已有文件没有区别了。 +实际上这正是 Emacs 创建新文件的方法:找到不存在的新文件,它一开始是空 +的,然后你就可以开始插入文本。事实上,只有在存盘的时候,Emacs 才会真正 +创建这个文件。而在这之后的一切就跟编辑一个已有文件没有区别了。 -* 缓冲区(BUFFER) +* 缓冲区(BUFFERS) ------------------ 你可以用 C-x C-f 找到并打开第二个文件,但第一个文件仍然在 Emacs 中。要 @@ -495,7 +509,7 @@ C-x C-f 是一种办法。不过还有一个更简单的办法,那就是用 C- 然后输入 C-x b TUTORIAL.cn 回到这里。 大多数情况下,缓冲区与跟其对应的文件是同名的(不包括目录名),不过这也 -不是绝对的。用 C-x C-b 得到的缓冲区列表总是显示缓冲区名。 +不是绝对的。因此用 C-x C-b 得到的缓冲区列表总是显示缓冲区名与文件名。 缓冲区未必有对应文件。显示缓冲区列表的缓冲区(叫做“*Buffer List*”)就 是这样。这个 TUTORIAL.cn 缓冲区起初没有对应的文件,但是现在有了,因为 @@ -516,8 +530,8 @@ C-x C-f 是一种办法。不过还有一个更简单的办法,那就是用 C- C-x s 保存多个缓冲区 -C-x s 会找出所有已被修改但尚未存盘的缓冲区,然后向你逐个询问:是否需要 -存盘? +C-x s 会找出所有访问文件的、且已被修改但尚未存盘的缓冲区,然后向你逐个 +询问:是否需要存盘此文件? >> 插入一行文字,然后输入 C-x s。 它应该会问你,是否要储存名为 TUTORIAL.cn 的缓冲区? @@ -554,7 +568,9 @@ C-x 的扩展命令有很多,下面列出的是你已经学过的: C-x C-f 寻找文件。 C-x C-s 保存文件。 + C-x s 保存多个缓冲区。 C-x C-b 列出缓冲区。 + C-x b 切换缓冲区。 C-x C-c 离开 Emacs。 C-x 1 关掉其它所有窗格,只保留一个。 C-x u 撤销。 @@ -608,10 +624,10 @@ replace-string(字符串替换)这个命令,它会把一个字符串替换 状态栏显示了 Emacs 的状态和你正在编辑的文字的一些信息。 -你应该知道文件名的意思吧?就是你找到的那个文件嘛。-NN%-- 显示的是光标在 -全文中的位置。如果位于文件的开头,那么就显示 --Top-- 而不是 --00%--;如 -果位于文件的末尾,就显示 --Bot--。如果文件很小,一屏就足以显示全部内容, -那么状态栏会显示 --All--。 +你应该知道文件名的意思吧?就是你找到的那个文件嘛。NN% 显示的是光标在 +全文中的位置。如果位于文件的开头,那么就显示 Top 而不是 0%;如 +果位于文件的末尾,就显示 Bot。如果文件很小,一屏就足以显示全部内容, +那么状态栏会显示 All。 “L” 和其后的数字给出了光标所在行的行号。 @@ -723,7 +739,10 @@ C-s 是向前搜索,C-r 是向后搜索。不过手别这么快!别着急试 * 多窗格(MULTIPLE WINDOWS) ---------------------------- -Emacs 的迷人之处很多,能够在屏幕上同时显示多个窗格就是其中之一。 +Emacs 的迷人之处很多,能够在屏幕上同时显示多个窗格就是其中之一。(请注 +意在 Emacs 里的“窗口(frame)”与“窗格(window)”的定义可能与其他应用程 +序不同,详见Emacs 手册里的术语表。)【另见此教程末尾的翻译章节的术语译 +词对照表。】 >> 移动光标到这一行,然后输入 C-l C-l。 @@ -782,13 +801,13 @@ Emacs 可以创建多个窗口。窗口由许多窗格以及菜单、滚动条 在图形界面下,多个窗口可以同时显示出来。在文本终端中,只能同时显示一个 窗口。 ->> 输入 M-x make-frame 。 +>> 输入 C-x 5 2。 可以看到一个新的窗口出现在了你的屏幕上。 你可以在新的窗口里做最初的窗口里可以做的任何事情。第一个窗口没有什么特 别的。 ->> 输入 M-x delete-frame . +>> 输入 C-x 5 0。 这个命令将会关闭选中的窗口。 你也可以通过图形系统来关闭某个窗口(通常是在窗口上面的某个角落里的一个 @@ -853,9 +872,9 @@ Emacs 可以创建多个窗口。窗口由许多窗格以及菜单、滚动条 还有一些其它有用的 C-h 命令: - C-h f 解释一个函数。需要输入函数名。 + C-h x 解释一个命令。需要输入命令名。 ->> 试试看,输入 C-h f previous-line 。 +>> 试试看,输入 C-h x previous-line 。 Emacs 会给出它所知道的所有有关“实现 C-p 命令功能的函数”的信息。 C-h v 用来显示 Emacs 变量的文档。Emacs 变量可以被用来“定制 Emacs 的行 @@ -905,15 +924,15 @@ Dired 能够在一个缓冲区里列出一个目录下的所有文件(可以 Emacs 使用手册里还有许许多多的精彩功能等着你来了解。 -* 安装包裹(INSTALLING PACKAGES) +* 安装软件包(INSTALLING PACKAGES) --------------------------- -Emacs 社区著作了许多持有扩展性的包裹(packages),其中包括对各种语言的 -支持、色彩鲜艳的主题、用于集成外部程序的包裹,等等。 +Emacs 社区著作了许多持有扩展性的软件包(packages),其中包括对各种语言 +的支持、色彩鲜艳的主题、用于集成外部程序的软件包,等等。 -使用 M-x list-packages 便可浏览存在的包裹。这个命令显示的界面中可以安 -装和卸载包裹,以及查看包裹的简介。Emacs 使用手册中有对包裹管理更详细的 -介绍。 +使用 M-x list-packages 便可浏览所有可安装的软件包。这个命令显示的界面 +中可以安装和卸载软件包,以及查看软件包的简介。Emacs 使用手册中有对软件 +包管理更详细的介绍。 * 总结(CONCLUSION) -------------------- @@ -929,6 +948,7 @@ Emacs 社区著作了许多持有扩展性的包裹(packages),其中包括 翻译:孙一江 维护:薛富侨 + 余睿杰 校对:水木社区(www.newsmth.net)Emacs 板众多网友及众多 Emacs 中文用户 Emacs 快速指南(Tutorial)早有两个刘昭宏的中文译本,繁简各一。其简体版本 diff --git a/etc/tutorials/TUTORIAL.translators b/etc/tutorials/TUTORIAL.translators index 222703cdb9f..30e169d263f 100644 --- a/etc/tutorials/TUTORIAL.translators +++ b/etc/tutorials/TUTORIAL.translators @@ -8,6 +8,7 @@ Maintainer: Ognyan Kulev * TUTORIAL.cn: Author: Sun Yijiang Maintainer: Xue Fuqiao + Ruijie Yu * TUTORIAL.cs: Author: Milan Zamazal commit d3ca0b3aa2ecdac799d6ef7dd50f613cb032d8e0 Author: Eli Zaretskii Date: Fri Apr 28 08:40:56 2023 +0300 ; * lisp/progmodes/c-ts-mode.el: Fix comments and doc strings (bug#62951). diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 8f7a0f26b44..7a1ee66cb77 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -971,24 +971,25 @@ c-ts-mode--emacs-current-defun-name (or (treesit-add-log-current-defun) (c-ts-mode--defun-name (c-ts-mode--emacs-defun-at-point)))) -;;; FOR_EACH_TAIL fix +;;; Support for FOR_EACH_* macros ;; -;; FOR_EACH_TAIL (and FOR_EACH_TAIL_SAFE) followed by a unbracketed -;; body will mess up the parser, which parses the thing as a function -;; declaration. We "fix" it by adding a shadow parser, emacs-c (which -;; is just c but under a different name). We use emacs-c to find each -;; FOR_EACH_TAIL with a unbracketed body, and set the ranges of the C -;; parser so that it skips those FOR_EACH_TAIL's. Note that we only -;; ignore FOR_EACH_TAIL's with a unbracketed body. Those with a -;; bracketed body parses more or less fine. +;; FOR_EACH_TAIL, FOR_EACH_TAIL_SAFE, FOR_EACH_FRAME etc., followed by +;; an unbracketed body will mess up the parser, which parses the thing +;; as a function declaration. We "fix" it by adding a shadow parser +;; for a language 'emacs-c' (which is just 'c' but under a different +;; name). We use 'emacs-c' to find each FOR_EACH_* macro with a +;; unbracketed body, and set the ranges of the C parser so that it +;; skips those FOR_EACH_*'s. Note that we only ignore FOR_EACH_*'s +;; with a unbracketed body. Those with a bracketed body parse more +;; or less fine. (defvar c-ts-mode--for-each-tail-regexp (rx "FOR_EACH_" (or "TAIL" "TAIL_SAFE" "ALIST_VALUE" "LIVE_BUFFER" "FRAME")) - "A regexp matching all the FOR_EACH_TAIL variants.") + "A regexp matching all the variants of the FOR_EACH_* macro.") (defun c-ts-mode--for-each-tail-body-matcher (_n _p bol &rest _) - "A matcher that matches the first line after a FOR_EACH_TAIL. + "A matcher that matches the first line after a FOR_EACH_* macro. For BOL see `treesit-simple-indent-rules'." (when c-ts-mode-emacs-sources-support (save-excursion @@ -1005,10 +1006,10 @@ c-ts-mode--emacs-c-range-query @for-each-tail) (:match ,c-ts-mode--for-each-tail-regexp @_name)))) - "Query that finds the FOR_EACH_TAIL with a unbracketed body.") + "Query that finds a FOR_EACH_* macro with an unbracketed body.") (defvar-local c-ts-mode--for-each-tail-ranges nil - "Ranges covering all the FOR_EACH_TAIL's in the buffer.") + "Ranges covering all the FOR_EACH_* macros in the buffer.") (defun c-ts-mode--reverse-ranges (ranges beg end) "Reverse RANGES and return the new ranges between BEG and END. @@ -1031,7 +1032,7 @@ c-ts-mode--reverse-ranges (nreverse new-ranges)))) (defun c-ts-mode--emacs-set-ranges (beg end) - "Set ranges for the C parser to skip some FOR_EACH_TAIL's. + "Set ranges for the C parser to skip some FOR_EACH_* macros. BEG and END are described in `treesit-range-rules'." (let* ((c-parser (treesit-parser-create 'c)) (old-ranges c-ts-mode--for-each-tail-ranges) @@ -1150,7 +1151,7 @@ c-ts-mode (when (treesit-ready-p 'c) ;; Add a fake "emacs-c" language which is just C. Used for - ;; skipping FOR_EACH_TAIL, see `c-ts-mode--emacs-set-ranges'. + ;; skipping FOR_EACH_* macros, see `c-ts-mode--emacs-set-ranges'. (setf (alist-get 'emacs-c treesit-load-name-override-list) '("libtree-sitter-c" "tree_sitter_c")) ;; If Emacs source support is enabled, make sure emacs-c parser is @@ -1173,7 +1174,7 @@ c-ts-mode (setq-local treesit-defun-tactic 'top-level) (treesit-major-mode-setup) - ;; Emacs source support: handle DEFUN and FOR_EACH_TAIL gracefully. + ;; Emacs source support: handle DEFUN and FOR_EACH_* gracefully. (when c-ts-mode-emacs-sources-support (setq-local add-log-current-defun-function #'c-ts-mode--emacs-current-defun-name) commit c6f15c2486253dbbcb466d12c4af7277c03c8288 Author: Eli Zaretskii Date: Fri Apr 28 08:27:20 2023 +0300 ; Fix last change. diff --git a/etc/NEWS b/etc/NEWS index 1f0c74d3a93..5f5ae1c75a1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1846,7 +1846,7 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'. *** New command 'package-upgrade'. This command allows you to upgrade packages without using 'M-x list-packages'. A package that comes with the Emacs distribution can -only be upgraded after you install it, once, a newer version from ELPA +only be upgraded after you install, once, a newer version from ELPA via the package-menu displayed by 'list-packages'. +++ commit b9e06330f7545aaf31e8fb4303cdeea044a8413b Author: Eli Zaretskii Date: Fri Apr 28 08:26:39 2023 +0300 ; * etc/NEWS: Followup to bug#62720. diff --git a/etc/NEWS b/etc/NEWS index ae4c5ffb842..1f0c74d3a93 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1845,11 +1845,16 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'. +++ *** New command 'package-upgrade'. This command allows you to upgrade packages without using 'M-x -list-packages'. +list-packages'. A package that comes with the Emacs distribution can +only be upgraded after you install it, once, a newer version from ELPA +via the package-menu displayed by 'list-packages'. +++ *** New command 'package-upgrade-all'. This command allows upgrading all packages without any queries. +A package that comes with the Emacs distribution will only be upgraded +by this command after you install, once, a newer version of that +package from ELPA via the package-menu displayed by 'list-packages'. +++ *** New commands 'package-recompile' and 'package-recompile-all'. commit b33d25f596725c69ad5d85f3d724b8bf452ff509 Author: Eli Zaretskii Date: Fri Apr 28 08:14:37 2023 +0300 ; Minor improvements in doc strings of package-upgrade commands * lisp/emacs-lisp/package.el (package-upgrade) (package-upgrade-all): Doc fixes. (Bug#62720) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 74796fc8744..9cc3f8724af 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2270,8 +2270,9 @@ package-upgrade "Upgrade package NAME if a newer version exists. Currently, packages which are part of the Emacs distribution -cannot be upgraded that way. Use `i' after `M-x list-packages' to -upgrade to an ELPA version first." +cannot be upgraded that way. To enable upgrades of such a +package using this command, first upgrade the package to a +newer version from ELPA by using `\\\\[package-menu-mark-install]' after `\\[list-packages]'." (interactive (list (completing-read "Upgrade package: " (package--upgradeable-packages) nil t))) @@ -2308,7 +2309,11 @@ package-upgrade-all interactively, QUERY is always true. Currently, packages which are part of the Emacs distribution are -not upgraded that way. Use `i' after `M-x list-packages' to +not upgraded by this command. To enable upgrading such a package +using this command, first upgrade the package to a newer version +from ELPA by using `\\\\[package-menu-mark-install]' after `\\[list-packages]'. + + Use `i' after `M-x list-packages' to upgrade to an ELPA version first." (interactive (list (not noninteractive))) (package-refresh-contents) commit c3a61870b94bf2745faa1565c445d60b5a289007 Author: Eli Zaretskii Date: Fri Apr 28 07:54:16 2023 +0300 Fix eglot.texi * doc/misc/eglot.texi (Troubleshooting Eglot): Add missing @menu. (Performance, Getting the latest version): Improve wording and indexing, add cross-references. diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index 4599b78ba56..542a4259d66 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1275,9 +1275,15 @@ Troubleshooting Eglot between the Eglot and language server. In many cases, this will indicate the problems or at least provide a hint. +@menu +* Performance:: +* Getting the latest version:: +* Reporting bugs:: +@end menu + @node Performance @section Performance -@cindex performance +@cindex performance problems, with Eglot A common and easy-to-fix cause of performance problems is the length of the Eglot events buffer because it represent additional work that Eglot must do. After verifying Eglot is operating correctly but @@ -1293,23 +1299,26 @@ Performance @node Getting the latest version @section Getting the latest version -@cindex updating Eglot +@cindex upgrading Eglot -To install the latest Eglot on an Emacs version that does not bundle +To install the latest Eglot in an Emacs version that does not bundle Eglot, use @kbd{M-x package-install}. Often, a newer Eglot version exists that has fixed a longstanding bug, -has more LSP features, or just better support for a particular -language server. Recent Eglot versions can self-update via the -command @kbd{M-x eglot-update}. This will replace any currently -installed version with the newest one available from the ELPA archives +has more LSP features, or just better supports a particular language +server. Recent Eglot versions can self-update via the command +@kbd{M-x eglot-update}. This will replace any currently installed +version with the newest one available from the ELPA archives configured in @code{package-archives}. -You may update though other methods, such as @code{package-install}, -@code{use-package}, @code{list-packages} or the newer -@code{package-update}. However, do read the docstrings of these -commands, as some may not work in exactly the same way across Emacs -versions, meaning your configuration may be not portable. +You can also update Eglot through other methods, such as +@code{use-package} (@pxref{Installing packages,,, use-package, +use-package User Manual}), @code{package-install}, +@code{list-packages} or the newer @code{package-upgrade} +(@pxref{Packages,,, emacs, GNU Emacs Manual}). However, do read the +docstrings of the command you intend to use before you use it, as some +of them may not work in exactly the same way across Emacs versions, +meaning your configuration may be not portable. @node Reporting bugs @section Reporting bugs commit a97c382682b483b34351c6757e54e3139fa27f89 Merge: dbd74657908 a40f1816237 Author: Po Lu Date: Fri Apr 28 11:51:01 2023 +0800 Merge from origin/emacs-29 a40f1816237 Fix two crashes upon startup 44ebd9cbd56 Eglot: explain how to update Eglot in manual (bug#62720) 941ef044f2e Eglot: fix edge case when deleting inlay hint overlays a365984d9e1 package-upgrade[-all]: Expand docstrings to note the curr... f965f35b33b Rename all functions called package-*-update-* to package... 31b58161bb5 Fix FOR_EACH_TAIL in c-ts-mode (bug#62951) 0cf6e0998ba * Makefile.in (distclean): Remove the 'native-lisp' direc... 933705d61e5 Improve greek-ibycus4 input method # Conflicts: # etc/NEWS commit a40f18162377d2f9a78d7443fd0f8106c8c28c3d Author: Po Lu Date: Fri Apr 28 11:47:46 2023 +0800 Fix two crashes upon startup * src/image.c (image_create_bitmap_from_data) (image_create_bitmap_from_file): Specify a Window or a Pixmap describing the screen, not a back buffer drawable which may not exist. Otherwise, Emacs crashes on startup when a bitmap icon is in use. diff --git a/src/image.c b/src/image.c index e78c0abb0db..8ee802a9d62 100644 --- a/src/image.c +++ b/src/image.c @@ -479,7 +479,8 @@ image_create_bitmap_from_data (struct frame *f, char *bits, #ifdef HAVE_X_WINDOWS Pixmap bitmap; - bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), + bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f), + dpyinfo->root_window, bits, width, height); if (! bitmap) return -1; @@ -729,8 +730,10 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object file) filename = SSDATA (found); - result = XReadBitmapFile (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), - filename, &width, &height, &bitmap, &xhot, &yhot); + result = XReadBitmapFile (FRAME_X_DISPLAY (f), + dpyinfo->root_window, + filename, &width, &height, &bitmap, + &xhot, &yhot); if (result != BitmapSuccess) return -1; commit 44ebd9cbd56b820ad5b014b442b5a9142e8cac89 Author: João Távora Date: Thu Apr 27 21:08:17 2023 +0100 Eglot: explain how to update Eglot in manual (bug#62720) * lisp/progmodes/eglot.el (eglot-update): New command. * doc/misc/eglot.texi (Troubleshooting): Rework. diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index fc5449b0e8d..4599b78ba56 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1265,7 +1265,7 @@ Troubleshooting Eglot @chapter Troubleshooting Eglot @cindex troubleshooting Eglot -This section documents commands and variables that can be used to +This chapter documents commands and variables that can be used to troubleshoot Eglot problems. It also provides guidelines for reporting Eglot bugs in a way that facilitates their resolution. @@ -1275,6 +1275,8 @@ Troubleshooting Eglot between the Eglot and language server. In many cases, this will indicate the problems or at least provide a hint. +@node Performance +@section Performance @cindex performance A common and easy-to-fix cause of performance problems is the length of the Eglot events buffer because it represent additional work that @@ -1289,6 +1291,30 @@ Troubleshooting Eglot by changing the server configuration (@pxref{Advanced server configuration}). +@node Getting the latest version +@section Getting the latest version +@cindex updating Eglot + +To install the latest Eglot on an Emacs version that does not bundle +Eglot, use @kbd{M-x package-install}. + +Often, a newer Eglot version exists that has fixed a longstanding bug, +has more LSP features, or just better support for a particular +language server. Recent Eglot versions can self-update via the +command @kbd{M-x eglot-update}. This will replace any currently +installed version with the newest one available from the ELPA archives +configured in @code{package-archives}. + +You may update though other methods, such as @code{package-install}, +@code{use-package}, @code{list-packages} or the newer +@code{package-update}. However, do read the docstrings of these +commands, as some may not work in exactly the same way across Emacs +versions, meaning your configuration may be not portable. + +@node Reporting bugs +@section Reporting bugs +@cindex bug reports + If you think you have found a bug, we want to hear about it. Before reporting a bug, keep in mind that interaction with language servers represents a large quantity of unknown variables. Therefore, it is @@ -1332,6 +1358,10 @@ Troubleshooting Eglot Include versions of the software used. The Emacs version can be obtained with @kbd{M-x emacs-version}. +We welcome bug reports about all Eglot versions, but it is helpful to +first check if the problem isn't already fixed in the latest version +(@pxref{Getting the latest version}). + It's also essential to include the version of ELPA packages that are explicitly or implicitly loaded. The optional but popular Company or Markdown packages are distributed as GNU ELPA packages, not to mention diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 0fab8db0e83..f005c4858e7 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1966,6 +1966,16 @@ eglot-manual (declare (obsolete info "29.1")) (interactive) (info "(eglot)")) +;;;###autoload +(defun eglot-update (&rest _) "Update Eglot." + (interactive) + (with-no-warnings + (require 'package) + (unless package-archive-contents (package-refresh-contents)) + (when-let ((existing (cadr (assoc 'eglot package-alist)))) + (package-delete existing t)) + (package-install (cadr (assoc 'eglot package-archive-contents))))) + (easy-menu-define eglot-menu nil "Eglot" `("Eglot" ;; Commands for getting information and customization. @@ -3056,8 +3066,7 @@ eglot-completion-at-point (funcall snippet-fn (or insertText label)))) (when (cl-plusp (length additionalTextEdits)) (eglot--apply-text-edits additionalTextEdits))) - (eglot--signal-textDocument/didChange) - (eldoc))))))))) + (eglot--signal-textDocument/didChange))))))))) (defun eglot--hover-info (contents &optional _range) (mapconcat #'eglot--format-markup commit 941ef044f2e0607bcaa537fbb56790a512c38782 Author: João Távora Date: Thu Apr 27 20:51:07 2023 +0100 Eglot: fix edge case when deleting inlay hint overlays When asked to update hints in a region (FROM TO), eglot--update-hints-1 first deletes the existing hints. It must however take care to delete all overlays that logically belong to the region, even if they don't physically belong to it, e.g. inlay overlays spanning (FROM-1 FROM) and having a 'after-string' property. * lisp/progmodes/eglot.el (eglot--update-hints-1): Fix edge case. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index ed554087084..0fab8db0e83 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3664,7 +3664,19 @@ eglot--update-hints-1 :success-fn (lambda (hints) (eglot--when-live-buffer buf (eglot--widening - (remove-overlays from to 'eglot--inlay-hint t) + ;; Overlays ending right at FROM with an + ;; `after-string' property logically belong to + ;; the (FROM TO) region. Likewise, such + ;; overlays ending at TO don't logically belong + ;; to it. + (dolist (o (overlays-in (1- from) to)) + (when (and (overlay-get o 'eglot--inlay-hint) + (cond ((eq (overlay-end o) from) + (overlay-get o 'after-string)) + ((eq (overlay-end o) to) + (overlay-get o 'before-string)) + (t))) + (delete-overlay o))) (mapc paint-hint hints)))) :deferred 'eglot--update-hints-1))) commit a365984d9e167c4d71a2a44a1abb4710765f460f Author: Dmitry Gutov Date: Fri Apr 28 02:24:10 2023 +0300 package-upgrade[-all]: Expand docstrings to note the current limitation * lisp/emacs-lisp/package.el (package-upgrade, package-upgrade-all): Expand docstrings to note the current limitation (bug#62720). diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index e15536c9f50..74796fc8744 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2267,7 +2267,11 @@ package-install ;;;###autoload (defun package-upgrade (name) - "Upgrade package NAME if a newer version exists." + "Upgrade package NAME if a newer version exists. + +Currently, packages which are part of the Emacs distribution +cannot be upgraded that way. Use `i' after `M-x list-packages' to +upgrade to an ELPA version first." (interactive (list (completing-read "Upgrade package: " (package--upgradeable-packages) nil t))) @@ -2301,7 +2305,11 @@ package--upgradeable-packages (defun package-upgrade-all (&optional query) "Refresh package list and upgrade all packages. If QUERY, ask the user before upgrading packages. When called -interactively, QUERY is always true." +interactively, QUERY is always true. + +Currently, packages which are part of the Emacs distribution are +not upgraded that way. Use `i' after `M-x list-packages' to +upgrade to an ELPA version first." (interactive (list (not noninteractive))) (package-refresh-contents) (let ((upgradeable (package--upgradeable-packages))) commit f965f35b33b7d722b34796823012dcd2a06ae0bd Author: Dmitry Gutov Date: Mon Apr 24 02:00:54 2023 +0300 Rename all functions called package-*-update-* to package-*-upgrade-* * lisp/emacs-lisp/package-vc.el (package-vc-upgrade-all): Rename from 'package-vc-update-all'. (package-vc-upgrade): Rename from 'package-vc-update'. * lisp/emacs-lisp/package.el (package-upgrade): Rename from 'package-update' (bug#62750). (package--upgradeable-packages): Rename from 'package--updateable-packages'. (package-upgrade-all): Rename from 'package-update-all'. diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 2b03399b0a7..d1766026db2 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -329,15 +329,15 @@ Package Installation @section Package Installation @findex package-install -@findex package-update -@findex package-update-all +@findex package-upgrade +@findex package-upgrade-all Packages are most conveniently installed using the package menu (@pxref{Package Menu}), but you can also use the command @kbd{M-x package-install}. This prompts for the name of a package with the @samp{available} status, then downloads and installs it. Similarly, -if you want to update a package, you can use the @kbd{M-x -package-update} command, and if you just want to update all the -packages, you can use the @kbd{M-x package-update-all} command. +if you want to upgrade a package, you can use the @kbd{M-x +package-upgrade} command, and if you want to upgrade all the packages, +you can use the @kbd{M-x package-upgrade-all} command. @cindex package requirements A package may @dfn{require} certain other packages to be installed, @@ -551,8 +551,8 @@ Fetching Package Sources source code for a package directly from source. The command will also automatically ensure that all files are byte-compiled and auto-loaded, just like with a regular package. Packages installed this way behave -just like any other package. You can update them using -@code{package-update} or @code{package-update-all} and delete them +just like any other package. You can upgrade them using +@code{package-upgrade} or @code{package-upgrade-all} and delete them again using @code{package-delete}. They are even displayed in the regular package listing. If you just wish to clone the source of a package, without adding it to the package list, use diff --git a/etc/NEWS b/etc/NEWS index 0eb5940dbca..ae4c5ffb842 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1843,13 +1843,13 @@ this includes "binary" buffers like 'archive-mode' and 'image-mode'. ** Package +++ -*** New command 'package-update'. +*** New command 'package-upgrade'. This command allows you to upgrade packages without using 'M-x list-packages'. +++ -*** New command 'package-update-all'. -This command allows updating all packages without any queries. +*** New command 'package-upgrade-all'. +This command allows upgrading all packages without any queries. +++ *** New commands 'package-recompile' and 'package-recompile-all'. diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index af57095f8ce..fa9fce24acc 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -24,7 +24,7 @@ ;; While packages managed by package.el use tarballs for distributing ;; the source code, this extension allows for packages to be fetched -;; and updated directly from a version control system. +;; and upgraded directly from a version control system. ;; ;; To install a package from source use `package-vc-install'. If you ;; aren't interested in activating a package, you can use @@ -660,19 +660,19 @@ package-vc--read-package-desc #'string=))) ;;;###autoload -(defun package-vc-update-all () - "Attempt to update all installed VC packages." +(defun package-vc-upgrade-all () + "Attempt to upgrade all installed VC packages." (interactive) (dolist (package package-alist) (dolist (pkg-desc (cdr package)) (when (package-vc-p pkg-desc) - (package-vc-update pkg-desc)))) - (message "Done updating packages.")) + (package-vc-upgrade pkg-desc)))) + (message "Done upgrading packages.")) ;;;###autoload -(defun package-vc-update (pkg-desc) - "Attempt to update the package PKG-DESC." - (interactive (list (package-vc--read-package-desc "Update VC package: " t))) +(defun package-vc-upgrade (pkg-desc) + "Attempt to upgrade the package PKG-DESC." + (interactive (list (package-vc--read-package-desc "Upgrade VC package: " t))) ;; HACK: To run `package-vc--unpack-1' after checking out the new ;; revision, we insert a hook into `vc-post-command-functions', and ;; remove it right after it ran. To avoid running the hook multiple @@ -870,7 +870,7 @@ package-vc-rebuild cookies, re-compiling Emacs Lisp files, building and installing any documentation, downloading any missing dependencies. This command does not fetch new revisions from a remote server. That -is the responsibility of `package-vc-update'. Interactively, +is the responsibility of `package-vc-upgrade'. Interactively, prompt for the name of the package to rebuild." (interactive (list (package-vc--read-package-desc "Rebuild package: " t))) (package-vc--unpack-1 pkg-desc (package-desc-dir pkg-desc))) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index ffa6272dd1f..e15536c9f50 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2263,24 +2263,24 @@ package-install (message "Package `%s' installed." name)) (message "`%s' is already installed" name)))) -(declare-function package-vc-update "package-vc" (pkg)) +(declare-function package-vc-upgrade "package-vc" (pkg)) ;;;###autoload -(defun package-update (name) - "Update package NAME if a newer version exists." +(defun package-upgrade (name) + "Upgrade package NAME if a newer version exists." (interactive (list (completing-read - "Update package: " (package--updateable-packages) nil t))) + "Upgrade package: " (package--upgradeable-packages) nil t))) (let* ((package (if (symbolp name) name (intern name))) (pkg-desc (cadr (assq package package-alist)))) (if (package-vc-p pkg-desc) - (package-vc-update pkg-desc) + (package-vc-upgrade pkg-desc) (package-delete pkg-desc 'force) (package-install package 'dont-select)))) -(defun package--updateable-packages () +(defun package--upgradeable-packages () ;; Initialize the package system to get the list of package ;; symbols for completion. (package--archives-initialize) @@ -2298,23 +2298,23 @@ package--updateable-packages package-alist))) ;;;###autoload -(defun package-update-all (&optional query) +(defun package-upgrade-all (&optional query) "Refresh package list and upgrade all packages. -If QUERY, ask the user before updating packages. When called +If QUERY, ask the user before upgrading packages. When called interactively, QUERY is always true." (interactive (list (not noninteractive))) (package-refresh-contents) - (let ((updateable (package--updateable-packages))) - (if (not updateable) - (message "No packages to update") + (let ((upgradeable (package--upgradeable-packages))) + (if (not upgradeable) + (message "No packages to upgrade") (when (and query (not (yes-or-no-p - (if (length= updateable 1) - "One package to update. Do it? " - (format "%s packages to update. Do it?" - (length updateable)))))) - (user-error "Updating aborted")) - (mapc #'package-update updateable)))) + (if (length= upgradeable 1) + "One package to upgrade. Do it? " + (format "%s packages to upgrade. Do it?" + (length upgradeable)))))) + (user-error "Upgrade aborted")) + (mapc #'package-upgrade upgradeable)))) (defun package--dependencies (pkg) "Return a list of all dependencies PKG has. commit 31b58161bb5e2afd30ade92854241976ee71bae0 Author: Yuan Fu Date: Wed Apr 26 20:09:42 2023 -0700 Fix FOR_EACH_TAIL in c-ts-mode (bug#62951) * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New indent rule. (c-ts-mode--for-each-tail-regexp) (c-ts-mode--for-each-tail-body-matcher) (c-ts-mode--emacs-c-range-query) (c-ts-mode--for-each-tail-ranges) (c-ts-mode--reverse-ranges) (c-ts-mode--emacs-set-ranges): New functions and variables. (c-ts-mode): Create a emacs-c parser. More setup for Emacs source support. * lisp/treesit.el (treesit-query-range): Ignore underscore-prefixed capture names. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 6100f00e3ba..8f7a0f26b44 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -357,7 +357,9 @@ c-ts-mode--indent-styles "Indent rules supported by `c-ts-mode'. MODE is either `c' or `cpp'." (let ((common - `(((parent-is "translation_unit") column-0 0) + `((c-ts-mode--for-each-tail-body-matcher prev-line c-ts-mode-indent-offset) + + ((parent-is "translation_unit") column-0 0) ((query "(ERROR (ERROR)) @indent") column-0 0) ((node-is ")") parent 1) ((node-is "]") parent-bol 0) @@ -969,6 +971,81 @@ c-ts-mode--emacs-current-defun-name (or (treesit-add-log-current-defun) (c-ts-mode--defun-name (c-ts-mode--emacs-defun-at-point)))) +;;; FOR_EACH_TAIL fix +;; +;; FOR_EACH_TAIL (and FOR_EACH_TAIL_SAFE) followed by a unbracketed +;; body will mess up the parser, which parses the thing as a function +;; declaration. We "fix" it by adding a shadow parser, emacs-c (which +;; is just c but under a different name). We use emacs-c to find each +;; FOR_EACH_TAIL with a unbracketed body, and set the ranges of the C +;; parser so that it skips those FOR_EACH_TAIL's. Note that we only +;; ignore FOR_EACH_TAIL's with a unbracketed body. Those with a +;; bracketed body parses more or less fine. + +(defvar c-ts-mode--for-each-tail-regexp + (rx "FOR_EACH_" (or "TAIL" "TAIL_SAFE" "ALIST_VALUE" + "LIVE_BUFFER" "FRAME")) + "A regexp matching all the FOR_EACH_TAIL variants.") + +(defun c-ts-mode--for-each-tail-body-matcher (_n _p bol &rest _) + "A matcher that matches the first line after a FOR_EACH_TAIL. +For BOL see `treesit-simple-indent-rules'." + (when c-ts-mode-emacs-sources-support + (save-excursion + (goto-char bol) + (forward-line -1) + (skip-chars-forward " \t") + (looking-at c-ts-mode--for-each-tail-regexp)))) + +(defvar c-ts-mode--emacs-c-range-query + (treesit-query-compile + 'emacs-c `(((declaration + type: (macro_type_specifier + name: (identifier) @_name) + @for-each-tail) + (:match ,c-ts-mode--for-each-tail-regexp + @_name)))) + "Query that finds the FOR_EACH_TAIL with a unbracketed body.") + +(defvar-local c-ts-mode--for-each-tail-ranges nil + "Ranges covering all the FOR_EACH_TAIL's in the buffer.") + +(defun c-ts-mode--reverse-ranges (ranges beg end) + "Reverse RANGES and return the new ranges between BEG and END. +Positions that were included RANGES are not in the returned +ranges, and vice versa. + +Return nil if RANGES is nil. This way, passing the returned +ranges to `treesit-parser-set-included-ranges' will make the +parser parse the whole buffer." + (if (null ranges) + nil + (let ((new-ranges nil) + (prev-end beg)) + (dolist (range ranges) + (when (< prev-end (car range)) + (push (cons prev-end (car range)) new-ranges)) + (setq prev-end (cdr range))) + (when (< prev-end end) + (push (cons prev-end end) new-ranges)) + (nreverse new-ranges)))) + +(defun c-ts-mode--emacs-set-ranges (beg end) + "Set ranges for the C parser to skip some FOR_EACH_TAIL's. +BEG and END are described in `treesit-range-rules'." + (let* ((c-parser (treesit-parser-create 'c)) + (old-ranges c-ts-mode--for-each-tail-ranges) + (new-ranges (treesit-query-range + 'emacs-c c-ts-mode--emacs-c-range-query beg end)) + (set-ranges (treesit--clip-ranges + (treesit--merge-ranges + old-ranges new-ranges beg end) + (point-min) (point-max))) + (reversed-ranges (c-ts-mode--reverse-ranges + set-ranges (point-min) (point-max)))) + (setq-local c-ts-mode--for-each-tail-ranges set-ranges) + (treesit-parser-set-included-ranges c-parser reversed-ranges))) + ;;; Modes (defvar-keymap c-ts-base-mode-map @@ -1072,6 +1149,17 @@ c-ts-mode :after-hook (c-ts-mode-set-modeline) (when (treesit-ready-p 'c) + ;; Add a fake "emacs-c" language which is just C. Used for + ;; skipping FOR_EACH_TAIL, see `c-ts-mode--emacs-set-ranges'. + (setf (alist-get 'emacs-c treesit-load-name-override-list) + '("libtree-sitter-c" "tree_sitter_c")) + ;; If Emacs source support is enabled, make sure emacs-c parser is + ;; after c parser in the parser list. This way various tree-sitter + ;; functions will automatically use the c parser rather than the + ;; emacs-c parser. + (when c-ts-mode-emacs-sources-support + (treesit-parser-create 'emacs-c)) + (treesit-parser-create 'c) ;; Comments. (setq-local comment-start "/* ") @@ -1085,9 +1173,16 @@ c-ts-mode (setq-local treesit-defun-tactic 'top-level) (treesit-major-mode-setup) + ;; Emacs source support: handle DEFUN and FOR_EACH_TAIL gracefully. (when c-ts-mode-emacs-sources-support (setq-local add-log-current-defun-function - #'c-ts-mode--emacs-current-defun-name)))) + #'c-ts-mode--emacs-current-defun-name) + + (setq-local treesit-range-settings + (treesit-range-rules 'c-ts-mode--emacs-set-ranges)) + + (setq-local treesit-language-at-point-function + (lambda (_pos) 'c))))) ;;;###autoload (define-derived-mode c++-ts-mode c-ts-base-mode "C++" commit 0cf6e0998badfa3d2d9e93791cd581f2e00fff0b Author: Eli Zaretskii Date: Thu Apr 27 21:39:33 2023 +0300 * Makefile.in (distclean): Remove the 'native-lisp' directory. diff --git a/Makefile.in b/Makefile.in index 8b77aac38cd..f5fda0eb61a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1030,6 +1030,9 @@ distclean_dirs = distclean: $(distclean_dirs:=_distclean) clean-gsettings-schemas ${top_distclean} +ifeq ($(HAVE_NATIVE_COMP),yes) + rm -rf native-lisp +endif ### 'bootstrap-clean' ### Delete everything that can be reconstructed by 'make' and that diff --git a/lisp/treesit.el b/lisp/treesit.el index e718ea1a23a..1d4749c8cd2 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -378,13 +378,16 @@ treesit-query-string (defun treesit-query-range (node query &optional beg end) "Query the current buffer and return ranges of captured nodes. -QUERY, NODE, BEG, END are the same as in -`treesit-query-capture'. This function returns a list -of (START . END), where START and END specifics the range of each -captured node. Capture names don't matter." +QUERY, NODE, BEG, END are the same as in `treesit-query-capture'. +This function returns a list of (START . END), where START and +END specifics the range of each captured node. Capture names +generally don't matter, but names that starts with an underscore +are ignored." (cl-loop for capture in (treesit-query-capture node query beg end) + for name = (car capture) for node = (cdr capture) + if (not (string-prefix-p "_" (symbol-name name))) collect (cons (treesit-node-start node) (treesit-node-end node)))) @@ -399,6 +402,9 @@ treesit-range-settings range to the range spanned by captured nodes. QUERY must be a compiled query. +Capture names generally don't matter, but names that starts with +an underscore are ignored. + QUERY can also be a function, in which case it is called with 2 arguments, START and END. It should ensure parsers' ranges are correct in the region between START and END. @@ -418,6 +424,9 @@ treesit-range-rules Each QUERY is a tree-sitter query in either the string, s-expression or compiled form. +Capture names generally don't matter, but names that starts with +an underscore are ignored. + For each QUERY, :KEYWORD and VALUE pairs add meta information to it. For example, commit dbd74657908e67e2a5001fbe440fb2a01a2f01af Author: Michael Albinus Date: Thu Apr 27 19:41:18 2023 +0200 Fix thinko in tramp-gvfs-maybe-open-connection * lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection): Use `assoc-default'. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index ad7b1ff054c..859f4870b80 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -2183,11 +2183,12 @@ tramp-gvfs-maybe-open-connection ;; Sanity check. (let ((method (tramp-file-name-method vec))) (unless (member - (or (rassoc method '(("smb" . "smb-share") - ("davs" . "dav") - ("nextcloud" . "dav") - ("afp". "afp-volume") - ("gdrive" . "google-drive"))) + (or (assoc-default + method '(("smb" . "smb-share") + ("davs" . "dav") + ("nextcloud" . "dav") + ("afp". "afp-volume") + ("gdrive" . "google-drive"))) method) tramp-gvfs-mounttypes) (tramp-error vec 'file-error "Method `%s' not supported by GVFS" method))) commit 98006bfd09cf0bbec5ade924e1a60c48b16701a1 Author: Michael Albinus Date: Thu Apr 27 19:40:46 2023 +0200 Fix Tramp bug#63102 * lisp/net/tramp.el (tramp-remote-path): Add ;;;###tramp-autoload cookie. (Bug#63102) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 81473404f0c..ca95b6b6971 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1349,6 +1349,7 @@ tramp-connection-min-time-diff ;; IRIX64: /usr/bin ;; QNAP QTS: --- ;; Hydra: /run/current-system/sw/bin:/bin:/usr/bin +;;;###tramp-autoload (defcustom tramp-remote-path '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" commit 5ead8c5f69b0a69bac4641d5003ee422d6b67038 Author: Mattias Engdegård Date: Thu Apr 27 13:52:57 2023 +0200 Clarify `nconc` behaviour for dotted lists (bug#63103) * doc/lispref/lists.texi (Rearrangement): Explicitly say that dotted lists are valid args to `nconc` and give an example. diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index a509325854f..22a5f7f1239 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1224,7 +1224,15 @@ Rearrangement @end example However, the other arguments (all but the last) should be mutable -lists. +lists. They can be dotted lists, whose last @sc{cdr}s are then +replaced with the next argument: + +@example +@group +(nconc (cons 1 2) (cons 3 (cons 4 5)) 'z) + @result{} (1 3 4 . z) +@end group +@end example A common pitfall is to use a constant list as a non-last argument to @code{nconc}. If you do this, the resulting behavior is undefined commit 1dcb737405a7a299fe6d01a5d9bd0c79328920b7 Author: Mattias Engdegård Date: Thu Apr 27 12:38:58 2023 +0200 Don't rewrite (nconc X nil) -> X for any X (bug#63103) Since the last cdr of a non-terminal argument to `nconc` is overwritten no matter its value: (nconc (cons 1 2) nil) => (1) a terminating nil arg cannot just be eliminated unconditionally. * lisp/emacs-lisp/byte-opt.el (byte-optimize-nconc): Only eliminate a terminal nil arg to `nconc` if preceded by a nonempty proper list. Right now we only bother to prove this for `(list ...)`, so that (nconc (list 1 2 3) nil) -> (list 1 2 3) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test cases. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index da997212eef..0f7a3cb2665 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1531,7 +1531,16 @@ byte-optimize-nconc (prev (car newargs))) (cond ;; Elide null args. - ((null arg) (loop (cdr args) newargs)) + ((and (null arg) + ;; Don't elide a terminal nil unless preceded by + ;; a nonempty proper list, since that will have + ;; its last cdr forced to nil. + (or (cdr args) + ;; FIXME: prove the 'nonempty proper list' property + ;; for more forms than just `list', such as + ;; `append', `mapcar' etc. + (eq 'list (car-safe (car newargs))))) + (loop (cdr args) newargs)) ;; Merge consecutive `list' args. ((and (eq (car-safe arg) 'list) (eq (car-safe prev) 'list)) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 9ade47331df..222065c2e4e 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -766,6 +766,16 @@ bytecomp-tests--test-cases ((eq x 2) (setq y 'c))) (list x y))))) (mapcar fn (bytecomp-test-identity '(0 1 2 3 10 11)))) + + ;; `nconc' nil arg elimination + (nconc (list 1 2 3 4) nil) + (nconc (list 1 2 3 4) nil nil) + (let ((x (cons 1 (cons 2 (cons 3 4))))) + (nconc x nil)) + (let ((x (cons 1 (cons 2 (cons 3 4))))) + (nconc x nil nil)) + (let ((x (cons 1 (cons 2 (cons 3 4))))) + (nconc nil x nil (list 5 6) nil)) ) "List of expressions for cross-testing interpreted and compiled code.") commit 521386f9201d0cacfcc857f7ef7cc1e5e586705a Author: Po Lu Date: Thu Apr 27 18:51:40 2023 +0800 ; * admin/charsets/mapconv (LC_ALL): Fix typo. diff --git a/admin/charsets/mapconv b/admin/charsets/mapconv index f44d72d3850..19e2ff8d8f7 100755 --- a/admin/charsets/mapconv +++ b/admin/charsets/mapconv @@ -38,7 +38,7 @@ ## So that eg [A-F] as used by KANJI-DATABASE branch below works as expected. ## Otherwise with LANG=en_US.utf8, CNS-6.map was generated with a ## bogus entry. By experiment, LC_COLLATE=C was not enough. -LC_ALL=c +LC_ALL=C export LC_ALL BASE=`expr "$1" : '.*/\(.*\)' '|' "$1"` # basename commit 0e0fd0c38fd57ee206a681d96775f0014357eb71 Author: Po Lu Date: Thu Apr 27 18:50:47 2023 +0800 Fix bootstrap on Unix * admin/charsets/Makefile.in (${charsetdir}/JISX0201.map): Use run_mapconv, which uses the correct awk. * admin/charsets/mapconv (LC_ALL): Don't place assignment in same line as export. diff --git a/admin/charsets/Makefile.in b/admin/charsets/Makefile.in index 4c62bb19dc5..efb9106adad 100644 --- a/admin/charsets/Makefile.in +++ b/admin/charsets/Makefile.in @@ -181,7 +181,7 @@ ${charsetdir}/GB180304.map: ${AM_V_GEN}$(AWK) -f ${gb180304} < $< > $@ ${charsetdir}/JISX0201.map: ${GLIBC_CHARMAPS}/JIS_X0201.gz ${mapconv} ${compact} - ${AM_V_GEN}(${mapconv} $< '/^<.*[ ]\/x[0-9]/' GLIBC-1 ${compact} && \ + ${AM_V_GEN}(${run_mapconv} $< '/^<.*[ ]\/x[0-9]/' GLIBC-1 ${compact} && \ echo "# Generated by hand" && \ echo "0xA1-0xDF 0xFF61" ) > $@ diff --git a/admin/charsets/mapconv b/admin/charsets/mapconv index 4a68d3da53b..f44d72d3850 100755 --- a/admin/charsets/mapconv +++ b/admin/charsets/mapconv @@ -38,7 +38,8 @@ ## So that eg [A-F] as used by KANJI-DATABASE branch below works as expected. ## Otherwise with LANG=en_US.utf8, CNS-6.map was generated with a ## bogus entry. By experiment, LC_COLLATE=C was not enough. -export LC_ALL=C +LC_ALL=c +export LC_ALL BASE=`expr "$1" : '.*/\(.*\)' '|' "$1"` # basename FILE="admin/charsets/mapfiles/$BASE" commit 933705d61e58465a8a0b89a8f747c8265a9e2a81 Author: Eli Zaretskii Date: Thu Apr 27 10:25:20 2023 +0300 Improve greek-ibycus4 input method * lisp/leim/quail/greek.el ("greek-ibycus4"): Add another sequence for CAPITAL LETTER RHO WITH DASIA. (Bug#63104) diff --git a/lisp/leim/quail/greek.el b/lisp/leim/quail/greek.el index 107f4131e38..0829097af5f 100644 --- a/lisp/leim/quail/greek.el +++ b/lisp/leim/quail/greek.el @@ -1116,6 +1116,7 @@ "greek-ibycus4" ("'U" ?Ύ) ("`R" ?Ῥ) + ("(R" ?Ῥ) ("+`" ?῭) ; #x1fed ("+'" ?΅) ; #x1fee