From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Please help me with filling in (enhanced) text mode. Date: Fri, 13 May 2005 21:24:10 +0000 Organization: muc.de e.V. -- private internet access Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1116020470 21540 80.91.229.2 (13 May 2005 21:41:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 May 2005 21:41:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 13 23:41:08 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DWhtP-0006RA-Jc for geh-help-gnu-emacs@m.gmane.org; Fri, 13 May 2005 23:40:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DWi2a-0005hT-GW for geh-help-gnu-emacs@m.gmane.org; Fri, 13 May 2005 17:49:52 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!informatik.tu-muenchen.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 87 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1116019995 18502 193.149.49.134 (13 May 2005 21:33:15 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 13 May 2005 21:33:15 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:130917 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:26577 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:26577 What I want to do is to extend text mode so that I can write lists of items labelled by parenthesised Roman numerals, like this: (i) Each item begins with a parenthesized Roman numeral and its second and subsequent lines should be indented by two spaces; (ii) I want commands like M-q `fill-paragraph', and C-j `newline-and-indent' to do the right thing in such Roman paragraphs. (iii) Outside of these list items, text-mode should work as it always has. My first try went something like this: (defvar roman (regexp-opt '("i" "ii" "iii" "iv" "v" "vi" "vii" "vii" "ix" "x"))) (defun enable-paren-lists () (setq paragraph-start (concat p-roman "\\|" paragraph-start) paragraph-separate paragraph-start)) (add-hook 'text-mode-hook 'enable-paren-lists) It didn't work. After some edebuggery, I took out the setqing of paragraph-separate, and it started sort-of-working, but I still have to type in the two spaces by hand after the first line break. How can I get these two spaces inserted automatically after the first line break? I have tried reading the fine manuals[*], but they have left me beaten. They seem vague and circular: For example, on Emacs's "Adaptive Fill" page, there is talk about "taking the [fill] prefix from a line", but not saying in detail how the taking is done. Then we have " If the prefix found on the first line matches `adaptive-fill-first-line-regexp', or if it appears to be a comment-starting sequence (this depends on the major mode), then the prefix found is used for filling the paragraph, provided it would not act as a paragraph starter on subsequent lines." , again not saying exactly how the "prefix found" is actually found. Searching for information about `adaptive-fill-first-line-regexp', I go for its doc-string: "*Regexp specifying whether to set fill prefix from a one-line paragraph. When a paragraph has just one line, then after `adaptive-fill-regexp' finds the prefix at the beginning of the line, if it doesn't match this regexp, it is replaced with whitespace." I'm having trouble parsing this: To what do the two "it"s refer? Which of the two candidate regexps is "this" regexp (in the last line)? "whether to set fill prefix": the prefix for _which_ line or group of lines? How and when does `adaptive-fill-regexp' find a prefix? That symbol is a VARIABLE, not a function. That implies some function uses it to search with at some point. Which? I then go to further to `adaptive-fill-regexp''s doc-string, and find this: *Regexp to match text at start of line that constitutes indentation. If Adaptive Fill mode is enabled, a prefix matching this pattern on the first and second lines of a paragraph is used as the standard indentation for the whole paragraph. , at which point I'm wondering how text (apart from whitespace) can constitute indentation. Then I'm just getting my head around exactly what a "prefix" is here, when my mental stack blows up in the complexity, and I've lost track of what I was trying to do in the first place. I've still not got the hang of what paragraph-start and paragraph-separate mean. Like, why are both variables set to the same thing in text-mode? What is the significance of a line which matches both of these regexps? Surely, setting things up for "simple" filling can't be that difficult? Somebody please tell me I'm missing something blindingly obvious, and what that thing is. Help! Thanks in advance! [*] In the Emacs manual: pages "Fill Prefix", "Adaptive Fill"; In the Elisp manual: Page "Filling". -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").