|
yay, so happy..
recently i fully switched to emacs and i was missing the alt+o feature for visual assist (pressing alt+o switches between source and header files)
so, today i implemented this for me:
.emacs --------------------------------------- .... (defun corresp_h (fln h) (let ((x (concat fln (string ?.) h))) (if (file-exists-p x) x nil))) (defun corresp_hh (fl lst) (if (not (null lst)) (or (corresp_h fl (car lst)) (corresp_hh fl (cdr lst))))) (defun corresponding (fln) (let ((ext (file-name-extension fln)) (prefix (file-name-sans-extension fln))) (cond ((string= ext "cpp") (corresp_hh prefix '("hpp" "h" "c"))) ((string= ext "hpp") (corresp_hh prefix '("cpp" "c" "h"))) ((string= ext "c") (corresp_hh prefix '("h" "hpp" "cpp"))) ((string= ext "h") (corresp_hh prefix '("c" "cpp" "hpp"))) (t nil) ) ) )
(defun switch-to-corresponding-hh (fln) (let* ( (fln2 (corresponding fln)) (buff (if (null fln2) nil (get-file-buffer fln2)))) (if (null buff) (if (not (null fln2)) (find-file fln2)) (switch-to-buffer buff))))
(defun switch-to-corresponding-h () "Swtich to the corresponding header/source file." (interactive) (switch-to-corresponding-hh buffer-file-name))
(global-set-key [?\A-\o] 'switch-to-corresponding-h) ---------------------------------------
i'm still a elisp newb, but fuck, this is awesome! still yearn for ctrl+shift+v and context-sensitive auto-complete/goto definition features though
|
that's pretty awesome, although a more intuitive solution is to use a real editor. we're not in the 80s anymore. if you want a real job, you'll probably have to learn how to use visual studio, so why waste time on this emacs garbage?
|
haha real job? i have it 12 years already
vassist is just a plugin for visual studio. i use vstudio with eyes closed for 10+ years already.
i use emacs for Linux and it really rocks
|
On March 13 2009 23:06 hni wrote: that's pretty awesome, although a more intuitive solution is to use a real editor.
Up to here I thought you were going to bash emacs and show him the light to the one and only true editor - Vim. >
On March 13 2009 23:06 hni wrote: we're not in the 80s anymore. if you want a real job, you'll probably have to learn how to use visual studio, so why waste time on this emacs garbage?
Both emacs and vim are much, much more powerful than you may realize, although they do have a steeper learning curve compared to the usual IDEs (visual studio, eclipse, etc). Also I don't think it makes a lot of sense to force your programmers to use a specific editor, so unless you work for M$ or are stuck in .NET so deeply that you don't see the rest of the world anymore, I really don't see that being an issue.
And for what it's worth... nah I will resist to rank the programmers I work with by their skill and try to correlate that to the editor they use ;-)
|
United States47024 Posts
On March 13 2009 23:06 hni wrote: that's pretty awesome, although a more intuitive solution is to use a real editor. we're not in the 80s anymore. if you want a real job, you'll probably have to learn how to use visual studio, so why waste time on this emacs garbage? Because it works? Depending on project size, simple editors can be far better for a project than an IDE. Most of the features present in IDEs either are implemented in Vim or Emacs, or can be added through various extensions, and both editors have plenty of things that modern IDEs haven't implemented.
Generally, it works out something like this: Small Projects - You don't need powerful features, so a lightweight editor will be better for the job than an IDE Medium-sized Projects - Code can get a little messy, so its good to have an IDE that can help you sort your work into a manageable way for you better than a text editor Large Projects - There's simply so much code that you can't sort it in a useful fashion, and doing so starts to work against the IDE. A text editor becomes useful here again
Also, as far as I know, jobs don't "force" you to use one editor or another (its a really stupid thing to manage). Whatever gets your code written in the way they want should work.
|
United States4991 Posts
On March 14 2009 00:55 TheYango wrote:Show nested quote +On March 13 2009 23:06 hni wrote: that's pretty awesome, although a more intuitive solution is to use a real editor. we're not in the 80s anymore. if you want a real job, you'll probably have to learn how to use visual studio, so why waste time on this emacs garbage? Because it works? Depending on project size, simple editors can be far better for a project than an IDE. Most of the features present in IDEs either are implemented in Vim or Emacs, or can be added through various extensions, and both editors have plenty of things that modern IDEs haven't implemented. Generally, it works out something like this: Small Projects - You don't need powerful features, so a lightweight editor will be better for the job than an IDE Medium-sized Projects - Code can get a little messy, so its good to have an IDE that can help you sort your work into a manageable way for you better than a text editor Large Projects - There's simply so much code that you can't sort it in a useful fashion, and doing so starts to work against the IDE. A text editor becomes useful here again Also, as far as I know, jobs don't "force" you to use one editor or another (its a really stupid thing to manage). Whatever gets your code written in the way they want should work. You may be 'forced' to use specific IDEs if test suites in the codebase are written for a specific IDE to run. I suppose you don't 'have' to use the IDE, but it makes the job significantly easier if you're a tester than trying to use some other text editor to write the code, and then run it in the IDE...
|
hahaha nice i never cared for emacs, i'm a vim guy :-) a friend of mine uses exclusively visual studio though. he writes good code, too. he usually spends a bit more time, but i'm not going to say that has anything to do with the choice of editor, that's just silly
use whatever you're comfortable with, and yes sometimes it was more comfortable for me to switch to an IDE, although it wasn't so much for the purposes of coding..
and of course the obligatory xkcd follows..
|
haha, yeah, good ol' xkcd
|
On March 13 2009 23:06 hni wrote: that's pretty awesome, although a more intuitive solution is to use a real editor. we're not in the 80s anymore. if you want a real job, you'll probably have to learn how to use visual studio, so why waste time on this emacs garbage?
What a useless comment.
It certainly depends on the field, doesn't it? In computational biology, Windows (and therefore Visual Studio) is a complete waste of time. You will probably have to learn a real language, too, which (except for C) Visual Studio doesn't even support.
Personally, I prefer vim, but I was an emacs guy before I started my phd.
|
United States47024 Posts
[B]On March 14 2009 04:03 HnR)Insane wrote:[/B You may be 'forced' to use specific IDEs if test suites in the codebase are written for a specific IDE to run. I suppose you don't 'have' to use the IDE, but it makes the job significantly easier if you're a tester than trying to use some other text editor to write the code, and then run it in the IDE... *shrug* The basic point is the same. Which editor is better depends both on personal preference and the codebase you're working with. Ideally, having experience in multiple environments is useful, just like having experience with multiple programming languages is useful. To dismiss either text editors or IDEs is closed-minded.
|
|
|
|