[PLUG] Emacs Text Editing Question

Dale Snell ddsnell at frontier.com
Fri Mar 25 16:23:00 UTC 2016


On Fri, 25 Mar 2016 08:04:32 -0700 (PDT), in message
alpine.LNX.2.11.1603250755300.8249 at localhost, Rich Shepard wrote:

>    While I regularly use emacs I'm not as expert with it as are many
> of you. Perhaps your expertise can explain an emacs paragraph
> formatting behavior that seems anomalous to me.
> 
>    Line length is set to 78 characters, and I use M-q to reformat a
> paragraph when I've made changes. Most lines are filled to column 78,
> or less, but now and then a word that could fit on a line without
> exceeding column 78 is placed on the following line. I'd like to
> understand why.
> 
>    Here are two such lines as an example:
> 
> measures are difficult to interpret as suitable for fish and
> wildlife. Biological-based standards of water quality are more useful
> 
> The 'd' in "and" is on column 59; when I place "wildlife" on that
> line the space after the '.' is in column 70. So, why is the \n
> placed between "and" and "wildlife." when I reformat using M-q?


Hi Rich,

What is 'sentence-end-double-space' set to?  I suspect it's 't',
which is what it's set to here, and is the default.

I noticed that you only used one space after the period.  When
I tried formatting your lines with 'M-q', I got the same results
as you did.  When I put a second space after the period and
reformatted, I got what you probably expected.  I.e., the first
line ends with the period at column 69 and the \n at column 70.

The only thing I can suggest is either change your typing habits
(which is hard to do, I know), or change the value of
'sentence-end-double-space'.  Since Emacs uses that variable
(among other things) to determine where a sentence ends, that
might do what you need.  My guess, and it's only a guess, is that
Emacs saw "wildlife. Biological" as a sort of contraction, like
"Dr. Smith", and refused to break the two words apart.  Which is
correct, but not what you were expecting in this case.

I just tried an experiment: 70 "a"s, followed by a space, followed
by the string "Dr. Smith".  I used 'M-q' to reformat the line, and
lo-and-behold, "Dr. Smith" ended up on the next line, even though
there was room for the "Dr." on the first line.  I then set
'sentence-end-double-space' to 'nil', and tried reformatting the
line again.  It worked the way you probably want: "Dr." ended the
first line, and "Smith" started the second.  Note, however, that
in this case, this is the _wrong_ thing to do.  A (contracted)
title and the associated name should _not_ be broken across
lines.

What would I do?  Use two spaces after a sentence.  But then,
I come from the old typewriter school that teaches that method.
I also use a monospace font (DejaVu Sans Mono, to be precise), so
that it looks like typewritten text.  Emacs always behaves nicely
when I do that.

Anyway, I hope my ramblings help.

--Dale

-- 
"Have a place for everything and keep the thing somewhere else;
this is not advice, it is merely custom."  -- Mark Twain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20160325/14e85585/attachment.asc>


More information about the PLUG mailing list