From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mCPzKHEp9WGaawEAgWs5BA (envelope-from ) for ; Sat, 29 Jan 2022 12:48:01 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wLYcJnEp9WEkzwAA9RJhRA (envelope-from ) for ; Sat, 29 Jan 2022 12:48:01 +0100 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 D7721137B6 for ; Sat, 29 Jan 2022 12:48:00 +0100 (CET) Received: from localhost ([::1]:51900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDmD2-0005nS-2I for larch@yhetil.org; Sat, 29 Jan 2022 06:48:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDm10-0002XH-Uk for emacs-orgmode@gnu.org; Sat, 29 Jan 2022 06:35:35 -0500 Received: from [2607:f8b0:4864:20::42f] (port=45827 helo=mail-pf1-x42f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDm0w-0000WW-MP; Sat, 29 Jan 2022 06:35:34 -0500 Received: by mail-pf1-x42f.google.com with SMTP id 128so8512386pfe.12; Sat, 29 Jan 2022 03:35:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mRj4QkCMkvAtxlWgaIOzsA89iD4B1C3q1mrv52nWaNM=; b=O/QtAEr//lo2hgXsUh6bEw7htG8yv7pC5G/zIWKx5S006RFA9sgtzO3ae9lqBplE4c phZmqwdHOLNC429OGAQcmowMrI8EuSombGmQ42mJgSfcenJPhzKigESteXIa0S3yLo5k HXudB55Nynv8qeOG8FsrRiQbiJC3RA1EzFmL3XmuxaQ9Z4sExiQjPbw6ylQWAq9Dm+6m rOoZ3/7vuFl7gIEKcUwqQZ0FR0bGQrNtB9PEf1i8abuP+0rgkvgHkIjZc4WzRqU5wHV0 bC+plbBsKtLHDuHpo2+nfolpMrb/k5tAGKF8lHG2q8RuqnsxWCR/dtv/iN930hS9Tizp qGnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mRj4QkCMkvAtxlWgaIOzsA89iD4B1C3q1mrv52nWaNM=; b=pvpRW2aesZ7M1/NHKuaZEM8Xncu2pcScY3eio5lCoSMBVS7wVK7wpV3n0w4roYfYTn MrKSWAYa3TxJ//KZzxCdFT3wIXtuwwuepguf5WdmSrx2w63CgwMQIdjM0N/Sg0BLbOh+ CIkaKDg67OJdWC83X1wmrWvYZlmrvM6ONA7MT54ev9CrFGBKfKCECw5BZ6A79GCdMMDm 6bz0WUnVrn+VfvioL4Nbo7p42YGeQ3mUSzVxbQupmmkysOwVCGA35hIe25K5Z4LKi2vh iYAiWmRkwQwnp+HYBl51/Sbu4B+MSjuREquHvwA7JlesmMmidwBMM/iJhIPNBK/EHn3F MXlA== X-Gm-Message-State: AOAM530jLXe5FjQseTJMr0adaPtQkbvMVCo4rDDNYq9dwbTTpQS2ZsDs by3LYGlwnC+6SW1xrolYULn/Cx0VOAfT1DwB X-Google-Smtp-Source: ABdhPJzRLfExUbWXYv+uCTTQz5oA/SQSOkjXnR/g1UiURDf3XHTeyn6u4KBLtcfJqwR1A300PNFqAw== X-Received: by 2002:a05:6a00:1914:: with SMTP id y20mr3493301pfi.41.1643456125110; Sat, 29 Jan 2022 03:35:25 -0800 (PST) Received: from localhost ([209.95.60.92]) by smtp.gmail.com with ESMTPSA id u19sm12784582pfi.150.2022.01.29.03.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 03:35:24 -0800 (PST) From: Ihor Radchenko To: Bastien , Kyle Meyer , Nicolas Goaziou , Karl Voit , Christian Heinrich , emacs-orgmode@gnu.org Subject: [PATCH 09/35] Rename old function call to use org-fold Date: Sat, 29 Jan 2022 19:38:01 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: <87y2cvloay.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.34.1" Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::42f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=yantar92@gmail.com; helo=mail-pf1-x42f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Ihor Radchenko Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643456881; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=NuVy+1KoOtf68wS/HMTg1pSUTLZBHxvqau3PDNlDDdM=; b=cC52+27SS3WLrV9a7YVIvPiBLJnXjCaxP1aXJ1uZEYIh9Z5KFYnXnRqXpqvzf3xRcfs+Oh FVmLUmE9PZQpsqMZY7/1wPu7JHO8o2+v4d5d3Qvc642x9mR1K/m0d6mGEU3wbJvyo2DMZQ s4Ern2kBtMX/b1bXuN+xHpAkNkxG0M47b7JXpjvB1TKL86g1rM73qO7Ojr9dA9WrMHTlwn 1T1EAUv3cRdDfXLUTbXL3RaCcsInntsXJueah0/BWPbfWStmYvwNkb2K1+3Z2lnuSk8TTh /iyZe/R0mW0VIdAofviPZtg3/pW+yNB19twgfHYck+RCXf5rTXea6DKs/jVSMQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643456881; a=rsa-sha256; cv=none; b=ZctvBF7l1fsekZjqt1arVy0ITIKIDc/ZCuruQMv+aSZFE0WZh8fGyFh4GaEDGidTXYRpyZ g3CamCqHk68ySP+qUvYZmAoFeGaR3cTg35o6/WXkt9Qw3DbJuAgHgol45g+euaT8Q2qBJj BicBGTlWTekNRX6e2/tt4tt1yLE46xVf10YCjF07BRTqqElYcMz/HsDrO94Cj9kAXsDz8R bVHF2cVnRYEvsFuRIv4AYzcNqJQ8ZTGfDW+Wdsx6Hy5UJraeWJSMuexEBa19VzkRGrhdDK 7prYiFPtdtLhDKtxjVxoIE1s5ta48205FKj0HPlQ5/Y5ZBvlehopIBRa95M32w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="O/QtAEr/"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: -1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="O/QtAEr/"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: D7721137B6 X-Spam-Score: -1.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: h6qrrMLScZ33 This is a multi-part message in MIME format. --------------2.34.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit --- lisp/ob-core.el | 14 ++-- lisp/ob-lilypond.el | 4 +- lisp/ob-ref.el | 4 +- lisp/ol.el | 13 ++-- lisp/org-agenda.el | 43 +++++------ lisp/org-archive.el | 12 +-- lisp/org-capture.el | 2 +- lisp/org-clock.el | 10 +-- lisp/org-colview.el | 6 +- lisp/org-compat.el | 29 +++---- lisp/org-crypt.el | 8 +- lisp/org-element.el | 1 + lisp/org-feed.el | 4 +- lisp/org-footnote.el | 6 +- lisp/org-goto.el | 6 +- lisp/org-id.el | 4 +- lisp/org-keys.el | 26 +++---- lisp/org-lint.el | 3 +- lisp/org-list.el | 10 ++- lisp/org-macs.el | 40 ++-------- lisp/org-mobile.el | 2 +- lisp/org-mouse.el | 4 +- lisp/org-refile.el | 2 +- lisp/org-src.el | 6 +- lisp/org-timer.el | 2 +- lisp/org.el | 137 +++++++++++++++++++--------------- lisp/ox-org.el | 2 +- testing/lisp/test-org-list.el | 2 +- testing/lisp/test-org.el | 78 +++++++++---------- 29 files changed, 242 insertions(+), 238 deletions(-) --------------2.34.1 Content-Type: text/x-patch; name="0009-Rename-old-function-call-to-use-org-fold.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0009-Rename-old-function-call-to-use-org-fold.patch" diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 239a57f96..6590eeee7 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -26,7 +26,9 @@ ;;; Code: (require 'cl-lib) (require 'ob-eval) (require 'org-macs) +(require 'org-fold) (require 'org-compat) +(require 'org-cycle) (defconst org-babel-exeext (if (memq system-type '(windows-nt cygwin)) @@ -50,7 +52,7 @@ (declare-function org-babel-ref-resolve "ob-ref" (ref)) (declare-function org-babel-ref-split-args "ob-ref" (arg-string)) (declare-function org-babel-tangle-comment-links "ob-tangle" (&optional info)) (declare-function org-current-level "org" ()) -(declare-function org-cycle "org" (&optional arg)) +(declare-function org-cycle "org-cycle" (&optional arg)) (declare-function org-edit-src-code "org-src" (&optional code edit-buffer-name)) (declare-function org-edit-src-exit "org-src" ()) (declare-function org-element-at-point "org-element" (&optional pom cached-only)) @@ -75,7 +77,7 @@ (declare-function org-narrow-to-subtree "org" (&optional element)) (declare-function org-next-block "org" (arg &optional backward block-regexp)) (declare-function org-open-at-point "org" (&optional in-emacs reference-buffer)) (declare-function org-previous-block "org" (arg &optional block-regexp)) -(declare-function org-show-context "org" (&optional key)) +(declare-function org-fold-show-context "org-fold" (&optional key)) (declare-function org-src-coderef-format "org-src" (&optional element)) (declare-function org-src-coderef-regexp "org-src" (fmt &optional label)) (declare-function org-src-get-lang-mode "org-src" (lang)) @@ -945,7 +947,7 @@ (defun org-babel-enter-header-arg-w-completion (&optional lang) (insert (concat header " " (or arg ""))) (cons header arg))) -(add-hook 'org-tab-first-hook 'org-babel-header-arg-expand) +(add-hook 'org-cycle-tab-first-hook 'org-babel-header-arg-expand) ;;;###autoload (defun org-babel-load-in-session (&optional _arg info) @@ -1469,7 +1471,7 @@ (defun org-babel-hide-result-toggle (&optional force) (push ov org-babel-hide-result-overlays))))) ;; org-tab-after-check-for-cycling-hook -(add-hook 'org-tab-first-hook #'org-babel-hide-result-toggle-maybe) +(add-hook 'org-cycle-tab-first-hook #'org-babel-hide-result-toggle-maybe) ;; Remove overlays when changing major mode (add-hook 'org-mode-hook (lambda () (add-hook 'change-major-mode-hook @@ -1817,7 +1819,7 @@ (defun org-babel-goto-named-src-block (name) (let ((point (org-babel-find-named-block name))) (if point ;; Taken from `org-open-at-point'. - (progn (org-mark-ring-push) (goto-char point) (org-show-context)) + (progn (org-mark-ring-push) (goto-char point) (org-fold-show-context)) (message "source-code block `%s' not found in this buffer" name)))) (defun org-babel-find-named-block (name) @@ -1857,7 +1859,7 @@ (defun org-babel-goto-named-result (name) (let ((point (org-babel-find-named-result name))) (if point ;; taken from `org-open-at-point' - (progn (goto-char point) (org-show-context)) + (progn (goto-char point) (org-fold-show-context)) (message "result `%s' not found in this buffer" name)))) (defun org-babel-find-named-result (name) diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index 15538b503..df128441a 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -34,7 +34,7 @@ ;;; Commentary: ;;; Code: (require 'ob) -(declare-function org-show-all "org" (&optional types)) +(declare-function org-fold-show-all "org-fold" (&optional types)) (defalias 'lilypond-mode 'LilyPond-mode) @@ -279,7 +279,7 @@ (defun org-babel-lilypond-mark-error-line (file-name line) (setq case-fold-search nil) (if (search-forward line nil t) (progn - (org-show-all) + (org-fold-show-all) (set-mark (point)) (goto-char (- (point) (length line)))) (goto-char temp)))) diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el index db8ced6b6..1a77e39b1 100644 --- a/lisp/ob-ref.el +++ b/lisp/ob-ref.el @@ -62,8 +62,8 @@ (declare-function org-find-property "org" (property &optional value)) (declare-function org-id-find-id-file "org-id" (id)) (declare-function org-id-find-id-in-file "org-id" (id file &optional markerp)) (declare-function org-in-commented-heading-p "org" (&optional no-inheritance)) -(declare-function org-show-context "org" (&optional key)) (declare-function org-narrow-to-subtree "org" (&optional element)) +(declare-function org-fold-show-context "org-fold" (&optional key)) (defvar org-babel-update-intermediate nil "Update the in-buffer results of code blocks executed to resolve references.") @@ -104,7 +104,7 @@ (defun org-babel-ref-goto-headline-id (id) (pop-to-buffer-same-window (marker-buffer m)) (goto-char m) (move-marker m nil) - (org-show-context) + (org-fold-show-context) t)))) (defun org-babel-ref-headline-body () diff --git a/lisp/ol.el b/lisp/ol.el index b80f943b2..21bd854e9 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -29,6 +29,7 @@ ;;; Code: (require 'org-compat) (require 'org-macs) +(require 'org-fold) (defvar clean-buffer-list-kill-buffer-names) (defvar org-agenda-buffer-name) @@ -66,10 +67,10 @@ (declare-function org-mark-ring-push "org" (&optional pos buffer)) (declare-function org-mode "org" ()) (declare-function org-occur "org" (regexp &optional keep-previous callback)) (declare-function org-open-file "org" (path &optional in-emacs line search)) -(declare-function org-overview "org" ()) +(declare-function org-cycle-overview "org-cycle" ()) (declare-function org-restart-font-lock "org" ()) (declare-function org-run-like-in-org-mode "org" (cmd)) -(declare-function org-show-context "org" (&optional key)) +(declare-function org-fold-show-context "org-fold" (&optional key)) (declare-function org-src-coderef-format "org-src" (&optional element)) (declare-function org-src-coderef-regexp "org-src" (fmt &optional label)) (declare-function org-src-edit-buffer-p "org-src" (&optional buffer)) @@ -700,7 +701,7 @@ (defun org-link--buffer-for-internals () (make-indirect-buffer (current-buffer) indirect-buffer-name 'clone)))) - (with-current-buffer indirect-buffer (org-overview)) + (with-current-buffer indirect-buffer (org-cycle-overview)) indirect-buffer)))) (defun org-link--search-radio-target (target) @@ -718,7 +719,7 @@ (defun org-link--search-radio-target (target) (let ((object (org-element-context))) (when (eq (org-element-type object) 'radio-target) (goto-char (org-element-property :begin object)) - (org-show-context 'link-search) + (org-fold-show-context 'link-search) (throw :radio-match nil)))) (goto-char origin) (user-error "No match for radio target: %s" target)))) @@ -1257,7 +1258,7 @@ (defun org-link-search (s &optional avoid-pos stealth) (error "No match for fuzzy expression: %s" normalized))) ;; Disclose surroundings of match, if appropriate. (when (and (derived-mode-p 'org-mode) (not stealth)) - (org-show-context 'link-search)) + (org-fold-show-context 'link-search)) type)) (defun org-link-heading-search-string (&optional string) @@ -1430,7 +1431,7 @@ (defun org-next-link (&optional search-backward) (`nil nil) (link (goto-char (org-element-property :begin link)) - (when (org-invisible-p) (org-show-context)) + (when (org-invisible-p) (org-fold-show-context)) (throw :found t))))) (goto-char pos) (setq org-link--search-failed t) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index cc7cb5527..2802e8636 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -47,6 +47,7 @@ ;;; Code: (require 'cl-lib) (require 'ol) +(require 'org-fold-core) (require 'org) (require 'org-macs) (require 'org-refile) @@ -9392,7 +9393,7 @@ (defun org-agenda-goto (&optional highlight) (push-mark) (goto-char pos) (when (derived-mode-p 'org-mode) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (recenter (/ (window-height) 2)) (org-back-to-heading t) (let ((case-fold-search nil)) @@ -9681,7 +9682,7 @@ (defun org-agenda-switch-to (&optional delete-other-windows) (widen) (goto-char pos) (when (derived-mode-p 'org-mode) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (run-hooks 'org-agenda-after-show-hook))))) (defun org-agenda-goto-mouse (ev) @@ -9697,7 +9698,7 @@ (defun org-agenda-show (&optional full-entry) (interactive "P") (let ((win (selected-window))) (org-agenda-goto t) - (when full-entry (org-show-entry)) + (when full-entry (org-fold-show-entry)) (select-window win))) (defvar org-agenda-show-window nil) @@ -9716,12 +9717,12 @@ (defun org-agenda-show-and-scroll-up (&optional arg) (select-window org-agenda-show-window) (ignore-errors (scroll-up))) (org-agenda-goto t) - (org-show-entry) + (org-fold-show-entry) (if arg (org-cycle-hide-drawers 'children) (org-with-wide-buffer (narrow-to-region (org-entry-beginning-position) (org-entry-end-position)) - (org-show-all '(drawers)))) + (org-fold-show-all '(drawers)))) (setq org-agenda-show-window (selected-window))) (select-window win))) @@ -9752,7 +9753,7 @@ (defun org-agenda-show-1 (&optional more) (set-window-start (selected-window) (point-at-bol)) (cond ((= more 0) - (org-flag-subtree t) + (org-fold-subtree t) (save-excursion (org-back-to-heading) (run-hook-with-args 'org-cycle-hook 'folded)) @@ -9760,20 +9761,20 @@ (defun org-agenda-show-1 (&optional more) ((and (called-interactively-p 'any) (= more 1)) (message "Remote: show with default settings")) ((= more 2) - (outline-show-entry) - (org-show-children) + (org-fold-show-entry) + (org-fold-show-children) (save-excursion (org-back-to-heading) (run-hook-with-args 'org-cycle-hook 'children)) (message "Remote: CHILDREN")) ((= more 3) - (outline-show-subtree) + (org-fold-show-subtree) (save-excursion (org-back-to-heading) (run-hook-with-args 'org-cycle-hook 'subtree)) (message "Remote: SUBTREE")) ((> more 3) - (outline-show-subtree) + (org-fold-show-subtree) (message "Remote: SUBTREE AND ALL DRAWERS"))) (select-window win))) @@ -9905,7 +9906,7 @@ (defun org-agenda-todo (&optional arg) (with-current-buffer buffer (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (let ((current-prefix-arg arg)) (call-interactively 'org-todo) ;; Make sure that log is recorded in current undo. @@ -9946,7 +9947,7 @@ (defun org-agenda-add-note (&optional _arg) (with-current-buffer buffer (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (org-add-note)))) (defun org-agenda-change-all-lines (newhead hdmarker @@ -10095,7 +10096,7 @@ (defun org-agenda-priority (&optional force-direction) (with-current-buffer buffer (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (org-priority force-direction) (end-of-line 1) (setq newhead (org-get-heading))) @@ -10119,7 +10120,7 @@ (defun org-agenda-set-tags (&optional tag onoff) (with-current-buffer buffer (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (if tag (org-toggle-tag tag onoff) (call-interactively #'org-set-tags-command)) @@ -10144,7 +10145,7 @@ (defun org-agenda-set-property () (with-current-buffer buffer (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (call-interactively 'org-set-property)))))) (defun org-agenda-set-effort () @@ -10163,7 +10164,7 @@ (defun org-agenda-set-effort () (with-current-buffer buffer (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (call-interactively 'org-set-effort) (end-of-line 1) (setq newhead (org-get-heading))) @@ -10185,7 +10186,7 @@ (defun org-agenda-toggle-archive-tag () (with-current-buffer buffer (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (call-interactively 'org-toggle-archive-tag) (end-of-line 1) (setq newhead (org-get-heading))) @@ -10395,7 +10396,7 @@ (defun org-agenda-clock-in (&optional arg) (with-current-buffer (marker-buffer marker) (widen) (goto-char pos) - (org-show-context 'agenda) + (org-fold-show-context 'agenda) (org-clock-in arg) (setq newhead (org-get-heading))) (org-agenda-change-all-lines newhead hdmarker)) @@ -10484,7 +10485,7 @@ (defun org-agenda-diary-entry-in-org-file () (find-file-noselect org-agenda-diary-file)) (require 'org-datetree) (org-datetree-find-date-create d1) - (org-reveal t)) + (org-fold-reveal t)) (t (user-error "Invalid selection character `%c'" char))))) (defcustom org-agenda-insert-diary-strategy 'date-tree @@ -10586,7 +10587,7 @@ (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2) (message "%s entry added to %s" (capitalize (symbol-name type)) (abbreviate-file-name org-agenda-diary-file))) - (org-reveal t) + (org-fold-reveal t) (message "Please finish entry here")))) (defun org-agenda-insert-diary-as-top-level (text) @@ -10624,7 +10625,7 @@ (defun org-agenda-insert-diary-make-new-entry (text) (unless (bolp) (insert "\n")) (unless (looking-at-p "^[ \t]*$") (save-excursion (insert "\n"))) (when org-adapt-indentation (indent-to-column col))) - (org-show-set-visibility 'lineage)) + (org-fold-show-set-visibility 'lineage)) (defun org-agenda-diary-entry () "Make a diary entry, like the `i' command from the calendar. diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 6ea16f8c1..1026a295e 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -324,7 +324,7 @@ (defun org-archive-subtree (&optional find-done) (org-todo-regexp tr-org-todo-regexp) (org-todo-line-regexp tr-org-todo-line-regexp)) (goto-char (point-min)) - (org-show-all '(headings blocks)) + (org-fold-show-all '(headings blocks)) (if (and heading (not (and datetree-date (not datetree-subheading-p)))) (progn (if (re-search-forward @@ -339,7 +339,7 @@ (defun org-archive-subtree (&optional find-done) (insert (if datetree-date "" "\n") heading "\n") (end-of-line 0)) ;; Make the subtree visible - (outline-show-subtree) + (org-fold-show-subtree) (if org-archive-reversed-order (progn (org-back-to-heading t) @@ -417,7 +417,7 @@ (defun org-archive-subtree (&optional find-done) (if (eq this-buffer buffer) (concat "under heading: " heading) (concat "in file: " (abbreviate-file-name afile))))))) - (org-reveal) + (org-fold-reveal) (if (looking-at "^[ \t]*$") (outline-next-visible-heading 1)))) @@ -487,13 +487,13 @@ (defun org-archive-to-archive-sibling () (format-time-string (substring (cdr org-time-stamp-formats) 1 -1))) (outline-up-heading 1 t) - (org-flag-subtree t) + (org-fold-subtree t) (org-cycle-show-empty-lines 'folded) (when org-provide-todo-statistics ;; Update TODO statistics of parent. (org-update-parent-todo-statistics)) (goto-char pos))) - (org-reveal) + (org-fold-reveal) (if (looking-at "^[ \t]*$") (outline-next-visible-heading 1)))) @@ -602,7 +602,7 @@ (defun org-toggle-archive-tag (&optional find-done) (save-excursion (org-back-to-heading t) (setq set (org-toggle-tag org-archive-tag)) - (when set (org-flag-subtree t))) + (when set (org-fold-subtree t))) (and set (beginning-of-line 1)) (message "Subtree %s" (if set "archived" "unarchived")))))) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 5195b785e..1d4d6e877 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1129,7 +1129,7 @@ (defun org-capture-place-template (&optional inhibit-wconf-store) (org-switch-to-buffer-other-window (org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE")) (widen) - (org-show-all) + (org-fold-show-all) (goto-char (org-capture-get :pos)) (setq-local outline-level 'org-outline-level) (pcase (org-capture-get :type) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 6f441c18e..583b30237 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1035,7 +1035,7 @@ (defun org-clock-jump-to-current-clock (&optional effective-clock) (let ((element (org-element-at-point))) (when (eq (org-element-type element) 'drawer) (when (> (org-element-property :end element) (car clock)) - (org-hide-drawer-toggle 'off nil element)) + (org-fold-hide-drawer-toggle 'off nil element)) (throw 'exit nil))))))))))) (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) @@ -1843,10 +1843,10 @@ (defun org-clock-goto (&optional select) (pop-to-buffer-same-window (marker-buffer m)) (if (or (< m (point-min)) (> m (point-max))) (widen)) (goto-char m) - (org-show-entry) + (org-fold-show-entry) (org-back-to-heading t) (recenter org-clock-goto-before-context) - (org-reveal) + (org-fold-reveal) (if recent (message "No running clock, this is the most recently clocked task")) (run-hooks 'org-clock-goto-hook))) @@ -2140,7 +2140,7 @@ (defun org-clock-report (&optional arg) (org-clock-remove-overlays) (when arg (org-find-dblock "clocktable") - (org-show-entry)) + (org-fold-show-entry)) (pcase (org-in-clocktable-p) (`nil (org-create-dblock @@ -3125,7 +3125,7 @@ (defun org-clock-load () (let ((org-clock-in-resume 'auto-restart) (org-clock-auto-clock-resolution nil)) (org-clock-in) - (when (org-invisible-p) (org-show-context)))))) + (when (org-invisible-p) (org-fold-show-context)))))) (_ nil))))) (defun org-clock-kill-emacs-query () diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 15cab35f0..c8443c135 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -159,8 +159,8 @@ (defconst org-columns-summary-types-default (defun org-columns-content () "Switch to contents view while in columns view." (interactive) - (org-overview) - (org-content)) + (org-cycle-overview) + (org-cycle-content)) (org-defkey org-columns-map "c" #'org-columns-content) (org-defkey org-columns-map "o" #'org-overview) @@ -701,7 +701,7 @@ (defun org-columns--call (fun) (move-beginning-of-line 2) (org-at-heading-p))))) (unwind-protect (funcall fun) - (when hide-body (outline-hide-entry))))) + (when hide-body (org-fold-hide-entry))))) (defun org-columns-previous-allowed-value () "Switch to the previous allowed value for this column." diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 38d330de6..772ef37f9 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -50,18 +50,20 @@ (declare-function org-element-property "org-element" (property element)) (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) (declare-function org-get-heading "org" (&optional no-tags no-todo no-priority no-comment)) (declare-function org-get-tags "org" (&optional pos local)) -(declare-function org-hide-block-toggle "org" (&optional force no-error element)) +(declare-function org-fold-hide-block-toggle "org-fold" (&optional force no-error element)) (declare-function org-link-display-format "ol" (s)) (declare-function org-link-set-parameters "ol" (type &rest rest)) (declare-function org-log-into-drawer "org" ()) (declare-function org-make-tag-string "org" (tags)) (declare-function org-reduced-level "org" (l)) (declare-function org-return "org" (&optional indent arg interactive)) -(declare-function org-show-context "org" (&optional key)) +(declare-function org-fold-show-context "org-fold" (&optional key)) (declare-function org-table-end "org-table" (&optional table-type)) (declare-function outline-next-heading "outline" ()) (declare-function speedbar-line-directory "speedbar" (&optional depth)) (declare-function table--at-cell-p "table" (position &optional object at-column)) +(declare-function org-fold-region "org-fold" (from to flag &optional spec)) +(declare-function org-fold-show-all "org-fold" (&optional types)) (defvar calendar-mode-map) (defvar org-complex-heading-regexp) @@ -72,6 +74,7 @@ (defvar org-table-any-border-regexp) (defvar org-table-dataline-regexp) (defvar org-table-tab-recognizes-table.el) (defvar org-table1-hline-regexp) +(defvar org-fold-core-style) ;;; Emacs < 28.1 compatibility @@ -627,7 +630,7 @@ (make-obsolete 'org-capture-import-remember-templates (defun org-show-block-all () "Unfold all blocks in the current buffer." (interactive) - (remove-overlays nil nil 'invisible 'org-hide-block)) + (org-fold-show-all '(blocks))) (make-obsolete 'org-show-block-all "use `org-show-all' instead." @@ -670,7 +673,7 @@ (defun org-flag-drawer (flag &optional element beg end) When buffer positions BEG and END are provided, hide or show that region as a drawer without further ado." (declare (obsolete "use `org-hide-drawer-toggle' instead." "9.4")) - (if (and beg end) (org-flag-region beg end flag 'outline) + (if (and beg end) (org-fold-region beg end flag (if (eq org-fold-core-style 'text-properties) 'drawer 'outline)) (let ((drawer (or element (and (save-excursion @@ -679,12 +682,12 @@ (defun org-flag-drawer (flag &optional element beg end) (org-element-at-point))))) (when (memq (org-element-type drawer) '(drawer property-drawer)) (let ((post (org-element-property :post-affiliated drawer))) - (org-flag-region + (org-fold-region (save-excursion (goto-char post) (line-end-position)) (save-excursion (goto-char (org-element-property :end drawer)) (skip-chars-backward " \t\n") (line-end-position)) - flag 'outline) + flag (if (eq org-fold-core-style 'text-properties) 'drawer 'outline)) ;; When the drawer is hidden away, make sure point lies in ;; a visible part of the buffer. (when (invisible-p (max (1- (point)) (point-min))) @@ -696,7 +699,7 @@ (defun org-hide-block-toggle-maybe () an error. Return a non-nil value when toggling is successful." (declare (obsolete "use `org-hide-block-toggle' instead." "9.4")) (interactive) - (org-hide-block-toggle nil t)) + (org-fold-hide-block-toggle nil t)) (defun org-hide-block-toggle-all () "Toggle the visibility of all blocks in the current buffer." @@ -712,7 +715,7 @@ (defun org-hide-block-toggle-all () (save-excursion (save-match-data (goto-char (match-beginning 0)) - (org-hide-block-toggle))))))) + (org-fold-hide-block-toggle))))))) (defun org-return-indent () "Goto next table row or insert a newline and indent. @@ -941,7 +944,7 @@ (eval-after-load 'imenu (add-hook 'imenu-after-jump-hook (lambda () (when (derived-mode-p 'org-mode) - (org-show-context 'org-goto)))) + (org-fold-show-context 'org-goto)))) (add-hook 'org-mode-hook (lambda () (setq imenu-create-index-function 'org-imenu-get-tree))))) @@ -1006,7 +1009,7 @@ (eval-after-load 'speedbar (define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock) (define-key speedbar-file-key-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock) (add-hook 'speedbar-visiting-tag-hook - (lambda () (and (derived-mode-p 'org-mode) (org-show-context 'org-goto)))))) + (lambda () (and (derived-mode-p 'org-mode) (org-fold-show-context 'org-goto)))))) ;;;; Add Log @@ -1120,7 +1123,7 @@ (defun org-bookmark-jump-unhide () (or (org-invisible-p) (save-excursion (goto-char (max (point-min) (1- (point)))) (org-invisible-p))) - (org-show-context 'bookmark-jump))) + (org-fold-show-context 'bookmark-jump))) ;; Make `bookmark-jump' shows the jump location if it was hidden. (add-hook 'bookmark-after-jump-hook 'org-bookmark-jump-unhide) @@ -1188,7 +1191,7 @@ (eval-after-load 'ecb '(defadvice ecb-method-clicked (after esf/org-show-context activate) "Make hierarchy visible when jumping into location from ECB tree buffer." (when (derived-mode-p 'org-mode) - (org-show-context)))) + (org-fold-show-context)))) ;;;; Simple @@ -1196,7 +1199,7 @@ (defun org-mark-jump-unhide () "Make the point visible with `org-show-context' after jumping to the mark." (when (and (derived-mode-p 'org-mode) (org-invisible-p)) - (org-show-context 'mark-goto))) + (org-fold-show-context 'mark-goto))) (eval-after-load 'simple '(defadvice pop-to-mark-command (after org-make-visible activate) diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index 41813cb18..b2542ab43 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -73,7 +73,7 @@ (declare-function org-before-first-heading-p "org" ()) (declare-function org-end-of-meta-data "org" (&optional full)) (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) (declare-function org-entry-get "org" (pom property &optional inherit literal-nil)) -(declare-function org-flag-subtree "org" (flag)) +(declare-function org-fold-subtree "org-fold" (flag)) (declare-function org-make-tags-matcher "org" (match)) (declare-function org-previous-visible-heading "org" (arg)) (declare-function org-scan-tags "org" (action matcher todo-only &optional start-level)) @@ -243,7 +243,7 @@ (defun org-encrypt-entry () (error (error-message-string err))))) (when folded-heading (goto-char folded-heading) - (org-flag-subtree t)) + (org-fold-subtree t)) nil))))) ;;;###autoload @@ -280,7 +280,7 @@ (defun org-decrypt-entry () 'org-crypt-text encrypted-text)) (when folded-heading (goto-char folded-heading) - (org-flag-subtree t)) + (org-fold-subtree t)) nil))) (_ nil))) @@ -313,7 +313,7 @@ (defun org-crypt-use-before-save-magic () 'org-mode-hook (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) -(add-hook 'org-reveal-start-hook 'org-decrypt-entry) +(add-hook 'org-fold-reveal-start-hook 'org-decrypt-entry) (provide 'org-crypt) diff --git a/lisp/org-element.el b/lisp/org-element.el index 77a9fc6e3..99999fb32 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -70,6 +70,7 @@ (require 'org-footnote) (require 'org-list) (require 'org-macs) (require 'org-table) +(require 'org-fold-core) (declare-function org-at-heading-p "org" (&optional _)) (declare-function org-escape-code-in-string "org-src" (s)) diff --git a/lisp/org-feed.el b/lisp/org-feed.el index a5fea0888..d634f9c41 100644 --- a/lisp/org-feed.el +++ b/lisp/org-feed.el @@ -412,8 +412,8 @@ (defun org-feed-update (feed &optional retrieve-only) ;; Normalize the visibility of the inbox tree (goto-char inbox-pos) - (org-flag-subtree t) - (org-show-children) + (org-fold-subtree t) + (org-fold-show-children) ;; Hooks and messages (when org-feed-save-after-adding (save-buffer)) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index b55f6d98e..a4c9ae770 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -52,7 +52,7 @@ (declare-function org-in-verbatim-emphasis "org" ()) (declare-function org-inside-LaTeX-fragment-p "org" ()) (declare-function org-inside-latex-macro-p "org" ()) (declare-function org-mark-ring-push "org" (&optional pos buffer)) -(declare-function org-show-context "org" (&optional key)) +(declare-function org-fold-show-context "org-fold" (&optional key)) (declare-function outline-next-heading "outline") (defvar electric-indent-mode) @@ -555,7 +555,7 @@ (defun org-footnote-goto-definition (label &optional location) (goto-char def-start) (looking-at (format "\\[fn:%s[]:]" (regexp-quote label))) (goto-char (match-end 0)) - (org-show-context 'link-search) + (org-fold-show-context 'link-search) (when (derived-mode-p 'org-mode) (message "%s" (substitute-command-keys "Edit definition and go back with \ @@ -581,7 +581,7 @@ (defun org-footnote-goto-previous-reference (label) (user-error "Reference is outside narrowed part of buffer"))) (org-mark-ring-push) (goto-char start) - (org-show-context 'link-search))) + (org-fold-show-context 'link-search))) ;;;; Getters diff --git a/lisp/org-goto.el b/lisp/org-goto.el index 860b0a3de..cd5000037 100644 --- a/lisp/org-goto.el +++ b/lisp/org-goto.el @@ -222,13 +222,13 @@ (defun org-goto-location (&optional _buf help) " Just type for auto-isearch." " n/p/f/b/u to navigate, q to quit."))))) (org-fit-window-to-buffer (get-buffer-window "*Org Help*")) - (org-overview) + (org-cycle-overview) (setq buffer-read-only t) (if (and (boundp 'org-goto-start-pos) (integer-or-marker-p org-goto-start-pos)) (progn (goto-char org-goto-start-pos) (when (org-invisible-p) - (org-show-set-visibility 'lineage))) + (org-fold-show-set-visibility 'lineage))) (goto-char (point-min))) (let (org-special-ctrl-a/e) (org-beginning-of-line)) (message "Select location and press RET") @@ -279,7 +279,7 @@ (defun org-goto (&optional alternative-interface) (org-mark-ring-push org-goto-start-pos) (goto-char selected-point) (when (or (org-invisible-p) (org-invisible-p2)) - (org-show-context 'org-goto))) + (org-fold-show-context 'org-goto))) (message "Quit")))) (provide 'org-goto) diff --git a/lisp/org-id.el b/lisp/org-id.el index b4acec7bd..780907cfa 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -331,7 +331,7 @@ (defun org-id-goto (id) (pop-to-buffer-same-window (marker-buffer m)) (goto-char m) (move-marker m nil) - (org-show-context))) + (org-fold-show-context))) ;;;###autoload (defun org-id-find (id &optional markerp) @@ -742,7 +742,7 @@ (defun org-id-open (id _) (funcall cmd (marker-buffer m))) (goto-char m) (move-marker m nil) - (org-show-context))) + (org-fold-show-context))) (org-link-set-parameters "id" :follow #'org-id-open) diff --git a/lisp/org-keys.el b/lisp/org-keys.el index b8e9ddd93..782ffa871 100644 --- a/lisp/org-keys.el +++ b/lisp/org-keys.el @@ -67,8 +67,8 @@ (declare-function org-ctrl-c-star "org" ()) (declare-function org-ctrl-c-tab "org" (&optional arg)) (declare-function org-cut-special "org" ()) (declare-function org-cut-subtree "org" (&optional n)) -(declare-function org-cycle "org" (&optional arg)) -(declare-function org-cycle-agenda-files "org" ()) +(declare-function org-cycle "org-cycle" (&optional arg)) +(declare-function org-cycle-agenda-files "org-cycle" ()) (declare-function org-date-from-calendar "org" ()) (declare-function org-dynamic-block-insert-dblock "org" (&optional arg)) (declare-function org-dblock-update "org" (&optional arg)) @@ -94,7 +94,7 @@ (declare-function org-feed-update-all "org" ()) (declare-function org-fill-paragraph "org" (&optional justify region)) (declare-function org-find-file-at-mouse "org" (ev)) (declare-function org-footnote-action "org" (&optional special)) -(declare-function org-force-cycle-archived "org" ()) +(declare-function org-cycle-force-archived "org-cycle" ()) (declare-function org-force-self-insert "org" (n)) (declare-function org-forward-element "org" ()) (declare-function org-forward-heading-same-level "org" (arg &optional invisible-ok)) @@ -143,8 +143,8 @@ (declare-function org-previous-visible-heading "org" (arg)) (declare-function org-priority "org" (&optional action show)) (declare-function org-promote-subtree "org" ()) (declare-function org-redisplay-inline-images "org" ()) -(declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg)) -(declare-function org-refile-copy "org" ()) +(declare-function org-refile "org-refile" (&optional arg1 default-buffer rfloc msg)) +(declare-function org-refile-copy "org-refile" ()) (declare-function org-refile-reverse "org-refile" (&optional arg default-buffer rfloc msg)) (declare-function org-reftex-citation "org" ()) (declare-function org-reload "org" (&optional arg1)) @@ -152,7 +152,7 @@ (declare-function org-remove-file "org" (&optional file)) (declare-function org-resolve-clocks "org" (&optional only-dangling-p prompt-fn last-valid)) (declare-function org-return "org" (&optional indent)) (declare-function org-return-and-maybe-indent "org" ()) -(declare-function org-reveal "org" (&optional siblings)) +(declare-function org-fold-reveal "org-fold" (&optional siblings)) (declare-function org-schedule "org" (arg &optional time)) (declare-function org-self-insert-command "org" (N)) (declare-function org-set-effort "org" (&optional increment value)) @@ -172,9 +172,9 @@ (declare-function org-shiftmetaup "org" (&optional arg)) (declare-function org-shiftright "org" (&optional arg)) (declare-function org-shifttab "org" (&optional arg)) (declare-function org-shiftup "org" (&optional arg)) -(declare-function org-show-all "org" (&optional types)) -(declare-function org-show-children "org" (&optional level)) -(declare-function org-show-subtree "org" ()) +(declare-function org-fold-show-all "org-fold" (&optional types)) +(declare-function org-fold-show-children "org-fold" (&optional level)) +(declare-function org-fold-show-subtree "org-fold" ()) (declare-function org-sort "org" (&optional with-case)) (declare-function org-sparse-tree "org" (&optional arg type)) (declare-function org-table-copy-down "org" (n)) @@ -423,7 +423,7 @@ (define-key org-mode-map [menu-bar hide] 'undefined) (define-key org-mode-map [menu-bar show] 'undefined) (define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree) -(define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree) +(define-key org-mode-map [remap outline-show-subtree] #'org-fold-show-subtree) (define-key org-mode-map [remap outline-forward-same-level] #'org-forward-heading-same-level) (define-key org-mode-map [remap outline-backward-same-level] @@ -437,14 +437,14 @@ (define-key org-mode-map [remap outline-next-visible-heading] #'org-next-visible-heading) (define-key org-mode-map [remap outline-previous-visible-heading] #'org-previous-visible-heading) -(define-key org-mode-map [remap show-children] #'org-show-children) +(define-key org-mode-map [remap outline-show-children] #'org-fold-show-children) ;;;; Make `C-c C-x' a prefix key (org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap)) ;;;; TAB key with modifiers (org-defkey org-mode-map (kbd "TAB") #'org-cycle) -(org-defkey org-mode-map (kbd "C-c C-") #'org-force-cycle-archived) +(org-defkey org-mode-map (kbd "C-c C-") #'org-cycle-force-archived) ;; Override text-mode binding to expose `complete-symbol' for ;; pcomplete functionality. (org-defkey org-mode-map (kbd "M-TAB") nil) @@ -544,7 +544,7 @@ (org-remap org-mode-map ;;;; All the other keys (org-defkey org-mode-map (kbd "|") #'org-force-self-insert) -(org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal) +(org-defkey org-mode-map (kbd "C-c C-r") #'org-fold-reveal) (org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element) (org-defkey org-mode-map (kbd "M-}") #'org-forward-element) (org-defkey org-mode-map (kbd "ESC }") #'org-forward-element) diff --git a/lisp/org-lint.el b/lisp/org-lint.el index 10b9a3589..3518edeb1 100644 --- a/lisp/org-lint.el +++ b/lisp/org-lint.el @@ -91,6 +91,7 @@ (require 'oc) (require 'ol) (require 'org-attach) (require 'org-macro) +(require 'org-fold) (require 'ox) (require 'seq) @@ -264,7 +265,7 @@ (defun org-lint--jump-to-source () (let ((l (org-lint--current-line))) (switch-to-buffer-other-window org-lint--source-buffer) (org-goto-line l) - (org-show-set-visibility 'local) + (org-fold-show-set-visibility 'local) (recenter))) (defun org-lint--show-source () diff --git a/lisp/org-list.el b/lisp/org-list.el index 3533c8319..187e9a9ff 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -79,6 +79,7 @@ ;;; Code: (require 'cl-lib) (require 'org-macs) (require 'org-compat) +(require 'org-fold-core) (defvar org-M-RET-may-split-line) (defvar org-adapt-indentation) @@ -138,7 +139,8 @@ (declare-function org-outline-level "org" ()) (declare-function org-previous-line-empty-p "org" ()) (declare-function org-reduced-level "org" (L)) (declare-function org-set-tags "org" (tags)) -(declare-function org-show-subtree "org" ()) +(declare-function org-fold-show-subtree "org-fold" ()) +(declare-function org-fold-region "org-fold" (from to flag &optional spec)) (declare-function org-sort-remove-invisible "org" (S)) (declare-function org-time-string-to-seconds "org" (s)) (declare-function org-timer-hms-to-secs "org-timer" (hms)) @@ -2029,7 +2031,7 @@ (defun org-list-set-item-visibility (item struct view) ((eq view 'folded) (let ((item-end (org-list-get-item-end-before-blank item struct))) ;; Hide from eol - (org-flag-region (save-excursion (goto-char item) (line-end-position)) + (org-fold-region (save-excursion (goto-char item) (line-end-position)) item-end t 'outline))) ((eq view 'children) ;; First show everything. @@ -2042,7 +2044,7 @@ (defun org-list-set-item-visibility (item struct view) ((eq view 'subtree) ;; Show everything (let ((item-end (org-list-get-item-end item struct))) - (org-flag-region item item-end nil 'outline))))) + (org-fold-region item item-end nil 'outline))))) (defun org-list-item-body-column (item) "Return column at which body of ITEM should start." @@ -2455,7 +2457,7 @@ (defun org-reset-checkbox-state-subtree () (save-restriction (save-excursion (org-narrow-to-subtree) - (org-show-subtree) + (org-fold-show-subtree) (goto-char (point-min)) (let ((end (point-max))) (while (< (point) end) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 8d156fa2f..2968e2ba5 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -35,11 +35,16 @@ (require 'cl-lib) (require 'format-spec) (declare-function org-mode "org" ()) -(declare-function org-show-context "org" (&optional key)) +(declare-function org-agenda-files "org" (&optional unrestricted archives)) +(declare-function org-fold-show-context "org-fold" (&optional key)) +(declare-function org-fold-save-outline-visibility "org-fold" (use-markers &rest body)) +(declare-function org-fold-next-visibility-change "org-fold" (&optional pos limit ignore-hidden-p previous-p)) +(declare-function org-fold-folded-p "org-fold" (&optional pos limit ignore-hidden-p previous-p)) (declare-function string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case)) (defvar org-ts-regexp0) (defvar ffap-url-regexp) +(defvar org-fold-core-style) ;;; Macros @@ -117,38 +122,7 @@ (defmacro org-no-read-only (&rest body) (declare (debug (body))) `(let ((inhibit-read-only t)) ,@body)) -(defmacro org-save-outline-visibility (use-markers &rest body) - "Save and restore outline visibility around BODY. -If USE-MARKERS is non-nil, use markers for the positions. This -means that the buffer may change while running BODY, but it also -means that the buffer should stay alive during the operation, -because otherwise all these markers will point to nowhere." - (declare (debug (form body)) (indent 1)) - (org-with-gensyms (data invisible-types markers?) - `(let* ((,invisible-types '(org-hide-block outline)) - (,markers? ,use-markers) - (,data - (mapcar (lambda (o) - (let ((beg (overlay-start o)) - (end (overlay-end o)) - (type (overlay-get o 'invisible))) - (and beg end - (> end beg) - (memq type ,invisible-types) - (list (if ,markers? (copy-marker beg) beg) - (if ,markers? (copy-marker end t) end) - type)))) - (org-with-wide-buffer - (overlays-in (point-min) (point-max)))))) - (unwind-protect (progn ,@body) - (org-with-wide-buffer - (dolist (type ,invisible-types) - (remove-overlays (point-min) (point-max) 'invisible type)) - (pcase-dolist (`(,beg ,end ,type) (delq nil ,data)) - (org-flag-region beg end t type) - (when ,markers? - (set-marker beg nil) - (set-marker end nil)))))))) +(defalias 'org-save-outline-visibility #'org-fold-save-outline-visibility) (defmacro org-with-wide-buffer (&rest body) "Execute body while temporarily widening the buffer." diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el index 5cfaa7fe0..dd5333399 100644 --- a/lisp/org-mobile.el +++ b/lisp/org-mobile.el @@ -1064,7 +1064,7 @@ (defun org-mobile-edit (what old new) (progn ;; Workaround a `org-insert-heading-respect-content' bug ;; which prevents correct insertion when point is invisible - (org-show-subtree) + (org-fold-show-subtree) (end-of-line 1) (org-insert-heading-respect-content t) (org-demote)) diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el index 8d5be4254..fadd38848 100644 --- a/lisp/org-mouse.el +++ b/lisp/org-mouse.el @@ -1003,10 +1003,10 @@ (defun org-mouse-do-remotely (command) (with-current-buffer buffer (widen) (goto-char pos) - (org-show-hidden-entry) + (org-fold-show-hidden-entry) (save-excursion (and (outline-next-heading) - (org-flag-heading nil))) ; show the next heading + (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))) diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 5dfffe785..d68760623 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -521,7 +521,7 @@ (defun org-refile (&optional arg default-buffer rfloc msg) (goto-char (cond (pos) ((org-notes-order-reversed-p) (point-min)) (t (point-max)))) - (org-show-context 'org-goto)) + (org-fold-show-context 'org-goto)) (if regionp (progn (org-kill-new (buffer-substring region-start region-end)) diff --git a/lisp/org-src.el b/lisp/org-src.el index 4fac93400..1197540d1 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -1356,8 +1356,10 @@ (defun org-edit-src-exit () (goto-char beg) (cond ;; Block is hidden; move at start of block. - ((cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block)) - (overlays-at (point))) + ((if (eq org-fold-core-style 'text-properties) + (org-fold-folded-p nil 'block) + (cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block)) + (overlays-at (point)))) (beginning-of-line 0)) (write-back (org-src--goto-coordinates coordinates beg end)))) ;; Clean up left-over markers and restore window configuration. diff --git a/lisp/org-timer.el b/lisp/org-timer.el index a6f3648fa..0c9350e76 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -478,7 +478,7 @@ (defun org-timer--get-timer-title () (with-current-buffer (marker-buffer marker) (org-with-wide-buffer (goto-char hdmarker) - (org-show-entry) + (org-fold-show-entry) (or (ignore-errors (org-get-heading)) (buffer-name (buffer-base-buffer)))))))) ((derived-mode-p 'org-mode) diff --git a/lisp/org.el b/lisp/org.el index b17a5477c..ebc9d81db 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -96,6 +96,9 @@ (require 'org-keys) (require 'ol) (require 'oc) (require 'org-table) +(require 'org-fold) + +(require 'org-cycle) ;; `org-outline-regexp' ought to be a defconst but is let-bound in ;; some places -- e.g. see the macro `org-with-limited-levels'. @@ -4669,7 +4672,7 @@ (define-derived-mode org-mode outline-mode "Org" t)) (when org-startup-with-inline-images (org-display-inline-images)) (when org-startup-with-latex-preview (org-latex-preview '(16))) - (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility)) + (unless org-inhibit-startup-visibility-stuff (org-cycle-set-startup-visibility)) (when org-startup-truncated (setq truncate-lines t)) (when org-startup-numerated (require 'org-num) (org-num-mode 1)) (when org-startup-indented (require 'org-indent) (org-indent-mode 1)))) @@ -5864,7 +5867,7 @@ (defun org-tree-to-indirect-buffer (&optional arg) (pop-to-buffer ibuf)) (t (error "Invalid value"))) (narrow-to-region beg end) - (org-show-all '(headings drawers blocks)) + (org-fold-show-all '(headings drawers blocks)) (goto-char pos) (run-hook-with-args 'org-cycle-hook 'all) (and (window-live-p cwin) (select-window cwin)))) @@ -5976,10 +5979,15 @@ (defun org-insert-heading (&optional arg invisible-ok top) ;; When INVISIBLE-OK is non-nil, ensure newly created headline ;; is visible. (unless invisible-ok - (pcase (get-char-property-and-overlay (point) 'invisible) - (`(outline . ,o) - (move-overlay o (overlay-start o) (line-end-position 0))) - (_ nil)))) + (if (eq org-fold-core-style 'text-properties) + (cond + ((org-fold-folded-p (line-beginning-position) 'headline) + (org-fold-region (line-end-position 0) (line-end-position) nil 'headline)) + (t nil)) + (pcase (get-char-property-and-overlay (point) 'invisible) + (`(outline . ,o) + (move-overlay o (overlay-start o) (line-end-position 0))) + (_ nil))))) ;; At a headline... ((org-at-heading-p) (cond ((bolp) @@ -6521,7 +6529,7 @@ (defun org-convert-to-oddeven-levels () (goto-char (point-min)) ;; First check if there are no even levels (when (re-search-forward "^\\(\\*\\*\\)+ " nil t) - (org-show-set-visibility 'canonical) + (org-fold-show-set-visibility 'canonical) (error "Not all levels are odd in this file. Conversion not possible")) (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ") (let ((outline-regexp org-outline-regexp) @@ -6614,9 +6622,9 @@ (defun org-move-subtree-down (&optional arg) (setq txt (buffer-substring beg end)) (org-save-markers-in-region beg end) (delete-region beg end) - (org-remove-empty-overlays-at beg) - (unless (= beg (point-min)) (org-flag-region (1- beg) beg nil 'outline)) - (unless (bobp) (org-flag-region (1- (point)) (point) nil 'outline)) + (when (eq org-fold-core-style 'overlays) (org-remove-empty-overlays-at beg)) + (unless (= beg (point-min)) (org-fold-region (1- beg) beg nil 'outline)) + (unless (bobp) (org-fold-region (1- (point)) (point) nil 'outline)) (and (not (bolp)) (looking-at "\n") (forward-char 1)) (let ((bbb (point))) (insert-before-markers txt) @@ -6627,9 +6635,9 @@ (defun org-move-subtree-down (&optional arg) (org-skip-whitespace) (move-marker ins-point nil) (if folded - (org-flag-subtree t) - (org-show-entry) - (org-show-children)) + (org-fold-subtree t) + (org-fold-show-entry) + (org-fold-show-children)) (org-clean-visibility-after-subtree-move) ;; move back to the initial column we were at (move-to-column col)))) @@ -6987,7 +6995,7 @@ (defun org-clone-subtree-with-time-shift (n &optional shift) (insert template) (org-mode) (goto-char (point-min)) - (org-show-subtree) + (org-fold-show-subtree) (and idprop (if org-clone-delete-id (org-entry-delete nil "ID") (org-id-get-create t))) @@ -7259,7 +7267,7 @@ (defun org-sort-entries (point)) what "children") (goto-char start) - (outline-show-subtree) + (org-fold-show-subtree) (outline-next-heading)) (t ;; we will sort the top-level entries in this file @@ -7275,7 +7283,7 @@ (defun org-sort-entries (setq end (point-max)) (setq what "top-level") (goto-char start) - (org-show-all '(headings drawers blocks)))) + (org-fold-show-all '(headings drawers blocks)))) (setq beg (point)) (when (>= beg end) (goto-char start) (user-error "Nothing to sort")) @@ -7858,7 +7866,7 @@ (defun org-open-file (path &optional in-emacs line search) (funcall (cdr (assq 'file org-link-frame-setup)) file) (widen) (cond (line (org-goto-line line) - (when (derived-mode-p 'org-mode) (org-reveal))) + (when (derived-mode-p 'org-mode) (org-fold-reveal))) (search (condition-case err (org-link-search search) ;; Save position before error-ing out so user @@ -8154,7 +8162,7 @@ (defun org-mark-ring-goto (&optional n) (setq m (car p)) (pop-to-buffer-same-window (marker-buffer m)) (goto-char m) - (when (or (org-invisible-p) (org-invisible-p2)) (org-show-context 'mark-goto)))) + (when (or (org-invisible-p) (org-invisible-p2)) (org-fold-show-context 'mark-goto)))) ;;; Following specific links @@ -10165,7 +10173,7 @@ (defun org-occur (regexp &optional keep-previous callback) "Make a compact tree showing all matches of REGEXP. The tree will show the lines where the regexp matches, and any other context -defined in `org-show-context-detail', which see. +defined in `org-fold-show-context-detail', which see. When optional argument KEEP-PREVIOUS is non-nil, highlighting and exposing done by a previous call to `org-occur' will be kept, to allow stacking of @@ -10187,7 +10195,7 @@ (defun org-occur (regexp &optional keep-previous callback) (when (or (not keep-previous) ; do not want to keep (not org-occur-highlights)) ; no previous matches ;; hide everything - (org-overview)) + (org-cycle-overview)) (let ((case-fold-search (if (eq org-occur-case-fold-search 'smart) (isearch-no-upper-case-p regexp t) org-occur-case-fold-search))) @@ -10197,12 +10205,12 @@ (defun org-occur (regexp &optional keep-previous callback) (setq cnt (1+ cnt)) (when org-highlight-sparse-tree-matches (org-highlight-new-match (match-beginning 0) (match-end 0))) - (org-show-context 'occur-tree))))) + (org-fold-show-context 'occur-tree))))) (when org-remove-highlights-with-change (add-hook 'before-change-functions 'org-remove-occur-highlights nil 'local)) (unless org-sparse-tree-open-archived-trees - (org-hide-archived-subtrees (point-min) (point-max))) + (org-fold-hide-archived-subtrees (point-min) (point-max))) (run-hooks 'org-occur-hook) (when (called-interactively-p 'interactive) (message "%d match(es) for regexp %s" cnt regexp)) @@ -10486,7 +10494,7 @@ (defun org-scan-tags (action matcher todo-only &optional start-level) (save-excursion (goto-char (point-min)) (when (eq action 'sparse-tree) - (org-overview) + (org-cycle-overview) (org-remove-occur-highlights)) (if (org-element--cache-active-p) (let ((fast-re (concat "^" @@ -10535,7 +10543,7 @@ (defun org-scan-tags (action matcher todo-only &optional start-level) (org-get-heading) (match-end 0) (org-highlight-new-match (match-beginning 1) (match-end 1))) - (org-show-context 'tags-tree)) + (org-fold-show-context 'tags-tree)) ((eq action 'agenda) (let* ((effort (org-entry-get (point) org-effort-property)) (effort-minutes (when effort (save-match-data (org-duration-to-minutes effort))))) @@ -10661,7 +10669,7 @@ (defun org-scan-tags (action matcher todo-only &optional start-level) (org-get-heading) (match-end 0) (org-highlight-new-match (match-beginning 1) (match-end 1))) - (org-show-context 'tags-tree)) + (org-fold-show-context 'tags-tree)) ((eq action 'agenda) (setq txt (org-agenda-format-item "" @@ -10699,7 +10707,7 @@ (defun org-scan-tags (action matcher todo-only &optional start-level) (and (= (point) lspos) (end-of-line 1)))))) (when (and (eq action 'sparse-tree) (not org-sparse-tree-open-archived-trees)) - (org-hide-archived-subtrees (point-min) (point-max))) + (org-fold-hide-archived-subtrees (point-min) (point-max))) (nreverse rtn))) (defun org-remove-uninherited-tags (tags) @@ -12548,7 +12556,7 @@ (defun org-insert-property-drawer () (inhibit-read-only t)) (unless (bobp) (insert "\n")) (insert ":PROPERTIES:\n:END:") - (org-flag-region (line-end-position 0) (point) t 'outline) + (org-fold-region (line-end-position 0) (point) t (if (eq org-fold-core-style 'text-properties) 'drawer 'outline)) (when (or (eobp) (= begin (point-min))) (insert "\n")) (org-indent-region begin (point)))))) @@ -14379,7 +14387,7 @@ (defun org-timestamp-change (n &optional what updown suppress-tmp-delay) (message "No clock to adjust") (save-excursion (org-goto-marker-or-bmk clfixpos) - (org-show-subtree) + (org-fold-show-subtree) (when (re-search-forward clrgx nil t) (goto-char (match-beginning 1)) (let (org-clock-adjust-closest) @@ -15877,7 +15885,7 @@ (defun org-self-insert-command (N) If the cursor is in a table looking at whitespace, the whitespace is overwritten, and the table is not marked as requiring realignment." (interactive "p") - (org-check-before-invisible-edit 'insert) + (org-fold-check-before-invisible-edit 'insert) (cond ((and org-use-speed-commands (let ((kv (this-command-keys-vector))) @@ -15947,7 +15955,7 @@ (defun org-delete-backward-char (N) because, in this case the deletion might narrow the column." (interactive "p") (save-match-data - (org-check-before-invisible-edit 'delete-backward) + (org-fold-check-before-invisible-edit 'delete-backward) (if (and (= N 1) (not overwrite-mode) (not (org-region-active-p)) @@ -15967,7 +15975,7 @@ (defun org-delete-char (N) because, in this case the deletion might narrow the column." (interactive "p") (save-match-data - (org-check-before-invisible-edit 'delete) + (org-fold-check-before-invisible-edit 'delete) (cond ((or (/= N 1) (eq (char-after) ?|) @@ -16153,11 +16161,11 @@ (defun org-shifttab (&optional arg) ((integerp arg) (let ((arg2 (if org-odd-levels-only (1- (* 2 arg)) arg))) (message "Content view to level: %d" arg) - (org-content (prefix-numeric-value arg2)) + (org-cycle-content (prefix-numeric-value arg2)) (org-cycle-show-empty-lines t) (setq org-cycle-global-status 'overview) (run-hook-with-args 'org-cycle-hook 'overview))) - (t (call-interactively 'org-global-cycle)))) + (t (call-interactively 'org-cycle-global)))) (defun org-shiftmetaleft () "Promote subtree or delete table column. @@ -16311,14 +16319,14 @@ (defun org-check-for-hidden (what) (setq beg (point-at-bol)) (beginning-of-line 2) (while (and (not (eobp)) ;; this is like `next-line' - (get-char-property (1- (point)) 'invisible)) + (org-invisible-p (1- (point)))) (beginning-of-line 2)) (setq end (point)) (goto-char beg) (goto-char (point-at-eol)) (setq end (max end (point))) (while (re-search-forward re end t) - (when (get-char-property (match-beginning 0) 'invisible) + (when (org-invisible-p (match-beginning 0)) (throw 'exit t)))) nil)))) @@ -16606,11 +16614,18 @@ (defun org-copy-visible (beg end) (interactive "r") (let ((result "")) (while (/= beg end) - (when (get-char-property beg 'invisible) - (setq beg (next-single-char-property-change beg 'invisible nil end))) - (let ((next (next-single-char-property-change beg 'invisible nil end))) - (setq result (concat result (buffer-substring beg next))) - (setq beg next))) + (if (eq org-fold-core-style 'text-properties) + (progn + (while (org-invisible-p beg) + (setq beg (org-fold-next-visibility-change beg end))) + (let ((next (org-fold-next-visibility-change beg end))) + (setq result (concat result (buffer-substring beg next))) + (setq beg next))) + (when (get-char-property beg 'invisible) + (setq beg (next-single-char-property-change beg 'invisible nil end))) + (let ((next (next-single-char-property-change beg 'invisible nil end))) + (setq result (concat result (buffer-substring beg next))) + (setq beg next)))) (setq deactivate-mark t) (kill-new result) (message "Visible strings have been copied to the kill ring."))) @@ -16984,14 +16999,14 @@ (defun org-kill-note-or-show-branches () (cond (org-finish-function (let ((org-note-abort t)) (funcall org-finish-function))) ((org-before-first-heading-p) - (org-show-branches-buffer) - (org-hide-archived-subtrees (point-min) (point-max))) + (org-fold-show-branches-buffer) + (org-fold-hide-archived-subtrees (point-min) (point-max))) (t (let ((beg (progn (org-back-to-heading) (point))) (end (save-excursion (org-end-of-subtree t t) (point)))) - (outline-hide-subtree) - (outline-show-branches) - (org-hide-archived-subtrees beg end))))) + (org-fold-hide-subtree) + (org-fold-show-branches) + (org-fold-hide-archived-subtrees beg end))))) (defun org-delete-indentation (&optional arg) "Join current line to previous and fix whitespace at join. @@ -17114,7 +17129,7 @@ (defun org-return (&optional indent arg interactive) (org-auto-align-tags (org-align-tags)) (t (org--align-tags-here tags-column))) ;preserve tags column (end-of-line) - (org-show-entry) + (org-fold-show-entry) (org--newline indent arg interactive) (when string (save-excursion (insert (org-trim string)))))) ;; In a list, make sure indenting keeps trailing text within. @@ -17152,11 +17167,11 @@ (defun org-ctrl-c-tab (&optional arg) (call-interactively #'org-table-toggle-column-width)) ((org-before-first-heading-p) (save-excursion - (org-flag-above-first-heading) - (outline-hide-sublevels (or arg 1)))) + (org-fold-flag-above-first-heading) + (org-fold-hide-sublevels (or arg 1)))) (t - (outline-hide-subtree) - (org-show-children arg)))) + (org-fold-hide-subtree) + (org-fold-show-children arg)))) (defun org-ctrl-c-star () "Compute table, or change heading status of lines. @@ -17291,7 +17306,7 @@ (defun org-meta-return (&optional arg) `org-table-wrap-region', depending on context. When called with an argument, unconditionally call `org-insert-heading'." (interactive "P") - (org-check-before-invisible-edit 'insert) + (org-fold-check-before-invisible-edit 'insert) (or (run-hook-with-args-until-success 'org-metareturn-hook) (call-interactively (cond (arg #'org-insert-heading) ((org-at-table-p) #'org-table-wrap-region) @@ -17311,8 +17326,8 @@ (easy-menu-define org-org-menu org-mode-map "Org menu." ["Cycle Visibility" org-cycle :active (or (bobp) (outline-on-heading-p))] ["Cycle Global Visibility" org-shifttab :active (not (org-at-table-p))] ["Sparse Tree..." org-sparse-tree t] - ["Reveal Context" org-reveal t] - ["Show All" org-show-all t] + ["Reveal Context" org-fold-reveal t] + ["Show All" org-fold-show-all t] "--" ["Subtree to indirect buffer" org-tree-to-indirect-buffer t]) "--" @@ -17770,7 +17785,7 @@ (defun org-goto-marker-or-bmk (marker &optional bookmark) (when (or (> marker (point-max)) (< marker (point-min))) (widen)) (goto-char marker) - (org-show-context 'org-goto)) + (org-fold-show-context 'org-goto)) (if bookmark (bookmark-jump bookmark) (error "Cannot find location")))) @@ -18007,7 +18022,7 @@ (defun org-occur-in-agenda-files (regexp &optional _nlines) regexp))) (add-hook 'occur-mode-find-occurrence-hook - (lambda () (when (derived-mode-p 'org-mode) (org-reveal)))) + (lambda () (when (derived-mode-p 'org-mode) (org-fold-reveal)))) (defun org-occur-link-in-agenda-files () "Create a link and search for it in the agendas. @@ -18943,7 +18958,7 @@ (defun org-next-block (arg &optional backward block-regexp) (cl-decf count)))) (if (= count 0) (prog1 (goto-char (org-element-property :post-affiliated last-element)) - (save-match-data (org-show-context))) + (save-match-data (org-fold-show-context))) (goto-char origin) (user-error "No %s code blocks" (if backward "previous" "further"))))) @@ -19424,7 +19439,7 @@ (defun org-kill-line (&optional _arg) ((or (not org-special-ctrl-k) (bolp) (not (org-at-heading-p))) - (when (and (get-char-property (line-end-position) 'invisible) + (when (and (org-invisible-p (line-end-position)) org-ctrl-k-protect-subtree (or (eq org-ctrl-k-protect-subtree 'error) (not (y-or-n-p "Kill hidden subtree along with headline? ")))) @@ -19512,7 +19527,7 @@ (defun org-yank-generic (command arg) (or (looking-at org-outline-regexp) (re-search-forward org-outline-regexp-bol end t)) (while (and (< (point) end) (looking-at org-outline-regexp)) - (org-flag-subtree t) + (org-fold-subtree t) (org-cycle-show-empty-lines 'folded) (condition-case nil (outline-forward-same-level 1) @@ -19569,7 +19584,7 @@ (defun org-back-to-heading (&optional invisible-ok) (fboundp 'org-inlinetask-end-p) (org-inlinetask-end-p)) (org-inlinetask-goto-beginning) - (setq found (and (or invisible-ok (not (org-invisible-p))) + (setq found (and (or invisible-ok (not (org-fold-folded-p))) (point)))))) (goto-char found) found))) @@ -20606,9 +20621,9 @@ (defun org-info-find-node (&optional nodename) ;;; Finish up -(add-hook 'org-mode-hook ;remove overlays when changing major mode +(add-hook 'org-mode-hook ;remove folds when changing major mode (lambda () (add-hook 'change-major-mode-hook - 'org-show-all 'append 'local))) + 'org-fold-show-all 'append 'local))) (provide 'org) diff --git a/lisp/ox-org.el b/lisp/ox-org.el index 3d3c4fe6a..96d22d178 100644 --- a/lisp/ox-org.el +++ b/lisp/ox-org.el @@ -329,7 +329,7 @@ (defun org-org-publish-to-org (plist filename pub-dir) newbuf) (with-current-buffer work-buffer (org-font-lock-ensure) - (org-show-all) + (org-fold-show-all) (setq newbuf (htmlize-buffer))) (with-current-buffer newbuf (when org-org-htmlized-css-url diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el index 3689a172f..24d96e58b 100644 --- a/testing/lisp/test-org-list.el +++ b/testing/lisp/test-org-list.el @@ -627,7 +627,7 @@ (ert-deftest test-org-list/move-item-down-contents-visibility () #+BEGIN_CENTER Text2 #+END_CENTER" - (org-hide-block-all) + (org-fold-hide-block-all) (let ((invisible-property-1 (progn (search-forward "Text1") diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index ce4d7b9dd..273441e0f 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -3787,7 +3787,7 @@ (ert-deftest test-org/end-of-line () (should-not (org-test-with-temp-text "#+BEGIN_CENTER\nContents\n#+END_CENTER" (let ((org-special-ctrl-a/e t)) - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (org-end-of-line) (eobp)))) ;; Get past invisible characters at the end of line. @@ -3935,7 +3935,7 @@ (ert-deftest test-org/forward-paragraph () (should (= 6 (org-test-with-temp-text "#+begin_center\nP1\n\nP2\n#+end_center\nP3" - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (org-forward-paragraph) (org-current-line)))) ;; On an item or a footnote definition, move past the first element @@ -4055,7 +4055,7 @@ (ert-deftest test-org/backward-paragraph () (bobp))) (should (org-test-with-temp-text "#+begin_center\nP1\n\nP2\n#+end_center\n" - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (goto-char (point-max)) (org-backward-paragraph) (bobp))) @@ -8057,108 +8057,110 @@ (ert-deftest test-org/timestamp-to-time () ;;; Visibility (ert-deftest test-org/hide-drawer-toggle () - "Test `org-hide-drawer-toggle' specifications." + "Test `org-fold-hide-drawer-toggle' specifications." ;; Error when not at a drawer. (should-error (org-test-with-temp-text ":fake-drawer:\ncontents" - (org-hide-drawer-toggle 'off) + (org-fold-hide-drawer-toggle 'off) (get-char-property (line-end-position) 'invisible))) (should-error (org-test-with-temp-text "#+begin_example\n:D:\nc\n:END:\n#+end_example" - (org-hide-drawer-toggle t))) + (org-fold-hide-drawer-toggle t))) ;; Hide drawer. (should (org-test-with-temp-text ":drawer:\ncontents\n:end:" - (org-hide-drawer-toggle) + (org-fold-show-all) + (org-fold-hide-drawer-toggle) (get-char-property (line-end-position) 'invisible))) ;; Show drawer unconditionally when optional argument is `off'. (should-not (org-test-with-temp-text ":drawer:\ncontents\n:end:" - (org-hide-drawer-toggle) - (org-hide-drawer-toggle 'off) + (org-fold-hide-drawer-toggle) + (org-fold-hide-drawer-toggle 'off) (get-char-property (line-end-position) 'invisible))) ;; Hide drawer unconditionally when optional argument is non-nil. (should (org-test-with-temp-text ":drawer:\ncontents\n:end:" - (org-hide-drawer-toggle t) + (org-fold-hide-drawer-toggle t) (get-char-property (line-end-position) 'invisible))) ;; Do not hide drawer when called from final blank lines. (should-not (org-test-with-temp-text ":drawer:\ncontents\n:end:\n\n" - (org-hide-drawer-toggle) + (org-fold-show-all) + (org-fold-hide-drawer-toggle) (goto-char (point-min)) (get-char-property (line-end-position) 'invisible))) ;; Don't leave point in an invisible part of the buffer when hiding ;; a drawer away. (should-not (org-test-with-temp-text ":drawer:\ncontents\n:end:" - (org-hide-drawer-toggle) + (org-fold-hide-drawer-toggle) (get-char-property (point) 'invisible)))) (ert-deftest test-org/hide-block-toggle () - "Test `org-hide-block-toggle' specifications." + "Test `org-fold-hide-block-toggle' specifications." ;; Error when not at a block. (should-error (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents" - (org-hide-block-toggle 'off) + (org-fold-hide-block-toggle 'off) (get-char-property (line-end-position) 'invisible))) ;; Hide block. (should (org-test-with-temp-text "#+BEGIN_CENTER\ncontents\n#+END_CENTER" - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (get-char-property (line-end-position) 'invisible))) (should (org-test-with-temp-text "#+BEGIN_EXAMPLE\ncontents\n#+END_EXAMPLE" - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (get-char-property (line-end-position) 'invisible))) ;; Show block unconditionally when optional argument is `off'. (should-not (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE" - (org-hide-block-toggle) - (org-hide-block-toggle 'off) + (org-fold-hide-block-toggle) + (org-fold-hide-block-toggle 'off) (get-char-property (line-end-position) 'invisible))) (should-not (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE" - (org-hide-block-toggle 'off) + (org-fold-hide-block-toggle 'off) (get-char-property (line-end-position) 'invisible))) ;; Hide block unconditionally when optional argument is non-nil. (should (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE" - (org-hide-block-toggle t) + (org-fold-hide-block-toggle t) (get-char-property (line-end-position) 'invisible))) (should (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE" - (org-hide-block-toggle) - (org-hide-block-toggle t) + (org-fold-hide-block-toggle) + (org-fold-hide-block-toggle t) (get-char-property (line-end-position) 'invisible))) ;; Do not hide block when called from final blank lines. (should-not (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE\n\n" - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (goto-char (point-min)) (get-char-property (line-end-position) 'invisible))) ;; Don't leave point in an invisible part of the buffer when hiding ;; a block away. (should-not (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE" - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (get-char-property (point) 'invisible)))) (ert-deftest test-org/hide-block-toggle-maybe () - "Test `org-hide-block-toggle-maybe' specifications." + "Test `org-fold-hide-block-toggle' specifications." (should (org-test-with-temp-text "#+BEGIN: dynamic\nContents\n#+END:" - (org-hide-block-toggle-maybe))) - (should-not - (org-test-with-temp-text "Paragraph" (org-hide-block-toggle-maybe)))) + (org-hide-block-toggle))) + (should-error + (org-test-with-temp-text "Paragraph" (org-hide-block-toggle)))) (ert-deftest test-org/show-set-visibility () - "Test `org-show-set-visibility' specifications." + "Test `org-fold-show-set-visibility' specifications." ;; Do not throw an error before first heading. (should (org-test-with-temp-text "Preamble\n* Headline" - (org-show-set-visibility 'tree) + (org-fold-show-set-visibility 'tree) t)) ;; Test all visibility spans, both on headline and in entry. (let ((list-visible-lines @@ -8180,7 +8182,7 @@ (ert-deftest test-org/show-set-visibility () " (org-cycle t) (search-forward (if headerp "Self" "Match")) - (org-show-set-visibility state) + (org-fold-show-set-visibility state) (goto-char (point-min)) (let (result (line 0)) (while (not (eobp)) @@ -8211,24 +8213,24 @@ (ert-deftest test-org/show-set-visibility () ;; visible. (should-not (org-test-with-temp-text "#+BEGIN_QUOTE\nText\n#+END_QUOTE" - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (search-forward "Text") - (org-show-set-visibility 'minimal) + (org-fold-show-set-visibility 'minimal) (org-invisible-p2))) (should-not (org-test-with-temp-text ":DRAWER:\nText\n:END:" - (org-hide-drawer-toggle) + (org-fold-hide-drawer-toggle) (search-forward "Text") - (org-show-set-visibility 'minimal) + (org-fold-show-set-visibility 'minimal) (org-invisible-p2))) (should-not (org-test-with-temp-text "#+BEGIN_QUOTE\n:DRAWER:\nText\n:END:\n#+END_QUOTE" - (org-hide-drawer-toggle) + (org-fold-hide-drawer-toggle) (forward-line -1) - (org-hide-block-toggle) + (org-fold-hide-block-toggle) (search-forward "Text") - (org-show-set-visibility 'minimal) + (org-fold-show-set-visibility 'minimal) (org-invisible-p2)))) (defun test-org/copy-visible () --------------2.34.1--