emacs feature similar to netbeans templates? - templates

In netbeans you can store some code as template and call it back whenever you like by typing a specific word and TAB..is there a similar emacs feature, and if yes how can I use it?
thanks in advance!

There are a couple of libraries that come with emacs that provide this kind of functionality. SkeletonMode and TempoMode both allow you to insert templates into your code. They can be combined with AbbrevMode to automatically trigger on keywords, like in NetBeans.
Yasnippet is a much more full-featured library to do the same, bundled with lots of defaults for various languages. It is not currently bundled with emacs.

Yes, take a look here : http://code.google.com/p/yasnippet
In addition, you can watch this video : http://www.youtube.com/watch?v=76Ygeg9miao

I used to use ELSE Mode very heavily when I was doing a lot of programming by voice.

Related

Vim code completion

Is it possible to make Vim complete the code for you, like in any other IDE (not just word searching, but members of classes, methods etc.)?
What are the best options / plugins available?
Clang Complete lets you use Clang for accurate auto-completion of C and C++
I believe that following this list of links you will be able to leave any IDE and become a faithful user of vim, see some plugins that help you with IDE resources...
snipMate plugin faster code complete skels
video showing snipmate on vimeo
article about sparkup html codding to understand this resource
video showing sparkup html complete to see this in action
Auto complete popup plugin here
Advanced undo resource
some interesting videos on advanced usage of vim on vimeo
more free videos at vimcasts.org
amazing article about vim in this link
vim for php programmers (useful not only for php programmers) here
This is a little out dated. A rising star in Vim code completion is the "YouCompleteMe" plugin. Check it out here.
Omni completion is definitely the way to go. Instantiate it in insert mode with Ctrl+X Ctrl+O.
I use it in conjunction with SuperTab as well to allow for tab completion similar to bash shell.
Don't use it myself but I have heard of Omni complete:
http://vim.wikia.com/wiki/Omni_completion
The Vim Wiki contains a couple of things that may be of use for auto completion of words.
You can try this out Dictionary completions, get dictionary for you language. Simple ways
if you are programming in c++, there are ctag and cscope and with OmniCppComplete plugin.
Hope it will help
It's possible, but most people don't.
vim is a fairly generic editor, that said, it does contain some "code completion" features such as word completion, etcetera, but nothing like the likes of, say, Delphi's IDE.
Such a system could be added by scripting vim - vim can directly run several scripting languages that make this easy, or you could send the file through an external script.

I want to make my own source code editor, what are the good choices to make? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've had it of those dozens of editors which never provides simple things like:
distinguish type keywords and instruction keywords so I can put different colors on them.
being cross platform using a standard GUI lib like qt gtk etc (notepad++, yes, I almost hate you).
enough keyboard shortcut like duplicate line, comment selection, and a decent find-replace.
Decent task-easing features like single-click-on-the-number-line-margin to select the entire line.
Scintilla or another good-enough lexer that highlights enough different things, because brain-compiling code is one thing, quickly identify with the eyes what is what is something I find important.
I just want to support very basic languages like C, C++, maybe Python, not HTML or CSS.
Is Scintilla a good choice to just highlight those languages, and is a lexer really necessary ?
Isn't QT enough to program a text editor such as the one I want to do ? I know there is QScintilla, but is there a reason I shouldn't use a lib that integrates a lexer ? Why is Scintilla such a good lib ?
Is QT a good choice for such an editor ? (I also want to hard embed ProFont in the editor to kill any reluctant font problem between OSes).
EDIT:
In short, I want to make an editor, only with the same syntax highlight features of notepad++. That's my main goal, and the use of QScintilla might be a little harder than I thought...
EDIT2:
Well I found textadept, it's not so known but is quite awesome. I didn't manage to make my lexer, since I have other to do which I do under windows, unfortunately it's slow on the mac. Apparently there isn't any Scite official build for the mac.
C++ is not a "very basic language" by any stretch of the imagination.
Why do you really want to do this? There are SOOO many open source code editors out there.
If you must write your own editor, I suggest looking at the other open source editors and examine which pieces you port to your editor.
Porting pieces of existing working and tested code is usually much better than writing your own code and debugging it.
After perusing a couple serious open source editors: Emacs, Eclips, CodeBlocks, CodeLight, etc., I believe you will start changing your mind about writing an editor from scratch.
-- Thomas Matthews
My Info
If you really want to do this (and it sounds like a lot of work) I would look at ANTLR for parsing the code. You may get some ideas from their ANTLRWorks display.
To link the parse tree to a display could be a fair amount of work so I'd see what an IDE platform such as Eclipse has to offer
Are you OK with Java?
If so, go for Eclipse technologies: SWT and JFace. The latter provides you with org.eclipse.jface.text package with a lot of features. Then you can roll own editor easily basing on that. (I prefer Eclipse-based editors to Scintilla-based, I believe they tend to be more advanced and feature-rich, but that's my personal opinion.)
But then, you might want to go a step further and use the Eclipse RCP framework for you application... But then why not use the Eclipse IDE itself and just add whatever you want as plug-ins.
The Eclipse codebase is huge and it's up to you how much you want to reuse.
I would expend some effort experimenting with the emacs colour theme package and the various langauge modes; see if you can bend the lisp to do what you want. You almost certainly can. to my mind emacs and a bit of effort on your part will get you your ultimate editor (remember emacs is really just a DIY editor toolkit). If you cant bend emacs into the shape you want you will be well placed to expend the effort in writing your own.
I have tried to do something similar myself for a project I'm working on at the moment, I looked into the QScintilla and had to remove it from my project because when you embedded inside a QGraphicsView I can't control the resolution of the widgets image, it seems to paint the text as an image and that's what we see, I played with increasing the smoothness of the QFont and that improved it but still a no-go.
So I found a simple code editor inside QT's code base it comes with every installation of QT if you look
into:
C:\Qt\4.7.3\src\scripttools\debugging\qscriptedit.h
C:\Qt\4.7.3\src\scripttools\debugging\qscriptedit.cpp
If you go to the source code of OpenShapeFactory where I'm trying to embed a Code Editor: check how I got the syntax Highlighter and the autocomplete :
this widget uses the qscriptedit widget that ships with qt, you can add your own keywords to the syntax hightlighter from a file as well as for the auto-complete dropdownlist.
this is the header, scriptwidget.h and the implementation scriptwidget.cpp are available as part of the whole project code.
the next stage is to look into the QTCreator and see the code they already have all if not most of these features after you get to compile their version, just find where to add your little mods and you might be getting closer to the simple code editor.
I wish you the best of luck on this direction and if you find a solution please send it over, :)
heads-up keep a lookout for the repository link above, if I find a way of making it first, I might chase you to the answer.
Like everyone else is saying, it's probably more trouble than it's worth, but if you really want to do it, Qt's a good choice since it's cross platform. Use QSyntaxHighlighter to do your keyword/type highlighting, and take full advantage Qt's support for keyboard shortcuts.
use something like C, QT and Lua for the scripting engine.

What are some open-source applications written in C/C++ using PostgreSQL?

I'm trying to find open source applications using PostgreSQL that are written in C/C++ so I can study them. A few open source projects using PostgreSQL are Evergreen ILS, SpamAssassin, and pgpool. However, Evergreen and SpamAssassin are written in Perl, and pgpool (written in C) is a replication tool, not a typical application. Moreover, I looked at the SQL code in Evergreen, and it is quite voluminous and complicated.
Hence, I'm looking for one or more applications using PostgreSQL, preferably those that are somewhat trivial (but not too trivial).
seen libpqxx? try asking on its mailing list (but scour their wiki first)
http://pqxx.org/development/libpqxx
pgAdmin is written using c++ using wxwidgets.
how about pgAdmin 3 ?
Also, you may find Qt4 a very easy way interact with databases programming in C++.
http://doc.trolltech.com/4.6-snapshot/sql-programming.html
Have you searched through the projects at http://pgfoundry.org ?
Two examples that are open-source:
Kexi (see kexi-project.org)
FOST4 (
http://support.felspar.com/Fost%204 )
It's pretty big, but the KDE Project's Amarok is written in C++ and can use a PgSQL backend (among several others). While it's pretty large, you may be able to find some interesting things in the database code. Since it uses a pre-defined schema (as opposed to the extremely general types of access that something like pgAdmin uses) it may have some good things to teach you. It will definitely be easier to pick apart than Evergreen, which actually has an entire middleware layer that actually does the data access through exposed services (The OpenSRF Project).

Spell checker for comments, strings, maybe more

I am looking for a spell checker for c++ source code. Unfortunately all I can find is Visual Studio specific. I would like something which works on Linux.
Edit:
Ultimately I want to automate it in some way. I am not very proficient in spell checking, but what I am thinking of is a not-interactive console tool which prints error messages, or something like that.
Personally I use vim, but not everyone on the project does of course.
Currently we are using svn so it is possible to integrate it into the pre-commit-hook maybe?
Don't you guys do something similar?
Eclipse (Java based so will do mac, linux etc.) has spellcheckers built in. With the CDT plugin you can edit and build C++ code.
Vim also supports spell checking.
See the other question for more.
Emacs too has spell checking, flyspell-prog-mode, is the one I use, it is a (very!) personal preference which one works best for you.
The automating the spell check idea is a much trickier one. The best you can hope for is one that will tell you if there are spelling errors. That's trickier than it sounds, especially with code comments which may have all sorts of valid abbreviations which are not real words.
Having a company policy that whatever people have their EDITOR environment variable set to has a spell check enabled, should cut down on the spelling errors in commit messages, for example.
I found something!
svn co svn://anonsvn.kde.org/home/kde/trunk/quality/krazy2 krazy2
this is part of the quality management of KDE.
Besides a multitude of checks (KDE-specific, qt-specific, cpp-specific, ...) there is automated spell checking.
hope this helps
Which editors do you use? Many of them have spell checking abilities. E.g., gedit just needs to have the spellcheck plugin enabled.
You can check out some alpha code I just whipped up for a similar purpose: pyspellcode. It's Zlib licensed and uses clang and hunspell.
No idea how pyspellcode compares to what KDE does/provides but am happy to receive comparisons and will prioritize its development more if there's interest it.
At just over 200 lines, I'm guessing pyspellcode is at least lighter weight than KDE's solution though KDE's solution I imagine is way more tested.

Has anyone used smartwin (a Windows C++ GUI OS library)?

I am considering using smartwin for a Windows platform only C++ project but notice that there has not been a release for 18months since 2.0rc5 was released i.e. it appears that it is no longer maintained.
After playing with it seems pretty good, I like it's use of templates, signals/slots (via boost) and it will meet the project needs but I would like some experiences of other users who are currently using it to help me weight it up?
Have you looked at Qt instead? I think it has a lot of the features you're looking for, and would be much better supported, both in developer tools and framework maturity.
"...we really don't need a full application framework or cross platform portability - just a lite Win32 GUI framework that can be easily added to an existing app "
That is exactly what Smartwin was created for. Combine that with the Sally IDE, and you'll have a complete RAD development environment that is fast compact and complete. Note that Google is currently using WTL for their Chrome browser, but Smartwin is even more efficient than WTL.
Smartwin Also has a library called Winelib that they hope will make this also a portable environment in the long term.
Personally, if you want to go portable, I'd go with wxWidgets. However, if you are planning for sure to stay with windows, I'd certainly give Smartwin++ a look.
I, myself, would use wxWidgets, as thats what I usually use and am used to, so thats kind just a personal choice.
Good Luck.
-Donald
Consider using wxWidgets. It is mature, well supported library with lots of features.
Went for WTL in the end and that's been a pretty seamless and painless transition. Thanks for the comments and responses everyone.
Ultimate++
http://www.ultimatepp.org/