emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org c2c8e66e5d 38/50: Backport commit b7e867b84 from Em


From: ELPA Syncer
Subject: [elpa] externals/org c2c8e66e5d 38/50: Backport commit b7e867b84 from Emacs
Date: Tue, 4 Oct 2022 21:58:01 -0400 (EDT)

branch: externals/org
commit c2c8e66e5de731911ca3c78fc471668a61eab81b
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    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. ]
---
 lisp/ob-core.el        |   8 ++--
 lisp/ob-lilypond.el    |   2 +-
 lisp/ob-octave.el      |   2 +-
 lisp/ol-irc.el         |  12 +++---
 lisp/ol.el             |   2 +-
 lisp/org-agenda.el     | 101 +++++++++++++++++++++++++++----------------------
 lisp/org-capture.el    |   2 +-
 lisp/org-clock.el      |  14 +++----
 lisp/org-compat.el     |   6 +--
 lisp/org-element.el    |   8 ++--
 lisp/org-habit.el      |   2 +-
 lisp/org-inlinetask.el |   6 +--
 lisp/org-list.el       |  72 +++++++++++++++++------------------
 lisp/org-macs.el       |   4 +-
 lisp/org-mobile.el     |  12 +++---
 lisp/org-mouse.el      |   8 ++--
 lisp/org-refile.el     |   4 +-
 lisp/org-table.el      |  28 +++++++-------
 lisp/org.el            |  83 +++++++++++++++++++++-------------------
 19 files changed, 198 insertions(+), 178 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 3b114703cd..41b7a2a971 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -917,7 +917,7 @@ arguments and pop open the results in a preview buffer."
                       vals ""))))))
     (save-excursion
       (goto-char begin)
-      (goto-char (point-at-eol))
+      (goto-char (line-end-position))
       (unless (= (char-before (point)) ?\ ) (insert " "))
       (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))
                    (indent (make-string (current-indentation) ?\s)))
               (when (string-match "^[[:space:]]*$"
-                                  (buffer-substring (point-at-bol)
-                                                    (point-at-eol)))
-                (delete-region (point-at-bol) (point-at-eol)))
+                                   (buffer-substring (line-beginning-position)
+                                                     (line-end-position)))
+                 (delete-region (line-beginning-position) (line-end-position)))
                (insert (concat
                        (if (looking-at "^") "" "\n")
                        indent (if upper-case-p "#+END_SRC\n" "#+end_src\n")
diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el
index dd204d7f6b..f1ea803ba3 100644
--- a/lisp/ob-lilypond.el
+++ b/lisp/ob-lilypond.el
@@ -312,7 +312,7 @@ LINENO is the number of the erroneous line."
        (progn
          (goto-char (point-min))
          (forward-line (- lineNo 1))
-         (buffer-substring (point) (point-at-eol)))
+          (buffer-substring (point) (line-end-position)))
       nil)))
 
 (defun org-babel-lilypond-attempt-to-open-pdf (file-name &optional test)
diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index bbbda5bb1e..9be8f5ad3e 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -255,7 +255,7 @@ This removes initial blank and comment lines and then calls
       (insert-file-contents file-name)
       (re-search-forward "^[ \t]*[^# \t]" nil t)
       (when (< (setq beg (point-min))
-              (setq end (point-at-bol)))
+               (setq end (line-beginning-position)))
        (delete-region beg end)))
     (org-babel-import-elisp-from-file temp-file '(16))))
 
diff --git a/lisp/ol-irc.el b/lisp/ol-irc.el
index ed8bad5a50..e36c44ff70 100644
--- a/lisp/ol-irc.el
+++ b/lisp/ol-irc.el
@@ -135,13 +135,13 @@ result is a cons of the filename and search string."
      ;; can we get a '::' part?
      (if (string= erc-line (erc-prompt))
         (progn
-          (goto-char (point-at-bol))
+           (goto-char (line-beginning-position))
           (when (search-backward-regexp "^[^   ]" nil t)
-            (buffer-substring-no-properties (point-at-bol)
-                                            (point-at-eol))))
+             (buffer-substring-no-properties (line-beginning-position)
+                                             (line-end-position))))
        (when (search-backward erc-line nil t)
-        (buffer-substring-no-properties (point-at-bol)
-                                        (point-at-eol)))))))
+         (buffer-substring-no-properties (line-beginning-position)
+                                         (line-end-position)))))))
 
 (defun org-irc-erc-store-link ()
   "Store a link to the IRC log file or the session itself.
@@ -151,7 +151,7 @@ the session itself."
   (require 'erc-log)
   (if org-irc-link-to-logs
       (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)))
        (if (erc-logging-enabled nil)
            (progn
diff --git a/lisp/ol.el b/lisp/ol.el
index a9e613e0d4..4ad1f6d345 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1481,7 +1481,7 @@ non-nil."
        (let ((end (region-end)))
          (goto-char (region-beginning))
          (set-mark (point))
-         (while (< (point-at-eol) end)
+          (while (< (line-end-position) end)
            (move-end-of-line 1) (activate-mark)
            (let (current-prefix-arg)
              (call-interactively 'org-store-link))
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index a43b083d53..35f19cf03b 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2113,7 +2113,7 @@ in that string.  If STRING is nil, it will be fetched 
from the beginning
 of the current line."
   (declare (debug t))
   (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)))
        (with-current-buffer (marker-buffer ,marker)
         (save-excursion
@@ -3076,10 +3076,10 @@ s   Search for keywords                 M   Like m, but 
only TODO entries
          (when (eq rmheader t)
            (org-goto-line 1)
            (re-search-forward ":" nil t)
-           (delete-region (match-end 0) (point-at-eol))
+            (delete-region (match-end 0) (line-end-position))
            (forward-char 1)
            (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)))
          (goto-char header-end)
          (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."
   (save-excursion
     (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)
     (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))))
 
 (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))
               (unless (looking-at "[ \t]*$")
                 (move-to-column ind)
-                (delete-region (point-at-bol) (point)))
+                 (delete-region (line-beginning-position) (point)))
               (beginning-of-line 2))
 
             (run-hooks 'org-agenda-entry-text-cleanup-hook)
@@ -3987,7 +3987,7 @@ agenda display, configure `org-agenda-finalize-hook'."
              (goto-char (point-min))
              (while (equal (forward-line) 0)
                (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
                                     (org-with-point-at mrk
                                       (org-get-tags))))))))
@@ -4035,7 +4035,8 @@ agenda display, configure `org-agenda-finalize-hook'."
              (goto-char s)
              (when (equal (org-get-at-bol 'org-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 'face 'org-agenda-clocking)
                (overlay-put ov 'help-echo
@@ -4066,7 +4067,7 @@ agenda display, configure `org-agenda-finalize-hook'."
              b (match-beginning 1)
              e (if (eq org-agenda-fontify-priorities 'cookies)
                    (1+ (match-end 2))
-                 (point-at-eol))
+                  (line-end-position))
              ov (make-overlay b e))
        (overlay-put
         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.
 Also moves point to the end of the skipped region, so that search can
 continue from there."
-  (let ((p (point-at-bol)) to)
+  (let ((p (line-beginning-position)) to)
     (when (or
           (save-excursion (goto-char p) (looking-at comment-start-skip))
           (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
                             org-agenda-entry-text-leaders))))
     (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 'org-overlay-type 'agenda-entry-content)
       (overlay-put o 'after-string txt))))
@@ -4749,7 +4750,7 @@ is active."
                                  (forward-line -1)
                                  (org-back-to-heading t)))
                      (skip-chars-forward "* ")
-                     (setq beg (point-at-bol)
+                      (setq beg (line-beginning-position)
                            beg1 (point)
                            end (progn
                                  (outline-next-heading)
@@ -4764,8 +4765,8 @@ is active."
                        (goto-char beg)
                        (org-agenda-skip)
                        (setq str (buffer-substring-no-properties
-                                  (point-at-bol)
-                                  (if hdl-only (point-at-eol) end)))
+                                   (line-beginning-position)
+                                   (if hdl-only (line-end-position) end)))
                        (mapc (lambda (wr) (when (string-match wr str)
                                             (goto-char (1- end))
                                             (throw :skip t)))
@@ -4793,7 +4794,7 @@ is active."
                              txt (org-agenda-format-item
                                   ""
                                   (buffer-substring-no-properties
-                                   beg1 (point-at-eol))
+                                    beg1 (line-end-position))
                                   level category tags t))
                        (org-add-props txt props
                          '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))
                 "")
     '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 ()
   "Add a dummy entry to the diary.
@@ -5986,7 +5987,7 @@ then those holidays will be skipped."
              clockp (not (or closedp statep))
              state (and statep (match-string 2))
              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)
          ;; substring should only run to end of time stamp
          (setq rest (substring timestr (match-end 0))
@@ -6044,7 +6045,7 @@ then those holidays will be skipped."
            'type type 'date date
            'undone-face 'org-warning 'done-face 'org-agenda-done)
          (push txt ee))
-       (goto-char (point-at-eol))))
+        (goto-char (line-end-position))))
     (nreverse ee)))
 
 (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))
        (org-with-point-at m
          (save-excursion
-           (goto-char (point-at-bol))
+            (goto-char (line-beginning-position))
            (unless (looking-at re)
              (error "No valid Clock line")
              (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))
       (when 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
                     (concat
                      (org-add-props
@@ -7147,7 +7148,10 @@ The optional argument TYPE tells the agenda type."
        (save-excursion
          (beginning-of-line 1)
          (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 "\\) +"))
            (add-text-properties (match-beginning 0) (match-end 1)
                                 (list 'face (org-get-todo-face 1)))
@@ -7428,7 +7432,7 @@ subtree."
                        (point)
                        (if org-agenda-restriction-lock-highlight-subtree
                            (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-end
                       (save-excursion (org-end-of-subtree t t)))
@@ -8254,8 +8258,8 @@ grouptags."
 (defun org-agenda-filter-hide-line (type)
   "If current line is TYPE, hide it in the agenda buffer."
   (let* (buffer-invisibility-spec
-        (beg (max (point-min) (1- (point-at-bol))))
-        (end (point-at-eol)))
+         (beg (max (point-min) (1- (line-beginning-position))))
+         (end (line-end-position)))
     (let ((inhibit-read-only t))
       (add-text-properties
        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")
   (let ((col (current-column)))
     (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)
        (goto-char (next-single-property-change (point) 'org-marker))))
     (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)
          (goto-char (match-beginning 4)))))
     (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
   "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)
                      (org-get-at-bol 'level))))
       (while (< (point) mend)
-       (let ((ov (make-overlay (point) (point-at-eol))))
+        (let ((ov (make-overlay (point) (line-end-position))))
          (if (not (or all
                       (and match (looking-at-p match))
                       (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"))))
               (setq dbeg (progn (org-back-to-heading t) (point))
                     dend (org-end-of-subtree t t))
-            (setq dbeg (point-at-bol)
-                  dend (min (point-max) (1+ (point-at-eol)))))
+             (setq dbeg (line-beginning-position)
+                   dend (min (point-max) (1+ (line-end-position)))))
           (goto-char dbeg)
           (while (re-search-forward "^[ \t]*\\S-" dend t) (setq n (1+ n)))))
        (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 end))
            (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))))))
 
 (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)
                     (org-get-at-bol 'org-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
                             buffer marker arg prefix)))
         (lk0 (car lkall))
@@ -9295,7 +9302,7 @@ if it was hidden in the outline."
   (let ((win (selected-window)))
     (org-agenda-goto t)
     (org-back-to-heading)
-    (set-window-start (selected-window) (point-at-bol))
+    (set-window-start (selected-window) (line-beginning-position))
     (cond
      ((= more 0)
       (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)
                    (org-with-wide-buffer
                     (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)
                done-face (org-get-at-bol 'done-face))
          (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)
              (beginning-of-line)
              (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
              (add-text-properties
-              (point-at-bol) (point-at-eol)
+               (line-beginning-position) (line-end-position)
               (list 'face
                     (if org-last-todo-state-is-todo
                         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))
           (t (error "Line update did not work")))
          (save-restriction
-           (narrow-to-region (point-at-bol) (point-at-eol))
+            (narrow-to-region (line-beginning-position) (line-end-position))
            (org-agenda-finalize)))
        (beginning-of-line 0)))))
 
@@ -9791,7 +9800,8 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
            (setq arg (- today cdate))))
        (org-timestamp-change arg (or what 'day))
        (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))
            (org-timestamp-change arg (or what 'day))
            (setq org-last-changed-timestamp
@@ -9846,7 +9856,7 @@ When called programmatically, FORCE-DIRECTION can be 
`set', `up',
               (length stamp))
            t)
           (add-text-properties
-          (1- (point)) (point-at-eol)
+           (1- (point)) (line-end-position)
           (list 'display (org-add-props stamp nil
                            'face '(secondary-selection default))))
          (beginning-of-line 1))
@@ -9990,13 +10000,13 @@ buffer, display it in another window."
     (if (equal (buffer-name) "*Calendar*")
        (setq d1 (calendar-cursor-to-date t)
              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"))
       (setq d1 (calendar-gregorian-from-absolute dp1)
            d2 (and (ignore-errors (mark))
                    (save-excursion
                      (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))))
     (message "Diary entry: [d]ay [a]nniversary [b]lock [j]ump to date tree")
     (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 ()
   "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))
 
 (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 m (user-error "Nothing to mark at point"))
          (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-get-todo-face "TODO")
                               'evaporate)
@@ -10388,7 +10399,7 @@ When ARG is greater than one mark ARG lines."
       (org-agenda-bulk-unmark-all)
     (cond ((org-agenda-bulk-marked-p)
           (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
                 (delete (org-get-at-bol 'org-hd-marker)
                         org-agenda-bulk-marked-entries))
@@ -10768,8 +10779,8 @@ tag and note")))))
     (message "Entry unflagged")))
 
 (defun org-agenda-get-any-marker (&optional pos)
-  (or (get-text-property (or pos (point-at-bol)) 'org-hd-marker)
-      (get-text-property (or pos (point-at-bol)) 'org-marker)))
+  (or (get-text-property (or pos (line-beginning-position)) 'org-hd-marker)
+      (get-text-property (or pos (line-beginning-position)) 'org-marker)))
 
 ;;; Appointment reminders
 
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 2fd9a9c74d..abf4f9610e 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1447,7 +1447,7 @@ Of course, if exact position has been required, just put 
it there."
                (if (org-at-table-p)
                    (save-excursion
                      (org-table-goto-line (nth 1 where))
-                     (point-at-bol))
+                      (line-beginning-position))
                  (point))))))
     (with-current-buffer (buffer-base-buffer (current-buffer))
       (org-with-point-at pos
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index fdc9818a5a..38e0826075 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1317,7 +1317,7 @@ the default behavior."
       ;; Clock in at which position?
       (setq target-pos
            (if (and (eobp) (not (org-at-heading-p)))
-               (point-at-bol 0)
+                (line-beginning-position 0)
              (point)))
       (save-excursion
        (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))
            (if fail-quietly (throw 'exit nil) (error "Clock start time is 
gone")))
          (goto-char (match-end 0))
-         (delete-region (point) (point-at-eol))
+          (delete-region (point) (line-end-position))
          (insert "--")
          (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
          (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)
     (if (looking-back (concat "^[ \t]*" org-clock-string ".*")
                      (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)))
       (message "Clock gone, cancel the timer anyway")
       (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))))
                  (setq time (aref ltimes level))
                  (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)
                  (when headline-filter
                    (save-excursion
@@ -2114,7 +2114,7 @@ fontified, and then returned."
     (forward-line 2)
     (buffer-substring (point) (progn
                                (re-search-forward "^[ \t]*#\\+END" nil t)
-                               (point-at-bol)))))
+                                (line-beginning-position)))))
 
 ;;;###autoload
 (defun org-clock-report (&optional arg)
@@ -2390,7 +2390,7 @@ the currently selected interval size."
   (setq n (prefix-numeric-value n))
   (and (memq dir '(left down)) (setq n (- n)))
   (save-excursion
-    (goto-char (point-at-bol))
+    (goto-char (line-beginning-position))
     (if (not (looking-at "^[ \t]*#\\+BEGIN:[ \t]+clocktable\\>.*?:block[ 
\t]+\\(\\S-+\\)"))
        (user-error "Line needs a :block definition before this command works")
       (let* ((b (match-beginning 1)) (e (match-end 1))
@@ -3030,7 +3030,7 @@ Otherwise, return nil."
         ((not (match-end 2))
          (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
                     (> org-clock-marker (point))
-                    (<= org-clock-marker (point-at-eol)))
+                     (<= org-clock-marker (line-end-position)))
            ;; The clock is running here
            (setq org-clock-start-time
                  (org-time-string-to-time (match-string 1)))
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 085e32d677..15f0daa91a 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -1028,7 +1028,7 @@ To get rid of the restriction, use 
`\\[org-agenda-remove-restriction-lock]'."
   (require 'org-agenda)
   (let (p m tp np dir txt)
     (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))
       (setq m (get-text-property p 'org-imenu-marker))
       (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))))
            (org-agenda-remove-restriction-lock 'noupdate)
          (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))
       (setq tp (previous-single-property-change
                (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)))
      (t (user-error "Don't know how to restrict Org mode agenda")))
     (move-overlay org-speedbar-restriction-lock-overlay
-                 (point-at-bol) (point-at-eol))
+                  (line-beginning-position) (line-end-position))
     (setq current-prefix-arg nil)
     (org-agenda-maybe-redo)))
 
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 20b5b03039..4c018062af 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -2205,7 +2205,7 @@ CDR is a plist containing `:key', `:value', `:begin', 
`:end',
          (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):")
                      (upcase (match-string-no-properties 1))))
          (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)))
          (end (progn (skip-chars-forward " \r\t\n" limit)
                      (if (eobp) (point) (line-beginning-position)))))
@@ -4273,7 +4273,7 @@ This function assumes that current major mode is 
`org-mode'."
     (goto-char (point-min))
     (org-skip-whitespace)
     (org-element--parse-elements
-     (point-at-bol) (point-max)
+     (line-beginning-position) (point-max)
      ;; Start in `first-section' mode so text before the first
      ;; headline belongs to a section.
      'first-section nil granularity visible-only (list 'org-data nil))))
@@ -6207,12 +6207,12 @@ end of ELEM-A."
           (end-A (save-excursion
                    (goto-char (org-element-property :end elem-A))
                    (skip-chars-backward " \r\t\n")
-                   (point-at-eol)))
+                    (line-end-position)))
           (beg-B (org-element-property :begin elem-B))
           (end-B (save-excursion
                    (goto-char (org-element-property :end elem-B))
                    (skip-chars-backward " \r\t\n")
-                   (point-at-eol)))
+                    (line-end-position)))
           ;; Store inner overlays responsible for visibility status.
           ;; We also need to store their boundaries as they will be
           ;; removed from buffer.
diff --git a/lisp/org-habit.el b/lisp/org-habit.el
index bc5175b163..3bf4307f4a 100644
--- a/lisp/org-habit.el
+++ b/lisp/org-habit.el
@@ -426,7 +426,7 @@ current time."
        (moment (org-time-subtract nil
                                   (* 3600 org-extend-today-until))))
     (save-excursion
-      (goto-char (if line (point-at-bol) (point-min)))
+      (goto-char (if line (line-beginning-position) (point-min)))
       (while (not (eobp))
        (let ((habit (get-text-property (point) 'org-habit-p))
               (invisible-prop (get-text-property (point) 'invisible)))
diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 581370bb53..2cbbf7f7ac 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -238,7 +238,7 @@ going below `org-inlinetask-min-level'."
          (setq beg (point))
          (replace-match down-task nil t nil 1)
          (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)
             (forward-line -1))
          (unless (= (point) beg)
@@ -264,7 +264,7 @@ If the task has an end part, also demote it."
        (setq beg (point))
        (replace-match down-task nil t nil 1)
        (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)
           (forward-line -1))
        (unless (= (point) beg)
@@ -312,7 +312,7 @@ If the task has an end part, also demote it."
               (if (bolp) (1- (point)) (point))))
        (start (save-excursion
                 (org-inlinetask-goto-beginning)
-                (point-at-eol))))
+                 (line-end-position))))
     (cond
      ;; Nothing to show/hide.
      ((= end start))
diff --git a/lisp/org-list.el b/lisp/org-list.el
index da309f8c6d..978e36ed61 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -517,7 +517,7 @@ Contexts `block' and `invalid' refer to 
`org-list-forbidden-blocks'."
                   (and (not (looking-at beg-re))
                        (not (looking-at end-re))
                        (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)
                                           (1- (match-beginning 0)))
                                      lim-down))
@@ -528,12 +528,12 @@ Contexts `block' and `invalid' refer to 
`org-list-forbidden-blocks'."
           (when (save-excursion
                   (and (not (looking-at block-re))
                        (setq beg (and (re-search-backward block-re lim-up t)
-                                      (1+ (point-at-eol))))
+                                       (1+ (line-end-position))))
                        (looking-at "^[ \t]*#\\+begin_\\(\\S-+\\)")
                        (setq type (downcase (match-string 1)))
                        (goto-char beg)
                        (setq end (or (and (re-search-forward block-re lim-down 
t)
-                                          (1- (point-at-bol)))
+                                           (1- (line-beginning-position)))
                                      lim-down))
                        (>= end pos)
                        (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]*$")))
                        (and (not (looking-at "^\\*+"))
                             (setq beg (and (re-search-backward beg-re lim-up t)
-                                           (1+ (point-at-eol))))
+                                            (1+ (line-end-position))))
                             (not (looking-at end-re))
                             (setq end (and (re-search-forward end-re lim-down 
t)
                                            (1- (match-beginning 0))))
@@ -569,7 +569,7 @@ values are:
 6. position at item end.
 
 Thus the following list, where numbers in parens are
-point-at-bol:
+line-beginning-position:
 
 - [X] first item                             (1)
   1. sub-item 1                              (18)
@@ -617,7 +617,7 @@ Assume point is at an item."
            ;; Ensure list ends at the first blank line.
            (lambda ()
              (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
       ;;    top item position and indentation in BEG-CELL.  Also store
       ;;    ending position of items in END-LST.
@@ -872,7 +872,7 @@ Point returned is at end of line."
   (save-excursion
     (goto-char (org-list-get-item-end item struct))
     (skip-chars-backward " \r\t\n")
-    (point-at-eol)))
+    (line-end-position)))
 
 (defun org-list-get-parent (item struct parents)
   "Return parent of ITEM or nil.
@@ -1182,7 +1182,7 @@ some heuristics to guess the result."
           (lambda ()
             ;; Count blank lines above beginning of line.
             (save-excursion
-              (count-lines (goto-char (point-at-bol))
+               (count-lines (goto-char (line-beginning-position))
                            (progn (skip-chars-backward " \r\t\n")
                                   (forward-line)
                                   (point)))))))
@@ -1287,7 +1287,7 @@ This function modifies STRUCT."
                 ;; must be removed, or they will be left, stacking up
                 ;; after the list.
                 (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")
                 ;; Cut position is after any blank on the line.
                 (save-excursion
@@ -1364,7 +1364,7 @@ STRUCT is the list structure."
                  (save-excursion
                    (goto-char item)
                    (skip-chars-backward " \r\t\n")
-                   (min (1+ (point-at-eol)) (point-max)))
+                    (min (1+ (line-end-position)) (point-max)))
                item)))
     ;; Remove item from buffer.
     (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))
                      (save-excursion
                        (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))
                      (let* ((all (org-list-get-all-items item struct prevs))
                             (len (length all))
@@ -1453,7 +1453,7 @@ This function returns, destructively, the new list 
structure."
                          (save-excursion
                            (goto-char
                             (org-list-get-last-item item struct prevs))
-                           (point-at-eol)))))
+                            (line-end-position)))))
                     (t dest)))
         (org-M-RET-may-split-line nil)
         ;; 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 " "))))))
              ;; c.  Indent item to appropriate column.
              (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)))
                (indent-to new-ind))))))
     ;; 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."
   (let* ((struct (org-list-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))
         (value init-value))
     (dolist (e (nreverse all))
@@ -2147,10 +2147,10 @@ the item, so this really moves item trees."
   (interactive)
   (unless (org-at-item-p) (error "Not at an item"))
   (let* ((col (current-column))
-        (item (point-at-bol))
+         (item (line-beginning-position))
         (struct (org-list-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)
       (user-error "Cannot move this item further down"))
     (if (not next-item)
@@ -2168,10 +2168,10 @@ the item, so this really moves item trees."
   (interactive)
   (unless (org-at-item-p) (error "Not at an item"))
   (let* ((col (current-column))
-        (item (point-at-bol))
+         (item (line-beginning-position))
         (struct (org-list-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)
       (user-error "Cannot move this item further up"))
     (if (not prev-item)
@@ -2312,7 +2312,7 @@ is an integer, 0 means `-', 1 means `+' etc.  If WHICH is
           (old-struct (copy-tree struct))
           (cbox (org-list-get-checkbox cpos 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))
                  "[ ]")))
       (dolist (pos (org-list-get-all-items
@@ -2372,7 +2372,7 @@ subtree, ignoring planning line and any drawer following 
it."
                (let ((limit (region-end)))
                  (goto-char (region-beginning))
                  (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"))
                  (setq lim-down (copy-marker limit))))
               ((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))))
                  (org-end-of-meta-data 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"))
                  (setq lim-down (copy-marker limit))))
               ;; Just one item: set SINGLEP flag.
               ((org-at-item-p)
                (setq singlep t)
-               (setq lim-up (point-at-bol)
-                     lim-down (copy-marker (point-at-eol))))
+                (setq lim-up (line-beginning-position)
+                      lim-down (copy-marker (line-end-position))))
               (t (error "Not at an item or heading, and no active region"))))
             ;; Determine the checkbox going to be applied to all items
             ;; within bounds.
@@ -2636,7 +2636,7 @@ Return t if successful."
           ;; Are we going to move the whole list?
           (specialp
            (and (not regionp)
-                (= top (point-at-bol))
+                 (= top (line-beginning-position))
                 (cdr (assq 'indent org-list-automatic-rules))
                 (if no-subtree
                     (user-error
@@ -2650,12 +2650,12 @@ Return t if successful."
            (progn
              (set-marker org-last-indent-begin-marker rbeg)
              (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
                      (cond
                       (specialp (org-list-get-bottom-point struct))
-                      (no-subtree (1+ (point-at-bol)))
-                      (t (org-list-get-item-end (point-at-bol) struct))))))
+                       (no-subtree (1+ (line-beginning-position)))
+                       (t (org-list-get-item-end (line-beginning-position) 
struct))))))
       (let* ((beg (marker-position org-last-indent-begin-marker))
             (end (marker-position org-last-indent-end-marker)))
        (cond
@@ -2893,8 +2893,8 @@ function is being called interactively."
   (let* ((case-func (if with-case 'identity 'downcase))
          (struct (org-list-struct))
          (prevs (org-list-prevs-alist struct))
-        (start (org-list-get-list-begin (point-at-bol) struct prevs))
-        (end (org-list-get-list-end (point-at-bol) struct prevs))
+         (start (org-list-get-list-begin (line-beginning-position) struct 
prevs))
+         (end (org-list-get-list-end (line-beginning-position) struct prevs))
         (sorting-type
          (or sorting-type
              (progn
@@ -2939,21 +2939,21 @@ function is being called interactively."
                   ((= dcst ?n)
                    (string-to-number
                     (org-sort-remove-invisible
-                     (buffer-substring (match-end 0) (point-at-eol)))))
+                      (buffer-substring (match-end 0) (line-end-position)))))
                   ((= dcst ?a)
                    (funcall case-func
                             (org-sort-remove-invisible
                              (buffer-substring
-                              (match-end 0) (point-at-eol)))))
+                               (match-end 0) (line-end-position)))))
                   ((= dcst ?t)
                    (cond
                     ;; If it is a timer list, convert timer to seconds
                     ((org-at-item-timer-p)
                      (org-timer-hms-to-secs (match-string 1)))
                     ((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
-                                                            (point-at-eol) t)))
+                                                             
(line-end-position) t)))
                      (org-time-string-to-seconds (match-string 0)))
                     (t (float-time now))))
                   ((= 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
             (goto-char pos)
             (skip-chars-forward " \r\t\n")
-            (point-at-bol))))
+             (line-beginning-position))))
        beg end)
     ;; Determine boundaries of changes.
     (if (org-region-active-p)
        (setq beg (funcall skip-blanks (region-beginning))
              end (copy-marker (region-end)))
-      (setq beg (point-at-bol)
-           end (copy-marker (point-at-eol))))
+      (setq beg (line-beginning-position)
+            end (copy-marker (line-end-position))))
     ;; Depending on the starting line, choose an action on the text
     ;; between BEG and END.
     (org-with-limited-levels
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index bb0562dde0..cf0eb48f2d 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1124,11 +1124,11 @@ the value in cadr."
 
 (defsubst org-get-at-bol (property)
   "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)
   "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)
   "Return the first non-nil value of property PROP in string S."
diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index 5cfaa7fe0a..6f0a60125c 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -617,7 +617,7 @@ The table of checksums is written to the file 
mobile-checksums."
         ((looking-at "[ \t]*$")) ; keep empty lines
         ((looking-at "=+$")
          ;; remove underlining
-         (delete-region (point) (point-at-eol)))
+          (delete-region (point) (line-end-position)))
         ((get-text-property (point) 'org-agenda-structural-header)
          (setq in-date nil)
          (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)))
          (setq sexp (member (get-text-property (point) 'type)
                             '("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
                (setq prefix (org-trim (buffer-substring
                                        (point) pl))
                      line (org-trim (buffer-substring
                                      pl
-                                     (point-at-eol))))
-               (delete-region (point-at-bol) (point-at-eol))
+                                      (line-end-position))))
+                (delete-region (line-beginning-position) (line-end-position))
                (insert line "<before>" prefix "</before>")
                (beginning-of-line 1))
            (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))
            (push (marker-buffer id-pos) buf-list))
          (unless (markerp id-pos)
-           (goto-char (+ 2 (point-at-bol)))
+            (goto-char (+ 2 (line-beginning-position)))
            (if (stringp id-pos)
                (insert id-pos " ")
              (insert "BAD REFERENCE "))
@@ -1093,7 +1093,7 @@ be returned that indicates what went wrong."
       (org-archive-to-archive-sibling))
 
      ((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)
                                                      (point))))
       (if (not (string-match "\\S-" current)) (setq current nil))
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index a590ff87f2..aa4c20050f 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -184,7 +184,7 @@ Changing this variable requires a restart of Emacs to get 
activated."
 (defun org-mouse-re-search-line (regexp)
   "Search the current line for a given regular expression."
   (beginning-of-line)
-  (re-search-forward regexp (point-at-eol) t))
+  (re-search-forward regexp (line-end-position) t))
 
 (defun org-mouse-end-headline ()
   "Go to the end of current headline (ignoring tags)."
@@ -574,7 +574,7 @@ This means, between the beginning of line and the point."
      (insert "+ "))
     (:end                              ; insert text here
      (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))
        (insert (concat org-mouse-punctuation " ")))))
   (insert text)
@@ -985,7 +985,7 @@ This means, between the beginning of line and the point."
 (defun org-mouse-do-remotely (command)
   ;;  (org-agenda-check-no-diary)
   (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))
           (buffer (marker-buffer 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-back-to-heading)
              (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)
              (message "_cmd: %S" org-mouse-cmd)
              (message "this-command: %S" this-command)
diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 71d00a7a22..3b3344b270 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -465,9 +465,9 @@ prefix argument (`C-u C-u C-u C-c C-w')."
        (unless (or (org-kill-is-subtree-p
                     (buffer-substring region-start region-end))
                    (prog1 org-refile-active-region-within-subtree
-                     (let ((s (point-at-eol)))
+                      (let ((s (line-end-position)))
                        (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)")))
       (if (equal arg '(16))
          (org-refile-goto-last-stored)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index c301bc6af1..9b692d0973 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -486,7 +486,7 @@ This may be useful when columns have been shrunk."
                                    (looking-at-p 
".*|\\s-+<[rcl]?\\([0-9]+\\)?>"))
                           (move-beginning-of-line 2))
                         (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)
                 (when (overlayp 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 "  |"))
                       "\n")))
     (if (string-match "^[ \t]*$" (buffer-substring-no-properties
-                                 (point-at-bol) (point)))
+                                  (line-beginning-position) (point)))
        (beginning-of-line 1)
       (newline))
     ;; (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)
       (setq n (1- n))
       (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")
       (goto-char (match-end 0))
       (and (looking-at " ") (forward-char 1)))
@@ -1102,7 +1102,7 @@ With numeric argument N, move N-1 fields forward first."
     (while (> n 1)
       (setq n (1- n))
       (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)
       (skip-chars-backward " ")
       (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))
       (while (and (re-search-forward org-table-dataline-regexp end t)
                  (setq cnt (1+ cnt))
-                 (< (point-at-eol) pos))))
+                  (< (line-end-position) pos))))
     cnt))
 
 (defun org-table-current-column ()
@@ -1322,7 +1322,7 @@ However, when FORCE is non-nil, create new columns if 
necessary."
   (beginning-of-line 1)
   (when (> n 0)
     (while (and (> (setq n (1- n)) -1)
-               (or (search-forward "|" (point-at-eol) t)
+                (or (search-forward "|" (line-end-position) t)
                    (and force
                         (progn (end-of-line 1)
                                (skip-chars-backward "^|")
@@ -1663,7 +1663,7 @@ With prefix ABOVE, insert above the current line."
     (org-table-align))
   (org-table-with-shrunk-columns
    (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)))
      (while (string-match "|\\( +\\)|" line)
        (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))
                    (org-table-current-dline))))
     (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))
      (org-move-to-column col)
      (when (and dline
@@ -2253,14 +2254,14 @@ For all numbers larger than LIMIT, shift them by DELTA."
                 (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
            s n a)
        (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([^)]+?)"))
              (if (equal (char-before (match-beginning 0)) ?.)
                  (user-error
                   "Change makes TBLFM term %s invalid, use undo to recover"
                   (match-string 0))
                (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([^)]+?)"))
            (setq s (match-string 1) n (string-to-number s))
            (cond
@@ -3789,8 +3790,9 @@ FACE, when non-nil, for the highlight."
     (let ((id 0) (ih 0) hline eol str ov)
       (goto-char (org-table-begin))
       (while (org-at-table-p)
-       (setq eol (point-at-eol))
-       (setq ov (make-overlay (point-at-bol) (1+ (point-at-bol))))
+        (setq eol (line-end-position))
+        (setq ov (make-overlay (line-beginning-position)
+                               (1+ (line-beginning-position))))
        (push ov org-table-coordinate-overlays)
        (setq hline (looking-at org-table-hline-regexp))
        (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)
                  (t (user-error "No reference at point")))
            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)
                                         'secondary-selection))
       (add-hook 'before-change-functions
diff --git a/lisp/org.el b/lisp/org.el
index bb6b6978f5..6f92cdeab5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5971,7 +5971,7 @@ and subscripts."
           (emph-p (get-text-property mpos 'org-emphasis))
           (link-p (get-text-property mpos 'mouse-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)
            comment-p (looking-at-p "^[ \t]*#[ +]"))
       (goto-char pos)
@@ -6443,7 +6443,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
                (and (memq org-cycle-emulate-tab '(white whitestart))
                     (save-excursion (beginning-of-line 1) (looking-at "[ 
\t]*"))
                     (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)
                              (>= (match-end 0) pos)))))
            (call-interactively (global-key-binding (kbd "TAB"))))
@@ -6498,7 +6498,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
          (progn
            (beginning-of-line)
            (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 has-children (org-list-has-child-p (point) struct)))
        (org-back-to-heading)
@@ -6545,7 +6545,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
       (unless (org-before-first-heading-p)
        (run-hook-with-args 'org-pre-cycle-hook 'children))
       (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-with-limited-levels (org-show-children))
        (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))
                (if (org-at-heading-p)
-                   (point-at-eol)
+                    (line-end-position)
                  (point))))
         (level (looking-at "\\*+"))
         (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."
   (save-excursion
     (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)
   "Edit the current headline.
@@ -8402,7 +8402,7 @@ function is being called interactively."
                    (org-time-string-to-seconds (match-string 1))
                  (float-time now))))
             ((= 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))
                org-priority-default))
             ((= dcst ?r)
@@ -9244,7 +9244,8 @@ If not found, stay at current position and return nil."
 (defun org-create-dblock (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."
-  (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)
     (newline))
   (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)
            (when (and arg (not (member org-state org-done-keywords)))
              (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?
            (when now-done-p
              (when (boundp 'org-agenda-headline-snapshot-before-repeat)
@@ -10121,7 +10123,7 @@ all statistics cookies in the buffer."
              (beginning-of-line 1)
              (while (re-search-forward
                      "\\(\\(\\[[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)))))
        (goto-char pos)
        (move-marker pos nil)))))
@@ -10168,7 +10170,7 @@ statistics everywhere."
                             (downcase (or (org-entry-get nil "COOKIE_DATA")
                                           "")))))
            (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 is-percent (match-end 2) checkbox-beg (match-beginning 0))
            (save-match-data
@@ -10277,10 +10279,11 @@ right sequence."
   (let (p)
     (cond
      ((not kwd)
-      (or (get-text-property (point-at-bol) 'org-todo-head)
+      (or (get-text-property (line-beginning-position) 'org-todo-head)
          (progn
-           (setq p (next-single-property-change (point-at-bol) 'org-todo-head
-                                                nil (point-at-eol)))
+            (setq p (next-single-property-change (line-beginning-position)
+                                                 'org-todo-head
+                                                 nil (line-end-position)))
            (get-text-property p 'org-todo-head))))
      ((not (member kwd org-todo-keywords-1))
       (car org-todo-keywords-1))
@@ -10736,13 +10739,13 @@ nil."
       (outline-next-heading)
       (while (re-search-backward re beg t)
        (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) ?\ ))
            (backward-delete-char 1)
          (when (string-match "^[ \t]*$" (buffer-substring
-                                         (point-at-bol) (point-at-eol)))
-           (delete-region (point-at-bol)
-                          (min (point-max) (1+ (point-at-eol))))))))))
+                                          (line-beginning-position) 
(line-end-position)))
+            (delete-region (line-beginning-position)
+                           (min (point-max) (1+ (line-end-position))))))))))
 
 (defvar org-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)
   (save-excursion
     (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 ""))
     (when flag
       (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)
                ov-end (match-end 1)
                ov-prefix "")
-       (setq ov-start (1- (point-at-eol))
+        (setq ov-start (1- (line-end-position))
              ov-end (1+ ov-start))
        (skip-chars-forward "^\n\r")
        (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))
                  (goto-char (point-min))
                  (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-set-current-tags-overlay current ov-prefix)
                  (let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)")))
@@ -14082,7 +14085,8 @@ user."
                            (max (point-min) (- (point) 4)) (point))
                           "    "))
          (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)))
             (org-end-time-was-given nil)
             (f (org-read-date-analyze ans org-def org-defdecode))
@@ -14104,7 +14108,7 @@ user."
        (when org-read-date-analyze-futurep
          (setq txt (concat txt " (=>F)")))
        (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)))))
 
 (defun org-read-date-analyze (ans def defdecode)
@@ -14654,8 +14658,8 @@ days in order to avoid rounding problems."
    (org-clock-update-time-maybe)
    (save-excursion
      (unless (org-at-date-range-p t)
-       (goto-char (point-at-bol))
-       (re-search-forward org-tr-regexp-both (point-at-eol) t))
+       (goto-char (line-beginning-position))
+       (re-search-forward org-tr-regexp-both (line-end-position) t))
      (unless (org-at-date-range-p t)
        (user-error "Not at a time-stamp range, and none found in current 
line")))
    (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))
                  (while (re-search-forward rea nil 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))
                (setq re (format "^\\*+ .*\\<%s\\>" org-comment-string))
                (while (re-search-forward re nil t)
@@ -17231,14 +17236,14 @@ this function returns t, nil otherwise."
     (save-excursion
       (catch 'exit
        (unless (org-region-active-p)
-         (setq beg (point-at-bol))
+          (setq beg (line-beginning-position))
          (beginning-of-line 2)
          (while (and (not (eobp)) ;; this is like `next-line'
                      (get-char-property (1- (point)) 'invisible))
            (beginning-of-line 2))
          (setq end (point))
          (goto-char beg)
-         (goto-char (point-at-eol))
+          (goto-char (line-end-position))
          (setq end (max end (point)))
          (while (re-search-forward re end t)
            (when (get-char-property (match-beginning 0) 'invisible)
@@ -18160,7 +18165,7 @@ number of stars to add."
             (goto-char pos)
             (while (org-at-comment-p) (forward-line))
             (skip-chars-forward " \r\t\n")
-            (point-at-bol))))
+             (line-beginning-position))))
        beg end toggled)
     ;; Determine boundaries of changes.  If a universal prefix has
     ;; 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))
              end (copy-marker (save-excursion
                                 (goto-char (region-end))
-                                (if (bolp) (point) (point-at-eol)))))
-      (setq beg (funcall skip-blanks (point-at-bol))
-           end (copy-marker (point-at-eol))))
+                                 (if (bolp) (point) (line-end-position)))))
+      (setq beg (funcall skip-blanks (line-beginning-position))
+            end (copy-marker (line-end-position))))
     ;; Ensure inline tasks don't count as headings.
     (org-with-limited-levels
      (save-excursion
@@ -18787,7 +18792,9 @@ and :keyword."
     ;; First the large context
     (cond
      ((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
              (beginning-of-line 1)
              (looking-at org-todo-line-tags-regexp))
@@ -18801,7 +18808,7 @@ and :keyword."
 
      ((org-at-item-p)
       (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)))
            clist)
       (and (org-at-item-checkbox-p)
@@ -19198,7 +19205,7 @@ Also align node properties according to 
`org-property-format'."
                      (beginning-of-line 1)
                      (skip-chars-backward "\n")
                      (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)))
           (type (org-element-type element)))
       (cond ((and (memq type '(plain-list item))
@@ -19938,7 +19945,7 @@ major mode."
                (point))))
       (org-babel-do-in-edit-buffer (call-interactively 'comment-dwim))
     (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))
     (org-indent-line)
     (insert "# ")))
@@ -20431,7 +20438,7 @@ interactive command with similar behavior."
                    (and (looking-at "[ \t]*$")
                         (string-match
                          "\\`\\*+\\'"
-                         (buffer-substring (point-at-bol) (point)))))))
+                          (buffer-substring (line-beginning-position) 
(point)))))))
          swallowp)
       (cond
        ((and subtreep org-yank-folded-subtrees)
@@ -20464,7 +20471,7 @@ interactive command with similar behavior."
          (beginning-of-line 1)
          (push-mark beg 'nomsg)))
        ((and subtreep org-yank-adjusted-subtrees)
-       (let ((beg (point-at-bol)))
+        (let ((beg (line-beginning-position)))
          (org-paste-subtree nil nil 'for-yank)
          (push-mark beg 'nomsg)))
        (t



reply via email to

[Prev in Thread] Current Thread [Next in Thread]