all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David <de_bb@arcor.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Auto-Insertion of C/C++ #include-statements upon use of their symbols
Date: Wed, 17 Sep 2008 23:54:27 +0200	[thread overview]
Message-ID: <87prn2a164.fsf@arcor.de> (raw)
In-Reply-To: uabe6mxbi.fsf@myhost.sbcglobal.net

>> Nordlöw <per.nordlow@gmail.com> writes:
>>> My suggestion is to make Emacs call a function each time a character
>>> is inserted into buffer and then check if we are currently standing
>>> behind such a use pattern. I believe looking-back() is usable here.
>>
>>> We also need to check that the cursor is *NOT* currently standing
>>> inside a comment or string; How do I query such a context?

> David <de_bb@arcor.de> writes:
>> Better solution: Since you are using semantic anyway, you could override
>> `semantic-ctxt-current-symbol' for C/C++, so that no symbol is returned
>> when the point is in a comment or string. Eric can surely say if this
>> would be reasonable to do.
>>
>> I'm not sure all of this will be fast enough for calling it in something
>> like 'post-command-hook, though. Maybe this should just be an extra
>> command, which inserts the correct header for the current symbol, if
>> necessary?

Chetan <Chet.xspam@xspam.sbcglobal.net> writes:
> This looks like something that abbrev-mode, expand and other template
> packages do already. I am not sure what you are trying to do and how it
> is differs from any of those.

He wants to automatically add proper #include statements as soon as you
use external functions. In practice, this would mean you wouldn't have
to write any #include statements at all, since they would be
automatically added as you write your code (and also removed again when
not needed anymore, although this would be more difficult to do). By
using CEDET's templating system SRecode, this could even be made
language independent. I don't think the usual templating systems can do
that.

-David





  parent reply	other threads:[~2008-09-17 21:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-17 15:04 Auto-Insertion of C/C++ #include-statements upon use of their symbols Nordlöw
2008-09-17 16:18 ` David
     [not found] ` <mailman.19414.1221668342.18990.help-gnu-emacs@gnu.org>
2008-09-17 18:39   ` Chetan
2008-09-17 21:17     ` Peter Milliken
2008-09-17 21:54     ` David [this message]
2008-09-19 16:13 ` Nikolaj Schumacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87prn2a164.fsf@arcor.de \
    --to=de_bb@arcor.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.