unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Problems with outline-minor-mode
@ 2004-07-18 13:15 Laurence Finston
  0 siblings, 0 replies; 3+ messages in thread
From: Laurence Finston @ 2004-07-18 13:15 UTC (permalink / raw)


Hello,

The headings below are interpreted correctly in
plain-tex-mode + outline-minor-mode but incorrectly in
c-mode + outline-minor-mode and c++-mode + outline-minor-mode.

Does anyone have an explanation for this?

I've tried this using:

GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit) of 2003-10-31 on raven,
modified by Debian.

and

GNU Emacs 21.2.1 (i586-suse-linux, X toolkit, Xaw3d scroll bars) of 2002-10-16 on D186


I'd like `/*\s-' to be recognized as a prefix, followed by a variable number of
dollar signs indicating the level of the heading.  However, the whitespace
characters are always counted in determining the heading level, so that
`/* $$ */' and `/*  $ */' are equivalent.

I've also tried to get the regular expression \s-*\*/ to be recognized
as the `outline-heading-end-regexp', but it hasn't worked, so that
`/* $' followed by whitespace and `\n' is a valid heading.
(I haven't tried this with GNU Emacs 21.2.1)

I've written a mode for use with
CWEB, but I've had to derive it from c-mode rather than c++-mode for this
reason.  Strangely enough, the headings work in my cweb-mode using
GNU Emacs 21.2.1.

Are the Emacs developers working on a CWEB-mode?  In Don Knuth's
_Digital Typesetting_ there's a photo caption that says so.  I'd like
to release the mode I've written as part of GNU 3DLDF, but if there's
going to be an official CWEB mode this probably wouldn't be a good idea,
or I'd have to change its name.

Thanks for your help.

Laurence Finston
GNU 3DLDF maintainer
http://www.gnu.org/software/3dldf/LDF.html

****************************************************************

(progn
  (plain-tex-mode)
  (outline-minor-mode t)
  (setq outline-regexp "/[ *$]+")
 )

(progn
  (c-mode)
  (outline-minor-mode t)
  (setq outline-regexp "/[ *$]+")
 )

(progn
 (plain-tex-mode)
 (outline-minor-mode t)
 (setq outline-regexp "/[ *$]+")
)





;; Headings.


/* $ */

/* $$ */

/* $$ */

/* $$$ */

/* $$ */

/* $ */

/* $$ */

/* $$$ */

/* $$$ */

/* $$$$ */

/* $$$ */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with outline-minor-mode
       [not found] <mailman.316.1090156719.1960.bug-gnu-emacs@gnu.org>
@ 2004-07-19 16:17 ` Kevin Rodgers
  2004-07-19 16:30   ` Laurence Finston
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2004-07-19 16:17 UTC (permalink / raw)


Laurence Finston wrote:
 > I'd like `/*\s-' to be recognized as a prefix, followed by a variable
 > number of dollar signs indicating the level of the heading.  However,
 > the whitespace characters are always counted in determining the
 > heading level, so that `/* $$ */' and `/* $ */' are equivalent.

You could define your own outline-level function:

(defun lfinsto1-outline-level ()
   "Return the number of `$' characters matched at point by `outline-regexp'."
   (save-excursion
     (looking-at outline-regexp)
     (car (read-from-string (count-matches "\\$"
					  (match-beginning 0) (match-end 0))))))

(set (make-local-variable 'outline-level)
      'lfinsto1-outline-level)

 > I've also tried to get the regular expression \s-*\*/ to be recognized
 > as the `outline-heading-end-regexp', but it hasn't worked, so that
 > `/* $' followed by whitespace and `\n' is a valid heading.
 > (I haven't tried this with GNU Emacs 21.2.1)

I would just leave outline-heading-end-regexp to its default value "\n",
or maybe prepend " *\*/" to it.

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problems with outline-minor-mode
  2004-07-19 16:17 ` Kevin Rodgers
@ 2004-07-19 16:30   ` Laurence Finston
  0 siblings, 0 replies; 3+ messages in thread
From: Laurence Finston @ 2004-07-19 16:30 UTC (permalink / raw)
  Cc: gnu-emacs-bug

Thanks.  I'll give it a try.

Laurence


On Mon, 19 Jul 2004, Kevin Rodgers wrote:

> Laurence Finston wrote:
>  > I'd like `/*\s-' to be recognized as a prefix, followed by a variable
>  > number of dollar signs indicating the level of the heading.  However,
>  > the whitespace characters are always counted in determining the
>  > heading level, so that `/* $$ */' and `/* $ */' are equivalent.
>
> You could define your own outline-level function:
>
> (defun lfinsto1-outline-level ()
>    "Return the number of `$' characters matched at point by `outline-regexp'."
>    (save-excursion
>      (looking-at outline-regexp)
>      (car (read-from-string (count-matches "\\$"
> 					  (match-beginning 0) (match-end 0))))))
>
> (set (make-local-variable 'outline-level)
>       'lfinsto1-outline-level)
>
>  > I've also tried to get the regular expression \s-*\*/ to be recognized
>  > as the `outline-heading-end-regexp', but it hasn't worked, so that
>  > `/* $' followed by whitespace and `\n' is a valid heading.
>  > (I haven't tried this with GNU Emacs 21.2.1)
>
> I would just leave outline-heading-end-regexp to its default value "\n",
> or maybe prepend " *\*/" to it.
>
> --
> Kevin Rodgers
>
>
>
> _______________________________________________
> Bug-gnu-emacs mailing list
> Bug-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-19 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-18 13:15 Problems with outline-minor-mode Laurence Finston
     [not found] <mailman.316.1090156719.1960.bug-gnu-emacs@gnu.org>
2004-07-19 16:17 ` Kevin Rodgers
2004-07-19 16:30   ` Laurence Finston

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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