unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Beginingless paragraphs
@ 2005-08-30 10:50 Alan Mackenzie
  2005-08-30 11:48 ` Benjamin Riefenstahl
  2005-08-31 14:36 ` Richard M. Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: Alan Mackenzie @ 2005-08-30 10:50 UTC (permalink / raw)


Hi, Emacs!

What is a "paragraph" in Emacs?  I can't find a @dfn{paragraph} anywhere
in the Emacs/Elisp manuals.  I don't have the full CVS of Lispref, but
grepping in the released version didn't produce any hits.

There are definitions of the two paragraph regexps in the Elisp Manual:

 - Variable: paragraph-separate
     This is the regular expression for recognizing the beginning of a
     line that separates paragraphs.  (If you change this, you may have
     to change `paragraph-start' also.)  The default value is
     `"[ \t\f]*$"', which matches a line that consists entirely of
     spaces, tabs, and form feeds (after its left margin).

 - Variable: paragraph-start
     This is the regular expression for recognizing the beginning of a
     line that starts _or_ separates paragraphs.  The default value is
     `"[ \t\n\f]"', which matches a line starting with a space, tab,
     newline, or form feed (after its left margin).

.  Then there is this evasive "definition" of paragraph in the Emacs
manual (taken from text.texi V1.57):

    The precise definition of a paragraph boundary is controlled by the
  variables `paragraph-separate' and `paragraph-start'.  The
  value of `paragraph-start' is a regexp that should match any line
  that either starts or separates paragraphs.  The value of
  `paragraph-separate' is another regexp that should match only lines
  that separate paragraphs without being part of any paragraph (for
  example, blank lines).  Lines that start a new paragraph and are
  contained in it must match only `paragraph-start', not
  `paragraph-separate'.  Each regular expression must match at the
  left margin.  For example, in Fundamental mode, `paragraph-start'
  is `"\f\\|[ \t]*$"', and `paragraph-separate' is
  `"[ \t\f]*$"'.

I don't really want to know what _controls_ the definition of a paragraph
boundary.  I want that definition itself without having to resort to a
kind of contorted reverse logic to get to it.  And believe me, working
through that logic is hard.

Doing that gives this:  A paragraph ends just before a line which matches
paragraph-start (?or at EOB).  A paragraph starts at a line which matches
p-start, but _doesn't_ match p-separate (?or at BOB).

What happens if these two regexps are the same (as they are by default in
Text mode)?  There cannot be any lines which start paragraphs, only lines
which separate them.  Beginningless paragraphs!  This is absurd.

Incidentally, what happens when a line matches p-start but not
p-separate?  Shouldn't ever happen, but it surely will.

At this point, the Elisp programmer, reduced to tears, starts reading the
source code to find out what a paragraph really is.  Non-programmers (and
there will be a fair number of them using Text mode) need to start
experimenting with regexps.

SURELY there should be a proper @dfn{paragraph} in the Emacs manual?  I'm
too confused to write one myself at the moment.

    "Like a circle in a spiral,
     Like a wheel within a wheel.
     Never starting, only ending
     On an ever-spinning reel.
     As the images unwind
     Like the paragraphs you find
     In the buffers of your mind."

-- 
Alan Mackenzie (Munich, Germany)

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

end of thread, other threads:[~2005-10-22 15:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-30 10:50 Beginingless paragraphs Alan Mackenzie
2005-08-30 11:48 ` Benjamin Riefenstahl
2005-08-31 14:36 ` Richard M. Stallman
2005-08-31 17:00   ` Eli Zaretskii
2005-08-31 18:11   ` Alan Mackenzie
2005-09-01 15:53     ` Richard M. Stallman
2005-09-01 17:56       ` Alan Mackenzie
2005-09-01 23:17         ` Thien-Thi Nguyen
2005-09-03  1:42         ` Richard M. Stallman
2005-09-03  1:41     ` Richard M. Stallman
2005-09-03 12:26       ` Alan Mackenzie
2005-09-04 16:49         ` Richard M. Stallman
2005-09-07 19:17           ` Beginingless paragraphs: second stab at a patch Alan Mackenzie
2005-09-08  9:04             ` Richard M. Stallman
2005-10-19 16:56               ` Clean-up of forward-paragraph [Re: Beginingless paragraphs: second stab at a patch.] Alan Mackenzie
2005-10-20  4:54                 ` Richard M. Stallman
2005-10-20 13:53                   ` Alan Mackenzie
2005-10-21  4:50                     ` Richard M. Stallman
2005-10-21 20:09                       ` Alan Mackenzie
2005-10-22 15:51                         ` Richard M. Stallman

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).