all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Expanding Include Files
@ 2003-02-12 22:16 CarlC
  2003-02-13  9:36 ` Kai Großjohann
  0 siblings, 1 reply; 5+ messages in thread
From: CarlC @ 2003-02-12 22:16 UTC (permalink / raw)


Here's a good one that maybe someone has already done.

If I am editting a main source file, I would like a function that would
expand my buffer to show the contents of "include" files. This doesn't have
to be for C, it could be any language. I would customize it for my own use.
I would like these external files to be in-line with the program that I am
editting. Preferably with read-only on these chunks. I would be able to
search and access any of this source as if it were one file, but I would
only edit and save the original code.

Any ideas on how/if this could be done. Thanks.

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

* Re: Expanding Include Files
  2003-02-12 22:16 Expanding Include Files CarlC
@ 2003-02-13  9:36 ` Kai Großjohann
  2003-02-13 16:02   ` CarlC
  2003-02-13 18:38   ` Stefan Monnier <foo@acm.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Kai Großjohann @ 2003-02-13  9:36 UTC (permalink / raw)


"CarlC" <carlc@snowbd.com> writes:

> If I am editting a main source file, I would like a function that would
> expand my buffer to show the contents of "include" files. This doesn't have
> to be for C, it could be any language. I would customize it for my own use.
> I would like these external files to be in-line with the program that I am
> editting. Preferably with read-only on these chunks. I would be able to
> search and access any of this source as if it were one file, but I would
> only edit and save the original code.

Hm.  I think you could use overlays to display the source code, but I
don't know whether C-s searches in overlays or in the buffer text.

-- 
A turnip curses Elvis

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

* Re: Expanding Include Files
  2003-02-13  9:36 ` Kai Großjohann
@ 2003-02-13 16:02   ` CarlC
  2003-02-14  9:00     ` Kai Großjohann
  2003-02-13 18:38   ` Stefan Monnier <foo@acm.com>
  1 sibling, 1 reply; 5+ messages in thread
From: CarlC @ 2003-02-13 16:02 UTC (permalink / raw)


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

"Kai Großjohann" <kai.grossjohann@uni-duisburg.de> wrote in message
news:841y2c4j4v.fsf@lucy.is.informatik.uni-duisburg.de...
> Hm.  I think you could use overlays to display the source code, but I
> don't know whether C-s searches in overlays or in the buffer text.

Thanks, Kai. It is a start, but as you suggested, C-s searches aren't
including overlay text. I will look further to see what capabilities I have
with overlays and searching. My main purpose for this routine is to search
for variables throughout the entire source of the program. I could create a
temporary view buffer, but it just wouldn't be quite as sexy.

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

* Re: Expanding Include Files
  2003-02-13  9:36 ` Kai Großjohann
  2003-02-13 16:02   ` CarlC
@ 2003-02-13 18:38   ` Stefan Monnier <foo@acm.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2003-02-13 18:38 UTC (permalink / raw)


>>>>> "Kai" == Kai Großjohann <kai.grossjohann@uni-duisburg.de> writes:
> Hm.  I think you could use overlays to display the source code, but I
> don't know whether C-s searches in overlays or in the buffer text.

It only searches the buffer text, not the displayed text
(i.e. overlays won't work the way he wants them to).


        Stefan

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

* Re: Expanding Include Files
  2003-02-13 16:02   ` CarlC
@ 2003-02-14  9:00     ` Kai Großjohann
  0 siblings, 0 replies; 5+ messages in thread
From: Kai Großjohann @ 2003-02-14  9:00 UTC (permalink / raw)


"CarlC" <carlc@snowbd.com> writes:

> "Kai Großjohann" <kai.grossjohann@uni-duisburg.de> wrote in message
> news:841y2c4j4v.fsf@lucy.is.informatik.uni-duisburg.de...
>> Hm.  I think you could use overlays to display the source code, but I
>> don't know whether C-s searches in overlays or in the buffer text.
>
> Thanks, Kai. It is a start, but as you suggested, C-s searches aren't
> including overlay text. I will look further to see what capabilities I have
> with overlays and searching. My main purpose for this routine is to search
> for variables throughout the entire source of the program. I could create a
> temporary view buffer, but it just wouldn't be quite as sexy.

Yeah, temp buffers wouldn't be as nice.  Hm.

One possibility is to try to abstract from buffers.  M-x tags-search
RET can search across buffers, for example.  Maybe ECB also helps to
get a better overview of your source code.

Otherwise, I guess you'll just have to frob the buffer text itself.
Hm.  Hmmm...  How about this idea: you implement a generic facility
for viewing several files in one buffer.  You could use text
properties or markers to specify which part of the buffer comes from
which file, and then you'd have to intercept the saving routine to
save each part to its file.  Then you implement something which looks
for #include directives and then uses the generic facility.

And then you post it to gnu.emacs.sources so others can use it, too :-)

Maybe you can use format-alist to frob the buffer text on saving, or
you add stuff to write-file-hooks.  I'm not sure what's the right
way, here.  Maybe others have a suggestion for this.
-- 
A turnip curses Elvis

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

end of thread, other threads:[~2003-02-14  9:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-12 22:16 Expanding Include Files CarlC
2003-02-13  9:36 ` Kai Großjohann
2003-02-13 16:02   ` CarlC
2003-02-14  9:00     ` Kai Großjohann
2003-02-13 18:38   ` Stefan Monnier <foo@acm.com>

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.