From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Matthias Meulien Newsgroups: gmane.emacs.help Subject: Re: State of the art in Emacs outlining? Date: 02 Oct 2002 19:11:30 +0200 Organization: ...!#$@~? Sender: help-gnu-emacs-admin@gnu.org Message-ID: References: <5llm5ijjab.fsf@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1033708468 20214 127.0.0.1 (4 Oct 2002 05:14:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 4 Oct 2002 05:14:28 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17xKnB-0005Fc-00 for ; Fri, 04 Oct 2002 07:14:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17xKnU-0002Oi-00; Fri, 04 Oct 2002 01:14:44 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail Mail-Copies-To: never Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Lines: 39 Original-NNTP-Posting-Date: 02 Oct 2002 19:11:37 MEST Original-NNTP-Posting-Host: 62.147.147.26 Original-X-Trace: 1033578697 news1-1.free.fr 20823 62.147.147.26 Original-X-Complaints-To: abuse@proxad.net Original-Xref: nntp.stanford.edu gnu.emacs.help:105651 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:2220 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:2220 Christian Lemburg wrote: > (defun text-outline-mode () > "Set customized outline major mode for text with numbered headings" > (interactive) > (setq outline-regexp "[0-9.]+") > (outline-mode)) Anolog with header level support, font-lock-mode. Put the following lines in `text-mode-hook' for example. ;; Provides outline facilities based on numbered headers. (defun outline-level () "Return the depth to which a statement is nested in the outline. Point must be at the beginning of a header line. This is actually the number of . characters that `outline-regexp' matches." (save-excursion (looking-at outline-regexp) (let ((string (match-string 0)) (level 0)) (while (string-match "\\." string) (setq level (1+ level) string (substring string (match-end 0)))) level))) (setq outline-regexp "\\([0-9]+\\.\\)+ ") (setq imenu-generic-expression (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) (outline-minor-mode 1) (set (make-local-variable 'font-lock-defaults) '(outline-font-lock-keywords t nil nil backward-paragraph)) (imenu-add-menubar-index) -- Matthias