unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Veli-Pekka Tätilä" <vtatila@gmailRemoveToReply.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Defining outline-regexp Interactively?, the Pros of outline-minor-mode
Date: Sun, 5 Oct 2008 16:07:58 +0300	[thread overview]
Message-ID: <48e8bb55$0$25384$9b536df3@news.fv.fi> (raw)
In-Reply-To: 48e7bb0d$0$23610$9b536df3@news.fv.fi

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1420 bytes --]

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 "<f9>") '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, <snip>

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. <snip>

(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




      reply	other threads:[~2008-10-05 13:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-04 18:54 Defining outline-regexp Interactively?, the Pros of outline-minor-mode Veli-Pekka Tätilä
2008-10-05 13:07 ` Veli-Pekka Tätilä [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='48e8bb55$0$25384$9b536df3@news.fv.fi' \
    --to=vtatila@gmailremovetoreply.com \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).