all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Newline-phobic text help.
@ 2016-07-14 18:47 R. Clayton
  2016-07-15  1:43 ` John Mastro
  0 siblings, 1 reply; 9+ messages in thread
From: R. Clayton @ 2016-07-14 18:47 UTC (permalink / raw
  To: help-gnu-emacs

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?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
       [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>
  0 siblings, 2 replies; 9+ messages in thread
From: Emanuel Berg @ 2016-07-15  1:11 UTC (permalink / raw
  To: help-gnu-emacs

rvclayton@acm.org (R. Clayton) writes:

> I use emacs and firefox's it's all text
> add-on to fill in web text-entry forms.

OK? You write in Emacs and then paste into
a Firefox add-on which is called "it's all
text"?

It is possible to fill in forms using
Emacs-w3m. It is third party stuff, so use
aptitude or the corresponding package manager
of your Unix system/Linux distro to get it.

It is "possible", but not enjoyable even in
Emacs. Stay away from them sites is
another attitude.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
  2016-07-14 18:47 Newline-phobic text help R. Clayton
@ 2016-07-15  1:43 ` John Mastro
  2016-07-15 16:22   ` R. Clayton
  0 siblings, 1 reply; 9+ messages in thread
From: John Mastro @ 2016-07-15  1:43 UTC (permalink / raw
  To: help-gnu-emacs@gnu.org; +Cc: R. Clayton

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
  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>
  1 sibling, 0 replies; 9+ messages in thread
From: R. Clayton @ 2016-07-15  1:55 UTC (permalink / raw
  To: help-gnu-emacs

  OK? You write in Emacs and then paste into a Firefox add-on which is called
  "it's all text"?

No.  Iat adds a button to text forms.  Click it and it fires up emacs with the
contents of the text form, if any, in the buffer.  Save the buffer to bung the
contents back to the text form.

https://addons.mozilla.org/en-US/firefox/addon/its-all-text/

  It is possible to fill in forms using Emacs-w3m. It is third party stuff, so
  use aptitude or the corresponding package manager of your Unix system/Linux
  distro to get it.

No. Most of the sites are too web 2.0 for w3m (or for me to figure out how to
get w3m to deal with them).

  It is "possible", but not enjoyable even in Emacs. Stay away from them sites
  is another attitude.

Unfortunately, these are the sites with which I must deal.  Besides, iat +
emacs makes it reasonable of not necessarily enjoyable; it's those newlines in
enriched-mode that are the problem.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
       [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>
  0 siblings, 2 replies; 9+ messages in thread
From: Emanuel Berg @ 2016-07-15  2:08 UTC (permalink / raw
  To: help-gnu-emacs

rvclayton@acm.org (R. Clayton) writes:

> No. Iat adds a button to text forms. Click it
> and it fires up emacs with the contents of
> the text form, if any, in the buffer.
> Save the buffer to bung the contents back to
> the text form.

RUN!!

Emacs should be started once and then never
shut down unless a foreign power pinpoints
your bungalow!

> No. Most of the sites are too web 2.0 for w3m
> (or for me to figure out how to get w3m to deal
> with them).

You mean Emacs-w3m can't handle web
2.0? ... wait, what is web 2.0?

> Unfortunately, these are the sites with which
> I must deal.

No.

> Besides, iat + emacs makes it reasonable of
> not necessarily enjoyable; it's those
> newlines in enriched-mode that are
> the problem.

Probably just some variable set and/or some
minor mode activated. You can do a `apropos' of
"line" and see where it gets you, also, do
`C-h m' when in the troublesome mode.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
  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>
  1 sibling, 0 replies; 9+ messages in thread
From: Marcin Borkowski @ 2016-07-15  4:45 UTC (permalink / raw
  To: Emanuel Berg; +Cc: help-gnu-emacs


On 2016-07-15, at 04:08, Emanuel Berg <embe8573@student.uu.se> wrote:

> rvclayton@acm.org (R. Clayton) writes:
>
>> No. Iat adds a button to text forms. Click it
>> and it fires up emacs with the contents of
>> the text form, if any, in the buffer.
>> Save the buffer to bung the contents back to
>> the text form.
>
> RUN!!
>
> Emacs should be started once and then never
> shut down unless a foreign power pinpoints
> your bungalow!

Have you heard about emacsclient?

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
       [not found]       ` <mailman.1459.1468557921.26859.help-gnu-emacs@gnu.org>
@ 2016-07-15  5:36         ` Emanuel Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2016-07-15  5:36 UTC (permalink / raw
  To: help-gnu-emacs

Marcin Borkowski <mbork@mbork.pl> writes:

> Have you heard about emacsclient?

Only rumors.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
  2016-07-15  1:43 ` John Mastro
@ 2016-07-15 16:22   ` R. Clayton
  2016-07-15 17:35     ` John Mastro
  0 siblings, 1 reply; 9+ messages in thread
From: R. Clayton @ 2016-07-15 16:22 UTC (permalink / raw
  To: John Mastro; +Cc: help-gnu-emacs

  Thanks for your reply to my message.

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.

  Nope, you got it.

I don't know the answer to your question about controlling how newlines are
written, but perhaps another approach would be to:

  You're being polite by not pointing out that using enriched-mode to do what I
  want is a stupid idea.  Apart from the hard-soft newlines problem, there's also
  the header at the beginning of the file.

The only trick would be identifying when you've got an "It's All Text!"
buffer so you can evaluate that code.

  I hacked around that like so: point iat to an editor that's the shim shell
  script

    emacs --exec '(defconst its-all-text! t)' $@

  and put

    (when (boundp? 'its-all-text!)
      (auto-fill-mode -1)
      (visual-line-mode))

  in the text-mode-hook.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Newline-phobic text help.
  2016-07-15 16:22   ` R. Clayton
@ 2016-07-15 17:35     ` John Mastro
  0 siblings, 0 replies; 9+ messages in thread
From: John Mastro @ 2016-07-15 17:35 UTC (permalink / raw
  To: help-gnu-emacs@gnu.org

R. Clayton <rvclayton@acm.org> wrote:
>   You're being polite by not pointing out that using enriched-mode to do what I
>   want is a stupid idea.  Apart from the hard-soft newlines problem, there's also
>   the header at the beginning of the file.

I'm just not familiar enriched-mode :)

> The only trick would be identifying when you've got an "It's All Text!"
> buffer so you can evaluate that code.
>
>   I hacked around that like so: point iat to an editor that's the shim shell
>   script
>
>     emacs --exec '(defconst its-all-text! t)' $@
>
>   and put
>
>     (when (boundp? 'its-all-text!)
>       (auto-fill-mode -1)
>       (visual-line-mode))
>
>   in the text-mode-hook.

That's definitely nicer than my suggestion.

        John



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-07-15 17:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-14 18:47 Newline-phobic text help R. Clayton
2016-07-15  1:43 ` John Mastro
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

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.