all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Auto-Insertion of C/C++ #include-statements upon use of their symbols
Date: Wed, 17 Sep 2008 08:04:39 -0700 (PDT)	[thread overview]
Message-ID: <0724fa6a-b298-49b8-84bb-06933d09c573@p25g2000hsf.googlegroups.com> (raw)

I am currently writing some logic for automatically looking up a
required header file when the programmer completes the use of a symbol
defined in this header file. This to relieve especially C/C++
programmers from the cumbersome process of doing for example "man
memcpy" to figure out that we need to "include <string.h>" before
calling memcpy().

In C++ this shall also work for Standard Template Library (STL)
Headers, that is "#include <vector>" is auto-(query-)included when the
user completes the expression "std::vector<int>".

The logic for these lookups and insertions already exists. What now
remains is the logic for sensing when this is needed.

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?

If any one is interested in using this add-ons I will gladly send it
to you.


Many Thanks in advance,
Nordlöw


             reply	other threads:[~2008-09-17 15:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-17 15:04 Nordlöw [this message]
2008-09-17 16:18 ` Auto-Insertion of C/C++ #include-statements upon use of their symbols 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
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=0724fa6a-b298-49b8-84bb-06933d09c573@p25g2000hsf.googlegroups.com \
    --to=per.nordlow@gmail.com \
    --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.