unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Visual line mode in email citation
@ 2010-05-31  9:45 Uday S Reddy
  2010-05-31 16:26 ` Stefan Monnier
  2010-06-02 16:54 ` Reiner Steib
  0 siblings, 2 replies; 9+ messages in thread
From: Uday S Reddy @ 2010-05-31  9:45 UTC (permalink / raw)
  To: emacs-devel

Getting email messages with long lines is a pretty common thing.  Both VM and Gnus (as far as I can tell) have traditionally used the longlines package to handle such long lines.

Citing messages in replies is a big deal (with "> " or other citation prefixes).  When a message is cited, Gnus and VM take the text that is already filled with longlines, and insert it in the reply, in effect converting the soft line breaks to hard line breaks.  Then they add the "> " prefix to each line.  This works surprisingly well.  (VM isn't doing this correctly at the moment, but I am in the process of fixing it.)

Trying to use the visual line mode in place of longlines isn't working very well.  There are no soft line breaks.   So, we end up citing the entire paragraph as a single line.  This is supposed to be ok.  Mail clients like Thunderbird know that the entire paragraph is being cited and put citation marks on all of it when they do word wrapping.

> But, VM and Gnus, depending on Emacs visual-line-mode, have no idea of what is going
on.  They end up putting the citation prefix on the first line of the paragraph, and
the remaining lines remain uncited.  Like this paragraph, for example.

Can the visual line mode be taught some email citation issues?

Cheers,
Uday




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

* Re: Visual line mode in email citation
  2010-05-31  9:45 Visual line mode in email citation Uday S Reddy
@ 2010-05-31 16:26 ` Stefan Monnier
  2010-05-31 16:58   ` Lennart Borgman
  2010-06-02 16:54 ` Reiner Steib
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2010-05-31 16:26 UTC (permalink / raw)
  To: Uday S Reddy; +Cc: emacs-devel

> Trying to use the visual line mode in place of longlines isn't working
> very well.  There are no soft line breaks.   So, we end up citing the
> entire paragraph as a single line.  This is supposed to be ok.
> Mail clients like Thunderbird know that the entire paragraph is being
> cited and put citation marks on all of it when they do word wrapping.

> But, VM and Gnus, depending on Emacs visual-line-mode, have no idea of
> what is going on.  They end up putting the citation prefix on the
> first line of the paragraph, and the remaining lines remain uncited.
> Like this paragraph, for example.

> Can the visual line mode be taught some email citation issues?

This was discussed here a few days ago: the word-wrapping performed by
the display engine makes indeed no attempts to recognize citation
prefixes (nor indentation), and given the level at which it works, it's
better that it doesn't try to do that.  OTOH it does provide hooks
(more specifically the `wrap-prefix' text-property), which Elisp code
can use to make this wrapping do the right thing.

IOW, some Elisp code somewhere needs to add a `wrap-prefix' to each line
specifying the citation/indentation/fill prefix to use.  This should
most likely be done by a function passed to jit-lock-register and which
then uses something like fill-context-prefix.

I'd welcome a patch that provides such a function (e.g. in fill.el) and
maybe visual-line-mode could/should use it, but at least Gnus's (and
VM's) message display code should use it.


        Stefan



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

* Re: Visual line mode in email citation
  2010-05-31 16:26 ` Stefan Monnier
@ 2010-05-31 16:58   ` Lennart Borgman
  2010-05-31 18:21     ` Lennart Borgman
  2010-05-31 18:30     ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Lennart Borgman @ 2010-05-31 16:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Uday S Reddy, emacs-devel

On Mon, May 31, 2010 at 6:26 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> can use to make this wrapping do the right thing.
>
> IOW, some Elisp code somewhere needs to add a `wrap-prefix' to each line
> specifying the citation/indentation/fill prefix to use.  This should
> most likely be done by a function passed to jit-lock-register and which
> then uses something like fill-context-prefix.


Why pass it to jit-lock-register? Isn't it better to add it to font
lock keywords. Then the frame work for handling changes in jit-lock is
used, otherwise I can't see how it can be used, but I might be missing
something.

This approach is what I am using in visual-indent-mode, which I just
extracted to live on its own outside of wrap-to-fill-column-mode. This
is available in nXhtm repository in wrap-to-fill.el. (The code needs
some restructuring to extract something similar to
fill-context-prefix, which I do not think can be used as it is.)


> I'd welcome a patch that provides such a function (e.g. in fill.el) and
> maybe visual-line-mode could/should use it, but at least Gnus's (and
> VM's) message display code should use it.



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

* Re: Visual line mode in email citation
  2010-05-31 16:58   ` Lennart Borgman
@ 2010-05-31 18:21     ` Lennart Borgman
  2010-05-31 18:30     ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Lennart Borgman @ 2010-05-31 18:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Uday S Reddy, emacs-devel

>
> This approach is what I am using in visual-indent-mode, which I just
> extracted to live on its own outside of wrap-to-fill-column-mode. This
> is available in nXhtm repository in wrap-to-fill.el. (The code needs
> some restructuring to extract something similar to
> fill-context-prefix, which I do not think can be used as it is.)


Refactored a bit so it now uses fill-match-adaptive-prefix. Seems ok
(but I have to rebuild Emacs, having problem with probably old bidi
code).


>> I'd welcome a patch that provides such a function (e.g. in fill.el) and
>> maybe visual-line-mode could/should use it, but at least Gnus's (and
>> VM's) message display code should use it.
>



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

* Re: Visual line mode in email citation
  2010-05-31 16:58   ` Lennart Borgman
  2010-05-31 18:21     ` Lennart Borgman
@ 2010-05-31 18:30     ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2010-05-31 18:30 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: Uday S Reddy, emacs-devel

>> can use to make this wrapping do the right thing.
>> IOW, some Elisp code somewhere needs to add a `wrap-prefix' to each line
>> specifying the citation/indentation/fill prefix to use.  This should
>> most likely be done by a function passed to jit-lock-register and which
>> then uses something like fill-context-prefix.
> Why pass it to jit-lock-register?

Because it doesn't use any of font-lock's functionality.
Because it should work even if font-lock is turned off.

> Isn't it better to add it to font lock keywords. Then the frame work
> for handling changes in jit-lock is used, otherwise I can't see how it
> can be used, but I might be missing something.

C-h f jit-lock-register.
Font-lock uses jit-lock via jit-lock-register.  Check out glasses-mode
for another mode that uses jit-lock-register.

> (The code needs some restructuring to extract something similar to
> fill-context-prefix, which I do not think can be used as it is.)

fill-context-prefix can probably be used as-is, but it will probably not
be ideal: it may suffer from some minor problems, and the code is
overkill for such a situation (all the part of the code that tries to
look at the prefix on several lines will never apply).

So a new function is probably in order, tho ideally the two functions
should share a lot of code (either via a third function, or by having
fill-context-prefix call the new function).


        Stefan



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

* Re: Visual line mode in email citation
  2010-05-31  9:45 Visual line mode in email citation Uday S Reddy
  2010-05-31 16:26 ` Stefan Monnier
@ 2010-06-02 16:54 ` Reiner Steib
  2010-06-03  9:50   ` Štěpán Němec
  2010-06-03 15:05   ` Chong Yidong
  1 sibling, 2 replies; 9+ messages in thread
From: Reiner Steib @ 2010-06-02 16:54 UTC (permalink / raw)
  To: emacs-devel

On Mon, May 31 2010, Uday S Reddy wrote:

> Getting email messages with long lines is a pretty common thing.

Unfortunately.  MUAs (and users) that use format=flowed correctly,
insert soft newlines at (say) column 70.  Your message was incorrect
with regards to this.  Thunderbird is (or was?) known to have issues
with f=f.

> Both VM and Gnus (as far as I can tell) have traditionally used the
> longlines package to handle such long lines.

Gnus doesn't use longlines-mode at all.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: Visual line mode in email citation
  2010-06-02 16:54 ` Reiner Steib
@ 2010-06-03  9:50   ` Štěpán Němec
  2010-06-03 15:05   ` Chong Yidong
  1 sibling, 0 replies; 9+ messages in thread
From: Štěpán Němec @ 2010-06-03  9:50 UTC (permalink / raw)
  To: emacs-devel; +Cc: reinersteib+gmane

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Mon, May 31 2010, Uday S Reddy wrote:
>
>> Getting email messages with long lines is a pretty common thing.
>
> Unfortunately.  MUAs (and users) that use format=flowed correctly,
> insert soft newlines at (say) column 70.  Your message was incorrect
> with regards to this.  Thunderbird is (or was?) known to have issues
> with f=f.
>
>> Both VM and Gnus (as far as I can tell) have traditionally used the
>> longlines package to handle such long lines.
>
> Gnus doesn't use longlines-mode at all.

But it suffers from the problem mentioned in this thread, i.e. producing
paragraphs which have the citation prefix (`> ' in my case) only on the
first line.

`gnus-treat-fill-long-lines' and `gnus-treat-fill-article' are also far
from perfect -- the former often produces paragraphs with normal and
very short lines interchanging, the latter usually messes up citation.

     Štěpán

>
> Bye, Reiner.



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

* Re: Visual line mode in email citation
  2010-06-02 16:54 ` Reiner Steib
  2010-06-03  9:50   ` Štěpán Němec
@ 2010-06-03 15:05   ` Chong Yidong
  2010-06-03 15:18     ` Lennart Borgman
  1 sibling, 1 reply; 9+ messages in thread
From: Chong Yidong @ 2010-06-03 15:05 UTC (permalink / raw)
  To: emacs-devel

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> On Mon, May 31 2010, Uday S Reddy wrote:
>
>> Getting email messages with long lines is a pretty common thing.
>
> Unfortunately.  MUAs (and users) that use format=flowed correctly,
> insert soft newlines at (say) column 70.  Your message was incorrect
> with regards to this.  Thunderbird is (or was?) known to have issues
> with f=f.

It might be good to set `word-wrap' to non-nil in article buffers, on
Emacs.  That way, even if Gnus doesn't fill the text due to a buggy MUA
or some other reason, the text will at least be easy to read.



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

* Re: Visual line mode in email citation
  2010-06-03 15:05   ` Chong Yidong
@ 2010-06-03 15:18     ` Lennart Borgman
  0 siblings, 0 replies; 9+ messages in thread
From: Lennart Borgman @ 2010-06-03 15:18 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

On Thu, Jun 3, 2010 at 5:05 PM, Chong Yidong <cyd@stupidchicken.com> wrote:
> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>
>> On Mon, May 31 2010, Uday S Reddy wrote:
>>
>>> Getting email messages with long lines is a pretty common thing.
>>
>> Unfortunately.  MUAs (and users) that use format=flowed correctly,
>> insert soft newlines at (say) column 70.  Your message was incorrect
>> with regards to this.  Thunderbird is (or was?) known to have issues
>> with f=f.
>
> It might be good to set `word-wrap' to non-nil in article buffers, on
> Emacs.  That way, even if Gnus doesn't fill the text due to a buggy MUA
> or some other reason, the text will at least be easy to read.


I added "visual citation markers" for such cases in
visual-indent-mode. I have tried it with gmail (which I edit in Emacs
sometimes though I use the web interface to gmail), but I do not know
how it works otherwise.

The idea is that it should show "visual citation markers" looking a
little bit different than the normal ones, but similar, when
visual-line-mode has wrapped a line.

If someone wants to try the code is currently in wrap-to-fill.el in
nXhtml. Suggestions are of cause welcome.



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

end of thread, other threads:[~2010-06-03 15:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31  9:45 Visual line mode in email citation Uday S Reddy
2010-05-31 16:26 ` Stefan Monnier
2010-05-31 16:58   ` Lennart Borgman
2010-05-31 18:21     ` Lennart Borgman
2010-05-31 18:30     ` Stefan Monnier
2010-06-02 16:54 ` Reiner Steib
2010-06-03  9:50   ` Štěpán Němec
2010-06-03 15:05   ` Chong Yidong
2010-06-03 15:18     ` Lennart Borgman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).