Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-05-01 Thread Philipp Kiefer

I see. Thank you for your very helpful reply!

On 01.05.2023 20:45, Ihor Radchenko wrote:

Philipp Kiefer  writes:


Do I understand you correctly that you mean tab should cycle visibility
in this case?

* headline
some text
CURSOR IS HERE
- a list

Yes, I suggested that in those cases, org-cycle should fold the subtree
point is in, i. e. fold up to the next parent heading above.

To get this, just customize `org-cycle-emulate-tab' to nil.


Hm, for me, TAB does not currently seem to do any indenting anywhere in
an Org file.

It just means that  is not configured to do anything in your Emacs.
By default, the Org's fallback is `org-cycle-emulate-tab' or whatever
global  is bound to.


If people use tab for indentation in Org out of the box when not on
headings (which it has never done for me, I think), my suggestion would
indeed be moot.

 does a lot of staff. Just read through `org-cycle' docstring.


Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-05-01 Thread Ihor Radchenko
Philipp Kiefer  writes:

>> Do I understand you correctly that you mean tab should cycle visibility
>> in this case?
>>
>> * headline
>> some text
>> CURSOR IS HERE
>> - a list
> Yes, I suggested that in those cases, org-cycle should fold the subtree 
> point is in, i. e. fold up to the next parent heading above.

To get this, just customize `org-cycle-emulate-tab' to nil.

> Hm, for me, TAB does not currently seem to do any indenting anywhere in 
> an Org file.

It just means that  is not configured to do anything in your Emacs.
By default, the Org's fallback is `org-cycle-emulate-tab' or whatever
global  is bound to.

> If people use tab for indentation in Org out of the box when not on 
> headings (which it has never done for me, I think), my suggestion would 
> indeed be moot.

 does a lot of staff. Just read through `org-cycle' docstring.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-04-30 Thread Philipp Kiefer



On 28.04.2023 19:41, Dr. Arne Babenhauserheide wrote:

Philipp Kiefer  writes:

My suggestion was aimed at improving the out-of-the-box experience of (new) Org 
users by extending the usefulness of 'org-cycle' by
folding the subtree at point from anywhere inside it that is not itself a 
parent item rather than doing nothing at all in those positions.
I've used two flavours of dedicated outlining software for many years and both 
have easy shortcuts to fold the current subtree from
any position - it is a frequently used action.

Do I understand you correctly that you mean tab should cycle visibility
in this case?

* headline
some text
CURSOR IS HERE
- a list
Yes, I suggested that in those cases, org-cycle should fold the subtree 
point is in, i. e. fold up to the next parent heading above.

For me tab is useful as it is, because it indents whatever I am writing
right now.

That could be a list-item or a source-block or a verse.

Org is not just for outlining but also for full-blown writing, and that
would be disrupted if tab were to fold the entry away that I’m currently
writing in.


Hm, for me, TAB does not currently seem to do any indenting anywhere in 
an Org file. Have you changed anything from the default configuration? 
Or maybe I did and forgot about it... But I can find any reference to / 
binding for unmodified tab in my init.el. If so, is this indenting 
handled by 'org-cycle' or is the binding of Tab to 'org-cycle' somehow 
selective based on where in an Org file point is positioned?


If people use tab for indentation in Org out of the box when not on 
headings (which it has never done for me, I think), my suggestion would 
indeed be moot.



That said: C-c C-t or M-x outline-hide-body


I tried out this command, but it does not do what I have in mind 
(folding subtrees from a non-parent position, not hiding non-heading text).


If tab really does indent in Org files in the default configuration when 
not on a heading, I'd limit my suggestion to the following:


Make 'org-fold-hide-subtree' and / or 'outline-hide-subtree' work from 
anywhere inside a subtree that is not itself a parent heading - not just 
when positioned on the parent heading of the subtree point is in.


Best,

Philipp




Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-04-28 Thread Dr. Arne Babenhauserheide

Esteban Ordóñez  writes:

> Hello Doctor.
>
>> That said: C-c C-t or M-x outline-hide-body
>
> C-c C-t
> is org-todo, not outline-hide-body.

I guess I customized that …

> Thanks for the clarification.

Glad to :-)

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-04-28 Thread Esteban Ordóñez
Hello Doctor.

> That said: C-c C-t or M-x outline-hide-body

C-c C-t
is org-todo, not outline-hide-body.

Thanks for the clarification.



Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-04-28 Thread Dr. Arne Babenhauserheide

Philipp Kiefer  writes:

> Thanks, Eric, I am aware of customization options.
>
> My suggestion was aimed at improving the out-of-the-box experience of (new) 
> Org users by extending the usefulness of 'org-cycle' by
> folding the subtree at point from anywhere inside it that is not itself a 
> parent item rather than doing nothing at all in those positions.
> I've used two flavours of dedicated outlining software for many years and 
> both have easy shortcuts to fold the current subtree from
> any position - it is a frequently used action.

Do I understand you correctly that you mean tab should cycle visibility
in this case?

* headline
some text
CURSOR IS HERE
- a list

For me tab is useful as it is, because it indents whatever I am writing
right now.

That could be a list-item or a source-block or a verse.

Org is not just for outlining but also for full-blown writing, and that
would be disrupted if tab were to fold the entry away that I’m currently
writing in.

That said: C-c C-t or M-x outline-hide-body

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-04-28 Thread Philipp Kiefer
Thanks, Eric, I am aware of customization options.

My suggestion was aimed at improving the out-of-the-box experience of (new)
Org users by extending the usefulness of 'org-cycle' by folding the subtree
at point from anywhere inside it that is not itself a parent item rather
than doing nothing at all in those positions. I've used two flavours of
dedicated outlining software for many years and both have easy shortcuts to
fold the current subtree from any position - it is a frequently used action.



Fraga, Eric  schrieb am Fr., 28. Apr. 2023, 11:45:

> Hi Philipp,
>
> On Friday, 28 Apr 2023 at 10:49, Philipp Kiefer wrote:
> > Well, it could simplify things a good deal further if, on issuing the
> > command when point is *not* on a parent heading, (non-global)
> > org-cycle would instead fold the subtree that point is in, i. e. do
> > 'outline-up-heading' and 'hide-subtree' on the parent heading.
>
> You could always bind TAB to your own command that does this.  As an
> illustration, I have TAB bound to my own function that invokes
> completion instead unless I'm on an org heading!
>
> --8<---cut here---start->8---
> (defun esf/complete-or-indent ()
>   (interactive)
>   (cond
>;; ((eq 'message-mode major-mode)
>;;  (message-tab))
>((and (eq 'message-mode major-mode)
>  (message-point-in-header-p)
>  (looking-back "^\\(To\\|B?[Cc]c\\): *.*"
> (line-beginning-position)))
> (if (looking-back " ")
> (progn
>   (message "try inserting alias abbrev")
>   (insert (symbol-value (intern-soft (completing-read "Expand
> alias: " mail-abbrevs nil t) mail-abbrevs
>   (progn
> (message "try eudc")
> (eudc-expand-try-all
>((eq 'message-mode major-mode)
> (completion-at-point))
>((org-table-p)
> (org-cycle))
>((looking-back "[ \t\n]")
> (if (eq 'org-mode major-mode)
> (if (looking-back "^\\(\\*+ \\| *|\\)[^\\n]*") ;a heading or
> table line
> (org-cycle)
>   (indent-for-tab-command)
>   )
>   (indent-for-tab-command))
> )
>(t
> ;;(consult-company)
> (completion-at-point)
> )))
> --8<---cut here---end--->8---
>
> You could use a similar (and much simpler) approach to get what you
> want.
>
> HTH,
> eric
>
> --
> : Eric S Fraga, with org release_9.6.4-335-ge065b5 in Emacs 30.0.50


Re: Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-04-28 Thread Fraga, Eric
Hi Philipp,

On Friday, 28 Apr 2023 at 10:49, Philipp Kiefer wrote:
> Well, it could simplify things a good deal further if, on issuing the
> command when point is *not* on a parent heading, (non-global)
> org-cycle would instead fold the subtree that point is in, i. e. do
> 'outline-up-heading' and 'hide-subtree' on the parent heading. 

You could always bind TAB to your own command that does this.  As an
illustration, I have TAB bound to my own function that invokes
completion instead unless I'm on an org heading!

--8<---cut here---start->8---
(defun esf/complete-or-indent ()
  (interactive)
  (cond
   ;; ((eq 'message-mode major-mode)
   ;;  (message-tab))
   ((and (eq 'message-mode major-mode)
 (message-point-in-header-p)
 (looking-back "^\\(To\\|B?[Cc]c\\): *.*" (line-beginning-position))) 
(if (looking-back " ")
(progn
  (message "try inserting alias abbrev")
  (insert (symbol-value (intern-soft (completing-read "Expand alias: " 
mail-abbrevs nil t) mail-abbrevs
  (progn
(message "try eudc")
(eudc-expand-try-all
   ((eq 'message-mode major-mode)
(completion-at-point))
   ((org-table-p)
(org-cycle))
   ((looking-back "[ \t\n]")
(if (eq 'org-mode major-mode)
(if (looking-back "^\\(\\*+ \\| *|\\)[^\\n]*") ;a heading or table 
line
(org-cycle)
  (indent-for-tab-command)
  )
  (indent-for-tab-command))
)
   (t
;;(consult-company)
(completion-at-point)
)))
--8<---cut here---end--->8---

You could use a similar (and much simpler) approach to get what you
want.

HTH,
eric

-- 
: Eric S Fraga, with org release_9.6.4-335-ge065b5 in Emacs 30.0.50


Suggestion to increase usefulness of TAB key / 'org-cycle' function

2023-04-28 Thread Philipp Kiefer
To quote from the Org Manual:
"Org greatly simplifies the use of outlines by compressing the entire show
and hide functionalities into a single command, org-cycle, which is bound
to the TAB key."

Well, it could simplify things a good deal further if, on issuing the
command when point is *not* on a parent heading, (non-global) org-cycle
would instead fold the subtree that point is in, i. e. do
'outline-up-heading' and 'hide-subtree' on the parent heading. This would
make collapsing subtrees a lot easier and quicker as it could be done from
any non-parent position inside a tree. It is very noticeable when
collapsing multiple adjacent trees in succession.

Currently, hitting TAB when not on a parent heading merely returns an
'EMPTY ENTRY' message - not useful at all. 'Outline-up-heading' (C-c C-u)
has to be called manually each time before hitting TAB to achieve what the
user is most likely attempting to do anyway.

Personally, I doubt this change in behaviour would break much for users,
unless one were to assume that there is a lot of Elisp code out there that
relies on 'org-cycle' doing nothing in such cases, incurring the 'EMPTY
ENTRY' reprimand to boot, rather than first checking whether point is on a
parent heading. I don't see any drawbacks when 'org-cycle' is used
interactively.