branch: externals/org
commit 67c5c4c1e88e08277ead3f16a6cbc6881c9a8869
Author: Morgan Smith <[email protected]>
Commit: Ihor Radchenko <[email protected]>
Testing: Use line-(beginning|end)-position over point-at-(bol|eol)
`point-at-bol' and `point-at-eol' are obsolete since Emacs 29.1.
* testing/lisp/test-ob-R.el (test-ob-R/results-file):
* testing/lisp/test-ob-emacs-lisp.el
(ob-emacs-lisp/commented-last-block-line-no-var)
(ob-emacs-lisp/dynamic-lexical-execute):
* testing/lisp/test-ob-lob.el
(test-ob-lob/call-with-header-arguments):
* testing/lisp/test-ob-python.el
(test-ob-python/async-inline-session-output):
* testing/lisp/test-ob.el
(test-ob/simple-variable-resolution)
(test-ob/inline-src_blk-default-results-replace-line-1)
(test-ob/inline-src_blk-default-results-replace-line-2)
(test-ob/inline-src_blk-manual-results-replace)
(test-ob/inline-src_blk-results-silent)
(test-ob/inline-src_blk-results-raw)
(test-ob/commented-last-block-line-no-var)
(test-ob/commented-last-block-line-with-var)
(test-ob/remove-inline-result)
(test-ob-verify-result-and-removed-result):
* testing/lisp/test-org-list.el
(test-org-list/send-item)
(test-org-list/sort):
* testing/lisp/test-org.el (test-org/sort-entries):
* testing/lisp/test-ox.el (test-org-export/before-parsing-functions):
Replace all instances of `point-at-bol' with
`line-beginning-position'.
Replace all instances of `point-at-eol with `line-end-position'.
---
testing/lisp/test-ob-R.el | 4 +--
testing/lisp/test-ob-emacs-lisp.el | 8 ++---
testing/lisp/test-ob-lob.el | 2 +-
testing/lisp/test-ob-python.el | 2 +-
testing/lisp/test-ob.el | 62 +++++++++++++++++++-------------------
testing/lisp/test-org-list.el | 14 ++++-----
testing/lisp/test-org.el | 8 ++---
testing/lisp/test-ox.el | 2 +-
8 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el
index cecdc7de8c..b92b3e8f10 100644
--- a/testing/lisp/test-ob-R.el
+++ b/testing/lisp/test-ob-R.el
@@ -99,13 +99,13 @@ x
(goto-char (point-min)) (org-babel-execute-maybe)
(org-babel-goto-named-result "TESTSRC") (forward-line 1)
(should (string= "[[file:junk/test.org]]"
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(goto-char (point-min)) (forward-line 1)
(insert "#+header: :session\n")
(goto-char (point-min)) (org-babel-execute-maybe)
(org-babel-goto-named-result "TESTSRC") (forward-line 1)
(should (string= "[[file:junk/test.org]]"
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol)))))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position)))))))
diff --git a/testing/lisp/test-ob-emacs-lisp.el
b/testing/lisp/test-ob-emacs-lisp.el
index 6661e59286..2d8b4f42a1 100644
--- a/testing/lisp/test-ob-emacs-lisp.el
+++ b/testing/lisp/test-ob-emacs-lisp.el
@@ -35,7 +35,7 @@
(should
(string=
""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position)))))
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp
\"some text\";;
@@ -48,7 +48,7 @@
(should
(string=
": some text"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))))
(ert-deftest ob-emacs-lisp/commented-last-block-line-with-var ()
(org-test-with-temp-text-in-file "
@@ -61,7 +61,7 @@
(forward-line)
(should (string=
""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))))
(ert-deftest ob-emacs-lisp/commented-last-block-line ()
(should
@@ -83,7 +83,7 @@
(org-babel-execute-maybe)
(re-search-forward "results" nil t)
(re-search-forward ": " nil t)
- (buffer-substring-no-properties (point) (point-at-eol)))))
+ (buffer-substring-no-properties (point) (line-end-position)))))
(should (string= "dynamic" (execute "
#+begin_src emacs-lisp :lexical no :results verbatim
diff --git a/testing/lisp/test-ob-lob.el b/testing/lisp/test-ob-lob.el
index 188fee4c00..5cd1b0ebe0 100644
--- a/testing/lisp/test-ob-lob.el
+++ b/testing/lisp/test-ob-lob.el
@@ -61,7 +61,7 @@
(org-test-at-id "fab7e291-fde6-45fc-bf6e-a485b8bca2f0"
(move-beginning-of-line 1)
(forward-line 6)
- (message (buffer-substring (point-at-bol) (point-at-eol)))
+ (message (buffer-substring (line-beginning-position)
(line-end-position)))
(should
(string= "testing" (org-babel-execute-src-block
nil (org-babel-lob-get-info))))
diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el
index 415f877aca..b770d1a90f 100644
--- a/testing/lisp/test-ob-python.el
+++ b/testing/lisp/test-ob-python.el
@@ -275,7 +275,7 @@ print('Yep!')
(string= expected-full
(progn
(sleep-for 0.200)
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol))))))))))
+ (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))))))))
(ert-deftest test-ob-python/async-named-output ()
;; Disable the test on older Emacs as built-in python.el sometimes
diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 618b6e0be6..a41f214cd6 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -203,8 +203,8 @@ list, then it should be treated as such; not as the symbol
nil."
(should (= 4 (org-babel-execute-src-block)))
(forward-line 5)
(should (string= ": 4" (buffer-substring
- (point-at-bol)
- (point-at-eol)))))
+ (line-beginning-position)
+ (line-end-position)))))
;; Test reading lists.
(org-test-with-temp-text-in-file "
@@ -223,8 +223,8 @@ list, then it should be treated as such; not as the symbol
nil."
(should (string=
"| simple | list |"
(buffer-substring
- (point-at-bol)
- (point-at-eol))))))
+ (line-beginning-position)
+ (line-end-position))))))
(ert-deftest test-ob/block-content-resolution ()
"Test block content resolution."
@@ -364,18 +364,18 @@ at the beginning of a line."
(goto-char (point-min)) (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=1=)}}}")
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol))))
+ (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(forward-char) (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=1=)}}}")
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol))))
+ (buffer-substring-no-properties
(line-beginning-position) (line-end-position))))
(re-search-forward "{{{")
;;(should-error (org-ctrl-c-ctrl-c))
(backward-char 4) ;; last char of block body
(org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=1=)}}}")
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol)))))
+ (buffer-substring-no-properties
(line-beginning-position) (line-end-position)))))
;; src_ follows space line 1...
(let ((test-line " src_emacs-lisp{ 1 }"))
(org-test-with-temp-text
@@ -384,11 +384,11 @@ at the beginning of a line."
(forward-char) (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=1=)}}}")
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(re-search-forward "{ 1 ") (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=1=)}}}")
- (buffer-substring-no-properties (point-at-bol)
(point-at-eol))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(forward-char 6)
(should-error (org-ctrl-c-ctrl-c))))
;; Results on a subsequent line are replaced.
@@ -435,7 +435,7 @@ at the beginning of a line."
(should (string=
(concat test-line " {{{results(=x=)}}}")
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))))
+ (line-beginning-position) (line-end-position))))))
(let ((test-line "Some text prior to block src_emacs-lisp{ \"y\" }")
(org-babel-inline-result-wrap "=%s="))
(org-test-with-temp-text
@@ -445,11 +445,11 @@ at the beginning of a line."
(re-search-backward "src") (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=y=)}}} end")
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(re-search-forward "\" ") (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=y=)}}} end")
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(forward-char 3)
(should-error (org-ctrl-c-ctrl-c)))))
@@ -467,7 +467,7 @@ at the beginning of a line."
(should (string=
(concat test-line " {{{results(=x=)}}}")
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))))
+ (line-beginning-position) (line-end-position))))))
(let ((test-line (concat " Some text prior to block "
"src_emacs-lisp[:results replace]{ \"y\" }"))
(org-babel-inline-result-wrap "=%s="))
@@ -477,11 +477,11 @@ at the beginning of a line."
(re-search-backward "src") (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=y=)}}} end")
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(re-search-forward "\" ") (org-babel-execute-maybe)
(should (string=
(concat test-line " {{{results(=y=)}}} end")
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))
(forward-char 3)
(should-error (org-ctrl-c-ctrl-c)))))
@@ -491,7 +491,7 @@ at the beginning of a line."
(org-babel-execute-maybe)
(should (string= test-line
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))))
+ (line-beginning-position) (line-end-position))))))
(let ((test-line (concat " Some text prior to block src_emacs-lisp"
"[ :results silent ]{ \"y\" }")))
(org-test-with-temp-text
@@ -501,11 +501,11 @@ at the beginning of a line."
(re-search-backward "src_") (org-babel-execute-maybe)
(should (string= (concat test-line " end")
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))
+ (line-beginning-position) (line-end-position))))
(re-search-forward "\" ") (org-babel-execute-maybe)
(should (string= (concat test-line " end")
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))
+ (line-beginning-position) (line-end-position))))
(forward-char 2)
(should-error (org-ctrl-c-ctrl-c)))))
@@ -521,11 +521,11 @@ at the beginning of a line."
(re-search-forward "src_") (org-babel-execute-maybe)
(should (string= (concat test-line " the end")
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))
+ (line-beginning-position) (line-end-position))))
(re-search-forward "\" ") (org-babel-execute-maybe)
(should (string= (concat test-line " the the end")
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))
+ (line-beginning-position) (line-end-position))))
(forward-char 2)
(should-error (org-ctrl-c-ctrl-c)))))
@@ -1033,7 +1033,7 @@ x
(should
(string=
""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position)))))
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp
\"some text\";;
@@ -1045,7 +1045,7 @@ x
(should
(string=
": some text"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))))
(ert-deftest test-ob/commented-last-block-line-with-var ()
(org-test-with-temp-text-in-file "
@@ -1058,7 +1058,7 @@ x
(forward-line)
(should (string=
""
- (buffer-substring-no-properties (point-at-bol) (point-at-eol)))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position)))))
(org-test-with-temp-text-in-file "
#+begin_src emacs-lisp :var a=2
2;;
@@ -1069,7 +1069,7 @@ x
(forward-line)
(should (string=
": 2"
- (buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
+ (buffer-substring-no-properties (line-beginning-position)
(line-end-position))))))
(ert-deftest test-ob/org-babel-insert-result ()
"Test `org-babel-insert-result' specifications."
@@ -1156,32 +1156,32 @@ x
(org-babel-execute-maybe)
(should (string= inline-sb-res-dot
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))
+ (line-beginning-position) (line-end-position))))
;; Delete whitespace and result.
(org-babel-remove-inline-result)
(should (string= inline-sb-dot
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))
+ (line-beginning-position) (line-end-position))))
;; Add whitespace and result before dot.
(search-forward inline-sb)
(insert " " inline-res)
- (goto-char (point-at-bol))
+ (goto-char (line-beginning-position))
;; Remove whitespace and result.
(org-babel-remove-inline-result)
(should (string= inline-sb-dot
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol))))
+ (line-beginning-position) (line-end-position))))
;; Add whitespace before dot.
(search-forward inline-sb)
(insert " ")
- (goto-char (point-at-bol))
+ (goto-char (line-beginning-position))
;; Add result before whitespace.
(org-babel-execute-maybe)
;; Remove result - leave trailing whitespace and dot.
(org-babel-remove-inline-result)
(should (string= (concat inline-sb " .")
(buffer-substring-no-properties
- (point-at-bol) (point-at-eol)))))))
+ (line-beginning-position) (line-end-position)))))))
(ert-deftest test-ob/org-babel-remove-result--results-default ()
"Test `org-babel-remove-result' with default :results."
@@ -1338,7 +1338,7 @@ replacement happens correctly."
(forward-line)
(should (string= result
(buffer-substring-no-properties
- (point-at-bol)
+ (line-beginning-position)
(- (point-max) 16))))
(org-babel-previous-src-block) (org-babel-remove-result)
(should (string= buffer-text
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el
index 092d960f67..a3a526ba69 100644
--- a/testing/lisp/test-org-list.el
+++ b/testing/lisp/test-org-list.el
@@ -1054,7 +1054,7 @@ b. Item 2<point>"
"- item1\n - item1child\n- item2\n- item3\n- item4\n- item5\n"
(re-search-forward "item3")
(org-list-send-item (car (nth 0 (org-list-struct)))
- (point-at-bol) (org-list-struct))
+ (line-beginning-position) (org-list-struct))
(buffer-string))))
;; Delete
(should
@@ -1062,7 +1062,7 @@ b. Item 2<point>"
(org-test-with-temp-text
"- item1\n - item1child\n- item2\n- item3\n- item4\n- item5\n"
(re-search-forward "item3")
- (org-list-send-item (point-at-bol)
+ (org-list-send-item (line-beginning-position)
'delete (org-list-struct))
(buffer-string))))
;; Kill
@@ -1070,7 +1070,7 @@ b. Item 2<point>"
(org-test-with-temp-text
"- item1\n - item1child\n- item2\n- item3\n - item3child\n- item4\n-
item5\n"
(re-search-forward "item3")
- (org-list-send-item (point-at-bol)
+ (org-list-send-item (line-beginning-position)
'kill (org-list-struct))
(should (equal "- item1\n - item1child\n- item2\n- item4\n- item5\n"
(buffer-string)))
@@ -1507,8 +1507,8 @@ Line 2
(org-test-with-temp-text "- ccc\n- b\n- aa\n"
(org-sort-list nil ?f
(lambda ()
- (length (buffer-substring (point-at-bol)
- (point-at-eol))))
+ (length (buffer-substring (line-beginning-position)
+ (line-end-position))))
#'<)
(buffer-string))))
(should
@@ -1516,8 +1516,8 @@ Line 2
(org-test-with-temp-text "- ccc\n- b\n- aa\n"
(org-sort-list nil ?F
(lambda ()
- (length (buffer-substring (point-at-bol)
- (point-at-eol))))
+ (length (buffer-substring (line-beginning-position)
+ (line-end-position))))
#'<)
(buffer-string)))))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 9873b45f64..14800f617c 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -3908,8 +3908,8 @@ Foo Bar
(org-test-with-temp-text "\n* ccc\n* b\n* aa\n"
(org-sort-entries nil ?f
(lambda ()
- (length (buffer-substring (point-at-bol)
- (point-at-eol))))
+ (length (buffer-substring
(line-beginning-position)
+ (line-end-position))))
#'<)
(buffer-string))))
(should
@@ -3917,8 +3917,8 @@ Foo Bar
(org-test-with-temp-text "\n* ccc\n* b\n* aa\n"
(org-sort-entries nil ?F
(lambda ()
- (length (buffer-substring (point-at-bol)
- (point-at-eol))))
+ (length (buffer-substring
(line-beginning-position)
+ (line-end-position))))
#'<)
(buffer-string))))
;; Sort by TODO keyword.
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 347a6dd979..5f0e26c734 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -1882,7 +1882,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(goto-char (point-min))
(while (re-search-forward org-outline-regexp-bol nil t)
(delete-region
- (point-at-bol) (progn (forward-line) (point))))))))
+ (line-beginning-position) (progn (forward-line)
(point))))))))
(org-export-as (org-test-default-backend)))))))