emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matthew Palermo <matt.r.palermo@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [Patch] Allow skipping the local org cycle SUBTREE state
Date: Fri, 23 Nov 2018 09:33:01 +1000	[thread overview]
Message-ID: <CAAg=FEUqHYRf5N5yhODU_Uea0Dg1F4oz+b53=41Jyam9huErzw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 611 bytes --]

Hi Org,

Attached is a patch that adds a customization variable,
org-cycle-local-skip-subtree, which, when set to t (nil by default)
will cause the SUBTREE state to be skipped when using org-cycle
locally. All behaviour remains the same by default.

I find the SUBTREE state such an unpleasant experience when using
org-cycle locally to the extent that I find it better when it is
disabled completely. I hope that others might find it useful and I
hope to get it merged into Org so that I don't have to maintain a fork
of org.el.

The change passes the test suite. No tests were added.

Cheers,
Matthew Palermo

[-- Attachment #2: 0001-org.el-Allow-skipping-the-local-org-cycle-SUBTREE.patch --]
[-- Type: application/octet-stream, Size: 2390 bytes --]

From 539f9230ca8c64dc51d8a2d1d108ea4b51b4ea87 Mon Sep 17 00:00:00 2001
From: Matthew Palermo <matt.r.palermo@gmail.com>
Date: Fri, 23 Nov 2018 07:55:57 +1000
Subject: [PATCH] org.el: Allow skipping the local org-cycle SUBTREE

* lisp/org.el (org-cycle-local-skip-subtree): New customization
variable to optionally skip the local org-cycle SUBTREE state.
No behaviour change by default.
(org-cycle-internal-local): If org-cycle-local-skip-subtree is t,
skip the SUBTREE state, otherwise do everything the same as before.

I find that the SUBTREE state unhelpful, distracting and jarring to the
extent that I'd like to disable it and that is what this change allows.
The default behaviour remains unchanged.

TINYCHANGE
---
 lisp/org.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index b78243c2c..6437a9aae 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1375,6 +1375,11 @@ is not set."
   :group 'org-cycle
   :type 'boolean)
 
+(defcustom org-cycle-local-skip-subtree nil
+  "Non-nil means skip SUBTREE state when org-cycle is used locally."
+  :group 'org-cycle
+  :type 'boolean)
+
 (defcustom org-cycle-max-level nil
   "Maximum level which should still be subject to visibility cycling.
 Levels higher than this will, for cycling, be treated as text, not a headline.
@@ -7155,6 +7160,7 @@ Use `\\[org-edit-special]' to edit table.el tables"))
      ((and (or (>= eol eos)
 	       (not (string-match "\\S-" (buffer-substring eol eos))))
 	   (or has-children
+	       org-cycle-local-skip-subtree
 	       (not (setq children-skipped
 			  org-cycle-skip-children-state-if-no-children))))
       ;; Entire subtree is hidden in one line: children view
@@ -7185,9 +7191,10 @@ Use `\\[org-edit-special]' to edit table.el tables"))
       (setq org-cycle-subtree-status 'children)
       (unless (org-before-first-heading-p)
 	(run-hook-with-args 'org-cycle-hook 'children)))
-     ((or children-skipped
-	  (and (eq last-command this-command)
-	       (eq org-cycle-subtree-status 'children)))
+     ((and (not org-cycle-local-skip-subtree)
+	   (or children-skipped
+	       (and (eq last-command this-command)
+		    (eq org-cycle-subtree-status 'children))))
       ;; We just showed the children, or no children are there,
       ;; now show everything.
       (unless (org-before-first-heading-p)
-- 
2.17.1.windows.2


                 reply	other threads:[~2018-11-22 23:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAg=FEUqHYRf5N5yhODU_Uea0Dg1F4oz+b53=41Jyam9huErzw@mail.gmail.com' \
    --to=matt.r.palermo@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).