• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 18:00
CEST 00:00
KST 07:00
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway13
Community News
SC4ALL $6,000 Open LAN in Philadelphia7Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues29LiuLi Cup - September 2025 Tournaments3Weekly Cups (August 25-31): Clem's Last Straw?39Weekly Cups (Aug 18-24): herO dethrones MaxPax6
StarCraft 2
General
Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues #1: Maru - Greatest Players of All Time Team Liquid Map Contest #21 - Presented by Monster Energy Classic Games #3: Rogue vs Serral at BlizzCon What happened to Singapore/Brazil servers?
Tourneys
Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series WardiTV TL Team Map Contest #5 Tournaments Sparkling Tuna Cup - Weekly Open Tournament SC4ALL $6,000 Open LAN in Philadelphia
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
Pros React To: SoulKey's 5-Peat Challenge BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion ASL20 General Discussion BSL Team Wars - Bonyth, Dewalt, Hawk & Sziky teams
Tourneys
[IPSL] ISPL Season 1 Winter Qualis and Info! Is there English video for group selection for ASL [ASL20] Ro16 Group B [ASL20] Ro16 Group A
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Borderlands 3 Nintendo Switch Thread Path of Exile General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread
Community
General
Canadian Politics Mega-thread US Politics Mega-thread Russo-Ukrainian War Thread The Big Programming Thread Things Aren’t Peaceful in Palestine
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1307 users

Alt+o on emacs

Blogs > araav
Post a Reply
araav
Profile Blog Joined September 2004
Armenia1590 Posts
March 13 2009 13:58 GMT
#1
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

The flower that blooms in adversity is the most rare and beautiful of all.
hni
Profile Joined February 2009
Canada8 Posts
March 13 2009 14:06 GMT
#2
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?
araav
Profile Blog Joined September 2004
Armenia1590 Posts
March 13 2009 14:25 GMT
#3
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
The flower that blooms in adversity is the most rare and beautiful of all.
Sirakor
Profile Joined April 2003
Great Britain455 Posts
March 13 2009 14:27 GMT
#4
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 ;-)
TheYango
Profile Joined September 2008
United States47024 Posts
Last Edited: 2009-03-13 15:59:06
March 13 2009 15:55 GMT
#5
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.
Moderator
Insane
Profile Blog Joined November 2003
United States4991 Posts
March 13 2009 19:03 GMT
#6
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...
JeeJee
Profile Blog Joined July 2003
Canada5652 Posts
Last Edited: 2009-03-13 19:13:42
March 13 2009 19:11 GMT
#7
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..
[image loading]
(\o/)  If you want it, you find a way. Otherwise you find excuses. No exceptions.
 /_\   aka Shinbi (requesting a name change since 27/05/09 ☺)
araav
Profile Blog Joined September 2004
Armenia1590 Posts
March 13 2009 19:32 GMT
#8
haha, yeah, good ol' xkcd
The flower that blooms in adversity is the most rare and beautiful of all.
miseiler
Profile Blog Joined October 2008
United States1389 Posts
Last Edited: 2009-03-13 19:45:05
March 13 2009 19:42 GMT
#9
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.
"Jinro soo manly wearing only a T-Shirt while the Koreans freeze in their jackets" -- Double_O
"He's from Sweden, man. We have to fight polar bears on our way to school." -- Yusername
TheYango
Profile Joined September 2008
United States47024 Posts
March 13 2009 20:27 GMT
#10
[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.
Moderator
Please log in or register to reply.
Live Events Refresh
BSL Team Wars
19:00
Playoff - 4th vs 3rd
Team Bonyth vs Team Sziky
ZZZero.O82
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
JuggernautJason127
Nathanias 64
Lillekanin 11
StarCraft: Brood War
ZZZero.O 82
sSak 30
NaDa 14
Artosis 0
Dota 2
NeuroSwarm123
LuMiX1
Counter-Strike
fl0m1579
Stewie2K521
Heroes of the Storm
Liquid`Hasu546
Other Games
Grubby3741
FrodaN2523
ToD415
KnowMe185
Sick176
SortOf125
Organizations
Other Games
BasetradeTV36
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• RyuSc2 42
• musti20045 41
• StrangeGG 37
• Sammyuel 7
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• HerbMon 23
• RayReign 1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota22982
League of Legends
• Doublelift5331
Other Games
• imaqtpie1191
• Scarra985
Upcoming Events
Afreeca Starleague
12h
Snow vs Sharp
Jaedong vs Mini
Wardi Open
13h
OSC
1d 2h
Sparkling Tuna Cup
1d 12h
Afreeca Starleague
1d 12h
Light vs Speed
Larva vs Soma
PiGosaur Monday
2 days
LiuLi Cup
2 days
RSL Revival
3 days
Maru vs Reynor
Cure vs TriGGeR
The PondCast
3 days
RSL Revival
4 days
Zoun vs Classic
[ Show More ]
Korean StarCraft League
5 days
RSL Revival
5 days
[BSL 2025] Weekly
5 days
BSL Team Wars
5 days
RSL Revival
6 days
Online Event
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
SEL Season 2 Championship
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

2025 Chongqing Offline CUP
BSL Polish World Championship 2025
IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
SC4ALL: StarCraft II
EC S1
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
MESA Nomadic Masters Fall
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.