From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Veli-Pekka Tätilä" Newsgroups: gmane.emacs.help Subject: Re: Defining outline-regexp Interactively?, the Pros of outline-minor-mode Date: Sun, 5 Oct 2008 16:07:58 +0300 Organization: FINNET customers Message-ID: <48e8bb55$0$25384$9b536df3@news.fv.fi> References: <48e7bb0d$0$23610$9b536df3@news.fv.fi> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1223214057 3143 80.91.229.12 (5 Oct 2008 13:40:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 5 Oct 2008 13:40:57 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 05 15:41:53 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KmTrd-00055R-O0 for geh-help-gnu-emacs@m.gmane.org; Sun, 05 Oct 2008 15:41:38 +0200 Original-Received: from localhost ([127.0.0.1]:55432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KmTqa-0004C1-CR for geh-help-gnu-emacs@m.gmane.org; Sun, 05 Oct 2008 09:40:32 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!fi.sn.net!newsfeed1.fi.sn.net!news.song.fi!not-for-mail Original-Newsgroups: gnu.emacs.help X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Original-Lines: 41 Original-NNTP-Posting-Host: 82-128-218-109-Karjasilta-TR1.suomi.net Original-X-Trace: 1223211861 news.fv.fi 25384 82.128.218.109:1391 Original-X-Complaints-To: abuse@news.fv.fi Original-Xref: news.stanford.edu gnu.emacs.help:163039 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:58378 Archived-At: Hi list, I'll answer my own questions. The following function seems to do the trick of defining a local outline regexp for the minor mode in the current buffer for me interactively. I don't know much Lisp yet but the Emacs wiki and programming in Emacs lisp helped a lot. (defun prompt-for-outline-regexp (new-regexp) "ask the user for a local value of outline-regexp in this buffer" (interactive "sOutline regexp: ") (set (make-local-variable 'outline-regexp) new-regexp) ) ; defun I bind it as follows: (global-set-key (kbd "") 'prompt-for-outline-regexp) And then, as to matching book headings, that one seems to be rather straight forward, too. Here: http://www.linux.com/feature/114144 Quote with snippage: For example, suppose you have a file that contains a book manuscript. Chapters in this file always begin with a numbered title line, sections beneath it are titled with the chapter number followed by a period and section number, and subsections add another number, You can view such a file as an outline in outline mode by changing the outline-regexp variable to a regexp that will match one or more numbers followed by the grouping of a period character and an optional second number. (setq outline-regexp "[0-9]+\\(\\.[0-9]+\\)*") End quote. -- With kind regards Veli-Pekka Tätilä Accessibility, Apps and Coding plus Synths and Music: http://vtatila.kapsi.fi