From: Florian Beck <abstraktion@t-online.de>
To: mail@christianmoe.com
Cc: emacs-orgmode@gnu.org, Florian Beck <abstraktion@t-online.de>
Subject: Re: Copy/Search Outline
Date: Tue, 26 Jul 2011 11:30:12 +0200 [thread overview]
Message-ID: <87y5zlcrtn.fsf@sophokles.streitblatt.de> (raw)
In-Reply-To: <4E2E6027.5070906@christianmoe.com> (Christian Moe's message of "Tue, 26 Jul 2011 08:35:19 +0200")
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
next prev parent reply other threads:[~2011-07-26 9:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y5zlcrtn.fsf@sophokles.streitblatt.de \
--to=abstraktion@t-online.de \
--cc=emacs-orgmode@gnu.org \
--cc=mail@christianmoe.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).