emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-hide-entry
@ 2010-10-14 19:04 Andreas Röhler
  2010-10-15  6:25 ` org-hide-entry Noorul Islam K M
  2010-10-15  7:47 ` org-hide-entry Carsten Dominik
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Röhler @ 2010-10-14 19:04 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi.

as org-mode knows a command `org-show-entry' looked for
`org-hide-entry', but couldn't get it.

So here it is.

Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
https://code.launchpad.net/s-x-emacs-werkstatt/


[-- Attachment #2: org-hide-entry.patch --]
[-- Type: text/x-patch, Size: 835 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index a80286f..df9ae99 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19391,6 +19391,24 @@ Stop at the first and last subheadings of a superior heading."
      (org-end-of-subtree t t))
    nil))
 
+(defun org-hide-entry ()
+  "Hide the body directly following this heading. "
+  (interactive)
+  (save-excursion
+    (condition-case nil
+	(progn
+	  (org-back-to-heading t)
+	  (outline-flag-region
+	   (max (point-min) (1- (point)))
+	   (save-excursion
+	     (if (re-search-forward
+		  (concat "[\r\n]\\(" outline-regexp "\\)") nil t)
+		 (1- (match-beginning 1))
+	       (point-max)))
+	   t)
+	  (org-cycle-hide-drawers 'children))
+      (error nil))))
+
 (defun org-show-entry ()
   "Show the body directly following this heading.
 Show the heading too, if it is currently invisible."

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-hide-entry
  2010-10-14 19:04 org-hide-entry Andreas Röhler
@ 2010-10-15  6:25 ` Noorul Islam K M
  2010-10-15 14:02   ` org-hide-entry Andreas Röhler
  2010-10-15  7:47 ` org-hide-entry Carsten Dominik
  1 sibling, 1 reply; 6+ messages in thread
From: Noorul Islam K M @ 2010-10-15  6:25 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-orgmode

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> Hi.
>
> as org-mode knows a command `org-show-entry' looked for
> `org-hide-entry', but couldn't get it.
>
> So here it is.
>
> Andreas
>
> --
> https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
>
>
> diff --git a/lisp/org.el b/lisp/org.el
> index a80286f..df9ae99 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -19391,6 +19391,24 @@ Stop at the first and last subheadings of a superior heading."
>       (org-end-of-subtree t t))
>     nil))
>  
> +(defun org-hide-entry ()
> +  "Hide the body directly following this heading. "
> +  (interactive)
> +  (save-excursion
> +    (condition-case nil
> +	(progn
> +	  (org-back-to-heading t)
> +	  (outline-flag-region
> +	   (max (point-min) (1- (point)))
> +	   (save-excursion
> +	     (if (re-search-forward
> +		  (concat "[\r\n]\\(" outline-regexp "\\)") nil t)
> +		 (1- (match-beginning 1))
> +	       (point-max)))
> +	   t)
> +	  (org-cycle-hide-drawers 'children))
> +      (error nil))))
> +
>  (defun org-show-entry ()
>    "Show the body directly following this heading.
>  Show the heading too, if it is currently invisible."

Are you going to use it in org-mode code base in future?

Thanks and Regards
Noorul

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

* Re: org-hide-entry
  2010-10-14 19:04 org-hide-entry Andreas Röhler
  2010-10-15  6:25 ` org-hide-entry Noorul Islam K M
@ 2010-10-15  7:47 ` Carsten Dominik
  2010-10-15 11:03   ` org-hide-entry Andreas Röhler
  1 sibling, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-10-15  7:47 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-orgmode


On Oct 14, 2010, at 9:04 PM, Andreas Röhler wrote:

> Hi.
>
> as org-mode knows a command `org-show-entry' looked for
> `org-hide-entry', but couldn't get it.
>
> So here it is.


This will leave the buffer in a pretty messy state.

It will hide a headline and the text below it, but not the subtree.   
The ellipsis will be on the text belonging to the entry before.

For example

* test
   aaa
** sub 1
    bbb
** sub2
    ccc

Call this command on sub one, and you get

* test
   aaa....
** sub2
    ccc


This is not good.  So I don't understand what this might be useful for.
Maybe there are outline-... commands which do what you really mean?

- Carsten

- Carsten

>
> Andreas
>
> --
> https://code.launchpad.net/~a-roehler/python-mode/python-mode- 
> components
> https://code.launchpad.net/s-x-emacs-werkstatt/
>
> <org-hide-entry.patch>_______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: org-hide-entry
  2010-10-15  7:47 ` org-hide-entry Carsten Dominik
@ 2010-10-15 11:03   ` Andreas Röhler
  2010-10-16  5:22     ` org-hide-entry Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2010-10-15 11:03 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

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

Am 15.10.2010 09:47, schrieb Carsten Dominik:
>
> On Oct 14, 2010, at 9:04 PM, Andreas Röhler wrote:
>
>> Hi.
>>
>> as org-mode knows a command `org-show-entry' looked for
>> `org-hide-entry', but couldn't get it.
>>
>> So here it is.
>
>
> This will leave the buffer in a pretty messy state.

Indeed, thanks. It's cured already.
Please try patch attached.

Andreas


>
> It will hide a headline and the text below it, but not the subtree. The
> ellipsis will be on the text belonging to the entry before.
>
> For example
>
> * test
> aaa
> ** sub 1
> bbb
> ** sub2
> ccc
>
> Call this command on sub one, and you get
>
> * test
> aaa....
> ** sub2
> ccc
>
>
> This is not good. So I don't understand what this might be useful for.
> Maybe there are outline-... commands which do what you really mean?
>
> - Carsten
>
> - Carsten
>
>>
>> Andreas
>>
>> --
>> https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
>> https://code.launchpad.net/s-x-emacs-werkstatt/
>>
>> <org-hide-entry.patch>_______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> - Carsten
>
>
>
>


[-- Attachment #2: 20101015_org-hide-entry.patch --]
[-- Type: text/x-patch, Size: 830 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index a80286f..7c589e6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19391,6 +19391,24 @@ Stop at the first and last subheadings of a superior heading."
      (org-end-of-subtree t t))
    nil))
 
+(defun org-hide-entry ()
+  "Hide the body directly following this heading. "
+  (interactive)
+  (save-excursion
+    (condition-case nil
+	(progn
+	  (org-back-to-heading t)
+	  (outline-flag-region
+	   (max (point-min) (point))
+	   (save-excursion
+	     (if (re-search-forward
+		  (concat "[\r\n]\\(" outline-regexp "\\)") nil t)
+		 (1- (match-beginning 1))
+	       (point-max)))
+	   t)
+	  (org-cycle-hide-drawers 'children))
+      (error nil))))
+
 (defun org-show-entry ()
   "Show the body directly following this heading.
 Show the heading too, if it is currently invisible."

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-hide-entry
  2010-10-15  6:25 ` org-hide-entry Noorul Islam K M
@ 2010-10-15 14:02   ` Andreas Röhler
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2010-10-15 14:02 UTC (permalink / raw)
  To: Noorul Islam K M; +Cc: emacs-orgmode

Am 15.10.2010 08:25, schrieb Noorul Islam K M:
> Andreas Röhler<andreas.roehler@easy-emacs.de>  writes:
>
>> Hi.
>>
>> as org-mode knows a command `org-show-entry' looked for
>> `org-hide-entry', but couldn't get it.
>>
>> So here it is.
>>
>> Andreas
>>
>> --
>> https://code.launchpad.net/~a-roehler/python-mode/python-mode-components
>>
>>
>> diff --git a/lisp/org.el b/lisp/org.el
>> index a80286f..df9ae99 100644
>> --- a/lisp/org.el
>> +++ b/lisp/org.el
>> @@ -19391,6 +19391,24 @@ Stop at the first and last subheadings of a superior heading."
>>        (org-end-of-subtree t t))
>>      nil))
>>
>> +(defun org-hide-entry ()
>> +  "Hide the body directly following this heading. "
>> +  (interactive)
>> +  (save-excursion
>> +    (condition-case nil
>> +	(progn
>> +	  (org-back-to-heading t)
>> +	  (outline-flag-region
>> +	   (max (point-min) (1- (point)))
>> +	   (save-excursion
>> +	     (if (re-search-forward
>> +		  (concat "[\r\n]\\(" outline-regexp "\\)") nil t)
>> +		 (1- (match-beginning 1))
>> +	       (point-max)))
>> +	   t)
>> +	  (org-cycle-hide-drawers 'children))
>> +      (error nil))))
>> +
>>   (defun org-show-entry ()
>>     "Show the body directly following this heading.
>>   Show the heading too, if it is currently invisible."
>
> Are you going to use it in org-mode code base in future?
>
> Thanks and Regards
> Noorul
>


Hi,

telling the future is hard.
Concerning the present state, I'd say programm should follow certain 
rules, meet expectations.

Which one is hard to say again. So it's rather my personal view: if a 
forward- function exists, I expect a backward-.

If hide-something exists I expect show-something.

And so on.

With Emacs in general it's better to expect the uncommon rather than the 
common, but why not have both?

Yours

Andreas

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

* Re: org-hide-entry
  2010-10-15 11:03   ` org-hide-entry Andreas Röhler
@ 2010-10-16  5:22     ` Carsten Dominik
  0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2010-10-16  5:22 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-orgmode


On Oct 15, 2010, at 1:03 PM, Andreas Röhler wrote:

> Am 15.10.2010 09:47, schrieb Carsten Dominik:
>>
>> On Oct 14, 2010, at 9:04 PM, Andreas Röhler wrote:
>>
>>> Hi.
>>>
>>> as org-mode knows a command `org-show-entry' looked for
>>> `org-hide-entry', but couldn't get it.
>>>
>>> So here it is.
>>
>>
>> This will leave the buffer in a pretty messy state.
>
> Indeed, thanks. It's cured already.
> Please try patch attached.

I still think this does something bad to the buffer.....

- Carsten

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

end of thread, other threads:[~2010-10-16  5:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-14 19:04 org-hide-entry Andreas Röhler
2010-10-15  6:25 ` org-hide-entry Noorul Islam K M
2010-10-15 14:02   ` org-hide-entry Andreas Röhler
2010-10-15  7:47 ` org-hide-entry Carsten Dominik
2010-10-15 11:03   ` org-hide-entry Andreas Röhler
2010-10-16  5:22     ` org-hide-entry Carsten Dominik

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