* Editing text in Emacs then pasting into something like Outlook
@ 2013-04-30 14:29 Ludwig, Mark
2013-04-30 14:37 ` Teemu Likonen
2013-05-01 4:29 ` eqyiel
0 siblings, 2 replies; 4+ messages in thread
From: Ludwig, Mark @ 2013-04-30 14:29 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
I need commands like M-a (sentence-forward) to maximize my
productivity when writing large swaths of text, so use Emacs for it.
I learned M-a and M-e so long ago, that sometimes my fingers will hit
one of them before I realize I'm not in Emacs....
Has anyone written code to take a region or a file of plain ASCII text
written in Emacs using classical block style (with paragraphs wrapped
as in this e-mail) and transform it into something suitable for
pasting into MS Word or Outlook as raw text? (I manually unwrap using
M-^ and C-p interactively, starting at the end, backing up to the
beginning.)
This means two newlines before the second through Nth paragraph in my
case, because I usually use extra paragraph marks to make space before
the following paragraph. I'm only looking for code to "unwrap" the
text; for extra credit, actually shove it into the appropriate
cross-application "clipboard" buffer. (I copy the unwrapped region
using M-w now.)
I took a whack at rolling my own unwrap code a few years ago, but it
failed in a few cases. I will ask for advice on it here if there is
no better existing solution. Please let me know of existing solutions
to this problem. I happen to be running Emacs on Windows, but really
want a solution for all platforms, because I want this sort of thing
on UNIX periodically too.
Oh, one of the finer points here is dealing with sentences that end at
the end of a line. (I use the traditional Emacs default, so of
course, I consistently want two spaces between paragraphs.)
Thanks!
Mark Ludwig
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Editing text in Emacs then pasting into something like Outlook
2013-04-30 14:29 Editing text in Emacs then pasting into something like Outlook Ludwig, Mark
@ 2013-04-30 14:37 ` Teemu Likonen
2013-05-01 4:29 ` eqyiel
1 sibling, 0 replies; 4+ messages in thread
From: Teemu Likonen @ 2013-04-30 14:37 UTC (permalink / raw)
To: Mark Ludwig; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 951 bytes --]
Mark Ludwig [2013-04-30 14:29:20 +00:00] wrote:
> Has anyone written code to take a region or a file of plain ASCII text
> written in Emacs using classical block style (with paragraphs wrapped
> as in this e-mail) and transform it into something suitable for
> pasting into MS Word or Outlook as raw text? (I manually unwrap using
> M-^ and C-p interactively, starting at the end, backing up to the
> beginning.)
How about setting fill-column to a very large value, like 999999 and
then fill-paragraph (M-q)?
I use my own flowing-text-mode when editing text with one-line
paragraphs. Here's the definition:
(define-derived-mode flowing-text-mode text-mode "Text[flow]"
"Major mode for editing text with long flowing lines."
(visual-line-mode 1)
(whitespace-newline-mode 1)
(set (make-local-variable 'tab-stop-list)
(number-sequence 4 100 4))
(setq indent-tabs-mode nil
fill-column 99999))
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Editing text in Emacs then pasting into something like Outlook
2013-04-30 14:29 Editing text in Emacs then pasting into something like Outlook Ludwig, Mark
2013-04-30 14:37 ` Teemu Likonen
@ 2013-05-01 4:29 ` eqyiel
2013-05-01 15:51 ` Ludwig, Mark
1 sibling, 1 reply; 4+ messages in thread
From: eqyiel @ 2013-05-01 4:29 UTC (permalink / raw)
To: Ludwig, Mark; +Cc: help-gnu-emacs@gnu.org
While searching for a solution a few months ago, I borrowed some code
from Xah Lee [1], but replaced his bigFillColumnVal "4333999" with
most-positive-fixnum, which changes depending on the system - I think.
On mine it is 2305843009213693951.
There is also a slightly more readable implementation I found on
StackOverflow [2]. I now have it bound to M-q. Works great!
[1] http://ergoemacs.org/emacs/modernization_fill-paragraph.html
[2] http://stackoverflow.com/a/14992483/2204400
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Editing text in Emacs then pasting into something like Outlook
2013-05-01 4:29 ` eqyiel
@ 2013-05-01 15:51 ` Ludwig, Mark
0 siblings, 0 replies; 4+ messages in thread
From: Ludwig, Mark @ 2013-05-01 15:51 UTC (permalink / raw)
To: eqyiel@gmail.com; +Cc: help-gnu-emacs@gnu.org
> From: eqyiel@gmail.com, Tuesday, April 30, 2013 11:30 PM
> While searching for a solution a few months ago, I borrowed some code from
> Xah Lee [1], but replaced his bigFillColumnVal "4333999" with most-positive-
> fixnum, which changes depending on the system - I think.
> On mine it is 2305843009213693951.
>
> There is also a slightly more readable implementation I found on StackOverflow
> [2]. I now have it bound to M-q. Works great!
>
> [1] http://ergoemacs.org/emacs/modernization_fill-paragraph.html
> [2] http://stackoverflow.com/a/14992483/2204400
I like to say "never is a long time," but this seems to violate the
predictability of the behavior of M-q such that I truly /never/ would
have thought to make this part of what M-q does.... (I /can/ see the
utility of it when used purely interactively, but doesn't the
self-inverting state information need to get reset on movement
of point across paragraph boundaries?)
Mostly I won't modify M-q, I suppose, because I want to be able to use
it in macros. I am thinking about using a prefix argument
(interactively) on M-q to invoke the "unfill" behavior, so it would be
C-u M-q. (I don't intend to need this frequently, instead using a
separate Emacs frame showing a buffer I'll use for my copy/paste.
Thanks to Teemu Likonen <tlikonen@iki.fi>, this buffer will be in the
previously-shared flowing-text-mode, where original (fill-paragraph) on
M-q will do the right thing.)
Thanks!
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-01 15:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-30 14:29 Editing text in Emacs then pasting into something like Outlook Ludwig, Mark
2013-04-30 14:37 ` Teemu Likonen
2013-05-01 4:29 ` eqyiel
2013-05-01 15:51 ` Ludwig, Mark
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).