[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 5d162b7 10/29: org.el/org-back-to-heading: Handle i
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 5d162b7 10/29: org.el/org-back-to-heading: Handle inlinetasks correctly |
Date: |
Sun, 17 Oct 2021 02:57:27 -0400 (EDT) |
branch: externals/org
commit 5d162b7bcf3b3790d9a4d2df8b5bf73f3a7e1dfc
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org.el/org-back-to-heading: Handle inlinetasks correctly
* lisp/org.el(org-back-to-heading): Rewrite `outline-back-to-heading'
considering inlinetasks.
---
lisp/org.el | 42 +++++++++++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index dafdb31..38ce7ac 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20567,21 +20567,39 @@ interactive command with similar behavior."
(<= (org-outline-level) level))))))))
(defun org-back-to-heading (&optional invisible-ok)
- "Call `outline-back-to-heading', but provide a better error message."
- (condition-case nil
- (outline-back-to-heading invisible-ok)
- (error
- (user-error "Before first headline at position %d in buffer %s"
- (point) (current-buffer)))))
+ "Go back to beginning of heading."
+ (beginning-of-line)
+ (or (org-at-heading-p (not invisible-ok))
+ (let (found)
+ (save-excursion
+ ;; At inlinetask end. Move to bol, so that the following
+ ;; search goes to the beginning of the inlinetask.
+ (when (and (featurep 'org-inlinetask)
+ (fboundp 'org-inlinetask-end-p)
+ (org-inlinetask-end-p))
+ (goto-char (line-beginning-position)))
+ (while (not found)
+ (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
+ nil t)
+ (user-error "Before first headline at position %d in buffer %s"
+ (point) (current-buffer)))
+ ;; Skip inlinetask end.
+ (if (and (featurep 'org-inlinetask)
+ (fboundp 'org-inlinetask-end-p)
+ (org-inlinetask-end-p))
+ (org-inlinetask-goto-beginning)
+ (setq found (and (or invisible-ok (not (org-invisible-p)))
+ (point))))))
+ (goto-char found)
+ found)))
(defun org-back-to-heading-or-point-min (&optional invisible-ok)
"Go back to heading or first point in buffer.
If point is before first heading go to first point in buffer
instead of back to heading."
- (condition-case nil
- (outline-back-to-heading invisible-ok)
- (error
- (goto-char (point-min)))))
+ (if (org-before-first-heading-p)
+ (goto-char (point-min))
+ (org-back-to-heading invisible-ok)))
(defun org-before-first-heading-p ()
"Before first heading?"
@@ -20712,7 +20730,9 @@ level of the headline found (down to 0) or nil if
already at a
point before the first headline or at point-min."
(when (ignore-errors (org-back-to-heading t))
(if (< 1 (funcall outline-level))
- (org-up-heading-safe)
+ (or (org-up-heading-safe)
+ ;; The first heading may not be level 1 heading.
+ (goto-char (point-min)))
(unless (= (point) (point-min)) (goto-char (point-min))))))
(defun org-first-sibling-p ()
- [elpa] externals/org updated (9475993 -> f4bcc0c), ELPA Syncer, 2021/10/17
- [elpa] externals/org 6933c1a 01/29: lisp/org-persist.el: New library to store data across sessions, ELPA Syncer, 2021/10/17
- [elpa] externals/org fc80d05 02/29: Re-implement org-element-cache and add headline support, ELPA Syncer, 2021/10/17
- [elpa] externals/org bc52c4d 03/29: Fix compatibility for older Emacs versions, ELPA Syncer, 2021/10/17
- [elpa] externals/org 68a44ea 04/29: org.el/org-narrow-to-subtree: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 7159ec0 05/29: org.el/org-at-planning-p: Add cache support, ELPA Syncer, 2021/10/17
- [elpa] externals/org 38b632d 06/29: org.el/org--get-local-tags: Add cache support, ELPA Syncer, 2021/10/17
- [elpa] externals/org 78abbcd 07/29: org.el/org-get-tags: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 5bf5fdb 09/29: org.el/org-entry-get-with-inheritance: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 5d162b7 10/29: org.el/org-back-to-heading: Handle inlinetasks correctly,
ELPA Syncer <=
- [elpa] externals/org f4bcc0c 29/29: Merge branch 'main' into feature/org-element-cache-new, ELPA Syncer, 2021/10/17
- [elpa] externals/org fede258 15/29: org.el/org-in-archived-heading-p: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org 07ca988 24/29: Fix compatibility with Emacs 27, ELPA Syncer, 2021/10/17
- [elpa] externals/org eeb0450 26/29: Use XDG cache dir as default dir for cache persistance, ELPA Syncer, 2021/10/17
- [elpa] externals/org 8ceb9e7 27/29: Add NEWS entry for new element cache, ELPA Syncer, 2021/10/17
- [elpa] externals/org 85e0a69 20/29: Avoid frequent cache updates in some functions, ELPA Syncer, 2021/10/17
- [elpa] externals/org 7b83168 08/29: org.el/org--property-local-values: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org ec73755 12/29: org.el/org-end-of-subtree: Support cache and passing element arg, ELPA Syncer, 2021/10/17
- [elpa] externals/org fe6cefd 16/29: ox.el: Support cache during export, ELPA Syncer, 2021/10/17
- [elpa] externals/org 60c927f 17/29: Add new element parser and cache tests, ELPA Syncer, 2021/10/17