emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Show hidden drawers when org-cycle on headlines
@ 2020-04-11  8:43 stardiviner
  2020-04-11 16:05 ` Nicolas Goaziou
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: stardiviner @ 2020-04-11  8:43 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 392 bytes --]


I think the hidden drawers info is useful for users, this should be
shown when org-cycle on headlines.

Here is the patch.

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-org.el-Rename-org-cycle-hide-drawers-to-org-cycle-to.patch --]
[-- Type: text/x-patch, Size: 5059 bytes --]

From 98e3ece4d2bd6f7c7ccd0ecf70dc327a01bff8bd Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Sat, 11 Apr 2020 13:16:02 +0800
Subject: [PATCH] org.el: Rename org-cycle-hide-drawers to
 org-cycle-toggle-drawers

* lisp/org.el (org-cycle-toggle-drawers): Make function toggle
show/hide drawers.

* lisp/org-agenda.el (org-cycle-toggle-drawers): updated renamed
functions.

* etc/ORG-NEWS: mention incompatible changes.
---
 etc/ORG-NEWS       |  9 +++++++++
 lisp/org-agenda.el |  4 ++--
 lisp/org.el        | 26 +++++++++++++++++++++-----
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e90ac60e3..244c30be4 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -80,6 +80,11 @@ resulting <div> will be ~<div id="outline-container-my-headline">~.
 You may want to check whether your HTML files are rendered differently
 after this change.
 
+*** Renamed ~org-cycle-hide-drawers~ to ~org-cycle-toggle-drawers~
+
+Rename function after added a third optional argument changed function
+meaning. Now drawers will be expanded when ~org-cycle~ on headlines.
+
 ** New default settings for some options
 
 These options now defaults to =t=:
@@ -294,6 +299,10 @@ HTML.
 
 Functions in this hook are run after ~org-agenda-filter~ is called.
 
+*** New option ~org-show-drawer-on-cycle~
+
+Option to control whether expand hidden drawer when ~org-cycle~ on headlines.
+
 ** Removed or renamed functions and variables
 *** Removed  ~org-maybe-keyword-time-regexp~
 
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ffb892b0c..e3dca49af 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9104,7 +9104,7 @@ (defun org-agenda-show-and-scroll-up (&optional arg)
 	  (ignore-errors (scroll-up)))
       (org-agenda-goto t)
       (org-show-entry)
-      (if arg (org-cycle-hide-drawers 'children)
+      (if arg (org-cycle-toggle-drawers 'children nil t)
 	(org-with-wide-buffer
 	 (narrow-to-region (org-entry-beginning-position)
 			   (org-entry-end-position))
@@ -9164,7 +9164,7 @@ (defun org-agenda-show-1 (&optional more)
       (outline-show-subtree)
       (save-excursion
 	(org-back-to-heading)
-	(org-cycle-hide-drawers 'subtree '("LOGBOOK")))
+	(org-cycle-toggle-drawers 'subtree '("LOGBOOK") t))
       (message "Remote: SUBTREE AND LOGBOOK"))
      ((> more 4)
       (outline-show-subtree)
diff --git a/lisp/org.el b/lisp/org.el
index 57682fd16..5d5e54574 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6012,7 +6012,23 @@ (defun org-hide-block-all ()
 
 ;;;; Drawers visibility
 
-(defun org-cycle-hide-drawers (state &optional exceptions)
+(defcustom org-show-drawer-on-cycle nil
+  "Whether auto expand hidden drawers when `org-cycle' headlines."
+  :type 'boolean
+  :safe #'booleanp
+  :group 'org)
+
+(defun org-cycle-expand-drawer (state)
+  "Show hidden drawer of headline."
+  (org-cycle-toggle-drawers 'children))
+
+(defun org-enable-cycle-expand-drawer ()
+  (when org-show-drawer-on-cycle
+    (add-hook 'org-cycle-hook #'org-cycle-expand-drawer)))
+
+(add-hook 'org-mode-hook #'org-enable-cycle-expand-drawer)
+
+(defun org-cycle-toggle-drawers (state &optional exceptions flag)
   "Re-hide all drawers after a visibility state change.
 STATE should be one of the symbols listed in the docstring of
 `org-cycle-hook'.  When non-nil, optional argument EXCEPTIONS is
@@ -6031,7 +6047,7 @@ (defun org-cycle-hide-drawers (state &optional exceptions)
 	  (unless (member-ignore-case (match-string 1) exceptions)
 	    (let ((drawer (org-element-at-point)))
 	      (when (memq (org-element-type drawer) '(drawer property-drawer))
-		(org-flag-drawer t drawer)
+		(org-flag-drawer flag drawer)
 		;; Make sure to skip drawer entirely or we might flag
 		;; it another time when matching its ending line with
 		;; `org-drawer-regexp'.
@@ -6427,7 +6443,7 @@ (defun org-set-startup-visibility ()
     (when org-hide-block-startup (org-hide-block-all))
     (org-set-visibility-according-to-property)
     (org-cycle-hide-archived-subtrees 'all)
-    (org-cycle-hide-drawers 'all)
+    (org-cycle-toggle-drawers 'all nil t)
     (org-cycle-show-empty-lines t)))
 
 (defun org-set-visibility-according-to-property ()
@@ -6532,7 +6548,7 @@ (defun org-clean-visibility-after-subtree-move ()
 	    (when (and (not (org-invisible-p))
 		       (org-invisible-p (line-end-position)))
 	      (outline-hide-entry))))
-	(org-cycle-hide-drawers 'all)
+	(org-cycle-toggle-drawers 'all nil t)
 	(org-cycle-show-empty-lines 'overview)))))
 
 (defun org-cycle-show-empty-lines (state)
@@ -8076,7 +8092,7 @@ (defun org-sort-entries
 			      "(empty for default `sort-subr' predicate): ")
 		      'allow-empty))))
 	   ((member dcst '(?p ?t ?s ?d ?c ?k)) '<))))
-	(org-cycle-hide-drawers 'all)
+	(org-cycle-toggle-drawers 'all nil t)
 	(when restore-clock?
 	  (move-marker org-clock-marker
 		       (1+ (next-single-property-change
-- 
2.26.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-11  8:43 [PATCH] Show hidden drawers when org-cycle on headlines stardiviner
@ 2020-04-11 16:05 ` Nicolas Goaziou
  2020-04-13  3:29   ` stardiviner
  2020-04-13 20:52 ` Samuel Wales
  2020-04-15  1:26 ` [SOLUTION] " stardiviner
  2 siblings, 1 reply; 22+ messages in thread
From: Nicolas Goaziou @ 2020-04-11 16:05 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-orgmode

Hello,

stardiviner <numbchild@gmail.com> writes:

> I think the hidden drawers info is useful for users, this should be
> shown when org-cycle on headlines.

Doesn't this defeat the whole purpose of drawers? What problem do you
want to solve?

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-11 16:05 ` Nicolas Goaziou
@ 2020-04-13  3:29   ` stardiviner
  2020-04-13  8:06     ` Nicolas Goaziou
  2020-04-13  9:12     ` Ihor Radchenko
  0 siblings, 2 replies; 22+ messages in thread
From: stardiviner @ 2020-04-13  3:29 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> I think the hidden drawers info is useful for users, this should be
>> shown when org-cycle on headlines.
>
> Doesn't this defeat the whole purpose of drawers? What problem do you
> want to solve?

Hmm, you're right, my patch seems against the purpose of drawers.

I try to record into under headline. For example, I use "org-contacts.el" which
record people personalized info. I want to see all properties drawer under a
headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.

I agree your opinion. I wonder is it possible to define a buffer local variable
so that user can control this behavior. WDYT?

>
> Regards,


- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6T3JAUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsPm0Af+JPZpVaz0GBhs3TS4rbKA58fO5RNS
lBbL0oaLpua9sBIh2erwLCnVff6hDcXW9tZp9CCXkFMlvx/kHJ8izGf8Sq59rPsa
X7N7szot6W+KJXLEsy+v3VwYcvKX5um8BBh+FrfUguLuCInUy03ZXquiruxHVZun
eKc67YBi5KpDJVyhkBD3NGSzuhmP8kiJ2hx05dh9PpLB9+YUeUX+8bb82biEu/O0
ynWItysHG7t116+UuSQ0ShHE2yJffZqa0ygKfIukdPw7hLqBKSrudZX0Zp9yyPHh
SKh+olNHbOyQCpSZRjrMzhDETBP/g+FjiCMlmO2024F3FOZtyhQF+ALCfw==
=0jTv
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13  3:29   ` stardiviner
@ 2020-04-13  8:06     ` Nicolas Goaziou
  2020-04-13 16:28       ` stardiviner
  2020-04-13  9:12     ` Ihor Radchenko
  1 sibling, 1 reply; 22+ messages in thread
From: Nicolas Goaziou @ 2020-04-13  8:06 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-orgmode

Hello,

stardiviner <numbchild@gmail.com> writes:

> I try to record into under headline. For example, I use "org-contacts.el" which
> record people personalized info. I want to see all properties drawer under a
> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.
>
> I agree your opinion. I wonder is it possible to define a buffer local variable
> so that user can control this behavior. WDYT?

I think that drawers and headlines are unrelated, and `org-cycle' should
not handle drawers, even through a variable.

However, using `org-show-all' function, you could write a function that
expands properties drawers, and add it to `org-cycle-hook'.

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13  3:29   ` stardiviner
  2020-04-13  8:06     ` Nicolas Goaziou
@ 2020-04-13  9:12     ` Ihor Radchenko
  2020-04-13 16:31       ` [SOLVED] " stardiviner
  1 sibling, 1 reply; 22+ messages in thread
From: Ihor Radchenko @ 2020-04-13  9:12 UTC (permalink / raw)
  To: numbchild, Nicolas Goaziou; +Cc: emacs-orgmode

> I try to record into under headline. For example, I use "org-contacts.el" which
> record people personalized info. I want to see all properties drawer under a
> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.

I recall seeing something similar in stackoverflow.
Here it is:
https://stackoverflow.com/questions/17478260/completely-hide-the-properties-drawer-in-org-mode

The accepted answer has a hint how to achieve what your want.

Best,
Ihor


stardiviner <numbchild@gmail.com> writes:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Hello,
>>
>> stardiviner <numbchild@gmail.com> writes:
>>
>>> I think the hidden drawers info is useful for users, this should be
>>> shown when org-cycle on headlines.
>>
>> Doesn't this defeat the whole purpose of drawers? What problem do you
>> want to solve?
>
> Hmm, you're right, my patch seems against the purpose of drawers.
>
> I try to record into under headline. For example, I use "org-contacts.el" which
> record people personalized info. I want to see all properties drawer under a
> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.
>
> I agree your opinion. I wonder is it possible to define a buffer local variable
> so that user can control this behavior. WDYT?
>
>>
>> Regards,
>
>
> - -- 
> [ stardiviner ]
>        I try to make every word tell the meaning what I want to express.
>
>        Blog: https://stardiviner.github.io/
>        IRC(freenode): stardiviner, Matrix: stardiviner
>        GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>       
> -----BEGIN PGP SIGNATURE-----
>
> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6T3JAUHG51bWJjaGls
> ZEBnbWFpbC5jb20ACgkQG13xyVromsPm0Af+JPZpVaz0GBhs3TS4rbKA58fO5RNS
> lBbL0oaLpua9sBIh2erwLCnVff6hDcXW9tZp9CCXkFMlvx/kHJ8izGf8Sq59rPsa
> X7N7szot6W+KJXLEsy+v3VwYcvKX5um8BBh+FrfUguLuCInUy03ZXquiruxHVZun
> eKc67YBi5KpDJVyhkBD3NGSzuhmP8kiJ2hx05dh9PpLB9+YUeUX+8bb82biEu/O0
> ynWItysHG7t116+UuSQ0ShHE2yJffZqa0ygKfIukdPw7hLqBKSrudZX0Zp9yyPHh
> SKh+olNHbOyQCpSZRjrMzhDETBP/g+FjiCMlmO2024F3FOZtyhQF+ALCfw==
> =0jTv
> -----END PGP SIGNATURE-----
>

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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13  8:06     ` Nicolas Goaziou
@ 2020-04-13 16:28       ` stardiviner
  0 siblings, 0 replies; 22+ messages in thread
From: stardiviner @ 2020-04-13 16:28 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> I try to record into under headline. For example, I use "org-contacts.el" which
>> record people personalized info. I want to see all properties drawer under a
>> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.
>>
>> I agree your opinion. I wonder is it possible to define a buffer local variable
>> so that user can control this behavior. WDYT?
>
> I think that drawers and headlines are unrelated, and `org-cycle' should
> not handle drawers, even through a variable.

I see. I will add a custom hook config in my personal init.

>
> However, using `org-show-all' function, you could write a function that
> expands properties drawers, and add it to `org-cycle-hook'.

Yes, my patch added a similar function like `org-show-all' which I borrowed code
from it to `org-cycle-hook'.

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6UkzkUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNlUAf9HntaeOxyVKZDEEe19yc9tK60Nn2v
JuzO9mEuFcwwrZQb0hYMADRGcjla5CJ5eQN0HZ9RHlwCQyqLGdqTVa5/Qt+nZvYm
HiP4vefHKAGIUGg+FUJh2Q0rFruRS34S05H/bWzPh4/gtno0KafR0YhqkVLp+Z7U
gPud1yacH6c1ANlMTyBKgVfJND/kntvfXStSNnciNwHX1CgpttrNt7KJC7BJ8poa
HoR6AfPqQK0M1IxUV0rTxpFElVSFYaHq5L+V//9alqRzsqaOLSvcK/HDCRhV8Tak
jl+EuC9HmkDX8PEnPlsp/GjXSZHbuTuYr5tX4A2ncYEN0SvxG7RoqSSTYg==
=L8iO
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13  9:12     ` Ihor Radchenko
@ 2020-04-13 16:31       ` stardiviner
  2020-04-13 16:58         ` Ihor Radchenko
  0 siblings, 1 reply; 22+ messages in thread
From: stardiviner @ 2020-04-13 16:31 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode, Nicolas Goaziou

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Ihor Radchenko <yantar92@gmail.com> writes:

>> I try to record into under headline. For example, I use "org-contacts.el" which
>> record people personalized info. I want to see all properties drawer under a
>> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.
>
> I recall seeing something similar in stackoverflow.
> Here it is:
> https://stackoverflow.com/questions/17478260/completely-hide-the-properties-drawer-in-org-mode
>
> The accepted answer has a hint how to achieve what your want.
>

Thanks Ihor, I indeed found related code in Org Mode source. I implemented a
similar functionality in my patch.

> Best,
> Ihor
>
>
> stardiviner <numbchild@gmail.com> writes:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>>
>> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>
>>> Hello,
>>>
>>> stardiviner <numbchild@gmail.com> writes:
>>>
>>>> I think the hidden drawers info is useful for users, this should be
>>>> shown when org-cycle on headlines.
>>>
>>> Doesn't this defeat the whole purpose of drawers? What problem do you
>>> want to solve?
>>
>> Hmm, you're right, my patch seems against the purpose of drawers.
>>
>> I try to record into under headline. For example, I use "org-contacts.el" which
>> record people personalized info. I want to see all properties drawer under a
>> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.
>>
>> I agree your opinion. I wonder is it possible to define a buffer local variable
>> so that user can control this behavior. WDYT?
>>
>>>
>>> Regards,
>>
>>
>> - -- 
>> [ stardiviner ]
>>        I try to make every word tell the meaning what I want to express.
>>
>>        Blog: https://stardiviner.github.io/
>>        IRC(freenode): stardiviner, Matrix: stardiviner
>>        GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>>       
>> -----BEGIN PGP SIGNATURE-----
>>
>> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6T3JAUHG51bWJjaGls
>> ZEBnbWFpbC5jb20ACgkQG13xyVromsPm0Af+JPZpVaz0GBhs3TS4rbKA58fO5RNS
>> lBbL0oaLpua9sBIh2erwLCnVff6hDcXW9tZp9CCXkFMlvx/kHJ8izGf8Sq59rPsa
>> X7N7szot6W+KJXLEsy+v3VwYcvKX5um8BBh+FrfUguLuCInUy03ZXquiruxHVZun
>> eKc67YBi5KpDJVyhkBD3NGSzuhmP8kiJ2hx05dh9PpLB9+YUeUX+8bb82biEu/O0
>> ynWItysHG7t116+UuSQ0ShHE2yJffZqa0ygKfIukdPw7hLqBKSrudZX0Zp9yyPHh
>> SKh+olNHbOyQCpSZRjrMzhDETBP/g+FjiCMlmO2024F3FOZtyhQF+ALCfw==
>> =0jTv
>> -----END PGP SIGNATURE-----
>>


- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6Uk+MUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsPYmAf/X0l7OXFrPUR86aGuKdppM+uk3/t1
edt3uCt1C2LCUZ2wiiCbCdmXgtTpwQumJjUnUM1WK9viNlMZq5FkmuWSZMwVwhc9
mR7f4QFHGPfjJF02YEWjAOpR27do5N+jZrsH8u2hcSaf9IpdL0bxA/n5nLTXpmpB
+ghOSAT186LqWCCDcxhNFH7vUOKrE2gtrWPo5LeedWiHgfuMJuvhESSbWGfHFHL4
ptxWlrEovDXZKZwsxVxZ578o27p8WgTkoRtfZjv3++lTG0BBg8DuOEfOWuZYDvf2
98OX2JnFoo57rL5KU9JFU8Y170RvRxDQF2ND7tg1e5RQcPoGFEKG+tfMaQ==
=kaPH
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13 16:31       ` [SOLVED] " stardiviner
@ 2020-04-13 16:58         ` Ihor Radchenko
  2020-04-13 20:00           ` Nicolas Goaziou
  0 siblings, 1 reply; 22+ messages in thread
From: Ihor Radchenko @ 2020-04-13 16:58 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-orgmode, Nicolas Goaziou

> Thanks Ihor, I indeed found related code in Org Mode source. I implemented a
> similar functionality in my patch.

Oh. I somehow missed your first message...

Now, actually adding something to the discussion.

FYI, there is org-cycle-include-plain-lists variable. If it is set to
'integrate, plain lists will be included into cycling with point at
headline. This is against the logic that org-cycle only needs to be
dealing with headlines. So, I don't see your patch breaking the present
conventions in org.


stardiviner <numbchild@gmail.com> writes:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> Ihor Radchenko <yantar92@gmail.com> writes:
>
>>> I try to record into under headline. For example, I use "org-contacts.el" which
>>> record people personalized info. I want to see all properties drawer under a
>>> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.
>>
>> I recall seeing something similar in stackoverflow.
>> Here it is:
>> https://stackoverflow.com/questions/17478260/completely-hide-the-properties-drawer-in-org-mode
>>
>> The accepted answer has a hint how to achieve what your want.
>>
>
> Thanks Ihor, I indeed found related code in Org Mode source. I implemented a
> similar functionality in my patch.
>
>> Best,
>> Ihor
>>
>>
>> stardiviner <numbchild@gmail.com> writes:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA256
>>>
>>>
>>> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>>
>>>> Hello,
>>>>
>>>> stardiviner <numbchild@gmail.com> writes:
>>>>
>>>>> I think the hidden drawers info is useful for users, this should be
>>>>> shown when org-cycle on headlines.
>>>>
>>>> Doesn't this defeat the whole purpose of drawers? What problem do you
>>>> want to solve?
>>>
>>> Hmm, you're right, my patch seems against the purpose of drawers.
>>>
>>> I try to record into under headline. For example, I use "org-contacts.el" which
>>> record people personalized info. I want to see all properties drawer under a
>>> headline when I press [Tab] (org-cycle) to expand it. It's more intuitive.
>>>
>>> I agree your opinion. I wonder is it possible to define a buffer local variable
>>> so that user can control this behavior. WDYT?
>>>
>>>>
>>>> Regards,
>>>
>>>
>>> - -- 
>>> [ stardiviner ]
>>>        I try to make every word tell the meaning what I want to express.
>>>
>>>        Blog: https://stardiviner.github.io/
>>>        IRC(freenode): stardiviner, Matrix: stardiviner
>>>        GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>>>       
>>> -----BEGIN PGP SIGNATURE-----
>>>
>>> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6T3JAUHG51bWJjaGls
>>> ZEBnbWFpbC5jb20ACgkQG13xyVromsPm0Af+JPZpVaz0GBhs3TS4rbKA58fO5RNS
>>> lBbL0oaLpua9sBIh2erwLCnVff6hDcXW9tZp9CCXkFMlvx/kHJ8izGf8Sq59rPsa
>>> X7N7szot6W+KJXLEsy+v3VwYcvKX5um8BBh+FrfUguLuCInUy03ZXquiruxHVZun
>>> eKc67YBi5KpDJVyhkBD3NGSzuhmP8kiJ2hx05dh9PpLB9+YUeUX+8bb82biEu/O0
>>> ynWItysHG7t116+UuSQ0ShHE2yJffZqa0ygKfIukdPw7hLqBKSrudZX0Zp9yyPHh
>>> SKh+olNHbOyQCpSZRjrMzhDETBP/g+FjiCMlmO2024F3FOZtyhQF+ALCfw==
>>> =0jTv
>>> -----END PGP SIGNATURE-----
>>>
>
>
> - -- 
> [ stardiviner ]
>        I try to make every word tell the meaning what I want to express.
>
>        Blog: https://stardiviner.github.io/
>        IRC(freenode): stardiviner, Matrix: stardiviner
>        GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>       
> -----BEGIN PGP SIGNATURE-----
>
> iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6Uk+MUHG51bWJjaGls
> ZEBnbWFpbC5jb20ACgkQG13xyVromsPYmAf/X0l7OXFrPUR86aGuKdppM+uk3/t1
> edt3uCt1C2LCUZ2wiiCbCdmXgtTpwQumJjUnUM1WK9viNlMZq5FkmuWSZMwVwhc9
> mR7f4QFHGPfjJF02YEWjAOpR27do5N+jZrsH8u2hcSaf9IpdL0bxA/n5nLTXpmpB
> +ghOSAT186LqWCCDcxhNFH7vUOKrE2gtrWPo5LeedWiHgfuMJuvhESSbWGfHFHL4
> ptxWlrEovDXZKZwsxVxZ578o27p8WgTkoRtfZjv3++lTG0BBg8DuOEfOWuZYDvf2
> 98OX2JnFoo57rL5KU9JFU8Y170RvRxDQF2ND7tg1e5RQcPoGFEKG+tfMaQ==
> =kaPH
> -----END PGP SIGNATURE-----

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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13 16:58         ` Ihor Radchenko
@ 2020-04-13 20:00           ` Nicolas Goaziou
  2020-04-13 23:19             ` Tim Cross
                               ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Nicolas Goaziou @ 2020-04-13 20:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hello,

Ihor Radchenko <yantar92@gmail.com> writes:

>> Thanks Ihor, I indeed found related code in Org Mode source. I implemented a
>> similar functionality in my patch.
>
> Oh. I somehow missed your first message...
>
> Now, actually adding something to the discussion.
>
> FYI, there is org-cycle-include-plain-lists variable. If it is set to
> 'integrate, plain lists will be included into cycling with point at
> headline. This is against the logic that org-cycle only needs to be
> dealing with headlines. So, I don't see your patch breaking the present
> conventions in org.

Yes, this `integrate' value is not great, IMO. However, plain lists have
much more in common with headlines than with drawers.

I still think basic cycling should not include drawers whatsoever. This
is even more true for properties drawers.

Note that you can already display drawers with `org-cycle', using three
prefix arguments.

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-11  8:43 [PATCH] Show hidden drawers when org-cycle on headlines stardiviner
  2020-04-11 16:05 ` Nicolas Goaziou
@ 2020-04-13 20:52 ` Samuel Wales
  2020-04-15  1:26 ` [SOLUTION] " stardiviner
  2 siblings, 0 replies; 22+ messages in thread
From: Samuel Wales @ 2020-04-13 20:52 UTC (permalink / raw)
  To: numbchild; +Cc: emacs-orgmode

i wonder if as a companion to such [perhaps hook-based user]
functionality, org-ellipsis could appear e.g. only if there is text
content.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13 20:00           ` Nicolas Goaziou
@ 2020-04-13 23:19             ` Tim Cross
  2020-04-14  3:18             ` Ihor Radchenko
  2020-04-14  5:21             ` stardiviner
  2 siblings, 0 replies; 22+ messages in thread
From: Tim Cross @ 2020-04-13 23:19 UTC (permalink / raw)
  To: emacs-orgmode


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I still think basic cycling should not include drawers whatsoever. This
> is even more true for properties drawers.
>
> Note that you can already display drawers with `org-cycle', using three
> prefix arguments.
>

I agree. I use drawers precisely because they contain information I
don't want to see when cycling. Drawers contain 'meta', which is often
tangential to the main content. 


-- 
Tim Cross


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13 20:00           ` Nicolas Goaziou
  2020-04-13 23:19             ` Tim Cross
@ 2020-04-14  3:18             ` Ihor Radchenko
  2020-04-14 12:58               ` Nicolas Goaziou
  2020-04-14  5:21             ` stardiviner
  2 siblings, 1 reply; 22+ messages in thread
From: Ihor Radchenko @ 2020-04-14  3:18 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

> Yes, this `integrate' value is not great, IMO. However, plain lists have
> much more in common with headlines than with drawers.
>
> I still think basic cycling should not include drawers whatsoever. This
> is even more true for properties drawers.

I tend to agree about the properties drawers. Cannot come up with a
reasonable use-case for such kind of behaviour.
However, I have some use-case for cycling user-defined property drawers.

In some of my entries, I have long tables storing historical data.
These tables tend to be extremely long and I sometimes hide them inside
a drawer. Opening these drawers (or a customised list of drawers) on
<TAB> would actually make sense for me. 


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Ihor Radchenko <yantar92@gmail.com> writes:
>
>>> Thanks Ihor, I indeed found related code in Org Mode source. I implemented a
>>> similar functionality in my patch.
>>
>> Oh. I somehow missed your first message...
>>
>> Now, actually adding something to the discussion.
>>
>> FYI, there is org-cycle-include-plain-lists variable. If it is set to
>> 'integrate, plain lists will be included into cycling with point at
>> headline. This is against the logic that org-cycle only needs to be
>> dealing with headlines. So, I don't see your patch breaking the present
>> conventions in org.
>
> Yes, this `integrate' value is not great, IMO. However, plain lists have
> much more in common with headlines than with drawers.
>
> I still think basic cycling should not include drawers whatsoever. This
> is even more true for properties drawers.
>
> Note that you can already display drawers with `org-cycle', using three
> prefix arguments.
>
> Regards,
>
> -- 
> Nicolas Goaziou

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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-13 20:00           ` Nicolas Goaziou
  2020-04-13 23:19             ` Tim Cross
  2020-04-14  3:18             ` Ihor Radchenko
@ 2020-04-14  5:21             ` stardiviner
  2020-04-14 12:55               ` Nicolas Goaziou
  2 siblings, 1 reply; 22+ messages in thread
From: stardiviner @ 2020-04-14  5:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Ihor Radchenko

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Ihor Radchenko <yantar92@gmail.com> writes:
>
>>> Thanks Ihor, I indeed found related code in Org Mode source. I implemented a
>>> similar functionality in my patch.
>>
>> Oh. I somehow missed your first message...
>>
>> Now, actually adding something to the discussion.
>>
>> FYI, there is org-cycle-include-plain-lists variable. If it is set to
>> 'integrate, plain lists will be included into cycling with point at
>> headline. This is against the logic that org-cycle only needs to be
>> dealing with headlines. So, I don't see your patch breaking the present
>> conventions in org.
>
> Yes, this `integrate' value is not great, IMO. However, plain lists have
> much more in common with headlines than with drawers.
>
> I still think basic cycling should not include drawers whatsoever. This
> is even more true for properties drawers.
>
> Note that you can already display drawers with `org-cycle', using three
> prefix arguments.

I agree. As I described in my given example "org-contacts", which include person
info in properties drawer. That's why I want to expand when I press "Tab" on
expanding headline. If I see a contact's info with "C-u C-u C-u Tab" is not
convenient.

As for this negation, I can accept.

Is it possible to change "org-cycle-hide-drawers" to "org-cycle-toggle-drawers".
Make it more extendable. Because that function only changed one argument of
"org-flag-drawer". If so some user like me will be easy to toggle hide/show
drawers. (Of course, I don't want to add redundant code in my Emacs init.) If
this is fine, I will re-edit my patch. Remove defcustom option, and hook on
cycle. Only keep changes in "org-cycle-hide-drawers".

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6VSEgUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsMFWAgAlhqnLF0PByf0k2Au3v7Ge4kj+BeF
U/S0XL+U3t8sjGSvXpR50AFEH9wPsp2Hr0yguJ2/WJDYDAO8dvzphcMgwP/q5EfZ
25hmKWQOP25rBMiHyXVcws6lVWLcsZ55l9k5ff/3mR2j5qV5dsA37G4gosbfTwMn
a29FXHyLBxMZMZgKGfK3cDY+W7F0tZ+XO4+E6TTZzu6OD8EmUwptbkmBd5XyiomQ
C7R1lBSR2xOYxFgdqy9sEp88lcRufN0tK3dun0hIotfabGq2HVv7lvsfD9DOC+IF
jaJKBzVzIAfvFCJVIUksW+DKvB4CiwL/Wm3NbzRaQmM4XZ66Emn1CaPYjQ==
=xMZt
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-14  5:21             ` stardiviner
@ 2020-04-14 12:55               ` Nicolas Goaziou
  2020-04-15  1:13                 ` stardiviner
  0 siblings, 1 reply; 22+ messages in thread
From: Nicolas Goaziou @ 2020-04-14 12:55 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-orgmode, Ihor Radchenko

Hello,

stardiviner <numbchild@gmail.com> writes:

> I agree. As I described in my given example "org-contacts", which include person
> info in properties drawer. That's why I want to expand when I press "Tab" on
> expanding headline. If I see a contact's info with "C-u C-u C-u Tab" is not
> convenient.

You can rebind it.

> Is it possible to change "org-cycle-hide-drawers" to "org-cycle-toggle-drawers".
> Make it more extendable. Because that function only changed one argument of
> "org-flag-drawer". If so some user like me will be easy to toggle hide/show
> drawers. (Of course, I don't want to add redundant code in my Emacs init.) If
> this is fine, I will re-edit my patch. Remove defcustom option, and hook on
> cycle. Only keep changes in "org-cycle-hide-drawers".

I think something is wrong with `org-cycle-hide-drawers' at the moment.
This function was initially meant to be added to `org-cycle-hook' to
re-hide drawers. It should only re-hide properties drawers. In any case,
it is not needed to expand this function, it should be trimmed down to
only take care of property drawers.

What is needed, though, it a tooling similar to block visibility
functions, i.e., `org-hide-block-toggle', `org-hide-block-hall', and,
maybe, `org-hide-block-toggle-maybe'. Regular drawers should get the
same treatment as blocks.

If you look at `org-cycle' code, there is a comment

     ;; Drawers: delegate to `org-flag-drawer'.

This part should be extracted into a new function.

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-14  3:18             ` Ihor Radchenko
@ 2020-04-14 12:58               ` Nicolas Goaziou
  2020-04-14 13:57                 ` Ihor Radchenko
  0 siblings, 1 reply; 22+ messages in thread
From: Nicolas Goaziou @ 2020-04-14 12:58 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hello,

Ihor Radchenko <yantar92@gmail.com> writes:

> In some of my entries, I have long tables storing historical data.
> These tables tend to be extremely long and I sometimes hide them inside
> a drawer. Opening these drawers (or a customised list of drawers) on
> <TAB> would actually make sense for me. 

It makes sense if point is on the drawer, and Org does this already.

If point is on a headline, possibly a zillion lines above, it doesn't,
at least not as a common operation.

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-14 12:58               ` Nicolas Goaziou
@ 2020-04-14 13:57                 ` Ihor Radchenko
  0 siblings, 0 replies; 22+ messages in thread
From: Ihor Radchenko @ 2020-04-14 13:57 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

> It makes sense if point is on the drawer, and Org does this already.
>
> If point is on a headline, possibly a zillion lines above, it doesn't,
> at least not as a common operation.

Well. It's hard to judge for me if my use case is common or not. Since
there are no many other replies in the thread, I have to agree that it
is indeed uncommon. 

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> In some of my entries, I have long tables storing historical data.
>> These tables tend to be extremely long and I sometimes hide them inside
>> a drawer. Opening these drawers (or a customised list of drawers) on
>> <TAB> would actually make sense for me. 
>
> It makes sense if point is on the drawer, and Org does this already.
>
> If point is on a headline, possibly a zillion lines above, it doesn't,
> at least not as a common operation.
>
> Regards,
>
> -- 
> Nicolas Goaziou


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-14 12:55               ` Nicolas Goaziou
@ 2020-04-15  1:13                 ` stardiviner
  2020-04-18 17:48                   ` Nicolas Goaziou
  0 siblings, 1 reply; 22+ messages in thread
From: stardiviner @ 2020-04-15  1:13 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Ihor Radchenko

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> I agree. As I described in my given example "org-contacts", which include person
>> info in properties drawer. That's why I want to expand when I press "Tab" on
>> expanding headline. If I see a contact's info with "C-u C-u C-u Tab" is not
>> convenient.
>
> You can rebind it.
>
>> Is it possible to change "org-cycle-hide-drawers" to "org-cycle-toggle-drawers".
>> Make it more extendable. Because that function only changed one argument of
>> "org-flag-drawer". If so some user like me will be easy to toggle hide/show
>> drawers. (Of course, I don't want to add redundant code in my Emacs init.) If
>> this is fine, I will re-edit my patch. Remove defcustom option, and hook on
>> cycle. Only keep changes in "org-cycle-hide-drawers".
>
> I think something is wrong with `org-cycle-hide-drawers' at the moment.
> This function was initially meant to be added to `org-cycle-hook' to
> re-hide drawers. It should only re-hide properties drawers. In any case,
> it is not needed to expand this function, it should be trimmed down to
> only take care of property drawers.
>
> What is needed, though, it a tooling similar to block visibility
> functions, i.e., `org-hide-block-toggle', `org-hide-block-hall', and,
> maybe, `org-hide-block-toggle-maybe'. Regular drawers should get the
> same treatment as blocks.
>
> If you look at `org-cycle' code, there is a comment
>
>      ;; Drawers: delegate to `org-flag-drawer'.
>
> This part should be extracted into a new function.

This sounds reasonable. (I deleted my patch on my local fork, I think your solution is better.)

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6WX64UHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsMKJggAzKm3lD0NTcG4eak7khuzw5bbt9W6
MNi8kkK61LWaPfW+BgCGxJz+RAYnKnPca7JDZ15xEwcVc1/UIFZ4bFTmeH25/yjp
49KsTVR4E8mgueAgm+Js1uNTj2GUXhvBpiu8RjPe6578GHzopLUbBgvTgPtZVswa
A9Mr3ecu3lFMja3KfjoB73w3sa6UncwQ3zqhiV6zqVFAcrO02YYfgLAFhmYjKQ5h
b5hkdxliZsL6H6kgLG7TQFwu1S1vpgGZNaZvz6sS9h3PO3UwglbCGxWo8EFsYHiz
+YFJMw3FcGxdXygp9l+ypG1Zhpwr7arZE8Zuq4ypduxmjWkUyOG7O6dbdA==
=haRH
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [SOLUTION] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-11  8:43 [PATCH] Show hidden drawers when org-cycle on headlines stardiviner
  2020-04-11 16:05 ` Nicolas Goaziou
  2020-04-13 20:52 ` Samuel Wales
@ 2020-04-15  1:26 ` stardiviner
  2 siblings, 0 replies; 22+ messages in thread
From: stardiviner @ 2020-04-15  1:26 UTC (permalink / raw)
  To: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


stardiviner <numbchild@gmail.com> writes:

> I think the hidden drawers info is useful for users, this should be
> shown when org-cycle on headlines.
>
> Here is the patch.

I found another solution:

Add file-local variable to eval to the Contacts.org file:

#+begin_src org
# Local Variables:
# eval: (let ((current-prefix-arg '(64))) (call-interactively 'org-cycle))
# End:
#+end_src

This is just a workaround. Not very close to my requirement which expand drawers
when press Tab on a single headline. Because this situation only need in
org-contacts or similar things. So I use file-local variables to do it. Maybe I
can define buffer local keybindings to do it better.

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6WYtQUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsPN1Qf+KK2RBmwTrFrvmb16EMEWlUQ3MyRG
jwNu59lfvWHYe9tp3a8UeXvAht5pFfSNF5CNsf4ueh1FSyUd5RSsF/L7QFovqMVb
wAmT+mYEP/OacKPxfRHdIWjUz7ZlsFj34vK8362D3PQcsXheNCjiMPnzOte86xH/
ZRhcd5+U4gk+0ySa1tj/CBBTWfBgn2tNTVrBoqPlBuG6aWOnMlor+v4rx5nLgfaa
ZOOnhqS4M223rzMKL5V4M+UcY/+lD9giGYr8g97degbrJqVpRD7FYJ2T5A1atbDc
WCE3dA7i0rxBhit/r2ytvPEMj7Kp/VJla+VddvEvCf2xrIAYye0Uj8hfqw==
=wGia
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-15  1:13                 ` stardiviner
@ 2020-04-18 17:48                   ` Nicolas Goaziou
  2020-04-19  9:10                     ` stardiviner
  0 siblings, 1 reply; 22+ messages in thread
From: Nicolas Goaziou @ 2020-04-18 17:48 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-orgmode, Ihor Radchenko

Hello,

stardiviner <numbchild@gmail.com> writes:

> This sounds reasonable. (I deleted my patch on my local fork, I think your solution is better.)

I pushed the changes. Now drawers folding is on par with blocks. You can
hide or show a drawer with `org-hide-drawer-toggle', which is similar to
`org-hide-block-toggle'. You may want to use it.

Now, visibility behaviour of drawers might be discussed. Currently, all
drawers are "mostly folded", which means that Org tries to fold them
whenever it can. OTOH, blocks are "mostly expanded", i.e., most
operations of the structure of the document opens the blocks. An
alternative would be to have property drawers "mostly folded" and
regular drawers "mostly expanded", i.e., like regular blocks. But that
would partly defeat the "tuck stuff away" feature from drawers.

Another (better?) option would be: "don't mess with folding state" for
regular drawers and blocks, i.e., what is open stays open, what is
closed stays closed. But that's more difficult to achieve. Any taker?

In any case, I think property drawers need to be "mostly folded".

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-18 17:48                   ` Nicolas Goaziou
@ 2020-04-19  9:10                     ` stardiviner
  2020-04-19 10:31                       ` Nicolas Goaziou
  0 siblings, 1 reply; 22+ messages in thread
From: stardiviner @ 2020-04-19  9:10 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Ihor Radchenko

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> This sounds reasonable. (I deleted my patch on my local fork, I think your solution is better.)
>
> I pushed the changes. Now drawers folding is on par with blocks. You can
> hide or show a drawer with `org-hide-drawer-toggle', which is similar to
> `org-hide-block-toggle'. You may want to use it.

I today update Org Mode source code, found this change. Thanks for your work.

>
> Now, visibility behaviour of drawers might be discussed. Currently, all
> drawers are "mostly folded", which means that Org tries to fold them
> whenever it can. OTOH, blocks are "mostly expanded", i.e., most
> operations of the structure of the document opens the blocks. An
> alternative would be to have property drawers "mostly folded" and
> regular drawers "mostly expanded", i.e., like regular blocks. But that
> would partly defeat the "tuck stuff away" feature from drawers.

I thought intuitively that property drawers "mostly expanded" and regular
drawers like :LOGBOOK: drawer "mostly folded".

>
> Another (better?) option would be: "don't mess with folding state" for
> regular drawers and blocks, i.e., what is open stays open, what is
> closed stays closed. But that's more difficult to achieve. Any taker?

This indeed will be more difficult. I agree. It's not worth to be more complicated.

>
> In any case, I think property drawers need to be "mostly folded".

In my opinion, this design is decided by the usage of properties drawers and
other regular drawers. For now, I only used this two drawers.

For properties drawer, I use them to store meta data. Like org-contacts info,
and URL, Git path, Magit revision link, Author, Email, IMDb, DATE, TIME,
CUSTOM_ID etc. I record those info for review in case of I want to know related
info about current headline's content. For examples:

- - the "DATE" property :: I want to know when I record this headline and content.
- - the "AUTHOR", "EMAIL" property :: I want to know the author name and email.
- - the "URL" property :: I might want to open it if I only record a part of original web page content.
- - the Magit revision link :: I might want to open it when I read the Org content.

About the "LOGBOOK" drawer, I usually record one log entry, or many log entries.
The log entry can be multiple lines, so I can be very long. This long drawer
"should be folder". Instead, the properties drawer is strict to one line as
value, It will not be very long, so should "keep it expanded". This is one
reason too.

I just checked out insert regular drawer keybinding [C-c C-x d]. I think this
should be hidden. Because it is user defined drawers, no one will know how long
it is, and what purpose it is used for. And it's format similar with LOGBOOK.
Not like properties drawer which has property key and value.

On the other side, this properties drawer might be used by some Org related
extensions, like org-contacts, org-drill etc. For org-contacts, the properties
drawer should be expanded, for org-drill, this properties drawer should be
hidden.

At the end, I know this is just my usage experience, this should consider most
Org user's habit of how to use those drawers.

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6cFXQUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsPCWgf9F0Za1sfg26LoCOH+gbHwlUEkCFKh
4Q6w8e1qb0Onwf7VP167WGq1ooQBkb2S4K/A8t+ZnepKjLasKM3j7x48Og4kAgCp
4aU3HN1q1z5dQKlcmPSFwTw4hmFXohQa/5+8nnKaPMZExuD427qdLtIRWKUiK7lO
vwI+E0oAGroVG+auUk/iH3hxKQrd4GCVIo93nVR7pG3agR+1Ql1acuVSXmFwqhUF
nO6qmiVzA2EWXaqtpWwQzagpc3hzRbqi3TP8yMaMM6nldyai5wsGFIl2LjDFF1Tk
rgE9diGs2ZX+wPS+H5A/Ty97EeigPI1PjchErneZQDnEfiuclezqnJhhTA==
=4m2J
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-19  9:10                     ` stardiviner
@ 2020-04-19 10:31                       ` Nicolas Goaziou
  2020-04-19 11:31                         ` stardiviner
  0 siblings, 1 reply; 22+ messages in thread
From: Nicolas Goaziou @ 2020-04-19 10:31 UTC (permalink / raw)
  To: stardiviner; +Cc: emacs-orgmode, Ihor Radchenko

Hello,

stardiviner <numbchild@gmail.com> writes:

> I thought intuitively that property drawers "mostly expanded" and regular
> drawers like :LOGBOOK: drawer "mostly folded".

There is no such thing as ":LOGBOOK:" drawers. There are property
drawers, and regular drawers. "LOGBOOK" belongs to the latter.

>> Another (better?) option would be: "don't mess with folding state" for
>> regular drawers and blocks, i.e., what is open stays open, what is
>> closed stays closed. But that's more difficult to achieve. Any taker?
>
> This indeed will be more difficult. I agree. It's not worth to be more
> complicated.

I think it is worth it, because it is a sane way to handle different
needs.

>> In any case, I think property drawers need to be "mostly folded".
>
> In my opinion, this design is decided by the usage of properties drawers and
> other regular drawers. For now, I only used this two drawers.

Property drawers are _internal_ to Org, which means the contents are to
be hidden. You can use property drawers, but think of them as
a database. Seeing the guts of a database is hardly useful. However, Org
provides tooling to read and write it, and even display it (e.g., Org
Colview) without having to expand them.

You may want to expand them to edit them, or simply retrieve
information, it is all text after all, but that's not the intended use
case, so there is no incentive to expand them automatically.


Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [SOLVED] Re: [PATCH] Show hidden drawers when org-cycle on headlines
  2020-04-19 10:31                       ` Nicolas Goaziou
@ 2020-04-19 11:31                         ` stardiviner
  0 siblings, 0 replies; 22+ messages in thread
From: stardiviner @ 2020-04-19 11:31 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Ihor Radchenko

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> I thought intuitively that property drawers "mostly expanded" and regular
>> drawers like :LOGBOOK: drawer "mostly folded".
>
> There is no such thing as ":LOGBOOK:" drawers. There are property
> drawers, and regular drawers. "LOGBOOK" belongs to the latter.
>
>>> Another (better?) option would be: "don't mess with folding state" for
>>> regular drawers and blocks, i.e., what is open stays open, what is
>>> closed stays closed. But that's more difficult to achieve. Any taker?
>>
>> This indeed will be more difficult. I agree. It's not worth to be more
>> complicated.
>
> I think it is worth it, because it is a sane way to handle different
> needs.

That's will be great.

>
>>> In any case, I think property drawers need to be "mostly folded".
>>
>> In my opinion, this design is decided by the usage of properties drawers and
>> other regular drawers. For now, I only used this two drawers.
>
> Property drawers are _internal_ to Org, which means the contents are to
> be hidden. You can use property drawers, but think of them as
> a database. Seeing the guts of a database is hardly useful. However, Org
> provides tooling to read and write it, and even display it (e.g., Org
> Colview) without having to expand them.

Yes, I use it as a very tiny database. :)

> You may want to expand them to edit them, or simply retrieve
> information, it is all text after all, but that's not the intended use
> case, so there is no incentive to expand them automatically.

Sure. I have already got the new added functions. I can define a custom advice
on my own Emacs init file.

Thanks, Nicolas.

- -- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6cNqkUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNpcAf9FnINJuSxq5JFcBiSHzQDuZe0oZfz
l6wd/rqRg7HpyVi/YJaUrQp+L+8md/YQpK+pt4+YIVWjK8Z6wpBvY0DCCtysiI2w
0MlJD7lq5Yuet+l0JsIN2lBApVaiVXaN61T2/mVdBQrTIw0mQVqiwMb8nUrBEi8q
kA7UdTuwdAiP/uwtC22+lG0lRvxYfCwfulCA+zemLNvnmN5xBJwdXN9O/pdDeAcS
nA0dQZYp/udkQ5EZcmkjFLRRBElCdxUqwYjiztWTuA+klGgKVzNQYo9H0mwsMo4P
uyG7JnP+I8pnH43UeSMNmFiQdpM7k3fJT2xUAbkoP97ol5QVLB2e51cOCg==
=02DA
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-04-19 11:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-11  8:43 [PATCH] Show hidden drawers when org-cycle on headlines stardiviner
2020-04-11 16:05 ` Nicolas Goaziou
2020-04-13  3:29   ` stardiviner
2020-04-13  8:06     ` Nicolas Goaziou
2020-04-13 16:28       ` stardiviner
2020-04-13  9:12     ` Ihor Radchenko
2020-04-13 16:31       ` [SOLVED] " stardiviner
2020-04-13 16:58         ` Ihor Radchenko
2020-04-13 20:00           ` Nicolas Goaziou
2020-04-13 23:19             ` Tim Cross
2020-04-14  3:18             ` Ihor Radchenko
2020-04-14 12:58               ` Nicolas Goaziou
2020-04-14 13:57                 ` Ihor Radchenko
2020-04-14  5:21             ` stardiviner
2020-04-14 12:55               ` Nicolas Goaziou
2020-04-15  1:13                 ` stardiviner
2020-04-18 17:48                   ` Nicolas Goaziou
2020-04-19  9:10                     ` stardiviner
2020-04-19 10:31                       ` Nicolas Goaziou
2020-04-19 11:31                         ` stardiviner
2020-04-13 20:52 ` Samuel Wales
2020-04-15  1:26 ` [SOLUTION] " stardiviner

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