todo-date-pattern
"\\( " diary-time-regexp "\\)?"
(regexp-quote todo-nondiary-end) "?")
- (line-end-position) t)
+ (pos-eol) t)
(forward-char)
(point)))
(start1 (save-excursion (funcall find-start)))
(let ((current-prefix-arg t) ; For todo-edit-item--header.
(get-date (lambda ()
(save-excursion
- (todo-date-string-matcher (line-end-position))
+ (todo-date-string-matcher (pos-eol))
(buffer-substring-no-properties (match-beginning 1)
(match-end 0))))))
(should (equal (funcall get-date) "Jan 1, 2020"))
(todo-test--insert-item item 1)
(re-search-forward (concat todo-date-string-start todo-date-pattern
(regexp-quote todo-nondiary-end) " ")
- (line-end-position) t)
+ (pos-eol) t)
(should (looking-at (regexp-quote (concat item0 "\n\t" item1)))))))
(ert-deftest todo-test-multiline-item-indentation-2 () ; bug#43068
(todo-edit-item--text 'multiline)
(insert (concat "\n" item1))
(todo-edit-quit)
- (goto-char (line-beginning-position))
+ (goto-char (pos-bol))
(should (looking-at (regexp-quote (concat item0 "\n\t" item1)))))))
(ert-deftest todo-test-multiline-item-indentation-3 ()
(item1 "Second line."))
(todo-edit-file)
(should (looking-at (regexp-quote item0)))
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(insert (concat "\n" item1))
(should-error (todo-edit-quit) :type 'user-error))))
(goto-char a)
- (let ((bss (buffer-substring-no-properties (point) (point-at-eol))))
+ (let ((bss (buffer-substring-no-properties (point) (pos-eol))))
(condition-case nil
(setq desired (read bss))
(error (setq desired (format " FAILED TO PARSE: %S"
)
fail)))
- (setq p nil a nil)
- (setq idx (1+ idx)))
+ (setq p nil a nil)
+ (setq idx (1+ idx)))
)
(when fail
(when (re-search-forward regex-p nil t)
(setq tag (semantic-current-tag))
(goto-char (match-end 0))
- (setq desired (read (buffer-substring (point) (point-at-eol))))
+ (setq desired (read (buffer-substring (point) (pos-eol))))
))
tag)
(when (re-search-forward regex-p nil t)
(goto-char (match-end 0))
(skip-syntax-backward "w")
- (setq desired (read (buffer-substring (point) (point-at-eol))))
+ (setq desired (read (buffer-substring (point) (pos-eol))))
(setq start (match-beginning 0))
(goto-char start)
(setq actual (semantic-symref-test-count-hits-in-tag))
(list
(format
"Symref id %d: No results." idx))
- fail))
+ fail))
)
(beginning-of-line)
(setq semantic-utest-last-kill-pos (point))
(setq semantic-utest-last-kill-text
- (buffer-substring (point) (point-at-eol)))
- (delete-region (point) (point-at-eol))
+ (buffer-substring (point) (pos-eol)))
+ (delete-region (point) (pos-eol))
(insert insertme)
(sit-for 0)
)
(defun semantic-utest-unkill-indicator ()
"Unkill the last indicator."
(goto-char semantic-utest-last-kill-pos)
- (delete-region (point) (point-at-eol))
+ (delete-region (point) (pos-eol))
(insert semantic-utest-last-kill-text)
(sit-for 0)
)
(save-excursion
(goto-char 1)
(forward-line 1)
- (- (point-at-eol) (point)))))
+ (- (pos-eol) (point)))))
orig-len len diff pos line-nb)
(make-directory subdir 'parents)
(with-current-buffer (dired-noselect subdir)
(forward-line 1)
(let ((inhibit-read-only t)
(new-header " test-bug27968"))
- (delete-region (point) (point-at-eol))
+ (delete-region (point) (pos-eol))
(when (= orig-len (length new-header))
;; Wow lucky guy! I must buy lottery today.
(setq new-header (concat new-header " :-)")))
;; Verify the form now spans multiple lines.
(let ((pos (point)))
(search-forward "number")
- (should-not (= pos (point-at-bol))))
+ (should-not (= pos (pos-bol))))
;; Collapse the form.
(backtrace-single-line)
;; Verify that the form is now back on one line,
;; and that point is at the same place.
(should (string= (backtrace-tests--get-substring
(- (point) 6) (point)) "number"))
- (should-not (= (point) (point-at-bol)))
+ (should-not (= (point) (pos-bol)))
(should (string= (backtrace-tests--get-substring
- (point-at-bol) (1+ (point-at-eol)))
+ (pos-bol) (1+ (pos-eol)))
line)))
(ert-deftest backtrace-tests--print-circle ()
(skip-chars-backward "\n")
(should (string-match-p
".join-line. is an alias for .delete-indentation."
- (buffer-substring
- (line-beginning-position)
- (point)))))))
+ (buffer-substring (pos-bol) (point)))))))
;; Avoid a byte-compilation warning that may confuse people reading
;; the result of the following test.
(erc-send-current-line)
(should (ring-p erc-input-ring))
(should (zerop (ring-member erc-input-ring "/one"))) ; equal
- (should (save-excursion (forward-line -1) (goto-char (point-at-bol))
+ (should (save-excursion (forward-line -1) (goto-char (pos-bol))
(looking-at-p "[*]+ echo: one")))
(should-not erc-input-ring-index)
(erc-bol)
(goto-char (point-min))
(search-forward "Version")
(search-forward "\r\n\r\n")
- (search-forward "myproxy.localhost:6667 >> PASS" (line-end-position))
+ (search-forward "myproxy.localhost:6667 >> PASS" (pos-eol))
(forward-line)
- (search-forward "irc.gnu.org << :irc.gnu.org 001" (line-end-position))
+ (search-forward "irc.gnu.org << :irc.gnu.org 001" (pos-eol))
(forward-line)
- (search-forward "irc.gnu.org << :irc.gnu.org 002" (line-end-position))
+ (search-forward "irc.gnu.org << :irc.gnu.org 002" (pos-eol))
(forward-line)
- (search-forward "FooNet << :irc.gnu.org 422" (line-end-position))
+ (search-forward "FooNet << :irc.gnu.org 422" (pos-eol))
(forward-line)
- (search-forward "BarNet << :irc.gnu.org 221" (line-end-position)))
+ (search-forward "BarNet << :irc.gnu.org 221" (pos-eol)))
(when noninteractive
(kill-buffer "*erc-protocol*")
(should-not erc-debug-irc-protocol)))
(setq-local parse-sexp-lookup-properties t)
(backward-sexp)
(should (string= "here's an opener "
- (buffer-substring-no-properties
- (line-beginning-position)
- (point))))
+ (buffer-substring-no-properties (pos-bol) (point))))
(forward-sexp)
(should (string= "and here's a closer )"
- (buffer-substring-no-properties
- (line-beginning-position)
- (point)))))
+ (buffer-substring-no-properties (pos-bol) (point)))))
(set-buffer-modified-p nil))))
(should (search-backward "done" nil t))
(should (string-match-p
" [0-9]\\{3,\\} good, 0 bad"
- (buffer-substring-no-properties (line-beginning-position)
- (line-end-position)))))))
+ (buffer-substring-no-properties (pos-bol) (pos-eol)))))))
;;; info-xref-tests.el ends here
(footnote-back-to-message)
(should (equal (buffer-substring (point-min) (point))
"hello[1]"))
- (should (equal (buffer-substring (point-min) (line-end-position))
+ (should (equal (buffer-substring (point-min) (pos-eol))
"hello[1][2] world"))))
(provide 'footnote-tests)
(insert "f-test-compl")
(completion-at-point)
(goto-char (point-min))
- (should (search-forward "f-test-complete-me" (line-end-position) t))
+ (should (search-forward "f-test-complete-me" (pos-eol) t))
(goto-char (point-min))
(should (string= (symbol-name (read (current-buffer)))
"elisp--foo-test-complete-me"))
end")
(f90-indent-line)
(should (equal " function foo"
- (buffer-substring (point) (line-end-position))))
+ (buffer-substring (point) (pos-eol))))
(goto-char (point-max))
(insert "\nmodule subroutine bar(x)
real :: x
end")
(f90-indent-line)
(should (equal " subroutine bar"
- (buffer-substring (point) (line-end-position))))))
+ (buffer-substring (point) (pos-eol))))))
;;; f90-tests.el ends here
"
(python-tests-look-at "- bar")
(should (eq (car (python-indent-context)) :inside-string))
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(python-tests-self-insert ",")
(should (= (current-indentation) 0))))
"
(python-tests-look-at "- bar'''")
(should (eq (car (python-indent-context)) :inside-string))
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(python-tests-self-insert ",")
(should (= (current-indentation) 0))))
def b()
"
(python-tests-look-at "def b()")
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(python-tests-self-insert ":")
(should (= (current-indentation) 0))))
outside
"
(python-tests-look-at "else")
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(python-tests-self-insert ":")
(should (= (current-indentation) 0))
(python-tests-look-at "outside")
that)
"
(python-tests-look-at "that)")
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(python-tests-self-insert ":")
(python-tests-look-at "elif" -1)
(should (= (current-indentation) 0))
else
"
(python-tests-look-at "else")
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(python-tests-self-insert ":")
(python-tests-look-at "else" -1)
(should (= (current-indentation) 4))))
(expected-mark-beginning-position
(progn
(python-tests-look-at "def __init__(self):")
- (1- (line-beginning-position))))
+ (1- (pos-bol))))
(expected-mark-end-position-1
(save-excursion
(python-tests-look-at "self.b = 'b'")
(progn
(python-tests-look-at "def fun(self):")
(python-tests-look-at "(self):")
- (1- (line-beginning-position))))
+ (1- (pos-bol))))
(expected-mark-end-position
(save-excursion
(python-tests-look-at "return self.b")
(let ((expected-mark-beginning-position
(progn
(python-tests-look-at "def foo(x):")
- (1- (line-beginning-position))))
+ (1- (pos-bol))))
(expected-mark-end-position (point-max)))
(python-tests-look-at "return bar")
(python-mark-defun 1)
(expected-mark-beginning-position
(progn
(python-tests-look-at "def ")
- (1- (line-beginning-position))))
+ (1- (pos-bol))))
(expected-mark-end-position
(save-excursion
(python-tests-look-at "return x")
(point))
(save-excursion
(python-tests-look-at "return wwrap")
- (line-beginning-position))))
+ (pos-bol))))
(should (= (save-excursion
(python-tests-look-at "def wrapped_f(*args):")
(python-nav-end-of-defun)
(point))
(save-excursion
(python-tests-look-at "return wrapped_f")
- (line-beginning-position))))
+ (pos-bol))))
(should (= (save-excursion
(python-tests-look-at "f(*args)")
(python-nav-end-of-defun)
(point))
(save-excursion
(python-tests-look-at "return wrapped_f")
- (line-beginning-position))))))
+ (pos-bol))))))
(ert-deftest python-nav-end-of-defun-3 ()
(python-tests-with-temp-buffer
(point))
(save-excursion
(python-tests-look-at "789")
- (line-end-position))))
+ (pos-eol))))
(python-tests-look-at "v2 =")
(should (= (save-excursion
(python-nav-end-of-statement)
(point))
(save-excursion
(python-tests-look-at "value4)")
- (line-end-position))))
+ (pos-eol))))
(python-tests-look-at "v3 =")
(should (= (save-excursion
(python-nav-end-of-statement)
(save-excursion
(python-tests-look-at
"'continue previous line')")
- (line-end-position))))
+ (pos-eol))))
(python-tests-look-at "v4 =")
(should (= (save-excursion
(python-nav-end-of-statement)
(point))
(save-excursion
(python-tests-look-at "return wrapped_f")
- (line-end-position))))
+ (pos-eol))))
(end-of-line)
(should (= (save-excursion
(python-nav-end-of-block)
(point))
(save-excursion
(python-tests-look-at "return wrapped_f")
- (line-end-position))))
+ (pos-eol))))
(python-tests-look-at "f(*args)")
(should (= (save-excursion
(python-nav-end-of-block)
(point))
(save-excursion
(python-tests-look-at "print 'After f(*args)'")
- (line-end-position))))))
+ (pos-eol))))))
(ert-deftest python-nav-end-of-block-2 ()
"Ensure that `python-nav-end-of-block' does not enter an infinite loop."
\tabcdefg
"
(python-tests-look-at "abcdefg")
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
- (line-beginning-position) (line-end-position))
+ (pos-bol) (pos-eol))
"\tabcdef")))))
(ert-deftest python-indent-dedent-line-backspace-3 ()
\t abcdefg
"
(python-tests-look-at "abcdefg")
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
- (line-beginning-position) (line-end-position))
+ (pos-bol) (pos-eol))
"\t abcdef"))
(back-to-indentation)
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
- (line-beginning-position) (line-end-position))
+ (pos-bol) (pos-eol))
"\tabcdef"))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
- (line-beginning-position) (line-end-position))
+ (pos-bol) (pos-eol))
" abcdef"))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
- (line-beginning-position) (line-end-position))
+ (pos-bol) (pos-eol))
"abcdef")))))
(ert-deftest python-bob-infloop-avoid ()
"
(python-tests-look-at "ap(xx")
(should (string= (python-eldoc--get-symbol-at-point) "map"))
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(should (string= (python-eldoc--get-symbol-at-point) "map"))
(python-tests-look-at "('somefile'")
(should (string= (python-eldoc--get-symbol-at-point) "map"))
- (goto-char (line-end-position))
+ (goto-char (pos-eol))
(should (string= (python-eldoc--get-symbol-at-point) "codecs.open"))))
(ert-deftest python-eldoc--get-symbol-at-point-2 ()
(should (not (python-info-beginning-of-statement-p)))
(python-tests-look-at "print (var_one)")
(should (python-info-beginning-of-statement-p))
- (goto-char (line-beginning-position))
+ (goto-char (pos-bol))
(should (not (python-info-beginning-of-statement-p)))))
(ert-deftest python-info-beginning-of-statement-p-2 ()
(should (not (python-info-beginning-of-statement-p)))
(python-tests-look-at "raise ValueError(")
(should (python-info-beginning-of-statement-p))
- (goto-char (line-beginning-position))
+ (goto-char (pos-bol))
(should (not (python-info-beginning-of-statement-p)))))
(ert-deftest python-info-end-of-statement-p-1 ()
(goto-char (point-min))
(should (string-match "\\`2 matches for \"and\" in buffer: "
(buffer-substring-no-properties
- (point) (line-end-position)))))))
+ (point) (pos-eol)))))))
(and (buffer-name temp-buffer)
(kill-buffer temp-buffer)))))
(goto-char (point-min))
(should (string-match "\\`2 matches for \"and\" in buffer: "
(buffer-substring-no-properties
- (point) (line-end-position)))))))
+ (point) (pos-eol)))))))
(and (buffer-name temp-buffer)
(kill-buffer temp-buffer)))))
;; Stay at BOB.
(forward-line -1)
(save-restriction
- (narrow-to-region (point) (line-end-position))
+ (narrow-to-region (point) (pos-eol))
(should-not (delete-indentation))
(should (equal (simple-test--buffer-substrings)
'("" . " second ")))
(should (equal (simple-test--buffer-substrings)
'(" first " . "")))
;; Single line.
- (should-not (delete-indentation
- nil (line-beginning-position) (1- (point))))
+ (should-not (delete-indentation nil (pos-bol) (1- (point))))
(should (equal (simple-test--buffer-substrings)
'("" . " first ")))
- (should-not (delete-indentation nil (1+ (point)) (line-end-position)))
+ (should-not (delete-indentation nil (1+ (point)) (pos-eol)))
(should (equal (simple-test--buffer-substrings)
'(" " . "first ")))
- (should-not (delete-indentation
- nil (line-beginning-position) (line-end-position)))
+ (should-not (delete-indentation nil (pos-bol) (pos-eol)))
(should (equal (simple-test--buffer-substrings)
'("" . " first ")))
;; Multiple lines.
(goto-char (point-max))
(insert "\n second \n third \n fourth ")
(goto-char (point-min))
- (should-not (delete-indentation
- nil (line-end-position) (line-beginning-position 2)))
+ (should-not (delete-indentation nil (pos-eol) (pos-bol 2)))
(should (equal (simple-test--buffer-substrings)
'(" first" . " second \n third \n fourth ")))
- (should-not (delete-indentation
- nil (point) (1+ (line-beginning-position 2))))
+ (should-not (delete-indentation nil (point) (1+ (pos-bol 2))))
(should (equal (simple-test--buffer-substrings)
'(" first second" . " third \n fourth ")))
;; Prefix argument overrides region.
(insert "a\nb\nc\nd\n")
(goto-char (point-min))
(forward-line (1- target-line))
- (narrow-to-region (line-beginning-position) (line-end-position))
+ (narrow-to-region (pos-bol) (pos-eol))
(should (equal (line-number-at-pos) 1))
(should (equal (line-number-at-pos nil t) target-line)))))
(insert "a\nb\nc\nd\n")
(goto-char (point-min))
(forward-line 2)
- (narrow-to-region (line-beginning-position) (line-end-position))
+ (narrow-to-region (pos-bol) (pos-eol))
(should (equal (line-number-at-pos) 1))
(line-number-at-pos nil t)
(should (equal (line-number-at-pos) 1))))
'css-selector)
(should-not (format "Didn't recognize %s as a selector"
(buffer-substring-no-properties
- (point) (line-end-position)))))))
+ (point) (pos-eol)))))))
;; Test many selectors.
(dolist (selector selectors)
(with-temp-buffer
'css-selector)
(should-not (format "Didn't recognize %s as a selector"
(buffer-substring-no-properties
- (point) (line-end-position)))))))
+ (point) (pos-eol)))))))
;; Test wrong separators.
(dolist (selector selectors)
(with-temp-buffer
'css-selector)
(should-not (format "Recognized %s as a selector"
(buffer-substring-no-properties
- (point) (line-end-position))))))))))
+ (point) (pos-eol))))))))))
(ert-deftest scss-mode-test-selectors ()
(let ((selectors
'css-selector)
(should-not (format "Didn't recognize %s as a selector"
(buffer-substring-no-properties
- (point) (line-end-position))))))))))
+ (point) (pos-eol))))))))))
(provide 'css-mode-tests)
(goto-char (point-min))
(search-forward "b")
(let* ((pos (point))
- (beg (line-beginning-position))
- (end (line-end-position))
+ (beg (pos-bol))
+ (end (pos-eol))
(fill-prefix (make-string (- pos beg) ?\s))
;; `fill-column' is too small to accommodate the current line
(fill-column (- end beg 10)))
(goto-char (point-min))
(search-forward "b")
(let* ((pos (point))
- (beg (line-beginning-position))
- (end (line-end-position))
+ (beg (pos-bol))
+ (end (pos-eol))
(fill-prefix (make-string (- pos beg) ?\s))
;; `fill-column' is too small to accommodate the current line
(fill-column (- end beg 10)))
(string-to-number line-limit1))))
(goto-char (point-min))
(if (> limit-number 0)
- (should (= search-limit (line-beginning-position
- (1+ limit-number))))
+ (should (= search-limit (pos-bol (1+ limit-number))))
(should (= search-limit (point-max))))
(goto-char (point-max))
(if (< limit-number 0)
- (should (= start (line-beginning-position
- (1+ limit-number))))
+ (should (= start (pos-bol (1+ limit-number))))
(should (= start (point-min)))))
(if (equal start1 "")
(should (equal ts-start time-stamp-start))
(save-excursion
(goto-char (point-max))
(skip-chars-backward "\n")
- (buffer-substring (line-beginning-position) (point)))))
+ (buffer-substring (pos-bol) (point)))))
(ert-deftest lread-tests--unescaped-char-literals ()
"Check that loading warns about unescaped character
(setq count (1+ count))))))))
(set-process-query-on-exit-flag proc nil)
(send-string proc "one\n")
- (while (not (equal (buffer-substring
- (line-beginning-position) (point-max))
+ (while (not (equal (buffer-substring (pos-bol) (point-max))
"1> "))
(accept-process-output proc)) ; Read "one".
(should (equal (buffer-string) "0> one\n1> "))
(accept-process-output proc 1)) ; Can't read "two" yet.
(should (equal (buffer-string) "0> one\n1> "))
(set-process-filter proc nil) ; Resume reading from proc.
- (while (not (equal (buffer-substring
- (line-beginning-position) (point-max))
+ (while (not (equal (buffer-substring (pos-bol) (point-max))
"2> "))
(accept-process-output proc)) ; Read "Two".
(should (equal (buffer-string) "0> one\n1> two\n2> "))))))
(delete-overlay ov))))))
(save-excursion
(goto-char (point-min))
- (let ((ov (make-overlay (line-beginning-position 2)
- (line-end-position 2))))
+ (let ((ov (make-overlay (pos-bol 2) (pos-eol 2))))
(overlay-put ov 'insert-in-front-hooks
(list overlay-modified)))))
- (kill-region (point-min) (line-beginning-position 2))
+ (kill-region (point-min) (pos-bol 2))
(undo-boundary)
(undo)))