Backport commit b7e867b84 from Emacs

Make point-at-eol and point-at-bol obsolete
b7e867b841f47dcff3aeaef9b5608a237386ce70
Stefan Kangas
Tue Aug 23 04:54:57 2022 +0200

[ km: This was independently covered on the main branch with
  e73c5b7d0.  I'm applying it here too for bookkeeping/traceability
  purposes. ]
This commit is contained in:
Stefan Kangas 2022-08-23 04:54:57 +02:00 committed by Kyle Meyer
parent 9c2bc2877f
commit c2c8e66e5d
19 changed files with 198 additions and 178 deletions

View File

@ -917,7 +917,7 @@ arguments and pop open the results in a preview buffer."
vals "")))))) vals ""))))))
(save-excursion (save-excursion
(goto-char begin) (goto-char begin)
(goto-char (point-at-eol)) (goto-char (line-end-position))
(unless (= (char-before (point)) ?\ ) (insert " ")) (unless (= (char-before (point)) ?\ ) (insert " "))
(insert ":" header-arg) (when value (insert " " value))))) (insert ":" header-arg) (when value (insert " " value)))))
@ -1936,9 +1936,9 @@ region is not active then the point is demarcated."
(let ((lang (nth 0 info)) (let ((lang (nth 0 info))
(indent (make-string (current-indentation) ?\s))) (indent (make-string (current-indentation) ?\s)))
(when (string-match "^[[:space:]]*$" (when (string-match "^[[:space:]]*$"
(buffer-substring (point-at-bol) (buffer-substring (line-beginning-position)
(point-at-eol))) (line-end-position)))
(delete-region (point-at-bol) (point-at-eol))) (delete-region (line-beginning-position) (line-end-position)))
(insert (concat (insert (concat
(if (looking-at "^") "" "\n") (if (looking-at "^") "" "\n")
indent (if upper-case-p "#+END_SRC\n" "#+end_src\n") indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")

View File

@ -312,7 +312,7 @@ LINENO is the number of the erroneous line."
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(forward-line (- lineNo 1)) (forward-line (- lineNo 1))
(buffer-substring (point) (point-at-eol))) (buffer-substring (point) (line-end-position)))
nil))) nil)))
(defun org-babel-lilypond-attempt-to-open-pdf (file-name &optional test) (defun org-babel-lilypond-attempt-to-open-pdf (file-name &optional test)

View File

@ -255,7 +255,7 @@ This removes initial blank and comment lines and then calls
(insert-file-contents file-name) (insert-file-contents file-name)
(re-search-forward "^[ \t]*[^# \t]" nil t) (re-search-forward "^[ \t]*[^# \t]" nil t)
(when (< (setq beg (point-min)) (when (< (setq beg (point-min))
(setq end (point-at-bol))) (setq end (line-beginning-position)))
(delete-region beg end))) (delete-region beg end)))
(org-babel-import-elisp-from-file temp-file '(16)))) (org-babel-import-elisp-from-file temp-file '(16))))

View File

@ -135,13 +135,13 @@ result is a cons of the filename and search string."
;; can we get a '::' part? ;; can we get a '::' part?
(if (string= erc-line (erc-prompt)) (if (string= erc-line (erc-prompt))
(progn (progn
(goto-char (point-at-bol)) (goto-char (line-beginning-position))
(when (search-backward-regexp "^[^ ]" nil t) (when (search-backward-regexp "^[^ ]" nil t)
(buffer-substring-no-properties (point-at-bol) (buffer-substring-no-properties (line-beginning-position)
(point-at-eol)))) (line-end-position))))
(when (search-backward erc-line nil t) (when (search-backward erc-line nil t)
(buffer-substring-no-properties (point-at-bol) (buffer-substring-no-properties (line-beginning-position)
(point-at-eol))))))) (line-end-position)))))))
(defun org-irc-erc-store-link () (defun org-irc-erc-store-link ()
"Store a link to the IRC log file or the session itself. "Store a link to the IRC log file or the session itself.
@ -151,7 +151,7 @@ the session itself."
(require 'erc-log) (require 'erc-log)
(if org-irc-link-to-logs (if org-irc-link-to-logs
(let* ((erc-line (buffer-substring-no-properties (let* ((erc-line (buffer-substring-no-properties
(point-at-bol) (point-at-eol))) (line-beginning-position) (line-end-position)))
(parsed-line (org-irc-erc-get-line-from-log erc-line))) (parsed-line (org-irc-erc-get-line-from-log erc-line)))
(if (erc-logging-enabled nil) (if (erc-logging-enabled nil)
(progn (progn

View File

@ -1481,7 +1481,7 @@ non-nil."
(let ((end (region-end))) (let ((end (region-end)))
(goto-char (region-beginning)) (goto-char (region-beginning))
(set-mark (point)) (set-mark (point))
(while (< (point-at-eol) end) (while (< (line-end-position) end)
(move-end-of-line 1) (activate-mark) (move-end-of-line 1) (activate-mark)
(let (current-prefix-arg) (let (current-prefix-arg)
(call-interactively 'org-store-link)) (call-interactively 'org-store-link))

View File

@ -2113,7 +2113,7 @@ in that string. If STRING is nil, it will be fetched from the beginning
of the current line." of the current line."
(declare (debug t)) (declare (debug t))
(org-with-gensyms (marker) (org-with-gensyms (marker)
`(let ((,marker (get-text-property (if ,string 0 (point-at-bol)) `(let ((,marker (get-text-property (if ,string 0 (line-beginning-position))
'org-hd-marker ,string))) 'org-hd-marker ,string)))
(with-current-buffer (marker-buffer ,marker) (with-current-buffer (marker-buffer ,marker)
(save-excursion (save-excursion
@ -3076,10 +3076,10 @@ s Search for keywords M Like m, but only TODO entries
(when (eq rmheader t) (when (eq rmheader t)
(org-goto-line 1) (org-goto-line 1)
(re-search-forward ":" nil t) (re-search-forward ":" nil t)
(delete-region (match-end 0) (point-at-eol)) (delete-region (match-end 0) (line-end-position))
(forward-char 1) (forward-char 1)
(looking-at "-+") (looking-at "-+")
(delete-region (match-end 0) (point-at-eol)) (delete-region (match-end 0) (line-end-position))
(move-marker header-end (match-end 0))) (move-marker header-end (match-end 0)))
(goto-char header-end) (goto-char header-end)
(delete-region (point) (point-max)) (delete-region (point) (point-max))
@ -3505,10 +3505,10 @@ This ensures the export commands can easily use it."
"Mark the line at POS as an agenda structure header." "Mark the line at POS as an agenda structure header."
(save-excursion (save-excursion
(goto-char pos) (goto-char pos)
(put-text-property (point-at-bol) (point-at-eol) (put-text-property (line-beginning-position) (line-end-position)
'org-agenda-structural-header t) 'org-agenda-structural-header t)
(when org-agenda-title-append (when org-agenda-title-append
(put-text-property (point-at-bol) (point-at-eol) (put-text-property (line-beginning-position) (line-end-position)
'org-agenda-title-append org-agenda-title-append)))) 'org-agenda-title-append org-agenda-title-append))))
(defvar org-mobile-creating-agendas) ; defined in org-mobile.el (defvar org-mobile-creating-agendas) ; defined in org-mobile.el
@ -3715,7 +3715,7 @@ removed from the entry content. Currently only `planning' is allowed here."
(while (not (eobp)) (while (not (eobp))
(unless (looking-at "[ \t]*$") (unless (looking-at "[ \t]*$")
(move-to-column ind) (move-to-column ind)
(delete-region (point-at-bol) (point))) (delete-region (line-beginning-position) (point)))
(beginning-of-line 2)) (beginning-of-line 2))
(run-hooks 'org-agenda-entry-text-cleanup-hook) (run-hooks 'org-agenda-entry-text-cleanup-hook)
@ -3987,7 +3987,7 @@ agenda display, configure `org-agenda-finalize-hook'."
(goto-char (point-min)) (goto-char (point-min))
(while (equal (forward-line) 0) (while (equal (forward-line) 0)
(when (setq mrk (get-text-property (point) 'org-hd-marker)) (when (setq mrk (get-text-property (point) 'org-hd-marker))
(put-text-property (point-at-bol) (point-at-eol) (put-text-property (line-beginning-position) (line-end-position)
'tags 'tags
(org-with-point-at mrk (org-with-point-at mrk
(org-get-tags)))))))) (org-get-tags))))))))
@ -4035,7 +4035,8 @@ agenda display, configure `org-agenda-finalize-hook'."
(goto-char s) (goto-char s)
(when (equal (org-get-at-bol 'org-hd-marker) (when (equal (org-get-at-bol 'org-hd-marker)
org-clock-hd-marker) org-clock-hd-marker)
(setq ov (make-overlay (point-at-bol) (1+ (point-at-eol)))) (setq ov (make-overlay (line-beginning-position)
(1+ (line-end-position))))
(overlay-put ov 'type 'org-agenda-clocking) (overlay-put ov 'type 'org-agenda-clocking)
(overlay-put ov 'face 'org-agenda-clocking) (overlay-put ov 'face 'org-agenda-clocking)
(overlay-put ov 'help-echo (overlay-put ov 'help-echo
@ -4066,7 +4067,7 @@ agenda display, configure `org-agenda-finalize-hook'."
b (match-beginning 1) b (match-beginning 1)
e (if (eq org-agenda-fontify-priorities 'cookies) e (if (eq org-agenda-fontify-priorities 'cookies)
(1+ (match-end 2)) (1+ (match-end 2))
(point-at-eol)) (line-end-position))
ov (make-overlay b e)) ov (make-overlay b e))
(overlay-put (overlay-put
ov 'face ov 'face
@ -4168,7 +4169,7 @@ A good way to set it is through options in `org-agenda-custom-commands'.")
"Throw to `:skip' in places that should be skipped. "Throw to `:skip' in places that should be skipped.
Also moves point to the end of the skipped region, so that search can Also moves point to the end of the skipped region, so that search can
continue from there." continue from there."
(let ((p (point-at-bol)) to) (let ((p (line-beginning-position)) to)
(when (or (when (or
(save-excursion (goto-char p) (looking-at comment-start-skip)) (save-excursion (goto-char p) (looking-at comment-start-skip))
(and org-agenda-skip-archived-trees (not org-agenda-archives-mode) (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
@ -4244,7 +4245,7 @@ This check for agenda markers in all agenda buffers currently active."
m org-agenda-entry-text-maxlines m org-agenda-entry-text-maxlines
org-agenda-entry-text-leaders)))) org-agenda-entry-text-leaders))))
(when (string-match "\\S-" txt) (when (string-match "\\S-" txt)
(setq o (make-overlay (point-at-bol) (point-at-eol))) (setq o (make-overlay (line-beginning-position) (line-end-position)))
(overlay-put o 'evaporate t) (overlay-put o 'evaporate t)
(overlay-put o 'org-overlay-type 'agenda-entry-content) (overlay-put o 'org-overlay-type 'agenda-entry-content)
(overlay-put o 'after-string txt)))) (overlay-put o 'after-string txt))))
@ -4749,7 +4750,7 @@ is active."
(forward-line -1) (forward-line -1)
(org-back-to-heading t))) (org-back-to-heading t)))
(skip-chars-forward "* ") (skip-chars-forward "* ")
(setq beg (point-at-bol) (setq beg (line-beginning-position)
beg1 (point) beg1 (point)
end (progn end (progn
(outline-next-heading) (outline-next-heading)
@ -4764,8 +4765,8 @@ is active."
(goto-char beg) (goto-char beg)
(org-agenda-skip) (org-agenda-skip)
(setq str (buffer-substring-no-properties (setq str (buffer-substring-no-properties
(point-at-bol) (line-beginning-position)
(if hdl-only (point-at-eol) end))) (if hdl-only (line-end-position) end)))
(mapc (lambda (wr) (when (string-match wr str) (mapc (lambda (wr) (when (string-match wr str)
(goto-char (1- end)) (goto-char (1- end))
(throw :skip t))) (throw :skip t)))
@ -4793,7 +4794,7 @@ is active."
txt (org-agenda-format-item txt (org-agenda-format-item
"" ""
(buffer-substring-no-properties (buffer-substring-no-properties
beg1 (point-at-eol)) beg1 (line-end-position))
level category tags t)) level category tags t))
(org-add-props txt props (org-add-props txt props
'org-marker marker 'org-hd-marker marker 'org-marker marker 'org-hd-marker marker
@ -5335,7 +5336,7 @@ each date. It also removes lines that contain only whitespace."
(abbreviate-file-name buffer-file-name)) (abbreviate-file-name buffer-file-name))
"") "")
'org-agenda-diary-link t 'org-agenda-diary-link t
'org-marker (org-agenda-new-marker (point-at-bol)))) 'org-marker (org-agenda-new-marker (line-beginning-position))))
(defun org-diary-default-entry () (defun org-diary-default-entry ()
"Add a dummy entry to the diary. "Add a dummy entry to the diary.
@ -5986,7 +5987,7 @@ then those holidays will be skipped."
clockp (not (or closedp statep)) clockp (not (or closedp statep))
state (and statep (match-string 2)) state (and statep (match-string 2))
category (org-get-category (match-beginning 0)) category (org-get-category (match-beginning 0))
timestr (buffer-substring (match-beginning 0) (point-at-eol))) timestr (buffer-substring (match-beginning 0) (line-end-position)))
(when (string-match "\\]" timestr) (when (string-match "\\]" timestr)
;; substring should only run to end of time stamp ;; substring should only run to end of time stamp
(setq rest (substring timestr (match-end 0)) (setq rest (substring timestr (match-end 0))
@ -6044,7 +6045,7 @@ then those holidays will be skipped."
'type type 'date date 'type type 'date date
'undone-face 'org-warning 'done-face 'org-agenda-done) 'undone-face 'org-warning 'done-face 'org-agenda-done)
(push txt ee)) (push txt ee))
(goto-char (point-at-eol)))) (goto-char (line-end-position))))
(nreverse ee))) (nreverse ee)))
(defun org-agenda-show-clocking-issues () (defun org-agenda-show-clocking-issues ()
@ -6081,7 +6082,7 @@ See also the user option `org-agenda-clock-consistency-checks'."
(setq issue "No valid clock line") (throw 'next t)) (setq issue "No valid clock line") (throw 'next t))
(org-with-point-at m (org-with-point-at m
(save-excursion (save-excursion
(goto-char (point-at-bol)) (goto-char (line-beginning-position))
(unless (looking-at re) (unless (looking-at re)
(error "No valid Clock line") (error "No valid Clock line")
(throw 'next t)) (throw 'next t))
@ -6127,7 +6128,7 @@ See also the user option `org-agenda-clock-consistency-checks'."
(setq tlend (or te tlend) tlstart (or ts tlstart)) (setq tlend (or te tlend) tlstart (or ts tlstart))
(when issue (when issue
;; OK, there was some issue, add an overlay to show the issue ;; OK, there was some issue, add an overlay to show the issue
(setq ov (make-overlay (point-at-bol) (point-at-eol))) (setq ov (make-overlay (line-beginning-position) (line-end-position)))
(overlay-put ov 'before-string (overlay-put ov 'before-string
(concat (concat
(org-add-props (org-add-props
@ -7147,7 +7148,10 @@ The optional argument TYPE tells the agenda type."
(save-excursion (save-excursion
(beginning-of-line 1) (beginning-of-line 1)
(setq re (org-get-at-bol 'org-todo-regexp)) (setq re (org-get-at-bol 'org-todo-regexp))
(goto-char (or (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) (point))) (goto-char (or (text-property-any (line-beginning-position)
(line-end-position)
'org-heading t)
(point)))
(when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +")) (when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +"))
(add-text-properties (match-beginning 0) (match-end 1) (add-text-properties (match-beginning 0) (match-end 1)
(list 'face (org-get-todo-face 1))) (list 'face (org-get-todo-face 1)))
@ -7428,7 +7432,7 @@ subtree."
(point) (point)
(if org-agenda-restriction-lock-highlight-subtree (if org-agenda-restriction-lock-highlight-subtree
(save-excursion (org-end-of-subtree t t) (point)) (save-excursion (org-end-of-subtree t t) (point))
(point-at-eol))) (line-end-position)))
(move-marker org-agenda-restrict-begin (point)) (move-marker org-agenda-restrict-begin (point))
(move-marker org-agenda-restrict-end (move-marker org-agenda-restrict-end
(save-excursion (org-end-of-subtree t t))) (save-excursion (org-end-of-subtree t t)))
@ -8254,8 +8258,8 @@ grouptags."
(defun org-agenda-filter-hide-line (type) (defun org-agenda-filter-hide-line (type)
"If current line is TYPE, hide it in the agenda buffer." "If current line is TYPE, hide it in the agenda buffer."
(let* (buffer-invisibility-spec (let* (buffer-invisibility-spec
(beg (max (point-min) (1- (point-at-bol)))) (beg (max (point-min) (1- (line-beginning-position))))
(end (point-at-eol))) (end (line-end-position)))
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(add-text-properties (add-text-properties
beg end `(invisible org-filtered org-filter-type ,type))))) beg end `(invisible org-filtered org-filter-type ,type)))))
@ -8887,7 +8891,7 @@ When called with a prefix argument, include all archive files as well."
(interactive "p") (interactive "p")
(let ((col (current-column))) (let ((col (current-column)))
(dotimes (_ n) (dotimes (_ n)
(when (next-single-property-change (point-at-eol) 'org-marker) (when (next-single-property-change (line-end-position) 'org-marker)
(move-end-of-line 1) (move-end-of-line 1)
(goto-char (next-single-property-change (point) 'org-marker)))) (goto-char (next-single-property-change (point) 'org-marker))))
(org-move-to-column col)) (org-move-to-column col))
@ -8945,7 +8949,8 @@ When called with a prefix argument, include all archive files as well."
(when (re-search-forward org-complex-heading-regexp nil t) (when (re-search-forward org-complex-heading-regexp nil t)
(goto-char (match-beginning 4))))) (goto-char (match-beginning 4)))))
(run-hooks 'org-agenda-after-show-hook) (run-hooks 'org-agenda-after-show-hook)
(and highlight (org-highlight (point-at-bol) (point-at-eol))))) (and highlight (org-highlight (line-beginning-position)
(line-end-position)))))
(defvar org-agenda-after-show-hook nil (defvar org-agenda-after-show-hook nil
"Normal hook run after an item has been shown from the agenda. "Normal hook run after an item has been shown from the agenda.
@ -8968,7 +8973,7 @@ deletes the agenda entry and don't move to the next entry."
(level (and (eq org-agenda-loop-over-headlines-in-active-region 'start-level) (level (and (eq org-agenda-loop-over-headlines-in-active-region 'start-level)
(org-get-at-bol 'level)))) (org-get-at-bol 'level))))
(while (< (point) mend) (while (< (point) mend)
(let ((ov (make-overlay (point) (point-at-eol)))) (let ((ov (make-overlay (point) (line-end-position))))
(if (not (or all (if (not (or all
(and match (looking-at-p match)) (and match (looking-at-p match))
(eq level (org-get-at-bol 'level)))) (eq level (org-get-at-bol 'level))))
@ -9013,8 +9018,8 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'."
(if (and (derived-mode-p 'org-mode) (not (member type '("sexp")))) (if (and (derived-mode-p 'org-mode) (not (member type '("sexp"))))
(setq dbeg (progn (org-back-to-heading t) (point)) (setq dbeg (progn (org-back-to-heading t) (point))
dend (org-end-of-subtree t t)) dend (org-end-of-subtree t t))
(setq dbeg (point-at-bol) (setq dbeg (line-beginning-position)
dend (min (point-max) (1+ (point-at-eol))))) dend (min (point-max) (1+ (line-end-position)))))
(goto-char dbeg) (goto-char dbeg)
(while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n))))) (while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
(when (or (eq t org-agenda-confirm-kill) (when (or (eq t org-agenda-confirm-kill)
@ -9113,7 +9118,8 @@ If this information is not given, the function uses the tree at point."
(>= p beg) (>= p beg)
(< p end)) (< p end))
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(delete-region (point-at-bol) (1+ (point-at-eol))))) (delete-region (line-beginning-position)
(1+ (line-end-position)))))
(beginning-of-line 0)))))) (beginning-of-line 0))))))
(defun org-agenda-refile (&optional goto rfloc no-update) (defun org-agenda-refile (&optional goto rfloc no-update)
@ -9162,7 +9168,8 @@ It also looks at the text of the entry itself."
(let* ((marker (or (org-get-at-bol 'org-hd-marker) (let* ((marker (or (org-get-at-bol 'org-hd-marker)
(org-get-at-bol 'org-marker))) (org-get-at-bol 'org-marker)))
(buffer (and marker (marker-buffer marker))) (buffer (and marker (marker-buffer marker)))
(prefix (buffer-substring (point-at-bol) (point-at-eol))) (prefix (buffer-substring (line-beginning-position)
(line-end-position)))
(lkall (and buffer (org-offer-links-in-entry (lkall (and buffer (org-offer-links-in-entry
buffer marker arg prefix))) buffer marker arg prefix)))
(lk0 (car lkall)) (lk0 (car lkall))
@ -9295,7 +9302,7 @@ if it was hidden in the outline."
(let ((win (selected-window))) (let ((win (selected-window)))
(org-agenda-goto t) (org-agenda-goto t)
(org-back-to-heading) (org-back-to-heading)
(set-window-start (selected-window) (point-at-bol)) (set-window-start (selected-window) (line-beginning-position))
(cond (cond
((= more 0) ((= more 0)
(org-flag-subtree t) (org-flag-subtree t)
@ -9532,7 +9539,8 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
(with-current-buffer (marker-buffer hdmarker) (with-current-buffer (marker-buffer hdmarker)
(org-with-wide-buffer (org-with-wide-buffer
(org-agenda-format-item extra newhead level cat tags dotime)))) (org-agenda-format-item extra newhead level cat tags dotime))))
;; pl (text-property-any (point-at-bol) (point-at-eol) 'org-heading t) ;; pl (text-property-any (line-beginning-position)
;; (line-end-position) 'org-heading t)
undone-face (org-get-at-bol 'undone-face) undone-face (org-get-at-bol 'undone-face)
done-face (org-get-at-bol 'done-face)) done-face (org-get-at-bol 'done-face))
(beginning-of-line 1) (beginning-of-line 1)
@ -9549,10 +9557,11 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
(replace-match new t t) (replace-match new t t)
(beginning-of-line) (beginning-of-line)
(when mark (move-overlay mark (point) (+ 2 (point))))) (when mark (move-overlay mark (point) (+ 2 (point)))))
(add-text-properties (point-at-bol) (point-at-eol) props) (add-text-properties (line-beginning-position)
(line-end-position) props)
(when fixface (when fixface
(add-text-properties (add-text-properties
(point-at-bol) (point-at-eol) (line-beginning-position) (line-end-position)
(list 'face (list 'face
(if org-last-todo-state-is-todo (if org-last-todo-state-is-todo
undone-face done-face)))) undone-face done-face))))
@ -9560,7 +9569,7 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags."
(beginning-of-line 1)) (beginning-of-line 1))
(t (error "Line update did not work"))) (t (error "Line update did not work")))
(save-restriction (save-restriction
(narrow-to-region (point-at-bol) (point-at-eol)) (narrow-to-region (line-beginning-position) (line-end-position))
(org-agenda-finalize))) (org-agenda-finalize)))
(beginning-of-line 0))))) (beginning-of-line 0)))))
@ -9791,7 +9800,8 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(setq arg (- today cdate)))) (setq arg (- today cdate))))
(org-timestamp-change arg (or what 'day)) (org-timestamp-change arg (or what 'day))
(when (and (org-at-date-range-p) (when (and (org-at-date-range-p)
(re-search-backward org-tr-regexp-both (point-at-bol))) (re-search-backward org-tr-regexp-both
(line-beginning-position)))
(let ((end org-last-changed-timestamp)) (let ((end org-last-changed-timestamp))
(org-timestamp-change arg (or what 'day)) (org-timestamp-change arg (or what 'day))
(setq org-last-changed-timestamp (setq org-last-changed-timestamp
@ -9846,7 +9856,7 @@ When called programmatically, FORCE-DIRECTION can be `set', `up',
(length stamp)) (length stamp))
t) t)
(add-text-properties (add-text-properties
(1- (point)) (point-at-eol) (1- (point)) (line-end-position)
(list 'display (org-add-props stamp nil (list 'display (org-add-props stamp nil
'face '(secondary-selection default)))) 'face '(secondary-selection default))))
(beginning-of-line 1)) (beginning-of-line 1))
@ -9990,13 +10000,13 @@ buffer, display it in another window."
(if (equal (buffer-name) "*Calendar*") (if (equal (buffer-name) "*Calendar*")
(setq d1 (calendar-cursor-to-date t) (setq d1 (calendar-cursor-to-date t)
d2 (car calendar-mark-ring)) d2 (car calendar-mark-ring))
(setq dp1 (get-text-property (point-at-bol) 'day)) (setq dp1 (get-text-property (line-beginning-position) 'day))
(unless dp1 (user-error "No date defined in current line")) (unless dp1 (user-error "No date defined in current line"))
(setq d1 (calendar-gregorian-from-absolute dp1) (setq d1 (calendar-gregorian-from-absolute dp1)
d2 (and (ignore-errors (mark)) d2 (and (ignore-errors (mark))
(save-excursion (save-excursion
(goto-char (mark)) (goto-char (mark))
(setq dp2 (get-text-property (point-at-bol) 'day))) (setq dp2 (get-text-property (line-beginning-position) 'day)))
(calendar-gregorian-from-absolute dp2)))) (calendar-gregorian-from-absolute dp2))))
(message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree") (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree")
(setq char (read-char-exclusive)) (setq char (read-char-exclusive))
@ -10319,7 +10329,7 @@ This is a command that has to be installed in `calendar-mode-map'."
(defun org-agenda-bulk-marked-p () (defun org-agenda-bulk-marked-p ()
"Non-nil when current entry is marked for bulk action." "Non-nil when current entry is marked for bulk action."
(eq (get-char-property (point-at-bol) 'type) (eq (get-char-property (line-beginning-position) 'type)
'org-marked-entry-overlay)) 'org-marked-entry-overlay))
(defun org-agenda-bulk-mark (&optional arg) (defun org-agenda-bulk-mark (&optional arg)
@ -10344,7 +10354,8 @@ When ARG is greater than one mark ARG lines."
(unless (org-agenda-bulk-marked-p) (unless (org-agenda-bulk-marked-p)
(unless m (user-error "Nothing to mark at point")) (unless m (user-error "Nothing to mark at point"))
(push m org-agenda-bulk-marked-entries) (push m org-agenda-bulk-marked-entries)
(setq ov (make-overlay (point-at-bol) (+ 2 (point-at-bol)))) (setq ov (make-overlay (line-beginning-position)
(+ 2 (line-beginning-position))))
(org-overlay-display ov (concat org-agenda-bulk-mark-char " ") (org-overlay-display ov (concat org-agenda-bulk-mark-char " ")
(org-get-todo-face "TODO") (org-get-todo-face "TODO")
'evaporate) 'evaporate)
@ -10388,7 +10399,7 @@ When ARG is greater than one mark ARG lines."
(org-agenda-bulk-unmark-all) (org-agenda-bulk-unmark-all)
(cond ((org-agenda-bulk-marked-p) (cond ((org-agenda-bulk-marked-p)
(org-agenda-bulk-remove-overlays (org-agenda-bulk-remove-overlays
(point-at-bol) (+ 2 (point-at-bol))) (line-beginning-position) (+ 2 (line-beginning-position)))
(setq org-agenda-bulk-marked-entries (setq org-agenda-bulk-marked-entries
(delete (org-get-at-bol 'org-hd-marker) (delete (org-get-at-bol 'org-hd-marker)
org-agenda-bulk-marked-entries)) org-agenda-bulk-marked-entries))
@ -10768,8 +10779,8 @@ tag and note")))))
(message "Entry unflagged"))) (message "Entry unflagged")))
(defun org-agenda-get-any-marker (&optional pos) (defun org-agenda-get-any-marker (&optional pos)
(or (get-text-property (or pos (point-at-bol)) 'org-hd-marker) (or (get-text-property (or pos (line-beginning-position)) 'org-hd-marker)
(get-text-property (or pos (point-at-bol)) 'org-marker))) (get-text-property (or pos (line-beginning-position)) 'org-marker)))
;;; Appointment reminders ;;; Appointment reminders

View File

@ -1447,7 +1447,7 @@ Of course, if exact position has been required, just put it there."
(if (org-at-table-p) (if (org-at-table-p)
(save-excursion (save-excursion
(org-table-goto-line (nth 1 where)) (org-table-goto-line (nth 1 where))
(point-at-bol)) (line-beginning-position))
(point)))))) (point))))))
(with-current-buffer (buffer-base-buffer (current-buffer)) (with-current-buffer (buffer-base-buffer (current-buffer))
(org-with-point-at pos (org-with-point-at pos

View File

@ -1317,7 +1317,7 @@ the default behavior."
;; Clock in at which position? ;; Clock in at which position?
(setq target-pos (setq target-pos
(if (and (eobp) (not (org-at-heading-p))) (if (and (eobp) (not (org-at-heading-p)))
(point-at-bol 0) (line-beginning-position 0)
(point))) (point)))
(save-excursion (save-excursion
(when (and selected-task (marker-buffer selected-task)) (when (and selected-task (marker-buffer selected-task))
@ -1666,7 +1666,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
(setq ts (match-string 2)) (setq ts (match-string 2))
(if fail-quietly (throw 'exit nil) (error "Clock start time is gone"))) (if fail-quietly (throw 'exit nil) (error "Clock start time is gone")))
(goto-char (match-end 0)) (goto-char (match-end 0))
(delete-region (point) (point-at-eol)) (delete-region (point) (line-end-position))
(insert "--") (insert "--")
(setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
(setq s (org-time-convert-to-integer (setq s (org-time-convert-to-integer
@ -1804,7 +1804,7 @@ Optional argument N tells to change by that many units."
(goto-char org-clock-marker) (goto-char org-clock-marker)
(if (looking-back (concat "^[ \t]*" org-clock-string ".*") (if (looking-back (concat "^[ \t]*" org-clock-string ".*")
(line-beginning-position)) (line-beginning-position))
(progn (delete-region (1- (point-at-bol)) (point-at-eol)) (progn (delete-region (1- (line-beginning-position)) (line-end-position))
(org-remove-empty-drawer-at (point))) (org-remove-empty-drawer-at (point)))
(message "Clock gone, cancel the timer anyway") (message "Clock gone, cancel the timer anyway")
(sit-for 2))) (sit-for 2)))
@ -1946,7 +1946,7 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(aset ltimes l (+ (aref ltimes l) t1)))) (aset ltimes l (+ (aref ltimes l) t1))))
(setq time (aref ltimes level)) (setq time (aref ltimes level))
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
(put-text-property (point) (point-at-eol) (put-text-property (point) (line-end-position)
(or propname :org-clock-minutes) time) (or propname :org-clock-minutes) time)
(when headline-filter (when headline-filter
(save-excursion (save-excursion
@ -2114,7 +2114,7 @@ fontified, and then returned."
(forward-line 2) (forward-line 2)
(buffer-substring (point) (progn (buffer-substring (point) (progn
(re-search-forward "^[ \t]*#\\+END" nil t) (re-search-forward "^[ \t]*#\\+END" nil t)
(point-at-bol))))) (line-beginning-position)))))
;;;###autoload ;;;###autoload
(defun org-clock-report (&optional arg) (defun org-clock-report (&optional arg)
@ -2390,7 +2390,7 @@ the currently selected interval size."
(setq n (prefix-numeric-value n)) (setq n (prefix-numeric-value n))
(and (memq dir '(left down)) (setq n (- n))) (and (memq dir '(left down)) (setq n (- n)))
(save-excursion (save-excursion
(goto-char (point-at-bol)) (goto-char (line-beginning-position))
(if (not (looking-at "^[ \t]*#\\+BEGIN:[ \t]+clocktable\\>.*?:block[ \t]+\\(\\S-+\\)")) (if (not (looking-at "^[ \t]*#\\+BEGIN:[ \t]+clocktable\\>.*?:block[ \t]+\\(\\S-+\\)"))
(user-error "Line needs a :block definition before this command works") (user-error "Line needs a :block definition before this command works")
(let* ((b (match-beginning 1)) (e (match-end 1)) (let* ((b (match-beginning 1)) (e (match-end 1))
@ -3030,7 +3030,7 @@ Otherwise, return nil."
((not (match-end 2)) ((not (match-end 2))
(when (and (equal (marker-buffer org-clock-marker) (current-buffer)) (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
(> org-clock-marker (point)) (> org-clock-marker (point))
(<= org-clock-marker (point-at-eol))) (<= org-clock-marker (line-end-position)))
;; The clock is running here ;; The clock is running here
(setq org-clock-start-time (setq org-clock-start-time
(org-time-string-to-time (match-string 1))) (org-time-string-to-time (match-string 1)))

View File

@ -1028,7 +1028,7 @@ To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
(require 'org-agenda) (require 'org-agenda)
(let (p m tp np dir txt) (let (p m tp np dir txt)
(cond (cond
((setq p (text-property-any (point-at-bol) (point-at-eol) ((setq p (text-property-any (line-beginning-position) (line-end-position)
'org-imenu t)) 'org-imenu t))
(setq m (get-text-property p 'org-imenu-marker)) (setq m (get-text-property p 'org-imenu-marker))
(with-current-buffer (marker-buffer m) (with-current-buffer (marker-buffer m)
@ -1038,7 +1038,7 @@ To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
(overlays-at (point)))) (overlays-at (point))))
(org-agenda-remove-restriction-lock 'noupdate) (org-agenda-remove-restriction-lock 'noupdate)
(org-agenda-set-restriction-lock 'subtree)))) (org-agenda-set-restriction-lock 'subtree))))
((setq p (text-property-any (point-at-bol) (point-at-eol) ((setq p (text-property-any (line-beginning-position) (line-end-position)
'speedbar-function 'speedbar-find-file)) 'speedbar-function 'speedbar-find-file))
(setq tp (previous-single-property-change (setq tp (previous-single-property-change
(1+ p) 'speedbar-function) (1+ p) 'speedbar-function)
@ -1055,7 +1055,7 @@ To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
(org-agenda-set-restriction-lock 'file))) (org-agenda-set-restriction-lock 'file)))
(t (user-error "Don't know how to restrict Org mode agenda"))) (t (user-error "Don't know how to restrict Org mode agenda")))
(move-overlay org-speedbar-restriction-lock-overlay (move-overlay org-speedbar-restriction-lock-overlay
(point-at-bol) (point-at-eol)) (line-beginning-position) (line-end-position))
(setq current-prefix-arg nil) (setq current-prefix-arg nil)
(org-agenda-maybe-redo))) (org-agenda-maybe-redo)))

View File

@ -2205,7 +2205,7 @@ CDR is a plist containing `:key', `:value', `:begin', `:end',
(key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):") (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):")
(upcase (match-string-no-properties 1)))) (upcase (match-string-no-properties 1))))
(value (org-trim (buffer-substring-no-properties (value (org-trim (buffer-substring-no-properties
(match-end 0) (point-at-eol)))) (match-end 0) (line-end-position))))
(pos-before-blank (progn (forward-line) (point))) (pos-before-blank (progn (forward-line) (point)))
(end (progn (skip-chars-forward " \r\t\n" limit) (end (progn (skip-chars-forward " \r\t\n" limit)
(if (eobp) (point) (line-beginning-position))))) (if (eobp) (point) (line-beginning-position)))))
@ -4273,7 +4273,7 @@ This function assumes that current major mode is `org-mode'."
(goto-char (point-min)) (goto-char (point-min))
(org-skip-whitespace) (org-skip-whitespace)
(org-element--parse-elements (org-element--parse-elements
(point-at-bol) (point-max) (line-beginning-position) (point-max)
;; Start in `first-section' mode so text before the first ;; Start in `first-section' mode so text before the first
;; headline belongs to a section. ;; headline belongs to a section.
'first-section nil granularity visible-only (list 'org-data nil)))) 'first-section nil granularity visible-only (list 'org-data nil))))
@ -6207,12 +6207,12 @@ end of ELEM-A."
(end-A (save-excursion (end-A (save-excursion
(goto-char (org-element-property :end elem-A)) (goto-char (org-element-property :end elem-A))
(skip-chars-backward " \r\t\n") (skip-chars-backward " \r\t\n")
(point-at-eol))) (line-end-position)))
(beg-B (org-element-property :begin elem-B)) (beg-B (org-element-property :begin elem-B))
(end-B (save-excursion (end-B (save-excursion
(goto-char (org-element-property :end elem-B)) (goto-char (org-element-property :end elem-B))
(skip-chars-backward " \r\t\n") (skip-chars-backward " \r\t\n")
(point-at-eol))) (line-end-position)))
;; Store inner overlays responsible for visibility status. ;; Store inner overlays responsible for visibility status.
;; We also need to store their boundaries as they will be ;; We also need to store their boundaries as they will be
;; removed from buffer. ;; removed from buffer.

View File

@ -426,7 +426,7 @@ current time."
(moment (org-time-subtract nil (moment (org-time-subtract nil
(* 3600 org-extend-today-until)))) (* 3600 org-extend-today-until))))
(save-excursion (save-excursion
(goto-char (if line (point-at-bol) (point-min))) (goto-char (if line (line-beginning-position) (point-min)))
(while (not (eobp)) (while (not (eobp))
(let ((habit (get-text-property (point) 'org-habit-p)) (let ((habit (get-text-property (point) 'org-habit-p))
(invisible-prop (get-text-property (point) 'invisible))) (invisible-prop (get-text-property (point) 'invisible)))

View File

@ -238,7 +238,7 @@ going below `org-inlinetask-min-level'."
(setq beg (point)) (setq beg (point))
(replace-match down-task nil t nil 1) (replace-match down-task nil t nil 1)
(org-inlinetask-goto-end) (org-inlinetask-goto-end)
(if (and (eobp) (looking-back "END\\s-*" (point-at-bol))) (if (and (eobp) (looking-back "END\\s-*" (line-beginning-position)))
(beginning-of-line) (beginning-of-line)
(forward-line -1)) (forward-line -1))
(unless (= (point) beg) (unless (= (point) beg)
@ -264,7 +264,7 @@ If the task has an end part, also demote it."
(setq beg (point)) (setq beg (point))
(replace-match down-task nil t nil 1) (replace-match down-task nil t nil 1)
(org-inlinetask-goto-end) (org-inlinetask-goto-end)
(if (and (eobp) (looking-back "END\\s-*" (point-at-bol))) (if (and (eobp) (looking-back "END\\s-*" (line-beginning-position)))
(beginning-of-line) (beginning-of-line)
(forward-line -1)) (forward-line -1))
(unless (= (point) beg) (unless (= (point) beg)
@ -312,7 +312,7 @@ If the task has an end part, also demote it."
(if (bolp) (1- (point)) (point)))) (if (bolp) (1- (point)) (point))))
(start (save-excursion (start (save-excursion
(org-inlinetask-goto-beginning) (org-inlinetask-goto-beginning)
(point-at-eol)))) (line-end-position))))
(cond (cond
;; Nothing to show/hide. ;; Nothing to show/hide.
((= end start)) ((= end start))

View File

@ -517,7 +517,7 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
(and (not (looking-at beg-re)) (and (not (looking-at beg-re))
(not (looking-at end-re)) (not (looking-at end-re))
(setq beg (and (re-search-backward beg-re lim-up t) (setq beg (and (re-search-backward beg-re lim-up t)
(1+ (point-at-eol)))) (1+ (line-end-position))))
(setq end (or (and (re-search-forward end-re lim-down t) (setq end (or (and (re-search-forward end-re lim-down t)
(1- (match-beginning 0))) (1- (match-beginning 0)))
lim-down)) lim-down))
@ -528,12 +528,12 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
(when (save-excursion (when (save-excursion
(and (not (looking-at block-re)) (and (not (looking-at block-re))
(setq beg (and (re-search-backward block-re lim-up t) (setq beg (and (re-search-backward block-re lim-up t)
(1+ (point-at-eol)))) (1+ (line-end-position))))
(looking-at "^[ \t]*#\\+begin_\\(\\S-+\\)") (looking-at "^[ \t]*#\\+begin_\\(\\S-+\\)")
(setq type (downcase (match-string 1))) (setq type (downcase (match-string 1)))
(goto-char beg) (goto-char beg)
(setq end (or (and (re-search-forward block-re lim-down t) (setq end (or (and (re-search-forward block-re lim-down t)
(1- (point-at-bol))) (1- (line-beginning-position)))
lim-down)) lim-down))
(>= end pos) (>= end pos)
(equal (downcase (match-string 1)) "end"))) (equal (downcase (match-string 1)) "end")))
@ -547,7 +547,7 @@ Contexts `block' and `invalid' refer to `org-list-forbidden-blocks'."
(end-re (concat beg-re "END[ \t]*$"))) (end-re (concat beg-re "END[ \t]*$")))
(and (not (looking-at "^\\*+")) (and (not (looking-at "^\\*+"))
(setq beg (and (re-search-backward beg-re lim-up t) (setq beg (and (re-search-backward beg-re lim-up t)
(1+ (point-at-eol)))) (1+ (line-end-position))))
(not (looking-at end-re)) (not (looking-at end-re))
(setq end (and (re-search-forward end-re lim-down t) (setq end (and (re-search-forward end-re lim-down t)
(1- (match-beginning 0)))) (1- (match-beginning 0))))
@ -569,7 +569,7 @@ values are:
6. position at item end. 6. position at item end.
Thus the following list, where numbers in parens are Thus the following list, where numbers in parens are
point-at-bol: line-beginning-position:
- [X] first item (1) - [X] first item (1)
1. sub-item 1 (18) 1. sub-item 1 (18)
@ -617,7 +617,7 @@ Assume point is at an item."
;; Ensure list ends at the first blank line. ;; Ensure list ends at the first blank line.
(lambda () (lambda ()
(skip-chars-backward " \r\t\n") (skip-chars-backward " \r\t\n")
(min (1+ (point-at-eol)) lim-down)))) (min (1+ (line-end-position)) lim-down))))
;; 1. Read list from starting item to its beginning, and save ;; 1. Read list from starting item to its beginning, and save
;; top item position and indentation in BEG-CELL. Also store ;; top item position and indentation in BEG-CELL. Also store
;; ending position of items in END-LST. ;; ending position of items in END-LST.
@ -872,7 +872,7 @@ Point returned is at end of line."
(save-excursion (save-excursion
(goto-char (org-list-get-item-end item struct)) (goto-char (org-list-get-item-end item struct))
(skip-chars-backward " \r\t\n") (skip-chars-backward " \r\t\n")
(point-at-eol))) (line-end-position)))
(defun org-list-get-parent (item struct parents) (defun org-list-get-parent (item struct parents)
"Return parent of ITEM or nil. "Return parent of ITEM or nil.
@ -1182,7 +1182,7 @@ some heuristics to guess the result."
(lambda () (lambda ()
;; Count blank lines above beginning of line. ;; Count blank lines above beginning of line.
(save-excursion (save-excursion
(count-lines (goto-char (point-at-bol)) (count-lines (goto-char (line-beginning-position))
(progn (skip-chars-backward " \r\t\n") (progn (skip-chars-backward " \r\t\n")
(forward-line) (forward-line)
(point))))))) (point)))))))
@ -1287,7 +1287,7 @@ This function modifies STRUCT."
;; must be removed, or they will be left, stacking up ;; must be removed, or they will be left, stacking up
;; after the list. ;; after the list.
(when (< item-end pos) (when (< item-end pos)
(delete-region (1- item-end) (point-at-eol))) (delete-region (1- item-end) (line-end-position)))
(skip-chars-backward " \r\t\n") (skip-chars-backward " \r\t\n")
;; Cut position is after any blank on the line. ;; Cut position is after any blank on the line.
(save-excursion (save-excursion
@ -1364,7 +1364,7 @@ STRUCT is the list structure."
(save-excursion (save-excursion
(goto-char item) (goto-char item)
(skip-chars-backward " \r\t\n") (skip-chars-backward " \r\t\n")
(min (1+ (point-at-eol)) (point-max))) (min (1+ (line-end-position)) (point-max)))
item))) item)))
;; Remove item from buffer. ;; Remove item from buffer.
(delete-region beg end) (delete-region beg end)
@ -1441,7 +1441,7 @@ This function returns, destructively, the new list structure."
(setq dest (org-list-get-list-end item struct prevs)) (setq dest (org-list-get-list-end item struct prevs))
(save-excursion (save-excursion
(goto-char (org-list-get-last-item item struct prevs)) (goto-char (org-list-get-last-item item struct prevs))
(point-at-eol))) (line-end-position)))
((and (stringp dest) (string-match-p "\\`[0-9]+\\'" dest)) ((and (stringp dest) (string-match-p "\\`[0-9]+\\'" dest))
(let* ((all (org-list-get-all-items item struct prevs)) (let* ((all (org-list-get-all-items item struct prevs))
(len (length all)) (len (length all))
@ -1453,7 +1453,7 @@ This function returns, destructively, the new list structure."
(save-excursion (save-excursion
(goto-char (goto-char
(org-list-get-last-item item struct prevs)) (org-list-get-last-item item struct prevs))
(point-at-eol))))) (line-end-position)))))
(t dest))) (t dest)))
(org-M-RET-may-split-line nil) (org-M-RET-may-split-line nil)
;; Store inner overlays (to preserve visibility). ;; Store inner overlays (to preserve visibility).
@ -1880,7 +1880,7 @@ Initial position of cursor is restored after the changes."
(insert (concat new-box (unless counterp " ")))))) (insert (concat new-box (unless counterp " "))))))
;; c. Indent item to appropriate column. ;; c. Indent item to appropriate column.
(unless (= new-ind old-ind) (unless (= new-ind old-ind)
(delete-region (goto-char (point-at-bol)) (delete-region (goto-char (line-beginning-position))
(progn (skip-chars-forward " \t") (point))) (progn (skip-chars-forward " \t") (point)))
(indent-to new-ind)))))) (indent-to new-ind))))))
;; 1. First get list of items and position endings. We maintain ;; 1. First get list of items and position endings. We maintain
@ -2010,7 +2010,7 @@ Sublists of the list are skipped. Cursor is always at the
beginning of the item." beginning of the item."
(let* ((struct (org-list-struct)) (let* ((struct (org-list-struct))
(prevs (org-list-prevs-alist struct)) (prevs (org-list-prevs-alist struct))
(item (copy-marker (point-at-bol))) (item (copy-marker (line-beginning-position)))
(all (org-list-get-all-items (marker-position item) struct prevs)) (all (org-list-get-all-items (marker-position item) struct prevs))
(value init-value)) (value init-value))
(dolist (e (nreverse all)) (dolist (e (nreverse all))
@ -2147,10 +2147,10 @@ the item, so this really moves item trees."
(interactive) (interactive)
(unless (org-at-item-p) (error "Not at an item")) (unless (org-at-item-p) (error "Not at an item"))
(let* ((col (current-column)) (let* ((col (current-column))
(item (point-at-bol)) (item (line-beginning-position))
(struct (org-list-struct)) (struct (org-list-struct))
(prevs (org-list-prevs-alist struct)) (prevs (org-list-prevs-alist struct))
(next-item (org-list-get-next-item (point-at-bol) struct prevs))) (next-item (org-list-get-next-item (line-beginning-position) struct prevs)))
(unless (or next-item org-list-use-circular-motion) (unless (or next-item org-list-use-circular-motion)
(user-error "Cannot move this item further down")) (user-error "Cannot move this item further down"))
(if (not next-item) (if (not next-item)
@ -2168,10 +2168,10 @@ the item, so this really moves item trees."
(interactive) (interactive)
(unless (org-at-item-p) (error "Not at an item")) (unless (org-at-item-p) (error "Not at an item"))
(let* ((col (current-column)) (let* ((col (current-column))
(item (point-at-bol)) (item (line-beginning-position))
(struct (org-list-struct)) (struct (org-list-struct))
(prevs (org-list-prevs-alist struct)) (prevs (org-list-prevs-alist struct))
(prev-item (org-list-get-prev-item (point-at-bol) struct prevs))) (prev-item (org-list-get-prev-item (line-beginning-position) struct prevs)))
(unless (or prev-item org-list-use-circular-motion) (unless (or prev-item org-list-use-circular-motion)
(user-error "Cannot move this item further up")) (user-error "Cannot move this item further up"))
(if (not prev-item) (if (not prev-item)
@ -2312,7 +2312,7 @@ is an integer, 0 means `-', 1 means `+' etc. If WHICH is
(old-struct (copy-tree struct)) (old-struct (copy-tree struct))
(cbox (org-list-get-checkbox cpos struct)) (cbox (org-list-get-checkbox cpos struct))
(prevs (org-list-prevs-alist struct)) (prevs (org-list-prevs-alist struct))
(start (org-list-get-list-begin (point-at-bol) struct prevs)) (start (org-list-get-list-begin (line-beginning-position) struct prevs))
(new (unless (and cbox (equal arg '(4)) (equal start cpos)) (new (unless (and cbox (equal arg '(4)) (equal start cpos))
"[ ]"))) "[ ]")))
(dolist (pos (org-list-get-all-items (dolist (pos (org-list-get-all-items
@ -2372,7 +2372,7 @@ subtree, ignoring planning line and any drawer following it."
(let ((limit (region-end))) (let ((limit (region-end)))
(goto-char (region-beginning)) (goto-char (region-beginning))
(if (org-list-search-forward (org-item-beginning-re) limit t) (if (org-list-search-forward (org-item-beginning-re) limit t)
(setq lim-up (point-at-bol)) (setq lim-up (line-beginning-position))
(error "No item in region")) (error "No item in region"))
(setq lim-down (copy-marker limit)))) (setq lim-down (copy-marker limit))))
((org-at-heading-p) ((org-at-heading-p)
@ -2381,14 +2381,14 @@ subtree, ignoring planning line and any drawer following it."
(let ((limit (save-excursion (outline-next-heading) (point)))) (let ((limit (save-excursion (outline-next-heading) (point))))
(org-end-of-meta-data t) (org-end-of-meta-data t)
(if (org-list-search-forward (org-item-beginning-re) limit t) (if (org-list-search-forward (org-item-beginning-re) limit t)
(setq lim-up (point-at-bol)) (setq lim-up (line-beginning-position))
(error "No item in subtree")) (error "No item in subtree"))
(setq lim-down (copy-marker limit)))) (setq lim-down (copy-marker limit))))
;; Just one item: set SINGLEP flag. ;; Just one item: set SINGLEP flag.
((org-at-item-p) ((org-at-item-p)
(setq singlep t) (setq singlep t)
(setq lim-up (point-at-bol) (setq lim-up (line-beginning-position)
lim-down (copy-marker (point-at-eol)))) lim-down (copy-marker (line-end-position))))
(t (error "Not at an item or heading, and no active region")))) (t (error "Not at an item or heading, and no active region"))))
;; Determine the checkbox going to be applied to all items ;; Determine the checkbox going to be applied to all items
;; within bounds. ;; within bounds.
@ -2636,7 +2636,7 @@ Return t if successful."
;; Are we going to move the whole list? ;; Are we going to move the whole list?
(specialp (specialp
(and (not regionp) (and (not regionp)
(= top (point-at-bol)) (= top (line-beginning-position))
(cdr (assq 'indent org-list-automatic-rules)) (cdr (assq 'indent org-list-automatic-rules))
(if no-subtree (if no-subtree
(user-error (user-error
@ -2650,12 +2650,12 @@ Return t if successful."
(progn (progn
(set-marker org-last-indent-begin-marker rbeg) (set-marker org-last-indent-begin-marker rbeg)
(set-marker org-last-indent-end-marker rend)) (set-marker org-last-indent-end-marker rend))
(set-marker org-last-indent-begin-marker (point-at-bol)) (set-marker org-last-indent-begin-marker (line-beginning-position))
(set-marker org-last-indent-end-marker (set-marker org-last-indent-end-marker
(cond (cond
(specialp (org-list-get-bottom-point struct)) (specialp (org-list-get-bottom-point struct))
(no-subtree (1+ (point-at-bol))) (no-subtree (1+ (line-beginning-position)))
(t (org-list-get-item-end (point-at-bol) struct)))))) (t (org-list-get-item-end (line-beginning-position) struct))))))
(let* ((beg (marker-position org-last-indent-begin-marker)) (let* ((beg (marker-position org-last-indent-begin-marker))
(end (marker-position org-last-indent-end-marker))) (end (marker-position org-last-indent-end-marker)))
(cond (cond
@ -2893,8 +2893,8 @@ function is being called interactively."
(let* ((case-func (if with-case 'identity 'downcase)) (let* ((case-func (if with-case 'identity 'downcase))
(struct (org-list-struct)) (struct (org-list-struct))
(prevs (org-list-prevs-alist struct)) (prevs (org-list-prevs-alist struct))
(start (org-list-get-list-begin (point-at-bol) struct prevs)) (start (org-list-get-list-begin (line-beginning-position) struct prevs))
(end (org-list-get-list-end (point-at-bol) struct prevs)) (end (org-list-get-list-end (line-beginning-position) struct prevs))
(sorting-type (sorting-type
(or sorting-type (or sorting-type
(progn (progn
@ -2939,21 +2939,21 @@ function is being called interactively."
((= dcst ?n) ((= dcst ?n)
(string-to-number (string-to-number
(org-sort-remove-invisible (org-sort-remove-invisible
(buffer-substring (match-end 0) (point-at-eol))))) (buffer-substring (match-end 0) (line-end-position)))))
((= dcst ?a) ((= dcst ?a)
(funcall case-func (funcall case-func
(org-sort-remove-invisible (org-sort-remove-invisible
(buffer-substring (buffer-substring
(match-end 0) (point-at-eol))))) (match-end 0) (line-end-position)))))
((= dcst ?t) ((= dcst ?t)
(cond (cond
;; If it is a timer list, convert timer to seconds ;; If it is a timer list, convert timer to seconds
((org-at-item-timer-p) ((org-at-item-timer-p)
(org-timer-hms-to-secs (match-string 1))) (org-timer-hms-to-secs (match-string 1)))
((or (save-excursion ((or (save-excursion
(re-search-forward org-ts-regexp (point-at-eol) t)) (re-search-forward org-ts-regexp (line-end-position) t))
(save-excursion (re-search-forward org-ts-regexp-both (save-excursion (re-search-forward org-ts-regexp-both
(point-at-eol) t))) (line-end-position) t)))
(org-time-string-to-seconds (match-string 0))) (org-time-string-to-seconds (match-string 0)))
(t (float-time now)))) (t (float-time now))))
((= dcst ?x) (or (and (stringp (match-string 1)) ((= dcst ?x) (or (and (stringp (match-string 1))
@ -3026,14 +3026,14 @@ With a prefix argument ARG, change the region in a single item."
(save-excursion (save-excursion
(goto-char pos) (goto-char pos)
(skip-chars-forward " \r\t\n") (skip-chars-forward " \r\t\n")
(point-at-bol)))) (line-beginning-position))))
beg end) beg end)
;; Determine boundaries of changes. ;; Determine boundaries of changes.
(if (org-region-active-p) (if (org-region-active-p)
(setq beg (funcall skip-blanks (region-beginning)) (setq beg (funcall skip-blanks (region-beginning))
end (copy-marker (region-end))) end (copy-marker (region-end)))
(setq beg (point-at-bol) (setq beg (line-beginning-position)
end (copy-marker (point-at-eol)))) end (copy-marker (line-end-position))))
;; Depending on the starting line, choose an action on the text ;; Depending on the starting line, choose an action on the text
;; between BEG and END. ;; between BEG and END.
(org-with-limited-levels (org-with-limited-levels

View File

@ -1124,11 +1124,11 @@ the value in cadr."
(defsubst org-get-at-bol (property) (defsubst org-get-at-bol (property)
"Get text property PROPERTY at the beginning of line." "Get text property PROPERTY at the beginning of line."
(get-text-property (point-at-bol) property)) (get-text-property (line-beginning-position) property))
(defun org-get-at-eol (property n) (defun org-get-at-eol (property n)
"Get text property PROPERTY at the end of line less N characters." "Get text property PROPERTY at the end of line less N characters."
(get-text-property (- (point-at-eol) n) property)) (get-text-property (- (line-end-position) n) property))
(defun org-find-text-property-in-string (prop s) (defun org-find-text-property-in-string (prop s)
"Return the first non-nil value of property PROP in string S." "Return the first non-nil value of property PROP in string S."

View File

@ -617,7 +617,7 @@ The table of checksums is written to the file mobile-checksums."
((looking-at "[ \t]*$")) ; keep empty lines ((looking-at "[ \t]*$")) ; keep empty lines
((looking-at "=+$") ((looking-at "=+$")
;; remove underlining ;; remove underlining
(delete-region (point) (point-at-eol))) (delete-region (point) (line-end-position)))
((get-text-property (point) 'org-agenda-structural-header) ((get-text-property (point) 'org-agenda-structural-header)
(setq in-date nil) (setq in-date nil)
(setq app (get-text-property (point) 'org-agenda-title-append)) (setq app (get-text-property (point) 'org-agenda-title-append))
@ -637,14 +637,14 @@ The table of checksums is written to the file mobile-checksums."
(get-text-property (point) 'org-marker))) (get-text-property (point) 'org-marker)))
(setq sexp (member (get-text-property (point) 'type) (setq sexp (member (get-text-property (point) 'type)
'("diary" "sexp"))) '("diary" "sexp")))
(if (setq pl (text-property-any (point) (point-at-eol) 'org-heading t)) (if (setq pl (text-property-any (point) (line-end-position) 'org-heading t))
(progn (progn
(setq prefix (org-trim (buffer-substring (setq prefix (org-trim (buffer-substring
(point) pl)) (point) pl))
line (org-trim (buffer-substring line (org-trim (buffer-substring
pl pl
(point-at-eol)))) (line-end-position))))
(delete-region (point-at-bol) (point-at-eol)) (delete-region (line-beginning-position) (line-end-position))
(insert line "<before>" prefix "</before>") (insert line "<before>" prefix "</before>")
(beginning-of-line 1)) (beginning-of-line 1))
(and (looking-at "[ \t]+") (replace-match ""))) (and (looking-at "[ \t]+") (replace-match "")))
@ -857,7 +857,7 @@ If BEG and END are given, only do this in that region."
(org-mobile-timestamp-buffer (marker-buffer id-pos)) (org-mobile-timestamp-buffer (marker-buffer id-pos))
(push (marker-buffer id-pos) buf-list)) (push (marker-buffer id-pos) buf-list))
(unless (markerp id-pos) (unless (markerp id-pos)
(goto-char (+ 2 (point-at-bol))) (goto-char (+ 2 (line-beginning-position)))
(if (stringp id-pos) (if (stringp id-pos)
(insert id-pos " ") (insert id-pos " ")
(insert "BAD REFERENCE ")) (insert "BAD REFERENCE "))
@ -1093,7 +1093,7 @@ be returned that indicates what went wrong."
(org-archive-to-archive-sibling)) (org-archive-to-archive-sibling))
((eq what 'body) ((eq what 'body)
(setq current (buffer-substring (min (1+ (point-at-eol)) (point-max)) (setq current (buffer-substring (min (1+ (line-end-position)) (point-max))
(save-excursion (outline-next-heading) (save-excursion (outline-next-heading)
(point)))) (point))))
(if (not (string-match "\\S-" current)) (setq current nil)) (if (not (string-match "\\S-" current)) (setq current nil))

View File

@ -184,7 +184,7 @@ Changing this variable requires a restart of Emacs to get activated."
(defun org-mouse-re-search-line (regexp) (defun org-mouse-re-search-line (regexp)
"Search the current line for a given regular expression." "Search the current line for a given regular expression."
(beginning-of-line) (beginning-of-line)
(re-search-forward regexp (point-at-eol) t)) (re-search-forward regexp (line-end-position) t))
(defun org-mouse-end-headline () (defun org-mouse-end-headline ()
"Go to the end of current headline (ignoring tags)." "Go to the end of current headline (ignoring tags)."
@ -574,7 +574,7 @@ This means, between the beginning of line and the point."
(insert "+ ")) (insert "+ "))
(:end ; insert text here (:end ; insert text here
(skip-chars-backward " \t") (skip-chars-backward " \t")
(kill-region (point) (point-at-eol)) (kill-region (point) (line-end-position))
(unless (looking-back org-mouse-punctuation (line-beginning-position)) (unless (looking-back org-mouse-punctuation (line-beginning-position))
(insert (concat org-mouse-punctuation " "))))) (insert (concat org-mouse-punctuation " ")))))
(insert text) (insert text)
@ -985,7 +985,7 @@ This means, between the beginning of line and the point."
(defun org-mouse-do-remotely (command) (defun org-mouse-do-remotely (command)
;; (org-agenda-check-no-diary) ;; (org-agenda-check-no-diary)
(when (get-text-property (point) 'org-marker) (when (get-text-property (point) 'org-marker)
(let* ((anticol (- (point-at-eol) (point))) (let* ((anticol (- (line-end-position) (point)))
(marker (get-text-property (point) 'org-marker)) (marker (get-text-property (point) 'org-marker))
(buffer (marker-buffer marker)) (buffer (marker-buffer marker))
(pos (marker-position marker)) (pos (marker-position marker))
@ -1009,7 +1009,7 @@ This means, between the beginning of line and the point."
(org-flag-heading nil))) ; show the next heading (org-flag-heading nil))) ; show the next heading
(org-back-to-heading) (org-back-to-heading)
(setq marker (point-marker)) (setq marker (point-marker))
(goto-char (max (point-at-bol) (- (point-at-eol) anticol))) (goto-char (max (line-beginning-position) (- (line-end-position) anticol)))
(funcall command) (funcall command)
(message "_cmd: %S" org-mouse-cmd) (message "_cmd: %S" org-mouse-cmd)
(message "this-command: %S" this-command) (message "this-command: %S" this-command)

View File

@ -465,9 +465,9 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(unless (or (org-kill-is-subtree-p (unless (or (org-kill-is-subtree-p
(buffer-substring region-start region-end)) (buffer-substring region-start region-end))
(prog1 org-refile-active-region-within-subtree (prog1 org-refile-active-region-within-subtree
(let ((s (point-at-eol))) (let ((s (line-end-position)))
(org-toggle-heading) (org-toggle-heading)
(setq region-end (+ (- (point-at-eol) s) region-end))))) (setq region-end (+ (- (line-end-position) s) region-end)))))
(user-error "The region is not a (sequence of) subtree(s)"))) (user-error "The region is not a (sequence of) subtree(s)")))
(if (equal arg '(16)) (if (equal arg '(16))
(org-refile-goto-last-stored) (org-refile-goto-last-stored)

View File

@ -486,7 +486,7 @@ This may be useful when columns have been shrunk."
(looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>")) (looking-at-p ".*|\\s-+<[rcl]?\\([0-9]+\\)?>"))
(move-beginning-of-line 2)) (move-beginning-of-line 2))
(line-beginning-position))) (line-beginning-position)))
(end (save-excursion (goto-char beg) (point-at-eol)))) (end (save-excursion (goto-char beg) (line-end-position))))
(if (pos-visible-in-window-p beg) (if (pos-visible-in-window-p beg)
(when (overlayp org-table-header-overlay) (when (overlayp org-table-header-overlay)
(delete-overlay org-table-header-overlay)) (delete-overlay org-table-header-overlay))
@ -825,7 +825,7 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
(line (concat (apply 'concat indent "|" (make-list columns " |")) (line (concat (apply 'concat indent "|" (make-list columns " |"))
"\n"))) "\n")))
(if (string-match "^[ \t]*$" (buffer-substring-no-properties (if (string-match "^[ \t]*$" (buffer-substring-no-properties
(point-at-bol) (point))) (line-beginning-position) (point)))
(beginning-of-line 1) (beginning-of-line 1)
(newline)) (newline))
;; (mapcar (lambda (x) (insert line)) (make-list rows t)) ;; (mapcar (lambda (x) (insert line)) (make-list rows t))
@ -1087,7 +1087,7 @@ With numeric argument N, move N-1 fields backward first."
(while (> n 1) (while (> n 1)
(setq n (1- n)) (setq n (1- n))
(org-table-previous-field)) (org-table-previous-field))
(if (not (re-search-backward "|" (point-at-bol 0) t)) (if (not (re-search-backward "|" (line-beginning-position 0) t))
(user-error "No more table fields before the current") (user-error "No more table fields before the current")
(goto-char (match-end 0)) (goto-char (match-end 0))
(and (looking-at " ") (forward-char 1))) (and (looking-at " ") (forward-char 1)))
@ -1102,7 +1102,7 @@ With numeric argument N, move N-1 fields forward first."
(while (> n 1) (while (> n 1)
(setq n (1- n)) (setq n (1- n))
(org-table-next-field)) (org-table-next-field))
(when (re-search-forward "|" (point-at-eol 1) t) (when (re-search-forward "|" (line-end-position 1) t)
(backward-char 1) (backward-char 1)
(skip-chars-backward " ") (skip-chars-backward " ")
(when (and (equal (char-before (point)) ?|) (equal (char-after (point)) ?\s)) (when (and (equal (char-before (point)) ?|) (equal (char-after (point)) ?\s))
@ -1159,7 +1159,7 @@ When ALIGN is set, also realign the table."
(goto-char (org-table-begin)) (goto-char (org-table-begin))
(while (and (re-search-forward org-table-dataline-regexp end t) (while (and (re-search-forward org-table-dataline-regexp end t)
(setq cnt (1+ cnt)) (setq cnt (1+ cnt))
(< (point-at-eol) pos)))) (< (line-end-position) pos))))
cnt)) cnt))
(defun org-table-current-column () (defun org-table-current-column ()
@ -1322,7 +1322,7 @@ However, when FORCE is non-nil, create new columns if necessary."
(beginning-of-line 1) (beginning-of-line 1)
(when (> n 0) (when (> n 0)
(while (and (> (setq n (1- n)) -1) (while (and (> (setq n (1- n)) -1)
(or (search-forward "|" (point-at-eol) t) (or (search-forward "|" (line-end-position) t)
(and force (and force
(progn (end-of-line 1) (progn (end-of-line 1)
(skip-chars-backward "^|") (skip-chars-backward "^|")
@ -1663,7 +1663,7 @@ With prefix ABOVE, insert above the current line."
(org-table-align)) (org-table-align))
(org-table-with-shrunk-columns (org-table-with-shrunk-columns
(let ((line (org-table-clean-line (let ((line (org-table-clean-line
(buffer-substring (point-at-bol) (point-at-eol)))) (buffer-substring (line-beginning-position) (line-end-position))))
(col (current-column))) (col (current-column)))
(while (string-match "|\\( +\\)|" line) (while (string-match "|\\( +\\)|" line)
(setq line (replace-match (setq line (replace-match
@ -1712,7 +1712,8 @@ In particular, this does handle wide and invisible characters."
(dline (and (not (org-match-line org-table-hline-regexp)) (dline (and (not (org-match-line org-table-hline-regexp))
(org-table-current-dline)))) (org-table-current-dline))))
(org-table-with-shrunk-columns (org-table-with-shrunk-columns
(kill-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))) (kill-region (line-beginning-position)
(min (1+ (line-end-position)) (point-max)))
(if (not (org-at-table-p)) (beginning-of-line 0)) (if (not (org-at-table-p)) (beginning-of-line 0))
(org-move-to-column col) (org-move-to-column col)
(when (and dline (when (and dline
@ -2253,14 +2254,14 @@ For all numbers larger than LIMIT, shift them by DELTA."
(format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove)))) (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
s n a) s n a)
(when remove (when remove
(while (re-search-forward re2 (point-at-eol) t) (while (re-search-forward re2 (line-end-position) t)
(unless (save-match-data (org-in-regexp "remote([^)]+?)")) (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
(if (equal (char-before (match-beginning 0)) ?.) (if (equal (char-before (match-beginning 0)) ?.)
(user-error (user-error
"Change makes TBLFM term %s invalid, use undo to recover" "Change makes TBLFM term %s invalid, use undo to recover"
(match-string 0)) (match-string 0))
(replace-match ""))))) (replace-match "")))))
(while (re-search-forward re (point-at-eol) t) (while (re-search-forward re (line-end-position) t)
(unless (save-match-data (org-in-regexp "remote([^)]+?)")) (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
(setq s (match-string 1) n (string-to-number s)) (setq s (match-string 1) n (string-to-number s))
(cond (cond
@ -3789,8 +3790,9 @@ FACE, when non-nil, for the highlight."
(let ((id 0) (ih 0) hline eol str ov) (let ((id 0) (ih 0) hline eol str ov)
(goto-char (org-table-begin)) (goto-char (org-table-begin))
(while (org-at-table-p) (while (org-at-table-p)
(setq eol (point-at-eol)) (setq eol (line-end-position))
(setq ov (make-overlay (point-at-bol) (1+ (point-at-bol)))) (setq ov (make-overlay (line-beginning-position)
(1+ (line-beginning-position))))
(push ov org-table-coordinate-overlays) (push ov org-table-coordinate-overlays)
(setq hline (looking-at org-table-hline-regexp)) (setq hline (looking-at org-table-hline-regexp))
(setq str (if hline (format "I*%-2d" (setq ih (1+ ih))) (setq str (if hline (format "I*%-2d" (setq ih (1+ ih)))
@ -4923,7 +4925,7 @@ When LOCAL is non-nil, show references for the table at point."
((not local) nil) ((not local) nil)
(t (user-error "No reference at point"))) (t (user-error "No reference at point")))
match (and what (or match (match-string 0)))) match (and what (or match (match-string 0))))
(when (and match (not (equal (match-beginning 0) (point-at-bol)))) (when (and match (not (equal (match-beginning 0) (line-beginning-position))))
(org-table-add-rectangle-overlay (match-beginning 0) (match-end 0) (org-table-add-rectangle-overlay (match-beginning 0) (match-end 0)
'secondary-selection)) 'secondary-selection))
(add-hook 'before-change-functions (add-hook 'before-change-functions

View File

@ -5971,7 +5971,7 @@ and subscripts."
(emph-p (get-text-property mpos 'org-emphasis)) (emph-p (get-text-property mpos 'org-emphasis))
(link-p (get-text-property mpos 'mouse-face)) (link-p (get-text-property mpos 'mouse-face))
(keyw-p (eq 'org-special-keyword (get-text-property mpos 'face)))) (keyw-p (eq 'org-special-keyword (get-text-property mpos 'face))))
(goto-char (point-at-bol)) (goto-char (line-beginning-position))
(setq table-p (looking-at-p org-table-dataline-regexp) (setq table-p (looking-at-p org-table-dataline-regexp)
comment-p (looking-at-p "^[ \t]*#[ +]")) comment-p (looking-at-p "^[ \t]*#[ +]"))
(goto-char pos) (goto-char pos)
@ -6443,7 +6443,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
(and (memq org-cycle-emulate-tab '(white whitestart)) (and (memq org-cycle-emulate-tab '(white whitestart))
(save-excursion (beginning-of-line 1) (looking-at "[ \t]*")) (save-excursion (beginning-of-line 1) (looking-at "[ \t]*"))
(or (and (eq org-cycle-emulate-tab 'white) (or (and (eq org-cycle-emulate-tab 'white)
(= (match-end 0) (point-at-eol))) (= (match-end 0) (line-end-position)))
(and (eq org-cycle-emulate-tab 'whitestart) (and (eq org-cycle-emulate-tab 'whitestart)
(>= (match-end 0) pos))))) (>= (match-end 0) pos)))))
(call-interactively (global-key-binding (kbd "TAB")))) (call-interactively (global-key-binding (kbd "TAB"))))
@ -6498,7 +6498,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
(progn (progn
(beginning-of-line) (beginning-of-line)
(setq struct (org-list-struct)) (setq struct (org-list-struct))
(setq eoh (point-at-eol)) (setq eoh (line-end-position))
(setq eos (org-list-get-item-end-before-blank (point) struct)) (setq eos (org-list-get-item-end-before-blank (point) struct))
(setq has-children (org-list-has-child-p (point) struct))) (setq has-children (org-list-has-child-p (point) struct)))
(org-back-to-heading) (org-back-to-heading)
@ -6545,7 +6545,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
(unless (org-before-first-heading-p) (unless (org-before-first-heading-p)
(run-hook-with-args 'org-pre-cycle-hook 'children)) (run-hook-with-args 'org-pre-cycle-hook 'children))
(if (org-at-item-p) (if (org-at-item-p)
(org-list-set-item-visibility (point-at-bol) struct 'children) (org-list-set-item-visibility (line-beginning-position) struct 'children)
(org-show-entry) (org-show-entry)
(org-with-limited-levels (org-show-children)) (org-with-limited-levels (org-show-children))
(org-show-set-visibility 'tree) (org-show-set-visibility 'tree)
@ -6729,7 +6729,7 @@ This function is the default value of the hook `org-cycle-hook'."
(org-get-next-sibling) (org-get-next-sibling)
(org-get-next-sibling)) (org-get-next-sibling))
(if (org-at-heading-p) (if (org-at-heading-p)
(point-at-eol) (line-end-position)
(point)))) (point))))
(level (looking-at "\\*+")) (level (looking-at "\\*+"))
(re (when level (concat "^" (regexp-quote (match-string 0)) " ")))) (re (when level (concat "^" (regexp-quote (match-string 0)) " "))))
@ -7147,7 +7147,7 @@ This is a list with the following elements:
"Get the entry text, after heading, entire subtree." "Get the entry text, after heading, entire subtree."
(save-excursion (save-excursion
(org-back-to-heading t) (org-back-to-heading t)
(buffer-substring (point-at-bol 2) (org-end-of-subtree t)))) (buffer-substring (line-beginning-position 2) (org-end-of-subtree t))))
(defun org-edit-headline (&optional heading) (defun org-edit-headline (&optional heading)
"Edit the current headline. "Edit the current headline.
@ -8402,7 +8402,7 @@ function is being called interactively."
(org-time-string-to-seconds (match-string 1)) (org-time-string-to-seconds (match-string 1))
(float-time now)))) (float-time now))))
((= dcst ?p) ((= dcst ?p)
(if (re-search-forward org-priority-regexp (point-at-eol) t) (if (re-search-forward org-priority-regexp (line-end-position) t)
(string-to-char (match-string 2)) (string-to-char (match-string 2))
org-priority-default)) org-priority-default))
((= dcst ?r) ((= dcst ?r)
@ -9244,7 +9244,8 @@ If not found, stay at current position and return nil."
(defun org-create-dblock (plist) (defun org-create-dblock (plist)
"Create a dynamic block section, with parameters taken from PLIST. "Create a dynamic block section, with parameters taken from PLIST.
PLIST must contain a :name entry which is used as the name of the block." PLIST must contain a :name entry which is used as the name of the block."
(when (string-match "\\S-" (buffer-substring (point-at-bol) (point-at-eol))) (when (string-match "\\S-" (buffer-substring (line-beginning-position)
(line-end-position)))
(end-of-line 1) (end-of-line 1)
(newline)) (newline))
(let ((col (current-column)) (let ((col (current-column))
@ -9908,7 +9909,8 @@ When called through ELisp, arg is also interpreted in the following way:
(run-hooks 'org-after-todo-state-change-hook) (run-hooks 'org-after-todo-state-change-hook)
(when (and arg (not (member org-state org-done-keywords))) (when (and arg (not (member org-state org-done-keywords)))
(setq head (org-get-todo-sequence-head org-state))) (setq head (org-get-todo-sequence-head org-state)))
(put-text-property (point-at-bol) (point-at-eol) 'org-todo-head head) (put-text-property (line-beginning-position)
(line-end-position) 'org-todo-head head)
;; Do we need to trigger a repeat? ;; Do we need to trigger a repeat?
(when now-done-p (when now-done-p
(when (boundp 'org-agenda-headline-snapshot-before-repeat) (when (boundp 'org-agenda-headline-snapshot-before-repeat)
@ -10121,7 +10123,7 @@ all statistics cookies in the buffer."
(beginning-of-line 1) (beginning-of-line 1)
(while (re-search-forward (while (re-search-forward
"\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)"
(point-at-eol) t) (line-end-position) t)
(replace-match (if (match-end 2) "[100%]" "[0/0]") t t))))) (replace-match (if (match-end 2) "[100%]" "[0/0]") t t)))))
(goto-char pos) (goto-char pos)
(move-marker pos nil))))) (move-marker pos nil)))))
@ -10168,7 +10170,7 @@ statistics everywhere."
(downcase (or (org-entry-get nil "COOKIE_DATA") (downcase (or (org-entry-get nil "COOKIE_DATA")
""))))) "")))))
(throw 'exit nil)) (throw 'exit nil))
(while (re-search-forward box-re (point-at-eol) t) (while (re-search-forward box-re (line-end-position) t)
(setq cnt-all 0 cnt-done 0 cookie-present t) (setq cnt-all 0 cnt-done 0 cookie-present t)
(setq is-percent (match-end 2) checkbox-beg (match-beginning 0)) (setq is-percent (match-end 2) checkbox-beg (match-beginning 0))
(save-match-data (save-match-data
@ -10277,10 +10279,11 @@ right sequence."
(let (p) (let (p)
(cond (cond
((not kwd) ((not kwd)
(or (get-text-property (point-at-bol) 'org-todo-head) (or (get-text-property (line-beginning-position) 'org-todo-head)
(progn (progn
(setq p (next-single-property-change (point-at-bol) 'org-todo-head (setq p (next-single-property-change (line-beginning-position)
nil (point-at-eol))) 'org-todo-head
nil (line-end-position)))
(get-text-property p 'org-todo-head)))) (get-text-property p 'org-todo-head))))
((not (member kwd org-todo-keywords-1)) ((not (member kwd org-todo-keywords-1))
(car org-todo-keywords-1)) (car org-todo-keywords-1))
@ -10736,13 +10739,13 @@ nil."
(outline-next-heading) (outline-next-heading)
(while (re-search-backward re beg t) (while (re-search-backward re beg t)
(replace-match "") (replace-match "")
(if (and (string-match "\\S-" (buffer-substring (point-at-bol) (point))) (if (and (string-match "\\S-" (buffer-substring (line-beginning-position) (point)))
(equal (char-before) ?\ )) (equal (char-before) ?\ ))
(backward-delete-char 1) (backward-delete-char 1)
(when (string-match "^[ \t]*$" (buffer-substring (when (string-match "^[ \t]*$" (buffer-substring
(point-at-bol) (point-at-eol))) (line-beginning-position) (line-end-position)))
(delete-region (point-at-bol) (delete-region (line-beginning-position)
(min (point-max) (1+ (point-at-eol)))))))))) (min (point-max) (1+ (line-end-position))))))))))
(defvar org-time-was-given) ; dynamically scoped parameter (defvar org-time-was-given) ; dynamically scoped parameter
(defvar org-end-time-was-given) ; dynamically scoped parameter (defvar org-end-time-was-given) ; dynamically scoped parameter
@ -12216,7 +12219,7 @@ Also insert END."
(defun org-fast-tag-show-exit (flag) (defun org-fast-tag-show-exit (flag)
(save-excursion (save-excursion
(org-goto-line 3) (org-goto-line 3)
(when (re-search-forward "[ \t]+Next change exits" (point-at-eol) t) (when (re-search-forward "[ \t]+Next change exits" (line-end-position) t)
(replace-match "")) (replace-match ""))
(when flag (when flag
(end-of-line 1) (end-of-line 1)
@ -12263,7 +12266,7 @@ Returns the new tags string, or nil to not change the current settings."
(setq ov-start (match-beginning 1) (setq ov-start (match-beginning 1)
ov-end (match-end 1) ov-end (match-end 1)
ov-prefix "") ov-prefix "")
(setq ov-start (1- (point-at-eol)) (setq ov-start (1- (line-end-position))
ov-end (1+ ov-start)) ov-end (1+ ov-start))
(skip-chars-forward "^\n\r") (skip-chars-forward "^\n\r")
(setq ov-prefix (setq ov-prefix
@ -12422,7 +12425,7 @@ Returns the new tags string, or nil to not change the current settings."
(when (eq exit-after-next 'now) (throw 'exit t)) (when (eq exit-after-next 'now) (throw 'exit t))
(goto-char (point-min)) (goto-char (point-min))
(beginning-of-line 2) (beginning-of-line 2)
(delete-region (point) (point-at-eol)) (delete-region (point) (line-end-position))
(org-fast-tag-insert "Current" current c-face) (org-fast-tag-insert "Current" current c-face)
(org-set-current-tags-overlay current ov-prefix) (org-set-current-tags-overlay current ov-prefix)
(let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)"))) (let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)")))
@ -14082,7 +14085,8 @@ user."
(max (point-min) (- (point) 4)) (point)) (max (point-min) (- (point) 4)) (point))
" ")) " "))
(insert " "))) (insert " ")))
(let* ((ans (concat (buffer-substring (point-at-bol) (point-max)) (let* ((ans (concat (buffer-substring (line-beginning-position)
(point-max))
" " (or org-ans1 org-ans2))) " " (or org-ans1 org-ans2)))
(org-end-time-was-given nil) (org-end-time-was-given nil)
(f (org-read-date-analyze ans org-def org-defdecode)) (f (org-read-date-analyze ans org-def org-defdecode))
@ -14104,7 +14108,7 @@ user."
(when org-read-date-analyze-futurep (when org-read-date-analyze-futurep
(setq txt (concat txt " (=>F)"))) (setq txt (concat txt " (=>F)")))
(setq org-read-date-overlay (setq org-read-date-overlay
(make-overlay (1- (point-at-eol)) (point-at-eol))) (make-overlay (1- (line-end-position)) (line-end-position)))
(org-overlay-display org-read-date-overlay txt 'secondary-selection))))) (org-overlay-display org-read-date-overlay txt 'secondary-selection)))))
(defun org-read-date-analyze (ans def defdecode) (defun org-read-date-analyze (ans def defdecode)
@ -14654,8 +14658,8 @@ days in order to avoid rounding problems."
(org-clock-update-time-maybe) (org-clock-update-time-maybe)
(save-excursion (save-excursion
(unless (org-at-date-range-p t) (unless (org-at-date-range-p t)
(goto-char (point-at-bol)) (goto-char (line-beginning-position))
(re-search-forward org-tr-regexp-both (point-at-eol) t)) (re-search-forward org-tr-regexp-both (line-end-position) t))
(unless (org-at-date-range-p t) (unless (org-at-date-range-p t)
(user-error "Not at a time-stamp range, and none found in current line"))) (user-error "Not at a time-stamp range, and none found in current line")))
(let* ((ts1 (match-string 1)) (let* ((ts1 (match-string 1))
@ -15719,7 +15723,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward rea nil t) (while (re-search-forward rea nil t)
(when (org-at-heading-p t) (when (org-at-heading-p t)
(add-text-properties (point-at-bol) (org-end-of-subtree t) pa)))) (add-text-properties (line-beginning-position)
(org-end-of-subtree t) pa))))
(goto-char (point-min)) (goto-char (point-min))
(setq re (format "^\\*+ .*\\<%s\\>" org-comment-string)) (setq re (format "^\\*+ .*\\<%s\\>" org-comment-string))
(while (re-search-forward re nil t) (while (re-search-forward re nil t)
@ -17231,14 +17236,14 @@ this function returns t, nil otherwise."
(save-excursion (save-excursion
(catch 'exit (catch 'exit
(unless (org-region-active-p) (unless (org-region-active-p)
(setq beg (point-at-bol)) (setq beg (line-beginning-position))
(beginning-of-line 2) (beginning-of-line 2)
(while (and (not (eobp)) ;; this is like `next-line' (while (and (not (eobp)) ;; this is like `next-line'
(get-char-property (1- (point)) 'invisible)) (get-char-property (1- (point)) 'invisible))
(beginning-of-line 2)) (beginning-of-line 2))
(setq end (point)) (setq end (point))
(goto-char beg) (goto-char beg)
(goto-char (point-at-eol)) (goto-char (line-end-position))
(setq end (max end (point))) (setq end (max end (point)))
(while (re-search-forward re end t) (while (re-search-forward re end t)
(when (get-char-property (match-beginning 0) 'invisible) (when (get-char-property (match-beginning 0) 'invisible)
@ -18160,7 +18165,7 @@ number of stars to add."
(goto-char pos) (goto-char pos)
(while (org-at-comment-p) (forward-line)) (while (org-at-comment-p) (forward-line))
(skip-chars-forward " \r\t\n") (skip-chars-forward " \r\t\n")
(point-at-bol)))) (line-beginning-position))))
beg end toggled) beg end toggled)
;; Determine boundaries of changes. If a universal prefix has ;; Determine boundaries of changes. If a universal prefix has
;; been given, put the list in a region. If region ends at a bol, ;; been given, put the list in a region. If region ends at a bol,
@ -18174,9 +18179,9 @@ number of stars to add."
(setq beg (funcall skip-blanks (region-beginning)) (setq beg (funcall skip-blanks (region-beginning))
end (copy-marker (save-excursion end (copy-marker (save-excursion
(goto-char (region-end)) (goto-char (region-end))
(if (bolp) (point) (point-at-eol))))) (if (bolp) (point) (line-end-position)))))
(setq beg (funcall skip-blanks (point-at-bol)) (setq beg (funcall skip-blanks (line-beginning-position))
end (copy-marker (point-at-eol)))) end (copy-marker (line-end-position))))
;; Ensure inline tasks don't count as headings. ;; Ensure inline tasks don't count as headings.
(org-with-limited-levels (org-with-limited-levels
(save-excursion (save-excursion
@ -18787,7 +18792,9 @@ and :keyword."
;; First the large context ;; First the large context
(cond (cond
((org-at-heading-p t) ((org-at-heading-p t)
(push (list :headline (point-at-bol) (point-at-eol)) clist) (push (list :headline (line-beginning-position)
(line-end-position))
clist)
(when (progn (when (progn
(beginning-of-line 1) (beginning-of-line 1)
(looking-at org-todo-line-tags-regexp)) (looking-at org-todo-line-tags-regexp))
@ -18801,7 +18808,7 @@ and :keyword."
((org-at-item-p) ((org-at-item-p)
(push (org-point-in-group p 2 :item-bullet) clist) (push (org-point-in-group p 2 :item-bullet) clist)
(push (list :item (point-at-bol) (push (list :item (line-beginning-position)
(save-excursion (org-end-of-item) (point))) (save-excursion (org-end-of-item) (point)))
clist) clist)
(and (org-at-item-checkbox-p) (and (org-at-item-checkbox-p)
@ -19198,7 +19205,7 @@ Also align node properties according to `org-property-format'."
(beginning-of-line 1) (beginning-of-line 1)
(skip-chars-backward "\n") (skip-chars-backward "\n")
(or (org-at-heading-p) (or (org-at-heading-p)
(looking-back ":END:.*" (point-at-bol)))))) (looking-back ":END:.*" (line-beginning-position))))))
(let* ((element (save-excursion (beginning-of-line) (org-element-at-point))) (let* ((element (save-excursion (beginning-of-line) (org-element-at-point)))
(type (org-element-type element))) (type (org-element-type element)))
(cond ((and (memq type '(plain-list item)) (cond ((and (memq type '(plain-list item))
@ -19938,7 +19945,7 @@ major mode."
(point)))) (point))))
(org-babel-do-in-edit-buffer (call-interactively 'comment-dwim)) (org-babel-do-in-edit-buffer (call-interactively 'comment-dwim))
(beginning-of-line) (beginning-of-line)
(if (looking-at "\\s-*$") (delete-region (point) (point-at-eol)) (if (looking-at "\\s-*$") (delete-region (point) (line-end-position))
(open-line 1)) (open-line 1))
(org-indent-line) (org-indent-line)
(insert "# "))) (insert "# ")))
@ -20431,7 +20438,7 @@ interactive command with similar behavior."
(and (looking-at "[ \t]*$") (and (looking-at "[ \t]*$")
(string-match (string-match
"\\`\\*+\\'" "\\`\\*+\\'"
(buffer-substring (point-at-bol) (point))))))) (buffer-substring (line-beginning-position) (point)))))))
swallowp) swallowp)
(cond (cond
((and subtreep org-yank-folded-subtrees) ((and subtreep org-yank-folded-subtrees)
@ -20464,7 +20471,7 @@ interactive command with similar behavior."
(beginning-of-line 1) (beginning-of-line 1)
(push-mark beg 'nomsg))) (push-mark beg 'nomsg)))
((and subtreep org-yank-adjusted-subtrees) ((and subtreep org-yank-adjusted-subtrees)
(let ((beg (point-at-bol))) (let ((beg (line-beginning-position)))
(org-paste-subtree nil nil 'for-yank) (org-paste-subtree nil nil 'for-yank)
(push-mark beg 'nomsg))) (push-mark beg 'nomsg)))
(t (t