emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Patch] Allow skipping the local org cycle SUBTREE state
@ 2018-11-22 23:33 Matthew Palermo
  0 siblings, 0 replies; only message in thread
From: Matthew Palermo @ 2018-11-22 23:33 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-22 23:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-22 23:33 [Patch] Allow skipping the local org cycle SUBTREE state Matthew Palermo

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).