[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hiding certain lines

From: Darragh Murphy
Subject: Re: hiding certain lines
Date: Thu, 12 Jul 2001 17:52:43 +0100

There is an option in the html-mode to toggle-tag visibility.

The code should be easy to find in sgml-mode.el.

here's a snippit, notice the regular expression 


defun sgml-tags-invisible (arg)
"Toggle visibility of existing tags."
(interactive "P")
(let ((modified (buffer-modified-p))
(inhibit-read-only t)
;; This is needed in case font lock gets called,
;; since it moves point and might call sgml-point-entered.
(inhibit-point-motion-hooks t)
(goto-char (point-min))
(if (setq sgml-tags-invisible
(if arg
(>= (prefix-numeric-value arg) 0)
(not sgml-tags-invisible)))
(while (re-search-forward "<\\([!/?A-Za-z][-A-Za-z0-9]*\\)"
nil t)
(setq symbol (intern-soft (downcase (match-string 1))))
(goto-char (match-beginning 0))
(and (get symbol 'before-string)
(not (overlays-at (point)))
(overlay-put (make-overlay (point)
(match-beginning 1))
'category symbol))
(put-text-property (point)
(progn (forward-list) (point))
'category 'sgml-tag))
(let ((pos (point)))
(while (< (setq pos (next-overlay-change pos)) (point-max))
(delete-overlay (car (overlays-at pos)))))
(remove-text-properties (point-min) (point-max)
'(category sgml-tag intangible t))))
(set-buffer-modified-p modified)
(run-hooks 'sgml-tags-invisible-hook)
(message "")))

At 19:30 11/07/2001, you wrote:

>On Wed, 11 Jul 2001 wrote:
>> 1.    Hide certain lines of code (all that start with WHITESPACE if(DEBUG)
>> System.out.println( ...
>> 2.    Show those lines again.
>Spencer Thiel wrote:
>> Do M-x apropos narrow
>> This will show you all the commands/variables that deal with narrowing.
>Seems more related to outline-minor-mode (e.g. hide-region-body)
>than to narrowing.
>Help-gnu-emacs mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]