all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* yanking in outline mode without expanding?
@ 2003-12-22 17:34 Peter Seibel
  2003-12-22 19:03 ` Thomas F. Burdick
  2003-12-22 19:47 ` Kevin Rodgers
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Seibel @ 2003-12-22 17:34 UTC (permalink / raw)


I've been using outline mode in:

  GNU Emacs 21.3.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2003-07-17 on xeon

When I have my outline collapsed and kill a section and then yank it
back, it always insterts the text fully expanded. Is there some simple
way to change this behavior--I'd like it to stay collapsed just the
way it was when I killed it.

-Peter

-- 
Peter Seibel                                      peter@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp

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

* Re: yanking in outline mode without expanding?
  2003-12-22 17:34 yanking in outline mode without expanding? Peter Seibel
@ 2003-12-22 19:03 ` Thomas F. Burdick
  2003-12-22 19:58   ` Peter Seibel
  2003-12-22 19:47 ` Kevin Rodgers
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas F. Burdick @ 2003-12-22 19:03 UTC (permalink / raw)


Peter Seibel <peter@javamonkey.com> writes:

> I've been using outline mode in:
> 
>   GNU Emacs 21.3.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2003-07-17 on xeon
> 
> When I have my outline collapsed and kill a section and then yank it
> back, it always insterts the text fully expanded. Is there some simple
> way to change this behavior--I'd like it to stay collapsed just the
> way it was when I killed it.

It looks like outline mode uses overlays, which aren't a part of the
text itself, so aren't copied when you kill it.  You could advise the
kill/yank functions so that in outline mode they stuff the appropriate
overlay information into text properties on kill, and the reverse on
yank.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               

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

* Re: yanking in outline mode without expanding?
  2003-12-22 17:34 yanking in outline mode without expanding? Peter Seibel
  2003-12-22 19:03 ` Thomas F. Burdick
@ 2003-12-22 19:47 ` Kevin Rodgers
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2003-12-22 19:47 UTC (permalink / raw)


Peter Seibel wrote:

> When I have my outline collapsed and kill a section and then yank it
> back, it always insterts the text fully expanded. Is there some simple
> way to change this behavior--I'd like it to stay collapsed just the
> way it was when I killed it.

I don't know -- does this work?

(defadvice yank (after hide-region-body activate)
   "If the buffer is in Outline mode, hide the body lines in the yanked text."
   (if (eq major-mode 'outline-mode)     ; (or ... outline-minor-mode)
       (hide-region-body (region-beginning) (region-end))))

-- 
Kevin Rodgers

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

* Re: yanking in outline mode without expanding?
  2003-12-22 19:03 ` Thomas F. Burdick
@ 2003-12-22 19:58   ` Peter Seibel
  2003-12-23  6:54     ` Thomas F. Burdick
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Seibel @ 2003-12-22 19:58 UTC (permalink / raw)


tfb@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> Peter Seibel <peter@javamonkey.com> writes:
> 
> > I've been using outline mode in:
> > 
> >   GNU Emacs 21.3.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2003-07-17 on xeon
> > 
> > When I have my outline collapsed and kill a section and then yank it
> > back, it always insterts the text fully expanded. Is there some simple
> > way to change this behavior--I'd like it to stay collapsed just the
> > way it was when I killed it.
> 
> It looks like outline mode uses overlays, which aren't a part of the
> text itself, so aren't copied when you kill it.  You could advise the
> kill/yank functions so that in outline mode they stuff the appropriate
> overlay information into text properties on kill, and the reverse on
> yank.

Yup. I looked into the code a bit after I asked this--to do it right
you'd have to find the overlays in the region being cut, split them if
they are completely contained in the region, and then do as you
suggest. Maybe someday I'll get annoyed enough to do that. For now
I'll probably just keep recollapsing things "by hand". Thanks though.

-Peter

-- 
Peter Seibel                                      peter@javamonkey.com

         Lisp is the red pill. -- John Fraser, comp.lang.lisp

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

* Re: yanking in outline mode without expanding?
  2003-12-22 19:58   ` Peter Seibel
@ 2003-12-23  6:54     ` Thomas F. Burdick
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas F. Burdick @ 2003-12-23  6:54 UTC (permalink / raw)


Peter Seibel <peter@javamonkey.com> writes:

> tfb@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:
> 
> > Peter Seibel <peter@javamonkey.com> writes:
> > 
> > > I've been using outline mode in:
> > > 
> > >   GNU Emacs 21.3.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2003-07-17 on xeon
> > > 
> > > When I have my outline collapsed and kill a section and then yank it
> > > back, it always insterts the text fully expanded. Is there some simple
> > > way to change this behavior--I'd like it to stay collapsed just the
> > > way it was when I killed it.
> > 
> > It looks like outline mode uses overlays, which aren't a part of the
> > text itself, so aren't copied when you kill it.  You could advise the
> > kill/yank functions so that in outline mode they stuff the appropriate
> > overlay information into text properties on kill, and the reverse on
> > yank.
> 
> Yup. I looked into the code a bit after I asked this--to do it right
> you'd have to find the overlays in the region being cut, split them if
> they are completely contained in the region, and then do as you
> suggest. Maybe someday I'll get annoyed enough to do that. For now
> I'll probably just keep recollapsing things "by hand". Thanks though.

Yeah, that's why I posted a suggestion, instead of code :-)

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               

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

end of thread, other threads:[~2003-12-23  6:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-22 17:34 yanking in outline mode without expanding? Peter Seibel
2003-12-22 19:03 ` Thomas F. Burdick
2003-12-22 19:58   ` Peter Seibel
2003-12-23  6:54     ` Thomas F. Burdick
2003-12-22 19:47 ` Kevin Rodgers

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.