all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matthias Meulien <meulien@club.lemonde.fr>
Subject: Re: State of the art in Emacs outlining?
Date: 02 Oct 2002 19:11:30 +0200	[thread overview]
Message-ID: <m2ofacyddp.fsf@clarinde.localdomain> (raw)
In-Reply-To: m3k7l07ulm.fsf@maki.aixonix.de

Christian Lemburg <lemburg@aixonix.de> 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

  reply	other threads:[~2002-10-02 17:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1033440784.21858.help-gnu-emacs@gnu.org>
2002-10-01 15:00 ` State of the art in Emacs outlining? Stefan Monnier <foo@acm.com>
2002-10-02 14:44   ` Benjamin Rutt
2002-10-02 16:06     ` Stefan Monnier <foo@acm.com>
2002-10-02 15:01   ` Christian Lemburg
2002-10-02 17:11     ` Matthias Meulien [this message]
     [not found] <mailman.1033275084.18063.help-gnu-emacs@gnu.org>
2002-09-29  9:33 ` Alex Schroeder
2002-10-01  2:52   ` Tom Davey
2002-09-29 15:38 ` Kai Großjohann
2002-09-29  4:49 Tom Davey
2002-10-01 15:02 ` Sacha Chua
2002-10-04  0:53   ` Tom Davey

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=m2ofacyddp.fsf@clarinde.localdomain \
    --to=meulien@club.lemonde.fr \
    /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.