unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
Subject: Beginingless paragraphs
Date: Tue, 30 Aug 2005 10:50:41 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.3.96.1050830094105.258A-100000@acm.acm> (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)

             reply	other threads:[~2005-08-30 10:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-30 10:50 Alan Mackenzie [this message]
2005-08-30 11:48 ` Beginingless paragraphs 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

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.3.96.1050830094105.258A-100000@acm.acm \
    --to=acm@muc.de \
    /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 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).