diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2022-08-23 04:54:57 +0200 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2022-08-23 04:54:57 +0200 |
commit | b7e867b841f47dcff3aeaef9b5608a237386ce70 (patch) | |
tree | 57154cb336fcfdf9fbf80e4c6bb24b07a0432b66 /lisp/org/org-list.el | |
parent | e425b7d231d02e76ec3e3790418121fc07877e70 (diff) | |
download | emacs-b7e867b841f47dcff3aeaef9b5608a237386ce70.tar.gz emacs-b7e867b841f47dcff3aeaef9b5608a237386ce70.tar.bz2 emacs-b7e867b841f47dcff3aeaef9b5608a237386ce70.zip |
Make point-at-eol and point-at-bol obsolete
* lisp/subr.el (point-at-eol, point-at-bol): Make XEmacs compat
aliases obsolete in favor of `pos-bol'/'line-beginning-position' or
'pos-eol'/'line-end-position'. Update callers.
Ref: https://lists.gnu.org/r/emacs-devel/2022-08/msg00853.html
Diffstat (limited to 'lisp/org/org-list.el')
-rw-r--r-- | lisp/org/org-list.el | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index da309f8c6da..978e36ed617 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/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 |