From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4NT2A0kMYGLf+AAAbAwnHQ (envelope-from ) for ; Wed, 20 Apr 2022 15:36:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GNPZA0kMYGLGIgEAauVa8A (envelope-from ) for ; Wed, 20 Apr 2022 15:36:09 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B0D8917574 for ; Wed, 20 Apr 2022 15:36:08 +0200 (CEST) Received: from localhost ([::1]:35362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhAV2-0001Yt-0u for larch@yhetil.org; Wed, 20 Apr 2022 09:36:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhAK2-00042z-RP for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:24:43 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:44908) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhAK1-0003Oo-9r for emacs-orgmode@gnu.org; Wed, 20 Apr 2022 09:24:42 -0400 Received: by mail-pl1-x635.google.com with SMTP id j8so1744234pll.11 for ; Wed, 20 Apr 2022 06:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:in-reply-to:references:message-id:date:mime-version; bh=iK14MIwk6oM4cTKB61ziY2Jft2eNxvK+5VCAV7o8CyI=; b=M2Tt+2V2Fyhv0Fvlr7BJs2kArXyhFScxbO8inSZAU9Hh14faFemrf6xLKPFHIZMI15 pc/tgOrWnYP9R2Yk7AwyLuuP9ZK4n483gtX3ouJBhPJRYAg/xQ3TrMwtEBxzwlw+Ghsd WlZfJscgP9Z7RMjjF/DsNhilOR8y9cUd1it+Em4JHeAODHqKCqt6SMRqWwX9JuSmzpQB VkTm4VsRIV3RiHnvZnOoLoneA+fN0jSSJf/zztO9BD2pTDfhU+L+kKmZEyDokGNdUyf5 fLfTkFlUloTK2lG8rM/yTr0haX+5rgF3D26o2pspQqC36+SBQ9lw+ZtGJHM/hZflv75o RTNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references :message-id:date:mime-version; bh=iK14MIwk6oM4cTKB61ziY2Jft2eNxvK+5VCAV7o8CyI=; b=hc54B6IdiAmguOZu3VP40Tq/pb4Tj5QoGTdR6D4h6llxCQM8vk1P7rP0lL6p5LEoIo 6YOpuIF/sQW68M2kHYXm8v0aN0MEDpqQebL7apeaS7q6u/XFQvGw5B8GE4F19k/pV5Hq kLGUcgsjLzfwnlANlY+0m6rP4EDbH3TKkJQpj4dbo2NahtPZRXIBGMqq2Jv5GWhTIWnj ggqtUc9E9yD3Acg/q77ksoK5S8miagEOs8iPjpHQT9ykXcrS7F1yrBF1s3E/LUY4goNG G9FNfKD2SKo5gQQ173SwTaI7LgYGDP3+3AuugAJFIL7pSMZz4pg/5vFGHwx9QkgNplP8 8cXw== X-Gm-Message-State: AOAM532uuzx9yhtAOF3KwPrUeMXsxIPnT1LHhy3jcv0fnCSzjPZQHmMj 1voAJLQquQ7t5qNGAxTy8s9nsb1PBQBg8A== X-Google-Smtp-Source: ABdhPJzBs+TltlAMO5tZ/Z1U44MAp3HsQ3qMTuvUGpHaTyM8rAS9FEF+Cs/s4ybmLZvADyB+C5py9w== X-Received: by 2002:a17:902:bd0c:b0:158:f864:4d9d with SMTP id p12-20020a170902bd0c00b00158f8644d9dmr15634214pls.13.1650461079169; Wed, 20 Apr 2022 06:24:39 -0700 (PDT) Received: from localhost ([64.32.23.62]) by smtp.gmail.com with ESMTPSA id z14-20020a17090a170e00b001cb7e69ee5csm23046151pjd.54.2022.04.20.06.24.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 06:24:38 -0700 (PDT) From: Ihor Radchenko To: emacs-orgmode@gnu.org Subject: [PATCH v2 12/38] org-fold: Handle indirect buffer visibility--- In-Reply-To: References: Message-Id: <406c5f80d93725d9646418bc23efb6a77d4053d7.1650460489.git.yantar92@gmail.com> Date: Wed, 20 Apr 2022 21:25:31 +0800 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=yantar92@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650461768; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=iK14MIwk6oM4cTKB61ziY2Jft2eNxvK+5VCAV7o8CyI=; b=tD328LvdQV7WyOYYHYBEMpBw7RiZDZneeHNnXMqn/bSxdWgv8o+ErVobG/8IXj/kYTfqsk cDpvab4k9waovDs89gENPWSaL65DxWXJHQ8hkXOFhnLgWP3+iWu7ofgCYn3hPNk2t174b8 VvlG7W9+QTam98SWIHj0hOtmCINDH4cTdMy3cKMpgzOwnVYFK2OeXyaF0dr+hOoRm2ZWRd s45YIrP6KKc1JOB3DOR7OBSNvd9lZ0Pb+L8j6iED/uzWc0w1IgVkdTN+rb1AEAsm/kYDNm ONVYV1A4U/hGbKvbzWl7PsAwQuMImfhcg0VzhjATgvxR1krthCaAt76nbAYgOw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650461768; a=rsa-sha256; cv=none; b=sjuFSB43JRMx+In+gJxLym8qXFfRnNgPKFs8obeGukomne1Qa9s7rxQN30gpTOP8G9OQK2 h8oBb1ZRi+WrflToG22Tz6s307/Rjy8TclUXk4GujeJbnB8G3uHIxzaiB32rZ9bg+ZFZ2y LGU/rsp0BLVt7OiZ2HvN7unYyIJE08+GbpPMH2ET9hTQZCh4jQ9z6oyXjOtfmrn6kBovj8 nl1pfkkY9mDPTZ9Qq7k8Qj00PISD2ftRafgGmiliSVMxDA1ZYkOICjVOb0Ezxw+jDCrF8B 2rZ+2lSHSEbQ23cKbmM+4co7TXlQHAP8qoaHFn3eUAHTIUEcPdq5vmpCpBIfyQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=M2Tt+2V2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.04 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=M2Tt+2V2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B0D8917574 X-Spam-Score: -3.04 X-Migadu-Scanner: scn1.migadu.com X-TUID: rAK/TaJVYD5M --- 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