From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Copy/Search Outline Date: Tue, 26 Jul 2011 11:54:41 +0200 Message-ID: <7123590C-F698-47FD-997E-CC7DEE3F7170@gmail.com> References: <87d3h2xe2t.fsf@sophokles.streitblatt.de> <4E2E6027.5070906@christianmoe.com> <87y5zlcrtn.fsf@sophokles.streitblatt.de> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:56894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QleLe-0000Ob-0L for emacs-orgmode@gnu.org; Tue, 26 Jul 2011 05:54:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QleLd-0007Nw-1Z for emacs-orgmode@gnu.org; Tue, 26 Jul 2011 05:54:45 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:44903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QleLc-0007No-Qg for emacs-orgmode@gnu.org; Tue, 26 Jul 2011 05:54:45 -0400 Received: by eyx24 with SMTP id 24so592722eyx.19 for ; Tue, 26 Jul 2011 02:54:44 -0700 (PDT) In-Reply-To: <87y5zlcrtn.fsf@sophokles.streitblatt.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Florian Beck Cc: emacs-orgmode@gnu.org, mail@christianmoe.com On Jul 26, 2011, at 11:30 AM, Florian Beck wrote: > Christian Moe writes: >=20 >>> Firstly, I want to copy the *visible* text (minus the =85, but never = mind >>> that); >=20 >> In other words: Begin exporting only the visible part with `C-c C-e=20= >> 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. >=20 > Thanks. Seems like `org-export-visible' does exactly what I want. >=20 > I also wrote a function to copy the visible part of the region. For > those curious: >=20 > (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 (=3D (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=