Re: [O] Copy/Search Outline
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
Re: [O] Copy/Search Outline
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
Re: [O] Copy/Search Outline
Christian Moe m...@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
Re: [O] Copy/Search Outline
On Jul 26, 2011, at 11:30 AM, Florian Beck wrote: Christian Moe m...@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
Re: [O] Copy/Search Outline
On Jul 26, 2011, at 11:54 AM, Carsten Dominik wrote: On Jul 26, 2011, at 11:30 AM, Florian Beck wrote: Christian Moe m...@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
Re: [O] Copy/Search Outline
Carsten Dominik carsten.domi...@gmail.com writes: 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. Great, thanks to both of you! -- Bastien
Re: [O] Copy/Search Outline
I post a howto over my morning coffee at 8:38am. By 11:30am, Florian has encapsulated it into a neat function with added goodies. Within 40 minutes, Carsten reports there is a key (C-c C-x v) and a menu entry, and documentation in manual and refcard for it. Gotta love this community. Yours, Christian
Re: [O] Copy/Search Outline
Hi Florian, Florian Beck abstrakt...@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
[O] Copy/Search Outline
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