all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Error with fill-paragraph in my own major mode
Date: Thu, 31 Jan 2008 10:25:21 -0500	[thread overview]
Message-ID: <jwvy7a6nhxo.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: 85hcgutmqc.fsf@usenet.my.skamphausen.de

> Nevertheless I must admit that I don't really grok that code in
> fill.el.  What is that (concat "\0" commark "a") good for?

The code in fill.el is fiendishly subtle (I should know, I wrote it).
This (concat "\0" commark "a") thingy is there to check whether or not
we can build a stricter comment-start-skip that will only match
a specific comment-marker rather than any comment marker.

E.g. we're looking at a line that starts with "//" and we want to find
all the lines that start with "//" and refill them together, but we
don't want to consider lines that start with "///" or "/*".

The `concat' builds a test case to check whether the comment-start-skip
regexp is restricting the comment starter to be in column 0 (as is the
case in Fortran), and whether a space (or similar) char is needed
between the comment-marker and the comment's content (as is the case
with Texinfo's "@c" and Basic's "Rem").

That's what the comment tries to explain:

              ;; A regexp more specialized than comment-start-skip, that only
              ;; matches the current commark rather than any valid commark.
              ;;
              ;; The specialized regexp only works for "normal" comment
              ;; syntax, not for Texinfo's "@c" (which can't be immediately
              ;; followed by word-chars) or Fortran's "C" (which needs to be
              ;; at bol), so check that comment-start-skip indeed allows the
              ;; commark to appear in the middle of the line and followed by
              ;; word chars.  The choice of "\0" and "a" is mostly arbitrary.


-- Stefan


  reply	other threads:[~2008-01-31 15:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30 16:41 Error with fill-paragraph in my own major mode Stefan Kamphausen
2008-01-30 21:15 ` Andreas Röhler
2008-01-30 21:49 ` Stefan Monnier
2008-01-31  8:36   ` Stefan Kamphausen
2008-01-31 15:25     ` Stefan Monnier [this message]
2008-01-31 15:58       ` Stefan Kamphausen
2008-01-31 19:57         ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=jwvy7a6nhxo.fsf-monnier+gnu.emacs.help@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /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 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.