[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hiding lines
From: |
Andreas Roehler |
Subject: |
Re: hiding lines |
Date: |
Fri, 03 Apr 2009 07:44:05 +0200 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
Alan Mackenzie wrote:
> Hi, Werner,
>
> On Thu, Apr 02, 2009 at 08:52:01AM +0200, Werner LEMBERG wrote:
>
>> Folks,
>
>
>> I would like to hide lines in a buffer which satisfy a regexp --
>> either the lines get completely hidden (or perhaps indicated with
>> `...' as in the outline mode), or a search-and-replace function
>> doesn't match them.
>
>> Does Emacs have such a thing? A lookup in the docs doesn't show
>> anything relevant. This would be a very convenient function for
>> editing lists.
>
> The following makes the current region invisible and intangible. It
> doesn't, as yet, make it visible and tangible again very well. It's not
> quite what you're asking for, but you can likely use it as the engine
> end of what you want.
>
> (defun make-region-invisible (beg end &optional arg)
> "Make the current region invisible and intangible.
> With a prefix arg, make it visible again. With an arg of 0,
> make all such regions visible."
> (interactive "r\nP")
> (let (ov ovs)
> (cond
> ((eq arg 0)
> (setq ovs (overlays-in (point-min) (point-max)))
> (mapc (lambda (o)
> (when (overlay-get o 'acm-invisible)
> (delete-overlay o)))
> ovs))
> ((equal arg '(4))
> (setq ovs (overlays-at (point)))
> (mapc (lambda (o)
> (when (overlay-get o 'acm-invisible)
> (delete-overlay o)))
> ovs))
> (t
> (setq ov (make-overlay beg end))
> (overlay-put ov 'acm-invisible t)
> (overlay-put ov 'invisible t)
> (overlay-put ov 'intangible t)))))
> (global-set-key "\C-cz" 'make-region-invisible)
>
>
>> Werner
>
Thanks to Bastien Guerry Emacs-Lisp Bill-Board is
available for just that kind of tasks.
Please have have a look at http://repo.or.cz/w/elbb.git
The declared bill-board environment allows some
playing, even with git.
Andreas Röhler
- Re: `make-overlay' very slow, (continued)
- Re: `make-overlay' very slow, Eli Zaretskii, 2009/04/11
- Re: `make-overlay' very slow, Stefan Monnier, 2009/04/11
- Re: `make-overlay' very slow, Kenichi Handa, 2009/04/14
- Re: `make-overlay' very slow, Stefan Monnier, 2009/04/14
- Re: `make-overlay' very slow, Richard M Stallman, 2009/04/14
- Re: `make-overlay' very slow, Kenichi Handa, 2009/04/14
- clone-indirect-buffer-hook should be make-indirect-buffer-hook, klaus.berndl, 2009/04/16
Re: hiding lines,
Andreas Roehler <=