From: John Mastro <john.b.mastro@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Cc: "R. Clayton" <rvclayton@acm.org>
Subject: Re: Newline-phobic text help.
Date: Thu, 14 Jul 2016 18:43:41 -0700 [thread overview]
Message-ID: <CAOj2CQSHYyPn_7euABYN7fZ7oDMjZW13PmkR3o98aOaQFRj5yg@mail.gmail.com> (raw)
In-Reply-To: <87d1mgt5tz.fsf@BanjaLuka.rclayton.net>
R. Clayton <rvclayton@acm.org> wrote:
> I use emacs and firefox's it's all text add-on to fill in web text-entry forms.
> Because those forms break text to the line width, I use the enriched-text minor
> mode under the assumption that soft newlines don't show up in the resulting
> text. That assumption seems to be incomplete: the soft newlines are gone, but
> the text in the form has (hard) newlines at the places the text in the buffer
> had soft newlines (resizing the form verifies this claim).
>
> Enriched text saved to a local disk file has the same property -
> intra-paragraph soft newlines are replaced by hard newlines - which leads me to
> believe I don't understand enriched text. What are the emacs incantations that
> keep hard newlines out of paragraphs when the buffer's written to wherever?
[ I think your scenario boils down to the fact that you don't want the
intra-paragraph newlines in your buffer to end up in your web form; if
I got that wrong, you can ignore what I wrote below. ]
I don't know the answer to your question about controlling how newlines
are written, but perhaps another approach would be to:
(auto-fill-mode -1)
(visual-line-mode)
In the relevant buffers, so the unwanted newlines are never inserted at
all. The only trick would be identifying when you've got an "It's All
Text!" buffer so you can evaluate that code. If the buffers are
text-mode buffers with somewhat predictable names as suggested here[1],
it might work to do something like:
(defun my-its-all-text-settings ()
(let ((file (buffer-file-name)))
(when (and file
(file-in-directory-p file "/tmp/")
(string-match-p "\\.[A-Za-z0-9]\\{10\\}\\.txt\\'" file))
(auto-fill-mode -1)
(visual-line-mode))))
(with-eval-after-load 'text-mode
(add-hook 'text-mode-hook #'my-its-all-text-settings))
Of course, that regexp could easily match files other than those created
by It's All Text!. But we're not doing anything dangerous, so unless you
often edit text files in /tmp it's probably okay.
Actually, I'm not sure that It's All Text! puts its temporary files in
/tmp, so you should confirm that (and adjust the file-in-directory-p
call if not).
John
[1] https://psung.blogspot.com/2009/05/using-itsalltext-with-emacsemacsclient.html
next prev parent reply other threads:[~2016-07-15 1:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 18:47 Newline-phobic text help R. Clayton
2016-07-15 1:43 ` John Mastro [this message]
2016-07-15 16:22 ` R. Clayton
2016-07-15 17:35 ` John Mastro
[not found] <mailman.1432.1468522060.26859.help-gnu-emacs@gnu.org>
2016-07-15 1:11 ` Emanuel Berg
2016-07-15 1:55 ` R. Clayton
[not found] ` <mailman.1457.1468547758.26859.help-gnu-emacs@gnu.org>
2016-07-15 2:08 ` Emanuel Berg
2016-07-15 4:45 ` Marcin Borkowski
[not found] ` <mailman.1459.1468557921.26859.help-gnu-emacs@gnu.org>
2016-07-15 5:36 ` Emanuel Berg
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOj2CQSHYyPn_7euABYN7fZ7oDMjZW13PmkR3o98aOaQFRj5yg@mail.gmail.com \
--to=john.b.mastro@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=rvclayton@acm.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.