* Copy/Search Outline
@ 2011-07-22 20:20 Florian Beck
2011-07-26 0:53 ` Bastien
2011-07-26 6:35 ` Christian Moe
0 siblings, 2 replies; 9+ messages in thread
From: Florian Beck @ 2011-07-22 20:20 UTC (permalink / raw)
To: emacs-orgmode
Hi all,
when working with outlines (tabbing until CONTENTS), there are two
things I cannot figure out:
Firstly, I want to copy the *visible* text (minus the …, but never mind
that); secondly, I want to be able to search only the visible text.
More generally (and less org specific), how do I restrict commands to
the visible parts of the buffer?
TIA
--
Florian Beck
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Copy/Search Outline
2011-07-22 20:20 Copy/Search Outline Florian Beck
@ 2011-07-26 0:53 ` Bastien
2011-07-26 6:35 ` Christian Moe
1 sibling, 0 replies; 9+ messages in thread
From: Bastien @ 2011-07-26 0:53 UTC (permalink / raw)
To: Florian Beck; +Cc: emacs-orgmode
Hi Florian,
Florian Beck <abstraktion@t-online.de> writes:
> Firstly, I want to copy the *visible* text (minus the …, but never mind
> that); secondly, I want to be able to search only the visible text.
>
> More generally (and less org specific), how do I restrict commands to
> the visible parts of the buffer?
Sorry to drop the question like this, but IMHO this is more a request
for Emacs hackers than for Orgers. Could you keep us posted about any
answer you get?
Thanks!
--
Bastien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Copy/Search Outline
2011-07-22 20:20 Copy/Search Outline Florian Beck
2011-07-26 0:53 ` Bastien
@ 2011-07-26 6:35 ` Christian Moe
2011-07-26 6:38 ` Christian Moe
2011-07-26 9:30 ` Florian Beck
1 sibling, 2 replies; 9+ messages in thread
From: Christian Moe @ 2011-07-26 6:35 UTC (permalink / raw)
To: Florian Beck; +Cc: emacs-orgmode
On 7/22/11 10:20 PM, Florian Beck wrote:
> Hi all,
>
> when working with outlines (tabbing until CONTENTS), there are two
> things I cannot figure out:
>
> Firstly, I want to copy the *visible* text (minus the …, but never mind
> that);
C-c C-e v [SPACE]
C-x h M-w
C-x k
In other words: Begin exporting only the visible part with `C-c C-e
v', then press space at the prompt for output formats. This leaves you
in a second buffer with a copy of the visible part (and yes, you do
get rid of the ellipses). Then select all with `C-c h' (alternately,
select the region of your choice) and copy. Kill the copy buffer when
you're done with it.
You may want to record a keyboard macro if you need this often.
> secondly, I want to be able to search only the visible text.
You can do that, albeit only in a copy of your document in a separate
buffer, with the approach above. But why would you want to? Perhaps if
you state a use case, someone can point out a different approach.
> More generally (and less org specific), how do I restrict commands to
> the visible parts of the buffer?
I don't know.
Yours,
Christian
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Copy/Search Outline
2011-07-26 6:35 ` Christian Moe
@ 2011-07-26 6:38 ` Christian Moe
2011-07-26 9:30 ` Florian Beck
1 sibling, 0 replies; 9+ messages in thread
From: Christian Moe @ 2011-07-26 6:38 UTC (permalink / raw)
Cc: emacs-orgmode, Florian Beck
On 7/26/11 8:35 AM, Christian Moe wrote:
> Then select all with `C-c h' (alternately,
Typo, sorry. I meant `C-x h'.
cm
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Copy/Search Outline
2011-07-26 6:35 ` Christian Moe
2011-07-26 6:38 ` Christian Moe
@ 2011-07-26 9:30 ` Florian Beck
2011-07-26 9:54 ` Carsten Dominik
1 sibling, 1 reply; 9+ messages in thread
From: Florian Beck @ 2011-07-26 9:30 UTC (permalink / raw)
To: mail; +Cc: emacs-orgmode, Florian Beck
Christian Moe <mail@christianmoe.com> writes:
>> Firstly, I want to copy the *visible* text (minus the …, but never mind
>> that);
> In other words: Begin exporting only the visible part with `C-c C-e
> v', then press space at the prompt for output formats. This leaves you
> in a second buffer with a copy of the visible part (and yes, you do
> get rid of the ellipses). Then select all with `C-c h' (alternately,
> select the region of your choice) and copy. Kill the copy buffer when
> you're done with it.
Thanks. Seems like `org-export-visible' does exactly what I want.
I also wrote a function to copy the visible part of the region. For
those curious:
(defun copy-visible (beg end)
(interactive "r")
(let ((text "") s)
(save-excursion
(save-restriction
(narrow-to-region beg end)
(setq s (goto-char (point-min)))
(while (not (= (point) (point-max)))
(goto-char (org-find-invisible))
(setq text (concat text (buffer-substring s (point))))
(setq s (goto-char (org-find-visible))))))
(kill-new text)))
>> secondly, I want to be able to search only the visible text.
>
> You can do that, albeit only in a copy of your document in a separate
> buffer, with the approach above. But why would you want to? Perhaps if
> you state a use case, someone can point out a different approach.
Actually (as I just found out) you can do it very easily by setting the
variable `search-invisible' no nil (found in isearch.el).
>
>> More generally (and less org specific), how do I restrict commands to
>> the visible parts of the buffer?
>
> I don't know.
I guess it's not possible because commands work on the buffer and
usually do not know about viviblity. Maybe something like
`with-visible-buffer' could be proposed – but now with searching and
copying working, I do not really have a use case.
Thanks again.
--
Florian Beck
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Copy/Search Outline
2011-07-26 9:30 ` Florian Beck
@ 2011-07-26 9:54 ` Carsten Dominik
2011-07-26 10:10 ` Carsten Dominik
0 siblings, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2011-07-26 9:54 UTC (permalink / raw)
To: Florian Beck; +Cc: emacs-orgmode, mail
On Jul 26, 2011, at 11:30 AM, Florian Beck wrote:
> Christian Moe <mail@christianmoe.com> writes:
>
>>> Firstly, I want to copy the *visible* text (minus the …, but never mind
>>> that);
>
>> In other words: Begin exporting only the visible part with `C-c C-e
>> v', then press space at the prompt for output formats. This leaves you
>> in a second buffer with a copy of the visible part (and yes, you do
>> get rid of the ellipses). Then select all with `C-c h' (alternately,
>> select the region of your choice) and copy. Kill the copy buffer when
>> you're done with it.
>
> Thanks. Seems like `org-export-visible' does exactly what I want.
>
> I also wrote a function to copy the visible part of the region. For
> those curious:
>
> (defun copy-visible (beg end)
> (interactive "r")
> (let ((text "") s)
> (save-excursion
> (save-restriction
> (narrow-to-region beg end)
> (setq s (goto-char (point-min)))
> (while (not (= (point) (point-max)))
> (goto-char (org-find-invisible))
> (setq text (concat text (buffer-substring s (point))))
> (setq s (goto-char (org-find-visible))))))
> (kill-new text)))
This is a very useful function, thanks! I have added it
to org-mode as `org-copy-visible', currently without a key
binding.
To speed it up a bit, you made it collect the snippets into
a list and then do the concat in one sweep - this might make a
difference for large buffers.
Cheers
- Carsten
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Copy/Search Outline
2011-07-26 9:54 ` Carsten Dominik
@ 2011-07-26 10:10 ` Carsten Dominik
2011-07-26 10:56 ` Bastien
0 siblings, 1 reply; 9+ messages in thread
From: Carsten Dominik @ 2011-07-26 10:10 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode, Florian Beck, mail
On Jul 26, 2011, at 11:54 AM, Carsten Dominik wrote:
>
> On Jul 26, 2011, at 11:30 AM, Florian Beck wrote:
>
>> Christian Moe <mail@christianmoe.com> writes:
>>
>>>> Firstly, I want to copy the *visible* text (minus the …, but never mind
>>>> that);
>>
>>> In other words: Begin exporting only the visible part with `C-c C-e
>>> v', then press space at the prompt for output formats. This leaves you
>>> in a second buffer with a copy of the visible part (and yes, you do
>>> get rid of the ellipses). Then select all with `C-c h' (alternately,
>>> select the region of your choice) and copy. Kill the copy buffer when
>>> you're done with it.
>>
>> Thanks. Seems like `org-export-visible' does exactly what I want.
>>
>> I also wrote a function to copy the visible part of the region. For
>> those curious:
>>
>> (defun copy-visible (beg end)
>> (interactive "r")
>> (let ((text "") s)
>> (save-excursion
>> (save-restriction
>> (narrow-to-region beg end)
>> (setq s (goto-char (point-min)))
>> (while (not (= (point) (point-max)))
>> (goto-char (org-find-invisible))
>> (setq text (concat text (buffer-substring s (point))))
>> (setq s (goto-char (org-find-visible))))))
>> (kill-new text)))
>
> This is a very useful function, thanks! I have added it
> to org-mode as `org-copy-visible', currently without a key
> binding.
Ando now there is a key (C-c C-x v) and a menu entry,
and documentation in manual and refcard for it.
Thanks again.
- Carsten
>
> To speed it up a bit, you made it collect the snippets into
> a list and then do the concat in one sweep - this might make a
> difference for large buffers.
>
> Cheers
>
> - Carsten
- Carsten
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-07-26 18:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-22 20:20 Copy/Search Outline Florian Beck
2011-07-26 0:53 ` Bastien
2011-07-26 6:35 ` Christian Moe
2011-07-26 6:38 ` Christian Moe
2011-07-26 9:30 ` Florian Beck
2011-07-26 9:54 ` Carsten Dominik
2011-07-26 10:10 ` Carsten Dominik
2011-07-26 10:56 ` Bastien
2011-07-26 18:54 ` Christian Moe
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).