]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge from origin/emacs-29
authorEli Zaretskii <eliz@gnu.org>
Sat, 2 Sep 2023 08:28:17 +0000 (04:28 -0400)
committerEli Zaretskii <eliz@gnu.org>
Sat, 2 Sep 2023 08:28:17 +0000 (04:28 -0400)
648a5e33e80 Update to Org 9.6.8-3-g21171d
458442fe78c Escape percent character in treesit--inspect-name (bug#65...
bc0426ce8ed Don't add an extraneous slash in remote PATH list in Eshell
34f7a47c9ce Fix Tramp on MS Windows
ea5fd6c96bc * Fix native disassemble on Windows platforms (bug#65455)
91d2d8439bb * Handle missing eln file when trying to disassble (bug#6...
e7ac50a1539 * lisp/emacs-lisp/comp.el (comp--native-compile): Fix OUT...
45cf3a0cede Update to Transient v0.4.3
31d3808fb9d Adapt Eshell manual
0c50af054f9 Fix applying patches with Git on MS-Windows

# Conflicts:
# doc/misc/transient.texi
# test/lisp/eshell/esh-util-tests.el

1  2 
doc/misc/eshell.texi
doc/misc/transient.texi
lisp/emacs-lisp/comp.el
lisp/emacs-lisp/disass.el
lisp/eshell/esh-util.el
lisp/net/tramp-sh.el
lisp/org/org.el
lisp/treesit.el
lisp/vc/vc-git.el
lisp/vc/vc.el
test/lisp/eshell/esh-util-tests.el

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc lisp/org/org.el
Simple merge
diff --cc lisp/treesit.el
Simple merge
index c689eec444b355c6f6c26eee09ec5de214f7ab67,218696c05f444fc5c00ad3aabf4f961cf375cc89..9a78264d8ff49b08ff20c5cbc6c8325f577a4dd8
@@@ -1099,28 -1038,28 +1099,36 @@@ It is based on `log-edit-mode', and ha
                (search-forward "diff --git" nil 'move)
                (move-beginning-of-line 1)
                (setq file-diff (buffer-substring pos (point)))
 -              (if (and (setq file-beg (string-search
 -                                       file-diff vc-git-patch-string))
 -                       ;; Check that file diff ends with an empty string
 -                       ;; or the beginning of the next file diff.
 -                       (string-match-p "\\`\\'\\|\\`diff --git"
 -                                       (substring
 -                                        vc-git-patch-string
 -                                        (+ file-beg (length file-diff)))))
 -                  (setq vc-git-patch-string
 -                        (string-replace file-diff "" vc-git-patch-string))
 -                (user-error "Index not empty"))
 +              (cond ((and (setq file-beg (string-search
 +                                          file-diff vc-git-patch-string))
 +                          ;; Check that file diff ends with an empty string
 +                          ;; or the beginning of the next file diff.
 +                          (string-match-p "\\`\\'\\|\\`diff --git"
 +                                          (substring
 +                                           vc-git-patch-string
 +                                           (+ file-beg (length file-diff)))))
 +                     (setq vc-git-patch-string
 +                           (string-replace file-diff "" vc-git-patch-string)))
 +                    ((string-match (format "^%s" (regexp-quote file-header))
 +                                   vc-git-patch-string)
 +                     (if (and file-name
 +                              (yes-or-no-p
 +                               (format "Unstage already-staged changes to %s?"
 +                                       file-name)))
 +                         (vc-git-command nil 0 file-name "reset" "-q" "--")
 +                       (user-error "Index not empty")))
 +                    (t (push file-name to-stash)))
                (setq pos (point))))))
        (unless (string-empty-p vc-git-patch-string)
-         (let ((patch-file (make-nearby-temp-file "git-patch")))
+         (let ((patch-file (make-nearby-temp-file "git-patch"))
+               ;; Temporarily countermand the let-binding at the
+               ;; beginning of this function.
+               (coding-system-for-write
+                (coding-system-change-eol-conversion
+                 ;; On DOS/Windows, it is important for the patch file
+                 ;; to have the Unix EOL format, because Git expects
+                 ;; that, even on Windows.
+                 (or pcsw vc-git-commits-coding-system) 'unix)))
            (with-temp-file patch-file
              (insert vc-git-patch-string))
            (unwind-protect
diff --cc lisp/vc/vc.el
Simple merge
index fe4eb9f31ddba9b1407411995af041d9faa19dac,9546a4a62fdc69d31d99bf9a7ba2f89f62a9ac66..7bd71b260ffd2c30ac26cab46c8f9db760af3ca7
    "Test that `eshell-stringify' correctly stringifies complex objects."
    (should (equal (eshell-stringify (list 'quote 'hello)) "'hello")))
  
 +(ert-deftest esh-util-test/eshell-convert-to-number/integer ()
 +  "Test that `eshell-convert-to-number' correctly converts integers."
 +  (should (equal (eshell-convert-to-number "123") 123))
 +  (should (equal (eshell-convert-to-number "-123") -123))
 +  ;; These are technially integers, since Emacs Lisp requires at least
 +  ;; one digit after the "." to be a float:
 +  (should (equal (eshell-convert-to-number "123.") 123))
 +  (should (equal (eshell-convert-to-number "-123.") -123)))
 +
 +(ert-deftest esh-util-test/eshell-convert-to-number/floating-point ()
 +  "Test that `eshell-convert-to-number' correctly converts floats."
 +  (should (equal (eshell-convert-to-number "1.23") 1.23))
 +  (should (equal (eshell-convert-to-number "-1.23") -1.23))
 +  (should (equal (eshell-convert-to-number ".1") 0.1))
 +  (should (equal (eshell-convert-to-number "-.1") -0.1)))
 +
 +(ert-deftest esh-util-test/eshell-convert-to-number/floating-point-exponent ()
 +  "Test that `eshell-convert-to-number' correctly converts exponent notation."
 +  ;; Positive exponent:
 +  (dolist (exp '("e2" "e+2" "E2" "E+2"))
 +    (should (equal (eshell-convert-to-number (concat "123" exp)) 12300.0))
 +    (should (equal (eshell-convert-to-number (concat "-123" exp)) -12300.0))
 +    (should (equal (eshell-convert-to-number (concat "1.23" exp)) 123.0))
 +    (should (equal (eshell-convert-to-number (concat "-1.23" exp)) -123.0))
 +    (should (equal (eshell-convert-to-number (concat "1." exp)) 100.0))
 +    (should (equal (eshell-convert-to-number (concat "-1." exp)) -100.0))
 +    (should (equal (eshell-convert-to-number (concat ".1" exp)) 10.0))
 +    (should (equal (eshell-convert-to-number (concat "-.1" exp)) -10.0)))
 +  ;; Negative exponent:
 +  (dolist (exp '("e-2" "E-2"))
 +    (should (equal (eshell-convert-to-number (concat "123" exp)) 1.23))
 +    (should (equal (eshell-convert-to-number (concat "-123" exp)) -1.23))
 +    (should (equal (eshell-convert-to-number (concat "1.23" exp)) 0.0123))
 +    (should (equal (eshell-convert-to-number (concat "-1.23" exp)) -0.0123))
 +    (should (equal (eshell-convert-to-number (concat "1." exp)) 0.01))
 +    (should (equal (eshell-convert-to-number (concat "-1." exp)) -0.01))
 +    (should (equal (eshell-convert-to-number (concat ".1" exp)) 0.001))
 +    (should (equal (eshell-convert-to-number (concat "-.1" exp)) -0.001))))
 +
 +(ert-deftest esh-util-test/eshell-convert-to-number/floating-point/infinite ()
 +  "Test that `eshell-convert-to-number' correctly converts infinite floats."
 +  (should (equal (eshell-convert-to-number "1.0e+INF") 1.0e+INF))
 +  (should (equal (eshell-convert-to-number "2.e+INF") 1.0e+INF))
 +  (should (equal (eshell-convert-to-number "-1.0e+INF") -1.0e+INF))
 +  (should (equal (eshell-convert-to-number "-2.e+INF") -1.0e+INF)))
 +
 +(ert-deftest esh-util-test/eshell-convert-to-number/floating-point/nan ()
 +  "Test that `eshell-convert-to-number' correctly converts NaNs."
 +  (should (equal (eshell-convert-to-number "1.0e+NaN") 1.0e+NaN))
 +  (should (equal (eshell-convert-to-number "2.e+NaN") 2.0e+NaN))
 +  (should (equal (eshell-convert-to-number "-1.0e+NaN") -1.0e+NaN))
 +  (should (equal (eshell-convert-to-number "-2.e+NaN") -2.0e+NaN)))
 +
 +(ert-deftest esh-util-test/eshell-convert-to-number/non-numeric ()
 +  "Test that `eshell-convert-to-number' does nothing to non-numeric values."
 +  (should (equal (eshell-convert-to-number "foo") "foo"))
 +  (should (equal (eshell-convert-to-number "") ""))
 +  (should (equal (eshell-convert-to-number "123foo") "123foo")))
 +
 +(ert-deftest esh-util-test/eshell-convert-to-number/no-convert ()
 +  "Test that `eshell-convert-to-number' does nothing when disabled."
 +  (let ((eshell-convert-numeric-arguments nil))
 +    (should (equal (eshell-convert-to-number "123") "123"))
 +    (should (equal (eshell-convert-to-number "1.23") "1.23"))))
 +
 +(ert-deftest esh-util-test/eshell-printable-size ()
 +  (should (equal (eshell-printable-size (expt 2 16)) "65536"))
 +  (should (equal (eshell-printable-size (expt 2 32)) "4294967296")))
 +
 +(ert-deftest esh-util-test/eshell-printable-size/zero ()
 +  (should (equal (eshell-printable-size 0 1000 nil t) "0")))
 +
 +(ert-deftest esh-util-test/eshell-printable-size/terabyte ()
 +  (should (equal (eshell-printable-size (1- (expt 2 40)) 1024 nil t) "1024G"))
 +  (should (equal (eshell-printable-size (expt 2 40) 1024 nil t) "1T"))
 +  (should (equal (eshell-printable-size (1- (expt 10 12)) 1000 nil t) "1000G"))
 +  (should (equal (eshell-printable-size (expt 10 12) 1000 nil t) "1T")))
 +
 +(ert-deftest esh-util-test/eshell-printable-size/use-colors ()
 +  (should (equal-including-properties
 +           (eshell-printable-size (1- (expt 2 20)) 1024 nil t)
 +           "1024k"))
 +  (should (equal-including-properties
 +           (eshell-printable-size (1- (expt 2 30)) 1024 nil t)
 +           (propertize "1024M" 'face 'bold)))
 +  (should (equal-including-properties
 +           (eshell-printable-size (1- (expt 2 40)) 1024 nil t)
 +           (propertize "1024G" 'face 'bold-italic))))
 +
 +(ert-deftest esh-util-test/eshell-printable-size/block-size ()
 +  (should (equal (eshell-printable-size (1- (expt 2 20)) nil 4096) "256"))
 +  (should (equal (eshell-printable-size (1- (expt 2 30)) nil 4096) "262144")))
 +
 +(ert-deftest esh-util-test/eshell-printable-size/human-readable-arg ()
 +  (should-error (eshell-printable-size 0 999 nil t)))
 +
+ (ert-deftest esh-util-test/path/get ()
+   "Test that getting the Eshell path returns the expected results."
+   (let ((expected-path (butlast (exec-path))))
+     (should (equal (eshell-get-path)
+                    (if (eshell-under-windows-p)
+                        (cons "." expected-path)
+                      expected-path)))
+     (should (equal (eshell-get-path 'literal)
+                    expected-path))))
+ (ert-deftest esh-util-test/path/get-remote ()
+   "Test that getting the remote Eshell path returns the expected results."
+   (let* ((default-directory ert-remote-temporary-file-directory)
+          (expected-path (butlast (exec-path))))
+     ;; Make sure we don't have a doubled directory separator.
+     (should (seq-every-p (lambda (i) (not (string-match-p "//" i)))
+                          (eshell-get-path)))
+     (should (equal (eshell-get-path)
+                    (mapcar (lambda (i)
+                              (concat (file-remote-p default-directory) i))
+                            expected-path)))
+     (should (equal (eshell-get-path 'literal)
+                    expected-path))))
  ;;; esh-util-tests.el ends here