diff --git a/lisp/ob-core.el b/lisp/ob-core.el index cf1be5ad2..d422c52d9 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -939,7 +939,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))))) @@ -1958,9 +1958,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 518e4d667..07cd21386 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -315,7 +315,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 d780b626f..b654f2dcb 100644 --- a/lisp/ob-octave.el +++ b/lisp/ob-octave.el @@ -259,7 +259,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/oc-basic.el b/lisp/oc-basic.el index 7020ec47e..07f9b39d1 100644 --- a/lisp/oc-basic.el +++ b/lisp/oc-basic.el @@ -277,7 +277,7 @@ Optional argument INFO is the export state, as a property list." (when (or (org-file-has-changed-p file) (not (gethash file org-cite-basic--file-id-cache))) (insert-file-contents file) - (setf (buffer-file-name) file) + (set-visited-file-name file t) (puthash file (org-buffer-hash) org-cite-basic--file-id-cache)) (condition-case nil (unwind-protect @@ -295,7 +295,7 @@ Optional argument INFO is the export state, as a property list." (push (cons file-id table) org-cite-basic--bibliography-cache) table)))) (push (cons file entries) results)) - (setf (buffer-file-name) nil)) + (set-visited-file-name nil t)) (error (setq org-cite-basic--file-id-cache nil)))))) (when info (plist-put info :cite-basic/bibliography results)) results))) diff --git a/lisp/ol-bibtex.el b/lisp/ol-bibtex.el index 1256839b9..d8547f316 100644 --- a/lisp/ol-bibtex.el +++ b/lisp/ol-bibtex.el @@ -139,6 +139,7 @@ (declare-function org-narrow-to-subtree "org" (&optional element)) (declare-function org-set-property "org" (property value)) (declare-function org-toggle-tag "org" (tag &optional onoff)) +(declare-function org-indent-region "org" (start end)) (declare-function org-search-view "org-agenda" (&optional todo-only string edit-at)) @@ -764,7 +765,7 @@ drawer." "Read bibtex entries from FILE and insert as Org headlines after point." (interactive "fFile: ") (let ((pos (point))) - (dotimes (i (org-bibtex-read-file file)) + (dotimes (_ (org-bibtex-read-file file)) (save-excursion (org-bibtex-write 'noindent)) (re-search-forward org-property-end-re) (insert "\n")) diff --git a/lisp/ol-irc.el b/lisp/ol-irc.el index d43e0c928..eb0372ac3 100644 --- a/lisp/ol-irc.el +++ b/lisp/ol-irc.el @@ -138,13 +138,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. @@ -154,7 +154,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 0231fd192..7e5398b22 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -681,7 +681,7 @@ followed by another \"%[A-F0-9]{2}\" group." (cons 6 128)))) (when (>= val 192) (setq eat (car shift-xor))) (setq val (logxor val (cdr shift-xor))) - (setq sum (+ (lsh sum (car shift-xor)) val)) + (setq sum (+ (ash sum (car shift-xor)) val)) (when (> eat 0) (setq eat (- eat 1))) (cond ((= 0 eat) ;multi byte @@ -1529,7 +1529,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 b02b2ba1a..053232078 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -2150,7 +2150,7 @@ in that string. If STRING is nil, it will be fetched from the beginning of the current line." (declare (debug t) (indent 1)) (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 @@ -3116,10 +3116,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)) @@ -3545,10 +3545,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 @@ -3755,7 +3755,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) @@ -4027,7 +4027,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)))))))) @@ -4075,7 +4075,7 @@ 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 @@ -4106,7 +4106,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 @@ -4210,7 +4210,7 @@ Also moves point to the end of the skipped region, so that search can continue from there. Optional argument ELEMENT contains element at point." - (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) @@ -4286,7 +4286,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)))) @@ -4795,7 +4795,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) @@ -4810,8 +4810,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))) @@ -4839,7 +4839,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 @@ -5381,7 +5381,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. @@ -6057,7 +6057,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)) effort (save-match-data (or (get-text-property (point) 'effort) (org-entry-get (point) org-effort-property)))) (setq effort-minutes (when effort (save-match-data (org-duration-to-minutes effort)))) @@ -6122,7 +6122,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 () @@ -6159,7 +6159,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)) @@ -6205,7 +6205,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 @@ -7633,7 +7633,7 @@ 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))) @@ -7914,7 +7914,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))) @@ -8743,8 +8743,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))))) @@ -9400,7 +9400,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)) @@ -9458,7 +9458,7 @@ 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. @@ -9481,10 +9481,10 @@ 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)))) + (and match (looking-at-p match)) + (eq level (org-get-at-bol 'level)))) (org-agenda-next-item 1) (overlay-put ov 'face 'region) (if (or arg force-arg) (funcall cmd arg) (funcall cmd)) @@ -9526,8 +9526,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) @@ -9539,8 +9539,8 @@ Pass ARG, FORCE-ARG, DELETE and BODY to `org-agenda-do-in-region'." (prog2 (org-agenda-tree-to-indirect-buffer nil) (not (y-or-n-p - (format "Delete entry with %d lines in buffer \"%s\"? " - n (buffer-name buffer)))) + (format "Delete entry with %d lines in buffer \"%s\"? " + n (buffer-name buffer)))) (kill-buffer org-last-indirect-buffer)) (error "Abort")) (set-window-configuration win-conf)))) @@ -9626,7 +9626,7 @@ 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) @@ -9675,7 +9675,7 @@ 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)) @@ -9808,7 +9808,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-fold-subtree t) @@ -10009,7 +10009,7 @@ the same tree node, and the headline of the tree node in the Org file." (org-add-note)))) (defun org-agenda-change-all-lines (newhead hdmarker - &optional fixface just-this) + &optional fixface just-this) "Change all lines in the agenda buffer which match HDMARKER. The new content of the line will be NEWHEAD (as modified by `org-agenda-format-item'). HDMARKER is checked with @@ -10052,7 +10052,7 @@ If FORCE-TAGS is non-nil, the car of it returns the new tags." 'effort effort 'effort-minutes effort-minutes) 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) @@ -10069,10 +10069,10 @@ 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)))) @@ -10080,7 +10080,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))))) @@ -10312,7 +10312,7 @@ 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 @@ -10364,7 +10364,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)) @@ -10508,13 +10508,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)) @@ -10837,7 +10837,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) @@ -10862,7 +10862,7 @@ 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) @@ -10906,7 +10906,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)) @@ -11286,8 +11286,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 435e68d0e..428d0ac0e 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1458,7 +1458,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 0b07a2bf8..b432c7df7 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1325,7 +1325,7 @@ the default behavior." ;; Clock in at which position? (setq target-pos (if (and (eobp) (not (org-at-heading-p))) - (org-with-wide-buffer (point-at-bol 0)) + (org-with-wide-buffer (line-beginning-position 0)) (point))) (save-excursion (when (and selected-task (marker-buffer selected-task)) @@ -1349,8 +1349,8 @@ the default behavior." (when newstate (org-todo newstate)))) ((and org-clock-in-switch-to-state (not (looking-at (concat org-outline-regexp "[ \t]*" - org-clock-in-switch-to-state - "\\>")))) + org-clock-in-switch-to-state + "\\>")))) (org-todo org-clock-in-switch-to-state))) (setq org-clock-heading (org-clock--mode-line-heading)) (org-clock-find-position org-clock-in-resume) @@ -1679,7 +1679,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)) (org-fold-core-ignore-modifications (insert-and-inherit "--") (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive)) @@ -1820,7 +1820,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))) @@ -1959,7 +1959,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 @@ -2127,7 +2127,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) @@ -2403,7 +2403,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)) @@ -3057,7 +3057,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 09f26e735..b3b50d9ae 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -1222,7 +1222,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) @@ -1232,7 +1232,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) @@ -1249,7 +1249,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-cycle.el b/lisp/org-cycle.el index 83fa71f52..656ca83f2 100644 --- a/lisp/org-cycle.el +++ b/lisp/org-cycle.el @@ -412,7 +412,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")))) @@ -471,7 +471,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) @@ -525,7 +525,7 @@ Use `\\[org-edit-special]' to edit table.el tables")) (org-with-limited-levels (run-hook-with-args 'org-cycle-pre-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-fold-show-entry) (org-with-limited-levels (org-fold-show-children)) (org-fold-show-set-visibility 'tree) diff --git a/lisp/org-element.el b/lisp/org-element.el index 3dc8ee976..3758d3a1a 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -2414,7 +2414,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))))) @@ -4496,7 +4496,7 @@ This function assumes that current major mode is `org-mode'." (gc-cons-threshold #x40000000)) (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 org-data)))) @@ -8030,12 +8030,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 folds responsible for visibility status. (folds (cons diff --git a/lisp/org-habit.el b/lisp/org-habit.el index 05e5f61a7..677b7adb6 100644 --- a/lisp/org-habit.el +++ b/lisp/org-habit.el @@ -428,7 +428,7 @@ current time." (buffer-invisibility-spec '(org-link)) (moment (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 5d87be49e..dcf657e33 100644 --- a/lisp/org-inlinetask.el +++ b/lisp/org-inlinetask.el @@ -241,7 +241,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) @@ -267,7 +267,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) @@ -317,7 +317,7 @@ When STATE is `unfold', unfold unconditionally." (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 9ebcdbe6b..4867c6240 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -522,7 +522,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)) @@ -533,12 +533,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"))) @@ -552,7 +552,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)))) @@ -574,7 +574,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) @@ -622,7 +622,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. @@ -877,7 +877,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. @@ -1172,7 +1172,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))))))) @@ -1277,7 +1277,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 @@ -1354,7 +1354,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) @@ -1431,7 +1431,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)) @@ -1443,7 +1443,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). @@ -1885,7 +1885,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 @@ -2015,7 +2015,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)) @@ -2152,10 +2152,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) @@ -2173,10 +2173,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) @@ -2342,7 +2342,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 @@ -2402,7 +2402,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) @@ -2411,14 +2411,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. @@ -2666,7 +2666,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 @@ -2680,12 +2680,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 @@ -2923,8 +2923,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 @@ -2969,21 +2969,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)) @@ -3056,14 +3056,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 2e4590e93..b2eb80950 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1062,7 +1062,8 @@ Return width in pixels when PIXELS is non-nil." current-char-property-alias-alist) (let (pixel-width symbol-width) (with-silent-modifications - (setf (buffer-string) string) + (erase-buffer) + (insert string) (setq pixel-width (if (get-buffer-window (current-buffer)) (car (window-text-pixel-size @@ -1071,7 +1072,8 @@ Return width in pixels when PIXELS is non-nil." (car (window-text-pixel-size nil (line-beginning-position) (point-max))))) (unless pixels - (setf (buffer-string) "a") + (erase-buffer) + (insert "a") (setq symbol-width (if (get-buffer-window (current-buffer)) (car (window-text-pixel-size @@ -1286,11 +1288,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 31c8381bc..1c1e82a92 100644 --- a/lisp/org-mobile.el +++ b/lisp/org-mobile.el @@ -620,7 +620,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)) @@ -640,14 +640,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 "" prefix "") (beginning-of-line 1)) (and (looking-at "[ \t]+") (replace-match ""))) @@ -860,7 +860,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 ")) @@ -1096,7 +1096,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 afc908111..70b9bbdf1 100644 --- a/lisp/org-mouse.el +++ b/lisp/org-mouse.el @@ -187,7 +187,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) @@ -989,7 +989,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)) @@ -1013,7 +1013,7 @@ This means, between the beginning of line and the point." (org-fold-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-plot.el b/lisp/org-plot.el index 6e5f3592d..29f578d0a 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -625,7 +625,7 @@ manner suitable for prepending to a user-specified script." (dolist (img-overlay org-inline-image-overlays) (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file)) (when (file-exists-p img-file) - (image-refresh (overlay-get img-overlay 'display)))))) + (image-flush (overlay-get img-overlay 'display)))))) ;;----------------------------------------------------------------------------- ;; facade functions diff --git a/lisp/org-refile.el b/lisp/org-refile.el index bf4e7d9bc..16cff25bd 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -467,9 +467,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 ad34ea1d6..9f4cd586f 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -490,7 +490,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)) @@ -829,7 +829,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)) @@ -1091,7 +1091,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))) @@ -1106,7 +1106,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)) @@ -1163,7 +1163,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 () @@ -1326,7 +1326,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 "^|") @@ -1667,7 +1667,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 @@ -1716,7 +1716,7 @@ 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 @@ -2257,14 +2257,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 @@ -3790,8 +3790,8 @@ 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))) @@ -4924,7 +4924,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 bb9536616..34560c83f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5994,7 +5994,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) @@ -6381,7 +6381,7 @@ This is a list with the following elements: "Get the entry text, after heading, entire subtree." (save-excursion (org-back-to-heading t) - (filter-buffer-substring (point-at-bol 2) (org-end-of-subtree t)))) + (filter-buffer-substring (line-beginning-position 2) (org-end-of-subtree t)))) (defun org-edit-headline (&optional heading) "Edit the current headline. @@ -6861,7 +6861,7 @@ case." (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)) " ")))) @@ -7686,7 +7686,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) @@ -8595,7 +8595,7 @@ 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)) @@ -9281,7 +9281,7 @@ 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) @@ -9494,7 +9494,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))))) @@ -9537,11 +9537,11 @@ statistics everywhere." (setq first nil cookie-present nil) (unless (and level (not (string-match - "\\" - (downcase (or (org-entry-get nil "COOKIE_DATA") - ""))))) + "\\" + (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 @@ -9650,10 +9650,10 @@ 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)) @@ -10115,13 +10115,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 @@ -11718,7 +11718,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) @@ -11765,7 +11765,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 @@ -11932,7 +11932,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 "\\)"))) @@ -13682,7 +13682,7 @@ 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)) @@ -13704,7 +13704,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) @@ -14259,8 +14259,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)) @@ -16053,7 +16053,7 @@ INCLUDE-LINKED is passed to `org-display-inline-images'." (org-toggle-inline-images))) ;; For without-x builds. -(declare-function image-refresh "image" (spec &optional frame)) +(declare-function image-flush "image" (spec &optional frame)) (defcustom org-display-remote-inline-images 'skip "How to display remote inline images. @@ -16194,7 +16194,7 @@ buffer boundaries with possible narrowing." (org-element-property :begin link) 'org-image-overlay))) (if (and (car-safe old) refresh) - (image-refresh (overlay-get (cdr old) 'display)) + (image-flush (overlay-get (cdr old) 'display)) (let ((image (org--create-inline-image file width))) (when image (let ((ov (make-overlay @@ -16738,14 +16738,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' (org-invisible-p (1- (point)))) (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 (org-invisible-p (match-beginning 0)) @@ -17660,7 +17660,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, @@ -17674,9 +17674,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 @@ -18249,10 +18249,10 @@ When ELEMENT is provided, it is considered to be element at point." (when (eq 'src-block (org-element-type element)) (or (not inside) (not (or (= (line-beginning-position) - (org-element-property :post-affiliated element)) - (= (1+ (line-end-position)) - (- (org-element-property :end element) - (org-element-property :post-blank element)))))))) + (org-element-property :post-affiliated element)) + (= (1+ (line-end-position)) + (- (org-element-property :end element) + (org-element-property :post-blank element)))))))) (defun org-context () "Return a list of contexts of the current cursor position. @@ -18289,7 +18289,7 @@ and :keyword." ;; First the large context (cond ((org-at-heading-p) - (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)) @@ -18303,7 +18303,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) @@ -18594,12 +18594,12 @@ ELEMENT." (and (eq org-adapt-indentation 'headline-data) (not (or (org-at-clock-log-p) - (org-at-planning-p))) + (org-at-planning-p))) (progn (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)))))) (throw 'exit 0)) (t (goto-char (org-element-property :begin previous)) (throw 'exit @@ -18722,7 +18722,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-no-context))) (type (org-element-type element))) (cond ((and (memq type '(plain-list item)) @@ -19468,7 +19468,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 "# "))) @@ -19486,10 +19486,10 @@ strictly within a source block, use appropriate comment syntax." (line-end-position)) beg) (>= (save-excursion - (goto-char (org-element-property :end element)) - (skip-chars-backward " \r\t\n") - (line-beginning-position)) - end))) + (goto-char (org-element-property :end element)) + (skip-chars-backward " \r\t\n") + (line-beginning-position)) + end))) ;; Translate region boundaries for the Org buffer to the source ;; buffer. (let ((offset (- end beg))) @@ -19963,7 +19963,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) @@ -19996,7 +19996,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 diff --git a/lisp/ox.el b/lisp/ox.el index 76ae871d9..97365aff7 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -6542,7 +6542,7 @@ to send the output file through additional processing, e.g, (let ((outfile (org-export-output-file-name \".tex\" subtreep))) (org-export-to-file \\='latex outfile async subtreep visible-only body-only ext-plist - #'org-latex-compile))) + #\\='org-latex-compile))) When expressed as an anonymous function, using `lambda', POST-PROCESS needs to be quoted.