[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 12/38] org-fold: Handle indirect buffer visibility---
From: |
Ihor Radchenko |
Subject: |
[PATCH v2 12/38] org-fold: Handle indirect buffer visibility--- |
Date: |
Wed, 20 Apr 2022 21:25:31 +0800 |
---
lisp/org-capture.el | 5 ++++-
lisp/org.el | 8 +++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 1324ffab4..068e3eda2 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1171,7 +1171,10 @@ (defun org-capture-place-entry ()
(goto-char (point-min))
(unless (org-at-heading-p) (outline-next-heading)))
;; Otherwise, insert as a top-level entry at the end of the file.
- (t (goto-char (point-max))))
+ (t (goto-char (point-max))
+ ;; Make sure that last point is not folded.
+ (org-fold-core-cycle-over-indirect-buffers
+ (org-fold-region (max 1 (1- (point-max))) (point-max) nil))))
(let ((origin (point)))
(unless (bolp) (insert "\n"))
(org-capture-empty-lines-before)
diff --git a/lisp/org.el b/lisp/org.el
index 0b50e30d9..9ebdb23e1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5984,7 +5984,13 @@ (defun org-get-indirect-buffer (&optional buffer heading)
(number-to-string n))))))
(setq n (1+ n)))
(condition-case nil
- (make-indirect-buffer buffer bname 'clone)
+ (let ((indirect-buffer (make-indirect-buffer buffer bname 'clone)))
+ ;; Decouple folding state. We need to do it manually since
+ ;; `make-indirect-buffer' does not run
+ ;; `clone-indirect-buffer-hook'.
+ (org-fold-core-decouple-indirect-buffer-folds)
+ ;; Return the buffer.
+ indirect-buffer)
(error (make-indirect-buffer buffer bname)))))
(defun org-set-frame-title (title)
--
2.35.1
--
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong
University, Xi'an, China
Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg
- [PATCH v2 01/38] Add org-fold-core: new folding engine---, (continued)
- [PATCH v2 01/38] Add org-fold-core: new folding engine---, Ihor Radchenko, 2022/04/20
- [PATCH v2 02/38] Separate folding functions from org.el into new library: org-fold, Ihor Radchenko, 2022/04/20
- [PATCH v2 03/38] Separate cycling functions from org.el into new library: org-cycle, Ihor Radchenko, 2022/04/20
- [PATCH v2 04/38] Remove functions from org.el that are now moved elsewhere, Ihor Radchenko, 2022/04/20
- [PATCH v2 05/38] Disable native-comp in agendaIt caused cryptic bugs in the past., Ihor Radchenko, 2022/04/20
- [PATCH v2 06/38] org-macs: New function org-find-text-property-region---, Ihor Radchenko, 2022/04/20
- [PATCH v2 07/38] org-at-heading-p: Accept optional argument* lisp/org.el (org-at-heading-p): Use second argument to allow, Ihor Radchenko, 2022/04/20
- [PATCH v2 08/38] org-string-width: Reimplement to work with new folding, Ihor Radchenko, 2022/04/20
- [PATCH v2 09/38] Rename old function call to use org-fold---, Ihor Radchenko, 2022/04/20
- [PATCH v2 10/38] Implement link folding* lisp/ol.el (org-link--link-folding-spec):, Ihor Radchenko, 2022/04/20
- [PATCH v2 12/38] org-fold: Handle indirect buffer visibility---,
Ihor Radchenko <=
- [PATCH v2 11/38] Implement overlay- and text-property-based versions of some functions, Ihor Radchenko, 2022/04/20
- [PATCH v2 13/38] Fix subtle differences between overlays and invisible text properties, Ihor Radchenko, 2022/04/20
- [PATCH v2 14/38] Support extra org-fold optimisations for huge buffers, Ihor Radchenko, 2022/04/20
- [PATCH v2 15/38] Alias new org-fold functions to their old shorter names, Ihor Radchenko, 2022/04/20
- [PATCH v2 16/38] Obsolete old function names that are now in org-fold---, Ihor Radchenko, 2022/04/20
- [PATCH v2 18/38] Move `org-buffer-list' to org-macs.el---, Ihor Radchenko, 2022/04/20
- [PATCH v2 19/38] Restore old visibility behaviour of org-refile---, Ihor Radchenko, 2022/04/20
- [PATCH v2 17/38] org-compat: Work around some third-party packages using outline-* functions, Ihor Radchenko, 2022/04/20
- [PATCH v2 20/38] Add org-fold-related tests---, Ihor Radchenko, 2022/04/20
- [PATCH v2 22/38] ORG-NEWS: Add list of changes---, Ihor Radchenko, 2022/04/20