diff options
| author | Po Lu | 2023-04-10 08:16:44 +0800 |
|---|---|---|
| committer | Po Lu | 2023-04-10 08:16:44 +0800 |
| commit | 857e2bcb664bbfa6df7101e8f314d7a44d5d7f56 (patch) | |
| tree | 769227249af9f7f9f9555969a3a03ac4b1c8b9d5 | |
| parent | 23e963b6f0d7c402d3d0679e4dd4288fba882f55 (diff) | |
| parent | b5c5e923dba5c5a7b064ce3371d13e165b5caa9e (diff) | |
| download | emacs-857e2bcb664bbfa6df7101e8f314d7a44d5d7f56.tar.gz emacs-857e2bcb664bbfa6df7101e8f314d7a44d5d7f56.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
| -rw-r--r-- | etc/NEWS | 15 | ||||
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 62 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-extra.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-lib.el | 1 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/ert-x.el | 4 | ||||
| -rw-r--r-- | lisp/gnus/gnus-group.el | 3 | ||||
| -rw-r--r-- | lisp/gnus/gnus-start.el | 3 | ||||
| -rw-r--r-- | lisp/gnus/nnselect.el | 147 | ||||
| -rw-r--r-- | lisp/net/eudcb-mab.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-sshfs.el | 4 | ||||
| -rw-r--r-- | lisp/org/ob-core.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/project.el | 8 | ||||
| -rw-r--r-- | lisp/progmodes/prolog.el | 4 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/nadvice-tests.el | 16 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 37 | ||||
| -rw-r--r-- | test/lisp/progmodes/eglot-tests.el | 63 | ||||
| -rw-r--r-- | test/src/fns-tests.el | 39 |
19 files changed, 266 insertions, 156 deletions
| @@ -480,6 +480,21 @@ simplified away. | |||
| 480 | This warning can be suppressed using 'with-suppressed-warnings' with | 480 | This warning can be suppressed using 'with-suppressed-warnings' with |
| 481 | the warning name 'suspicious'. | 481 | the warning name 'suspicious'. |
| 482 | 482 | ||
| 483 | --- | ||
| 484 | *** Warn about more ignored function return values. | ||
| 485 | The compiler now warns when the return value from certain functions is | ||
| 486 | ignored. Example: | ||
| 487 | |||
| 488 | (progn (nreverse my-list) my-list) | ||
| 489 | |||
| 490 | will elicit a warning because it is usually pointless to call | ||
| 491 | 'nreverse' on a list without using the returned value. To silence the | ||
| 492 | warning, make use of the value in some way, such as assigning it to a | ||
| 493 | variable. You can also wrap the function call in '(ignore ...)'. | ||
| 494 | |||
| 495 | This warning can be suppressed using 'with-suppressed-warnings' with | ||
| 496 | the warning name 'ignored-return-value'. | ||
| 497 | |||
| 483 | +++ | 498 | +++ |
| 484 | ** New function 'file-user-uid'. | 499 | ** New function 'file-user-uid'. |
| 485 | This function is like 'user-uid', but is aware of file name handlers, | 500 | This function is like 'user-uid', but is aware of file name handlers, |
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 70317e2365d..dad3bd694a6 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el | |||
| @@ -1706,7 +1706,7 @@ See Info node `(elisp) Integer Basics'." | |||
| 1706 | charsetp commandp cons consp | 1706 | charsetp commandp cons consp |
| 1707 | current-buffer current-global-map current-indentation | 1707 | current-buffer current-global-map current-indentation |
| 1708 | current-local-map current-minor-mode-maps current-time | 1708 | current-local-map current-minor-mode-maps current-time |
| 1709 | eobp eolp eq equal | 1709 | eobp eolp eq equal eql |
| 1710 | floatp following-char framep | 1710 | floatp following-char framep |
| 1711 | hash-table-p | 1711 | hash-table-p |
| 1712 | identity indirect-function integerp integer-or-marker-p | 1712 | identity indirect-function integerp integer-or-marker-p |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4a10ae29804..1b28fcd5093 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -3502,7 +3502,67 @@ lambda-expression." | |||
| 3502 | ;; so maybe we don't need to bother about it here? | 3502 | ;; so maybe we don't need to bother about it here? |
| 3503 | (setq form (cons 'progn (cdr form))) | 3503 | (setq form (cons 'progn (cdr form))) |
| 3504 | (setq handler #'byte-compile-progn)) | 3504 | (setq handler #'byte-compile-progn)) |
| 3505 | ((and (or sef (eq (car form) 'mapcar)) | 3505 | ((and (or sef |
| 3506 | (memq (car form) | ||
| 3507 | ;; FIXME: Use a function property (declaration) | ||
| 3508 | ;; instead of this list. | ||
| 3509 | '( | ||
| 3510 | ;; Functions that are side-effect-free | ||
| 3511 | ;; except for the behaviour of | ||
| 3512 | ;; functions passed as argument. | ||
| 3513 | mapcar mapcan mapconcat | ||
| 3514 | cl-mapcar cl-mapcan cl-maplist cl-map cl-mapcon | ||
| 3515 | cl-reduce | ||
| 3516 | assoc assoc-default plist-get plist-member | ||
| 3517 | cl-assoc cl-assoc-if cl-assoc-if-not | ||
| 3518 | cl-rassoc cl-rassoc-if cl-rassoc-if-not | ||
| 3519 | cl-member cl-member-if cl-member-if-not | ||
| 3520 | cl-adjoin | ||
| 3521 | cl-mismatch cl-search | ||
| 3522 | cl-find cl-find-if cl-find-if-not | ||
| 3523 | cl-position cl-position-if cl-position-if-not | ||
| 3524 | cl-count cl-count-if cl-count-if-not | ||
| 3525 | cl-remove cl-remove-if cl-remove-if-not | ||
| 3526 | cl-member cl-member-if cl-member-if-not | ||
| 3527 | cl-remove-duplicates | ||
| 3528 | cl-subst cl-subst-if cl-subst-if-not | ||
| 3529 | cl-substitute cl-substitute-if | ||
| 3530 | cl-substitute-if-not | ||
| 3531 | cl-sublis | ||
| 3532 | cl-union cl-intersection | ||
| 3533 | cl-set-difference cl-set-exclusive-or | ||
| 3534 | cl-subsetp | ||
| 3535 | cl-every cl-some cl-notevery cl-notany | ||
| 3536 | cl-tree-equal | ||
| 3537 | |||
| 3538 | ;; Functions that mutate and return a list. | ||
| 3539 | cl-delete-if cl-delete-if-not | ||
| 3540 | ;; `delete-dups' and `delete-consecutive-dups' | ||
| 3541 | ;; never delete the first element so it's | ||
| 3542 | ;; safe to ignore their return value, but | ||
| 3543 | ;; this isn't the case with | ||
| 3544 | ;; `cl-delete-duplicates'. | ||
| 3545 | cl-delete-duplicates | ||
| 3546 | cl-nsubst cl-nsubst-if cl-nsubst-if-not | ||
| 3547 | cl-nsubstitute cl-nsubstitute-if | ||
| 3548 | cl-nsubstitute-if-not | ||
| 3549 | cl-nunion cl-nintersection | ||
| 3550 | cl-nset-difference cl-nset-exclusive-or | ||
| 3551 | cl-nreconc cl-nsublis | ||
| 3552 | cl-merge | ||
| 3553 | ;; It's safe to ignore the value of `sort' | ||
| 3554 | ;; and `nreverse' when used on arrays, | ||
| 3555 | ;; but most calls pass lists. | ||
| 3556 | nreverse | ||
| 3557 | sort cl-sort cl-stable-sort | ||
| 3558 | |||
| 3559 | ;; Adding the following functions yields many | ||
| 3560 | ;; positives; evaluate how many of them are | ||
| 3561 | ;; false first. | ||
| 3562 | |||
| 3563 | ;;delq delete cl-delete | ||
| 3564 | ;;nconc plist-put | ||
| 3565 | ))) | ||
| 3506 | (byte-compile-warning-enabled-p | 3566 | (byte-compile-warning-enabled-p |
| 3507 | 'ignored-return-value (car form))) | 3567 | 'ignored-return-value (car form))) |
| 3508 | (byte-compile-warn-x | 3568 | (byte-compile-warn-x |
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index de5eb9c2d92..a89bbc3a748 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el | |||
| @@ -408,6 +408,7 @@ Other non-digit chars are considered junk. | |||
| 408 | RADIX is an integer between 2 and 36, the default is 10. Signal | 408 | RADIX is an integer between 2 and 36, the default is 10. Signal |
| 409 | an error if the substring between START and END cannot be parsed | 409 | an error if the substring between START and END cannot be parsed |
| 410 | as an integer unless JUNK-ALLOWED is non-nil." | 410 | as an integer unless JUNK-ALLOWED is non-nil." |
| 411 | (declare (side-effect-free t)) | ||
| 411 | (cl-check-type string string) | 412 | (cl-check-type string string) |
| 412 | (let* ((start (or start 0)) | 413 | (let* ((start (or start 0)) |
| 413 | (len (length string)) | 414 | (len (length string)) |
| @@ -566,6 +567,7 @@ too large if positive or too small if negative)." | |||
| 566 | ;;;###autoload | 567 | ;;;###autoload |
| 567 | (defun cl-revappend (x y) | 568 | (defun cl-revappend (x y) |
| 568 | "Equivalent to (append (reverse X) Y)." | 569 | "Equivalent to (append (reverse X) Y)." |
| 570 | (declare (side-effect-free t)) | ||
| 569 | (nconc (reverse x) y)) | 571 | (nconc (reverse x) y)) |
| 570 | 572 | ||
| 571 | ;;;###autoload | 573 | ;;;###autoload |
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 95a51a4bdde..7fee780a735 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el | |||
| @@ -459,6 +459,7 @@ Thus, `(cl-list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to | |||
| 459 | (defun cl-copy-list (list) | 459 | (defun cl-copy-list (list) |
| 460 | "Return a copy of LIST, which may be a dotted list. | 460 | "Return a copy of LIST, which may be a dotted list. |
| 461 | The elements of LIST are not copied, just the list structure itself." | 461 | The elements of LIST are not copied, just the list structure itself." |
| 462 | (declare (side-effect-free error-free)) | ||
| 462 | (if (consp list) | 463 | (if (consp list) |
| 463 | (let ((res nil)) | 464 | (let ((res nil)) |
| 464 | (while (consp list) (push (pop list) res)) | 465 | (while (consp list) (push (pop list) res)) |
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 8dc8b475a7f..41fc3b9f335 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -3690,14 +3690,14 @@ macro that returns its `&whole' argument." | |||
| 3690 | 3690 | ||
| 3691 | ;;; Things that are side-effect-free. | 3691 | ;;; Things that are side-effect-free. |
| 3692 | (mapc (lambda (x) (function-put x 'side-effect-free t)) | 3692 | (mapc (lambda (x) (function-put x 'side-effect-free t)) |
| 3693 | '(cl-oddp cl-evenp cl-signum last butlast cl-ldiff cl-pairlis cl-gcd | 3693 | '(cl-oddp cl-evenp cl-signum cl-ldiff cl-pairlis cl-gcd |
| 3694 | cl-lcm cl-isqrt cl-floor cl-ceiling cl-truncate cl-round cl-mod cl-rem | 3694 | cl-lcm cl-isqrt cl-floor cl-ceiling cl-truncate cl-round cl-mod cl-rem |
| 3695 | cl-subseq cl-list-length cl-get cl-getf)) | 3695 | cl-subseq cl-list-length cl-get cl-getf)) |
| 3696 | 3696 | ||
| 3697 | ;;; Things that are side-effect-and-error-free. | 3697 | ;;; Things that are side-effect-and-error-free. |
| 3698 | (mapc (lambda (x) (function-put x 'side-effect-free 'error-free)) | 3698 | (mapc (lambda (x) (function-put x 'side-effect-free 'error-free)) |
| 3699 | '(eql cl-list* cl-subst cl-acons cl-equalp | 3699 | '(cl-list* cl-acons cl-equalp |
| 3700 | cl-random-state-p copy-tree cl-sublis)) | 3700 | cl-random-state-p copy-tree)) |
| 3701 | 3701 | ||
| 3702 | ;;; Types and assertions. | 3702 | ;;; Types and assertions. |
| 3703 | 3703 | ||
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 98a017c8a8e..e8b0dd92989 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el | |||
| @@ -563,9 +563,9 @@ The same keyword arguments are supported as in | |||
| 563 | ;; Emacs's Makefile sets $HOME to a nonexistent value. Needed | 563 | ;; Emacs's Makefile sets $HOME to a nonexistent value. Needed |
| 564 | ;; in batch mode only, therefore. | 564 | ;; in batch mode only, therefore. |
| 565 | (when (and noninteractive (not (file-directory-p "~/"))) | 565 | (when (and noninteractive (not (file-directory-p "~/"))) |
| 566 | (setenv "HOME" temporary-file-directory)) | 566 | (setenv "HOME" (directory-file-name temporary-file-directory))) |
| 567 | (format "/mock::%s" temporary-file-directory)))) | 567 | (format "/mock::%s" temporary-file-directory)))) |
| 568 | "Temporary directory for remote file tests.") | 568 | "Temporary directory for remote file tests.") |
| 569 | 569 | ||
| 570 | (provide 'ert-x) | 570 | (provide 'ert-x) |
| 571 | 571 | ||
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 070d1223e2c..8c1d7e3c86a 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el | |||
| @@ -4195,7 +4195,8 @@ If DONT-SCAN is non-nil, scan non-activated groups as well." | |||
| 4195 | (let ((info (gnus-get-info group)) | 4195 | (let ((info (gnus-get-info group)) |
| 4196 | (active (gnus-active group))) | 4196 | (active (gnus-active group))) |
| 4197 | (when info | 4197 | (when info |
| 4198 | (gnus-request-update-info info method)) | 4198 | (gnus-request-update-info info method) |
| 4199 | (setq active (gnus-active group))) | ||
| 4199 | (gnus-get-unread-articles-in-group info active) | 4200 | (gnus-get-unread-articles-in-group info active) |
| 4200 | (unless (gnus-virtual-group-p group) | 4201 | (unless (gnus-virtual-group-p group) |
| 4201 | (gnus-close-group group)) | 4202 | (gnus-close-group group)) |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index d59b5b58ceb..19b8b09de03 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -1490,7 +1490,8 @@ backend check whether the group actually exists." | |||
| 1490 | (gnus-request-update-info | 1490 | (gnus-request-update-info |
| 1491 | info (inline (gnus-find-method-for-group | 1491 | info (inline (gnus-find-method-for-group |
| 1492 | (gnus-info-group info))))) | 1492 | (gnus-info-group info))))) |
| 1493 | (gnus-activate-group (gnus-info-group info) nil t)) | 1493 | (gnus-activate-group (gnus-info-group info) nil t) |
| 1494 | (setq active (gnus-active (gnus-info-group info)))) | ||
| 1494 | 1495 | ||
| 1495 | (let* ((range (gnus-info-read info)) | 1496 | (let* ((range (gnus-info-read info)) |
| 1496 | (num 0)) | 1497 | (num 0)) |
diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el index 66577282a0f..9a2957c9f52 100644 --- a/lisp/gnus/nnselect.el +++ b/lisp/gnus/nnselect.el | |||
| @@ -440,7 +440,7 @@ artlist; otherwise store the ARTLIST in the group parameters." | |||
| 440 | (if (eq 'nnselect (car (gnus-server-to-method server))) | 440 | (if (eq 'nnselect (car (gnus-server-to-method server))) |
| 441 | (with-current-buffer gnus-summary-buffer | 441 | (with-current-buffer gnus-summary-buffer |
| 442 | (let ((thread (gnus-id-to-thread article))) | 442 | (let ((thread (gnus-id-to-thread article))) |
| 443 | (when thread | 443 | (when (car thread) |
| 444 | (mapc | 444 | (mapc |
| 445 | (lambda (x) | 445 | (lambda (x) |
| 446 | (when (and x (> x 0)) | 446 | (when (and x (> x 0)) |
| @@ -594,62 +594,63 @@ artlist; otherwise store the ARTLIST in the group parameters." | |||
| 594 | (gnus-newsgroup-selection | 594 | (gnus-newsgroup-selection |
| 595 | (or gnus-newsgroup-selection (nnselect-get-artlist group))) | 595 | (or gnus-newsgroup-selection (nnselect-get-artlist group))) |
| 596 | newmarks) | 596 | newmarks) |
| 597 | (gnus-info-set-marks info nil) | 597 | (when gnus-newsgroup-selection |
| 598 | (setf (gnus-info-read info) nil) | 598 | (gnus-info-set-marks info nil) |
| 599 | (pcase-dolist (`(,artgroup . ,nartids) | 599 | (setf (gnus-info-read info) nil) |
| 600 | (ids-by-group | 600 | (pcase-dolist (`(,artgroup . ,nartids) |
| 601 | (number-sequence 1 (nnselect-artlist-length | 601 | (ids-by-group |
| 602 | gnus-newsgroup-selection)))) | 602 | (number-sequence 1 (nnselect-artlist-length |
| 603 | (let* ((gnus-newsgroup-active nil) | 603 | gnus-newsgroup-selection)))) |
| 604 | (idmap (make-hash-table :test 'eql)) | 604 | (let* ((gnus-newsgroup-active nil) |
| 605 | (gactive (sort (mapcar 'cdr nartids) '<)) | 605 | (idmap (make-hash-table :test 'eql)) |
| 606 | (group-info (gnus-get-info artgroup)) | 606 | (gactive (sort (mapcar 'cdr nartids) #'<)) |
| 607 | (marks (gnus-info-marks group-info))) | 607 | (group-info (gnus-get-info artgroup)) |
| 608 | (pcase-dolist (`(,val . ,key) nartids) | 608 | (marks (gnus-info-marks group-info))) |
| 609 | (puthash key val idmap)) | 609 | (pcase-dolist (`(,val . ,key) nartids) |
| 610 | (setf (gnus-info-read info) | 610 | (puthash key val idmap)) |
| 611 | (range-add-list | 611 | (setf (gnus-info-read info) |
| 612 | (gnus-info-read info) | 612 | (range-add-list |
| 613 | (sort (mapcar (lambda (art) (gethash art idmap)) | 613 | (gnus-info-read info) |
| 614 | (gnus-sorted-intersection | 614 | (sort (mapcar (lambda (art) (gethash art idmap)) |
| 615 | gactive | 615 | (gnus-sorted-intersection |
| 616 | (range-uncompress (gnus-info-read group-info)))) | 616 | gactive |
| 617 | '<))) | 617 | (range-uncompress (gnus-info-read group-info)))) |
| 618 | (pcase-dolist (`(,type . ,mark-list) marks) | 618 | #'<))) |
| 619 | (let ((mark-type (gnus-article-mark-to-type type)) new) | 619 | (pcase-dolist (`(,type . ,mark-list) marks) |
| 620 | (when | 620 | (let ((mark-type (gnus-article-mark-to-type type)) new) |
| 621 | (setq new | 621 | (when |
| 622 | (if (not mark-list) nil | 622 | (setq new |
| 623 | (cond | 623 | (if (not mark-list) nil |
| 624 | ((eq mark-type 'tuple) | 624 | (cond |
| 625 | (delq nil | 625 | ((eq mark-type 'tuple) |
| 626 | (mapcar | 626 | (delq nil |
| 627 | (lambda (mark) | 627 | (mapcar |
| 628 | (let ((id (gethash (car mark) idmap))) | 628 | (lambda (mark) |
| 629 | (when id (cons id (cdr mark))))) | 629 | (let ((id (gethash (car mark) idmap))) |
| 630 | mark-list))) | 630 | (when id (cons id (cdr mark))))) |
| 631 | (t | 631 | mark-list))) |
| 632 | (mapcar (lambda (art) (gethash art idmap)) | 632 | (t |
| 633 | (gnus-sorted-intersection | 633 | (mapcar (lambda (art) (gethash art idmap)) |
| 634 | gactive (range-uncompress mark-list))))))) | 634 | (gnus-sorted-intersection |
| 635 | (let ((previous (alist-get type newmarks))) | 635 | gactive (range-uncompress mark-list))))))) |
| 636 | (if previous | 636 | (let ((previous (alist-get type newmarks))) |
| 637 | (nconc previous new) | 637 | (if previous |
| 638 | (push (cons type new) newmarks)))))))) | 638 | (nconc previous new) |
| 639 | 639 | (push (cons type new) newmarks)))))))) | |
| 640 | ;; Clean up the marks: compress lists; | 640 | |
| 641 | (pcase-dolist (`(,type . ,mark-list) newmarks) | 641 | ;; Clean up the marks: compress lists; |
| 642 | (let ((mark-type (gnus-article-mark-to-type type))) | 642 | (pcase-dolist (`(,type . ,mark-list) newmarks) |
| 643 | (unless (eq mark-type 'tuple) | 643 | (let ((mark-type (gnus-article-mark-to-type type))) |
| 644 | (setf (alist-get type newmarks) | 644 | (unless (eq mark-type 'tuple) |
| 645 | (gnus-compress-sequence (sort mark-list '<)))))) | 645 | (setf (alist-get type newmarks) |
| 646 | ;; and ensure an unexist key. | 646 | (gnus-compress-sequence (sort mark-list #'<)))))) |
| 647 | (unless (assq 'unexist newmarks) | 647 | ;; and ensure an unexist key. |
| 648 | (push (cons 'unexist nil) newmarks)) | 648 | (unless (assq 'unexist newmarks) |
| 649 | 649 | (push (cons 'unexist nil) newmarks)) | |
| 650 | (gnus-info-set-marks info newmarks) | 650 | |
| 651 | (gnus-set-active group (cons 1 (nnselect-artlist-length | 651 | (gnus-info-set-marks info newmarks) |
| 652 | gnus-newsgroup-selection))))) | 652 | (gnus-set-active group (cons 1 (nnselect-artlist-length |
| 653 | gnus-newsgroup-selection)))))) | ||
| 653 | 654 | ||
| 654 | 655 | ||
| 655 | (deffoo nnselect-request-thread (header &optional group server) | 656 | (deffoo nnselect-request-thread (header &optional group server) |
| @@ -759,7 +760,8 @@ artlist; otherwise store the ARTLIST in the group parameters." | |||
| 759 | (deffoo nnselect-close-group (group &optional _server) | 760 | (deffoo nnselect-close-group (group &optional _server) |
| 760 | (let ((group (nnselect-add-prefix group))) | 761 | (let ((group (nnselect-add-prefix group))) |
| 761 | (unless gnus-group-is-exiting-without-update-p | 762 | (unless gnus-group-is-exiting-without-update-p |
| 762 | (nnselect-push-info group)) | 763 | (when gnus-newsgroup-selection |
| 764 | (nnselect-push-info group))) | ||
| 763 | (setq gnus-newsgroup-selection nil) | 765 | (setq gnus-newsgroup-selection nil) |
| 764 | (when (gnus-ephemeral-group-p group) | 766 | (when (gnus-ephemeral-group-p group) |
| 765 | (gnus-kill-ephemeral-group group) | 767 | (gnus-kill-ephemeral-group group) |
| @@ -882,23 +884,28 @@ article came from is also searched." | |||
| 882 | 884 | ||
| 883 | 885 | ||
| 884 | 886 | ||
| 885 | (defun nnselect-push-info (group) | 887 | (defun nnselect-push-info (_group) |
| 886 | "Copy mark-lists from GROUP to the originating groups." | 888 | "Copy mark-lists from GROUP to the originating groups." |
| 887 | (let ((select-unreads (numbers-by-group gnus-newsgroup-unreads)) | 889 | (let ((select-unreads (numbers-by-group gnus-newsgroup-unreads)) |
| 888 | (select-reads (numbers-by-group | 890 | (select-reads (numbers-by-group |
| 889 | (gnus-info-read (gnus-get-info group)) 'range)) | 891 | (gnus-sorted-difference gnus-newsgroup-articles |
| 890 | (select-unseen (numbers-by-group gnus-newsgroup-unseen)) | 892 | gnus-newsgroup-unreads))) |
| 891 | (gnus-newsgroup-active nil) mark-list) | 893 | (select-unseen (numbers-by-group gnus-newsgroup-unseen)) |
| 894 | (gnus-newsgroup-active nil) mark-list) | ||
| 892 | ;; collect the set of marked article lists categorized by | 895 | ;; collect the set of marked article lists categorized by |
| 893 | ;; originating groups | 896 | ;; originating groups |
| 894 | (pcase-dolist (`(,mark . ,type) gnus-article-mark-lists) | 897 | (pcase-dolist (`(,mark . ,type) gnus-article-mark-lists) |
| 895 | (let (type-list) | 898 | (let ((mark-type (gnus-article-mark-to-type type)) |
| 896 | (when (setq type-list | 899 | (type-list (symbol-value |
| 897 | (symbol-value (intern (format "gnus-newsgroup-%s" mark)))) | 900 | (intern (format "gnus-newsgroup-%s" mark))))) |
| 898 | (push (cons | 901 | (when type-list |
| 899 | type | 902 | (unless (eq 'tuple mark-type) |
| 900 | (numbers-by-group type-list (gnus-article-mark-to-type type))) | 903 | (setq type-list (range-list-intersection |
| 901 | mark-list)))) | 904 | gnus-newsgroup-articles type-list))) |
| 905 | (push (cons | ||
| 906 | type | ||
| 907 | (numbers-by-group type-list mark-type)) | ||
| 908 | mark-list)))) | ||
| 902 | ;; now work on each originating group one at a time | 909 | ;; now work on each originating group one at a time |
| 903 | (pcase-dolist (`(,artgroup . ,artlist) | 910 | (pcase-dolist (`(,artgroup . ,artlist) |
| 904 | (numbers-by-group gnus-newsgroup-articles)) | 911 | (numbers-by-group gnus-newsgroup-articles)) |
diff --git a/lisp/net/eudcb-mab.el b/lisp/net/eudcb-mab.el index 08fc20f438a..805c742d9e0 100644 --- a/lisp/net/eudcb-mab.el +++ b/lisp/net/eudcb-mab.el | |||
| @@ -86,7 +86,8 @@ RETURN-ATTRS is a list of attributes to return, defaulting to | |||
| 86 | ((eq (car term) 'email) | 86 | ((eq (car term) 'email) |
| 87 | (unless (string= (cdr term) mail) | 87 | (unless (string= (cdr term) mail) |
| 88 | (setq matched nil))) | 88 | (setq matched nil))) |
| 89 | ((eq (car term) 'phone)))) | 89 | ;; ((eq (car term) 'phone)) |
| 90 | )) | ||
| 90 | 91 | ||
| 91 | (when matched | 92 | (when matched |
| 92 | (setq result | 93 | (setq result |
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 6b788c00ba6..a4f6246ec23 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el | |||
| @@ -244,8 +244,8 @@ arguments to pass to the OPERATION." | |||
| 244 | (setq result | 244 | (setq result |
| 245 | (insert-file-contents | 245 | (insert-file-contents |
| 246 | (tramp-fuse-local-file-name filename) visit beg end replace)) | 246 | (tramp-fuse-local-file-name filename) visit beg end replace)) |
| 247 | (when visit (setq buffer-file-name filename)) | 247 | (when visit (setq buffer-file-name filename))) |
| 248 | (cons filename (cdr result))))) | 248 | (cons filename (cdr result)))) |
| 249 | 249 | ||
| 250 | (defun tramp-sshfs-handle-process-file | 250 | (defun tramp-sshfs-handle-process-file |
| 251 | (program &optional infile destination display &rest args) | 251 | (program &optional infile destination display &rest args) |
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index 3f6696fce77..e69ce4f1d12 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el | |||
| @@ -2426,7 +2426,8 @@ INFO may provide the values of these header arguments (in the | |||
| 2426 | (delete-region (point) (org-babel-result-end))) | 2426 | (delete-region (point) (org-babel-result-end))) |
| 2427 | ((member "append" result-params) | 2427 | ((member "append" result-params) |
| 2428 | (goto-char (org-babel-result-end)) (setq beg (point-marker))) | 2428 | (goto-char (org-babel-result-end)) (setq beg (point-marker))) |
| 2429 | ((member "prepend" result-params))) ; already there | 2429 | ;; ((member "prepend" result-params)) ; already there |
| 2430 | ) | ||
| 2430 | (setq results-switches | 2431 | (setq results-switches |
| 2431 | (if results-switches (concat " " results-switches) "")) | 2432 | (if results-switches (concat " " results-switches) "")) |
| 2432 | (let ((wrap | 2433 | (let ((wrap |
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 11228226592..877d79353aa 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -1248,8 +1248,10 @@ If you exit the `query-replace', you can later continue the | |||
| 1248 | 1248 | ||
| 1249 | (defun project-prefixed-buffer-name (mode) | 1249 | (defun project-prefixed-buffer-name (mode) |
| 1250 | (concat "*" | 1250 | (concat "*" |
| 1251 | (file-name-nondirectory | 1251 | (if-let ((proj (project-current nil))) |
| 1252 | (directory-file-name default-directory)) | 1252 | (project-name proj) |
| 1253 | (file-name-nondirectory | ||
| 1254 | (directory-file-name default-directory))) | ||
| 1253 | "-" | 1255 | "-" |
| 1254 | (downcase mode) | 1256 | (downcase mode) |
| 1255 | "*")) | 1257 | "*")) |
| @@ -1261,7 +1263,7 @@ If non-nil, it overrides `compilation-buffer-name-function' for | |||
| 1261 | :version "28.1" | 1263 | :version "28.1" |
| 1262 | :group 'project | 1264 | :group 'project |
| 1263 | :type '(choice (const :tag "Default" nil) | 1265 | :type '(choice (const :tag "Default" nil) |
| 1264 | (const :tag "Prefixed with root directory name" | 1266 | (const :tag "Prefixed with project name" |
| 1265 | project-prefixed-buffer-name) | 1267 | project-prefixed-buffer-name) |
| 1266 | (function :tag "Custom function"))) | 1268 | (function :tag "Custom function"))) |
| 1267 | 1269 | ||
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 1b48fe9c3a8..66dea8803b3 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el | |||
| @@ -828,7 +828,7 @@ Relevant only when `prolog-imenu-flag' is non-nil." | |||
| 828 | ((not (zerop (skip-chars-forward prolog-operator-chars)))) | 828 | ((not (zerop (skip-chars-forward prolog-operator-chars)))) |
| 829 | ((not (zerop (skip-syntax-forward "w_'")))) | 829 | ((not (zerop (skip-syntax-forward "w_'")))) |
| 830 | ;; In case of non-ASCII punctuation. | 830 | ;; In case of non-ASCII punctuation. |
| 831 | ((not (zerop (skip-syntax-forward "."))))) | 831 | (t (skip-syntax-forward "."))) |
| 832 | (point)))) | 832 | (point)))) |
| 833 | 833 | ||
| 834 | (defun prolog-smie-backward-token () | 834 | (defun prolog-smie-backward-token () |
| @@ -842,7 +842,7 @@ Relevant only when `prolog-imenu-flag' is non-nil." | |||
| 842 | ((not (zerop (skip-chars-backward prolog-operator-chars)))) | 842 | ((not (zerop (skip-chars-backward prolog-operator-chars)))) |
| 843 | ((not (zerop (skip-syntax-backward "w_'")))) | 843 | ((not (zerop (skip-syntax-backward "w_'")))) |
| 844 | ;; In case of non-ASCII punctuation. | 844 | ;; In case of non-ASCII punctuation. |
| 845 | ((not (zerop (skip-syntax-backward "."))))) | 845 | (t (skip-syntax-backward "."))) |
| 846 | (point)))) | 846 | (point)))) |
| 847 | 847 | ||
| 848 | (defconst prolog-smie-grammar | 848 | (defconst prolog-smie-grammar |
diff --git a/test/lisp/emacs-lisp/nadvice-tests.el b/test/lisp/emacs-lisp/nadvice-tests.el index 716ab694e2c..f6bd5733ba3 100644 --- a/test/lisp/emacs-lisp/nadvice-tests.el +++ b/test/lisp/emacs-lisp/nadvice-tests.el | |||
| @@ -118,20 +118,20 @@ | |||
| 118 | (declare-function sm-test7 nil) | 118 | (declare-function sm-test7 nil) |
| 119 | (advice-add 'sm-test7 :around | 119 | (advice-add 'sm-test7 :around |
| 120 | (lambda (f &rest args) | 120 | (lambda (f &rest args) |
| 121 | (list (cons 1 (called-interactively-p)) (apply f args)))) | 121 | (list (cons 1 (called-interactively-p 'any)) (apply f args)))) |
| 122 | (should (equal (sm-test7) '((1 . nil) 11))) | 122 | (should (equal (sm-test7) '((1 . nil) 11))) |
| 123 | (should (equal (call-interactively 'sm-test7) '((1 . t) 11))) | 123 | (should (equal (call-interactively 'sm-test7) '((1 . t) 11))) |
| 124 | (let ((smi 7)) | 124 | (let ((smi 7)) |
| 125 | (advice-add 'sm-test7 :before | 125 | (advice-add 'sm-test7 :before |
| 126 | (lambda (&rest _args) | 126 | (lambda (&rest _args) |
| 127 | (setq smi (called-interactively-p)))) | 127 | (setq smi (called-interactively-p 'any)))) |
| 128 | (should (equal (list (sm-test7) smi) | 128 | (should (equal (list (sm-test7) smi) |
| 129 | '(((1 . nil) 11) nil))) | 129 | '(((1 . nil) 11) nil))) |
| 130 | (should (equal (list (call-interactively 'sm-test7) smi) | 130 | (should (equal (list (call-interactively 'sm-test7) smi) |
| 131 | '(((1 . t) 11) t)))) | 131 | '(((1 . t) 11) t)))) |
| 132 | (advice-add 'sm-test7 :around | 132 | (advice-add 'sm-test7 :around |
| 133 | (lambda (f &rest args) | 133 | (lambda (f &rest args) |
| 134 | (cons (cons 2 (called-interactively-p)) (apply f args)))) | 134 | (cons (cons 2 (called-interactively-p 'any)) (apply f args)))) |
| 135 | (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11)))) | 135 | (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11)))) |
| 136 | 136 | ||
| 137 | (ert-deftest advice-test-called-interactively-p-around () | 137 | (ert-deftest advice-test-called-interactively-p-around () |
| @@ -140,18 +140,18 @@ | |||
| 140 | This tests the currently broken case of the innermost advice to a | 140 | This tests the currently broken case of the innermost advice to a |
| 141 | function being an around advice." | 141 | function being an around advice." |
| 142 | :expected-result :failed | 142 | :expected-result :failed |
| 143 | (defun sm-test7.2 () (interactive) (cons 1 (called-interactively-p))) | 143 | (defun sm-test7.2 () (interactive) (cons 1 (called-interactively-p 'any))) |
| 144 | (declare-function sm-test7.2 nil) | 144 | (declare-function sm-test7.2 nil) |
| 145 | (advice-add 'sm-test7.2 :around | 145 | (advice-add 'sm-test7.2 :around |
| 146 | (lambda (f &rest args) | 146 | (lambda (f &rest args) |
| 147 | (list (cons 1 (called-interactively-p)) (apply f args)))) | 147 | (list (cons 1 (called-interactively-p 'any)) (apply f args)))) |
| 148 | (should (equal (sm-test7.2) '((1 . nil) (1 . nil)))) | 148 | (should (equal (sm-test7.2) '((1 . nil) (1 . nil)))) |
| 149 | (should (equal (call-interactively 'sm-test7.2) '((1 . t) (1 . t))))) | 149 | (should (equal (call-interactively 'sm-test7.2) '((1 . t) (1 . t))))) |
| 150 | 150 | ||
| 151 | (ert-deftest advice-test-called-interactively-p-filter-args () | 151 | (ert-deftest advice-test-called-interactively-p-filter-args () |
| 152 | "Check interaction between filter-args advice and called-interactively-p." | 152 | "Check interaction between filter-args advice and called-interactively-p." |
| 153 | :expected-result :failed | 153 | :expected-result :failed |
| 154 | (defun sm-test7.3 () (interactive) (cons 1 (called-interactively-p))) | 154 | (defun sm-test7.3 () (interactive) (cons 1 (called-interactively-p 'any))) |
| 155 | (declare-function sm-test7.3 nil) | 155 | (declare-function sm-test7.3 nil) |
| 156 | (advice-add 'sm-test7.3 :filter-args #'list) | 156 | (advice-add 'sm-test7.3 :filter-args #'list) |
| 157 | (should (equal (sm-test7.3) '(1 . nil))) | 157 | (should (equal (sm-test7.3) '(1 . nil))) |
| @@ -159,7 +159,9 @@ function being an around advice." | |||
| 159 | 159 | ||
| 160 | (ert-deftest advice-test-call-interactively () | 160 | (ert-deftest advice-test-call-interactively () |
| 161 | "Check interaction between advice on call-interactively and called-interactively-p." | 161 | "Check interaction between advice on call-interactively and called-interactively-p." |
| 162 | (let ((sm-test7.4 (lambda () (interactive) (cons 1 (called-interactively-p)))) | 162 | (let ((sm-test7.4 (lambda () |
| 163 | (interactive) | ||
| 164 | (cons 1 (called-interactively-p 'any)))) | ||
| 163 | (old (symbol-function 'call-interactively))) | 165 | (old (symbol-function 'call-interactively))) |
| 164 | (unwind-protect | 166 | (unwind-protect |
| 165 | (progn | 167 | (progn |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 3a9f5e03000..9bca6a03754 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -2412,22 +2412,51 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2412 | (with-temp-buffer | 2412 | (with-temp-buffer |
| 2413 | (write-region "foo" nil tmp-name) | 2413 | (write-region "foo" nil tmp-name) |
| 2414 | (let ((point (point))) | 2414 | (let ((point (point))) |
| 2415 | (insert-file-contents tmp-name) | 2415 | (should |
| 2416 | (equal | ||
| 2417 | (insert-file-contents tmp-name) | ||
| 2418 | `(,(expand-file-name tmp-name) 3))) | ||
| 2416 | (should (string-equal (buffer-string) "foo")) | 2419 | (should (string-equal (buffer-string) "foo")) |
| 2417 | (should (= point (point)))) | 2420 | (should (= point (point)))) |
| 2418 | (goto-char (1+ (point))) | 2421 | (goto-char (1+ (point))) |
| 2419 | (let ((point (point))) | 2422 | (let ((point (point))) |
| 2420 | (insert-file-contents tmp-name) | 2423 | (should |
| 2424 | (equal | ||
| 2425 | (insert-file-contents tmp-name) | ||
| 2426 | `(,(expand-file-name tmp-name) 3))) | ||
| 2421 | (should (string-equal (buffer-string) "ffoooo")) | 2427 | (should (string-equal (buffer-string) "ffoooo")) |
| 2422 | (should (= point (point)))) | 2428 | (should (= point (point)))) |
| 2423 | ;; Insert partly. | 2429 | ;; Insert partly. |
| 2424 | (let ((point (point))) | 2430 | (let ((point (point))) |
| 2425 | (insert-file-contents tmp-name nil 1 3) | 2431 | (should |
| 2432 | (equal | ||
| 2433 | (insert-file-contents tmp-name nil 1 3) | ||
| 2434 | `(,(expand-file-name tmp-name) 2))) | ||
| 2426 | (should (string-equal (buffer-string) "foofoooo")) | 2435 | (should (string-equal (buffer-string) "foofoooo")) |
| 2427 | (should (= point (point)))) | 2436 | (should (= point (point)))) |
| 2437 | (let ((point (point))) | ||
| 2438 | (should | ||
| 2439 | (equal | ||
| 2440 | (insert-file-contents tmp-name nil 2 5) | ||
| 2441 | `(,(expand-file-name tmp-name) 1))) | ||
| 2442 | (should (string-equal (buffer-string) "fooofoooo")) | ||
| 2443 | (should (= point (point)))) | ||
| 2428 | ;; Replace. | 2444 | ;; Replace. |
| 2429 | (let ((point (point))) | 2445 | (let ((point (point))) |
| 2430 | (insert-file-contents tmp-name nil nil nil 'replace) | 2446 | ;; 0 characters replaced, because "foo" is already there. |
| 2447 | (should | ||
| 2448 | (equal | ||
| 2449 | (insert-file-contents tmp-name nil nil nil 'replace) | ||
| 2450 | `(,(expand-file-name tmp-name) 0))) | ||
| 2451 | (should (string-equal (buffer-string) "foo")) | ||
| 2452 | (should (= point (point)))) | ||
| 2453 | (let ((point (point))) | ||
| 2454 | (replace-string-in-region "foo" "bar" (point-min) (point-max)) | ||
| 2455 | (goto-char point) | ||
| 2456 | (should | ||
| 2457 | (equal | ||
| 2458 | (insert-file-contents tmp-name nil nil nil 'replace) | ||
| 2459 | `(,(expand-file-name tmp-name) 3))) | ||
| 2431 | (should (string-equal (buffer-string) "foo")) | 2460 | (should (string-equal (buffer-string) "foo")) |
| 2432 | (should (= point (point)))) | 2461 | (should (= point (point)))) |
| 2433 | ;; Error case. | 2462 | ;; Error case. |
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 62e04539ebf..86e7b21def0 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el | |||
| @@ -37,8 +37,8 @@ | |||
| 37 | ;; value (FIXME: like what?) in order to overwrite the default value. | 37 | ;; value (FIXME: like what?) in order to overwrite the default value. |
| 38 | ;; | 38 | ;; |
| 39 | ;; IMPORTANT: Since Eglot is a :core ELPA package, these tests are | 39 | ;; IMPORTANT: Since Eglot is a :core ELPA package, these tests are |
| 40 | ;;supposed to run on Emacsen down to 26.3. Do not use bleeding-edge | 40 | ;; supposed to run on Emacsen down to 26.3. Do not use bleeding-edge |
| 41 | ;;functionality not compatible with that Emacs version. | 41 | ;; functionality not compatible with that Emacs version. |
| 42 | 42 | ||
| 43 | ;;; Code: | 43 | ;;; Code: |
| 44 | (require 'eglot) | 44 | (require 'eglot) |
| @@ -61,16 +61,13 @@ | |||
| 61 | (apply #'format format args))) | 61 | (apply #'format format args))) |
| 62 | 62 | ||
| 63 | (defmacro eglot--with-fixture (fixture &rest body) | 63 | (defmacro eglot--with-fixture (fixture &rest body) |
| 64 | "Setup FIXTURE, call BODY, teardown FIXTURE. | 64 | "Set up FIXTURE, call BODY, tear down FIXTURE. |
| 65 | FIXTURE is a list. Its elements are of the form (FILE . CONTENT) | 65 | FIXTURE is a list. Its elements are of the form (FILE . CONTENT) |
| 66 | to create a readable FILE with CONTENT. FILE may be a directory | 66 | to create a readable FILE with CONTENT. FILE may be a directory |
| 67 | name and CONTENT another (FILE . CONTENT) list to specify a | 67 | name and CONTENT another (FILE . CONTENT) list to specify a |
| 68 | directory hierarchy. FIXTURE's elements can also be (SYMBOL | 68 | directory hierarchy." |
| 69 | VALUE) meaning SYMBOL should be bound to VALUE during BODY and | ||
| 70 | then restored." | ||
| 71 | (declare (indent 1) (debug t)) | 69 | (declare (indent 1) (debug t)) |
| 72 | `(eglot--call-with-fixture | 70 | `(eglot--call-with-fixture ,fixture (lambda () ,@body))) |
| 73 | ,fixture #'(lambda () ,@body))) | ||
| 74 | 71 | ||
| 75 | (defun eglot--make-file-or-dir (ass) | 72 | (defun eglot--make-file-or-dir (ass) |
| 76 | (let ((file-or-dir-name (car ass)) | 73 | (let ((file-or-dir-name (car ass)) |
| @@ -91,18 +88,9 @@ then restored." | |||
| 91 | "Helper for `eglot--with-fixture'. Run FN under FIXTURE." | 88 | "Helper for `eglot--with-fixture'. Run FN under FIXTURE." |
| 92 | (let* ((fixture-directory (make-nearby-temp-file "eglot--fixture" t)) | 89 | (let* ((fixture-directory (make-nearby-temp-file "eglot--fixture" t)) |
| 93 | (default-directory fixture-directory) | 90 | (default-directory fixture-directory) |
| 94 | file-specs created-files | 91 | created-files |
| 95 | syms-to-restore | ||
| 96 | new-servers | 92 | new-servers |
| 97 | test-body-successful-p) | 93 | test-body-successful-p) |
| 98 | (dolist (spec fixture) | ||
| 99 | (cond ((symbolp spec) | ||
| 100 | (push (cons spec (symbol-value spec)) syms-to-restore) | ||
| 101 | (set spec nil)) | ||
| 102 | ((symbolp (car spec)) | ||
| 103 | (push (cons (car spec) (symbol-value (car spec))) syms-to-restore) | ||
| 104 | (set (car spec) (cadr spec))) | ||
| 105 | ((stringp (car spec)) (push spec file-specs)))) | ||
| 106 | (eglot--test-message "[%s]: test start" (ert-test-name (ert-running-test))) | 94 | (eglot--test-message "[%s]: test start" (ert-test-name (ert-running-test))) |
| 107 | (unwind-protect | 95 | (unwind-protect |
| 108 | (let* ((process-environment | 96 | (let* ((process-environment |
| @@ -123,7 +111,7 @@ then restored." | |||
| 123 | process-environment)) | 111 | process-environment)) |
| 124 | (eglot-server-initialized-hook | 112 | (eglot-server-initialized-hook |
| 125 | (lambda (server) (push server new-servers)))) | 113 | (lambda (server) (push server new-servers)))) |
| 126 | (setq created-files (mapcan #'eglot--make-file-or-dir file-specs)) | 114 | (setq created-files (mapcan #'eglot--make-file-or-dir fixture)) |
| 127 | (prog1 (funcall fn) | 115 | (prog1 (funcall fn) |
| 128 | (setq test-body-successful-p t))) | 116 | (setq test-body-successful-p t))) |
| 129 | (eglot--test-message "[%s]: %s" (ert-test-name (ert-running-test)) | 117 | (eglot--test-message "[%s]: %s" (ert-test-name (ert-running-test)) |
| @@ -155,18 +143,15 @@ then restored." | |||
| 155 | (t | 143 | (t |
| 156 | (eglot--test-message "Preserved for inspection: %s" | 144 | (eglot--test-message "Preserved for inspection: %s" |
| 157 | (mapconcat #'buffer-name buffers ", ")))))))) | 145 | (mapconcat #'buffer-name buffers ", ")))))))) |
| 158 | (eglot--cleanup-after-test fixture-directory created-files syms-to-restore))))) | 146 | (eglot--cleanup-after-test fixture-directory created-files))))) |
| 159 | 147 | ||
| 160 | (defun eglot--cleanup-after-test (fixture-directory created-files syms-to-restore) | 148 | (defun eglot--cleanup-after-test (fixture-directory created-files) |
| 161 | (let ((buffers-to-delete | 149 | (let ((buffers-to-delete |
| 162 | (delete nil (mapcar #'find-buffer-visiting created-files)))) | 150 | (delq nil (mapcar #'find-buffer-visiting created-files)))) |
| 163 | (eglot--test-message "Killing %s, wiping %s, restoring %s" | 151 | (eglot--test-message "Killing %s, wiping %s" |
| 164 | buffers-to-delete | 152 | buffers-to-delete |
| 165 | fixture-directory | 153 | fixture-directory) |
| 166 | (mapcar #'car syms-to-restore)) | 154 | (dolist (buf buffers-to-delete) ;; Have to save otherwise will get prompted. |
| 167 | (cl-loop for (sym . val) in syms-to-restore | ||
| 168 | do (set sym val)) | ||
| 169 | (dolist (buf buffers-to-delete) ;; have to save otherwise will get prompted | ||
| 170 | (with-current-buffer buf (save-buffer) (kill-buffer))) | 155 | (with-current-buffer buf (save-buffer) (kill-buffer))) |
| 171 | (delete-directory fixture-directory 'recursive) | 156 | (delete-directory fixture-directory 'recursive) |
| 172 | ;; Delete Tramp buffers if needed. | 157 | ;; Delete Tramp buffers if needed. |
| @@ -325,8 +310,7 @@ then restored." | |||
| 325 | "Connect to eclipse.jdt.ls server." | 310 | "Connect to eclipse.jdt.ls server." |
| 326 | (skip-unless (executable-find "jdtls")) | 311 | (skip-unless (executable-find "jdtls")) |
| 327 | (eglot--with-fixture | 312 | (eglot--with-fixture |
| 328 | '(("project/src/main/java/foo" . (("Main.java" . ""))) | 313 | '(("project/src/main/java/foo" . (("Main.java" . "")))) |
| 329 | ("project/.git/" . nil)) | ||
| 330 | (with-current-buffer | 314 | (with-current-buffer |
| 331 | (eglot--find-file-noselect "project/src/main/java/foo/Main.java") | 315 | (eglot--find-file-noselect "project/src/main/java/foo/Main.java") |
| 332 | (eglot--sniffing (:server-notifications s-notifs) | 316 | (eglot--sniffing (:server-notifications s-notifs) |
| @@ -480,11 +464,11 @@ then restored." | |||
| 480 | (should (eq 'eglot-diagnostic-tag-unnecessary-face (face-at-point)))))))) | 464 | (should (eq 'eglot-diagnostic-tag-unnecessary-face (face-at-point)))))))) |
| 481 | 465 | ||
| 482 | (defun eglot--eldoc-on-demand () | 466 | (defun eglot--eldoc-on-demand () |
| 483 | ;; Trick Eldoc 1.1.0 into accepting on-demand calls. | 467 | ;; Trick ElDoc 1.1.0 into accepting on-demand calls. |
| 484 | (eldoc t)) | 468 | (eldoc t)) |
| 485 | 469 | ||
| 486 | (defun eglot--tests-force-full-eldoc () | 470 | (defun eglot--tests-force-full-eldoc () |
| 487 | ;; FIXME: This uses some Eldoc implementation defatils. | 471 | ;; FIXME: This uses some ElDoc implementation details. |
| 488 | (when (buffer-live-p eldoc--doc-buffer) | 472 | (when (buffer-live-p eldoc--doc-buffer) |
| 489 | (with-current-buffer eldoc--doc-buffer | 473 | (with-current-buffer eldoc--doc-buffer |
| 490 | (let ((inhibit-read-only t)) | 474 | (let ((inhibit-read-only t)) |
| @@ -670,7 +654,7 @@ int main() { | |||
| 670 | (should (string-match "^fprintf" (eglot--tests-force-full-eldoc)))))) | 654 | (should (string-match "^fprintf" (eglot--tests-force-full-eldoc)))))) |
| 671 | 655 | ||
| 672 | (ert-deftest eglot-test-multiline-eldoc () | 656 | (ert-deftest eglot-test-multiline-eldoc () |
| 673 | "Test Eldoc documentation from multiple osurces." | 657 | "Test ElDoc documentation from multiple osurces." |
| 674 | (skip-unless (executable-find "clangd")) | 658 | (skip-unless (executable-find "clangd")) |
| 675 | (eglot--with-fixture | 659 | (eglot--with-fixture |
| 676 | `(("project" . (("coiso.c" . | 660 | `(("project" . (("coiso.c" . |
| @@ -723,7 +707,7 @@ int main() { | |||
| 723 | (eglot--sniffing (:server-notifications s-notifs) | 707 | (eglot--sniffing (:server-notifications s-notifs) |
| 724 | (should (eglot--tests-connect)) | 708 | (should (eglot--tests-connect)) |
| 725 | (eglot--wait-for (s-notifs 20) (&key method &allow-other-keys) | 709 | (eglot--wait-for (s-notifs 20) (&key method &allow-other-keys) |
| 726 | (string= method "textDocument/publishDiagnostics"))) | 710 | (string= method "textDocument/publishDiagnostics"))) |
| 727 | (goto-char (point-max)) | 711 | (goto-char (point-max)) |
| 728 | (eglot--simulate-key-event ?.) | 712 | (eglot--simulate-key-event ?.) |
| 729 | (should (looking-back "^ \\.")))))) | 713 | (should (looking-back "^ \\.")))))) |
| @@ -872,9 +856,9 @@ int main() { | |||
| 872 | (skip-unless (executable-find "clangd")) | 856 | (skip-unless (executable-find "clangd")) |
| 873 | (eglot--with-fixture | 857 | (eglot--with-fixture |
| 874 | `(("project" . (("foo.c" . "int foo() {return 42;}") | 858 | `(("project" . (("foo.c" . "int foo() {return 42;}") |
| 875 | ("bar.c" . "int bar() {return 42;}"))) | 859 | ("bar.c" . "int bar() {return 42;}")))) |
| 876 | (c-mode-hook (eglot-ensure))) | 860 | (let ((c-mode-hook '(eglot-ensure)) |
| 877 | (let (server) | 861 | server) |
| 878 | ;; need `ert-simulate-command' because `eglot-ensure' | 862 | ;; need `ert-simulate-command' because `eglot-ensure' |
| 879 | ;; relies on `post-command-hook'. | 863 | ;; relies on `post-command-hook'. |
| 880 | (with-current-buffer | 864 | (with-current-buffer |
| @@ -1288,7 +1272,7 @@ macro will assume it exists." | |||
| 1288 | (ert-deftest eglot-test-path-to-uri-windows () | 1272 | (ert-deftest eglot-test-path-to-uri-windows () |
| 1289 | (skip-unless (eq system-type 'windows-nt)) | 1273 | (skip-unless (eq system-type 'windows-nt)) |
| 1290 | (should (string-prefix-p "file:///" | 1274 | (should (string-prefix-p "file:///" |
| 1291 | (eglot--path-to-uri "c:/Users/Foo/bar.lisp"))) | 1275 | (eglot--path-to-uri "c:/Users/Foo/bar.lisp"))) |
| 1292 | (should (string-suffix-p "c%3A/Users/Foo/bar.lisp" | 1276 | (should (string-suffix-p "c%3A/Users/Foo/bar.lisp" |
| 1293 | (eglot--path-to-uri "c:/Users/Foo/bar.lisp")))) | 1277 | (eglot--path-to-uri "c:/Users/Foo/bar.lisp")))) |
| 1294 | 1278 | ||
| @@ -1318,8 +1302,9 @@ macro will assume it exists." | |||
| 1318 | (should (eq (eglot-current-server) server)))))) | 1302 | (should (eq (eglot-current-server) server)))))) |
| 1319 | 1303 | ||
| 1320 | (provide 'eglot-tests) | 1304 | (provide 'eglot-tests) |
| 1321 | ;;; eglot-tests.el ends here | ||
| 1322 | 1305 | ||
| 1323 | ;; Local Variables: | 1306 | ;; Local Variables: |
| 1324 | ;; checkdoc-force-docstrings-flag: nil | 1307 | ;; checkdoc-force-docstrings-flag: nil |
| 1325 | ;; End: | 1308 | ;; End: |
| 1309 | |||
| 1310 | ;;; eglot-tests.el ends here | ||
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 6f79d3277a8..2859123da80 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -114,22 +114,24 @@ | |||
| 114 | (should-error (nreverse 1)) | 114 | (should-error (nreverse 1)) |
| 115 | (should-error (nreverse (make-char-table 'foo))) | 115 | (should-error (nreverse (make-char-table 'foo))) |
| 116 | (should (equal (nreverse (copy-sequence "xyzzy")) "yzzyx")) | 116 | (should (equal (nreverse (copy-sequence "xyzzy")) "yzzyx")) |
| 117 | (let ((A (vector))) | 117 | (let* ((A (vector)) |
| 118 | (nreverse A) | 118 | (B (nreverse A))) |
| 119 | (should (equal A []))) | 119 | (should (equal A [])) |
| 120 | (let ((A (vector 0))) | 120 | (should (eq B A))) |
| 121 | (nreverse A) | 121 | (let* ((A (vector 0)) |
| 122 | (should (equal A [0]))) | 122 | (B (nreverse A))) |
| 123 | (let ((A (vector 1 2 3 4))) | 123 | (should (equal A [0])) |
| 124 | (nreverse A) | 124 | (should (eq B A))) |
| 125 | (should (equal A [4 3 2 1]))) | ||
| 126 | (let ((A (vector 1 2 3 4))) | ||
| 127 | (nreverse A) | ||
| 128 | (nreverse A) | ||
| 129 | (should (equal A [1 2 3 4]))) | ||
| 130 | (let* ((A (vector 1 2 3 4)) | 125 | (let* ((A (vector 1 2 3 4)) |
| 131 | (B (nreverse (nreverse A)))) | 126 | (B (nreverse A))) |
| 132 | (should (equal A B)))) | 127 | (should (equal A [4 3 2 1])) |
| 128 | (should (eq B A))) | ||
| 129 | (let* ((A (vector 1 2 3 4)) | ||
| 130 | (B (nreverse A)) | ||
| 131 | (C (nreverse A))) | ||
| 132 | (should (equal A [1 2 3 4])) | ||
| 133 | (should (eq B A)) | ||
| 134 | (should (eq C A)))) | ||
| 133 | 135 | ||
| 134 | (ert-deftest fns-tests-reverse-bool-vector () | 136 | (ert-deftest fns-tests-reverse-bool-vector () |
| 135 | (let ((A (make-bool-vector 10 nil))) | 137 | (let ((A (make-bool-vector 10 nil))) |
| @@ -140,9 +142,10 @@ | |||
| 140 | (ert-deftest fns-tests-nreverse-bool-vector () | 142 | (ert-deftest fns-tests-nreverse-bool-vector () |
| 141 | (let ((A (make-bool-vector 10 nil))) | 143 | (let ((A (make-bool-vector 10 nil))) |
| 142 | (dotimes (i 5) (aset A i t)) | 144 | (dotimes (i 5) (aset A i t)) |
| 143 | (nreverse A) | 145 | (let ((B (nreverse A))) |
| 144 | (should (equal [nil nil nil nil nil t t t t t] (vconcat A))) | 146 | (should (eq B A)) |
| 145 | (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A)))))) | 147 | (should (equal [nil nil nil nil nil t t t t t] (vconcat A))) |
| 148 | (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A))))))) | ||
| 146 | 149 | ||
| 147 | (defconst fns-tests--string-lessp-cases | 150 | (defconst fns-tests--string-lessp-cases |
| 148 | `(("abc" < "abd") | 151 | `(("abc" < "abd") |