Forcing myself to master Emacs - macos

Assuming a superficial knowledge exists, how might one go about forcing a mastery of Emacs?
Assume also that said person currently uses Aquamacs but falls back on Mac OS X-isms far too often. This person is serious (this time for sure), and needs some advice.

C-h t
Take the tutorial, and actually follow it all the way through.
Then, learn some of the more useful time-saving functionality, like C-x ( to start recording a macro, C-x ) to finish, and C-x e to execute the last macro. Read the manual (C-h i m emacs RET) for more details. Try learning to browse through the documentation within info mode in Emacs, rather than resorting to the web, to get more used to how navigation works in Emacs.
Oh, and try using an Emacs that doesn't have the Aquamacs key bindings. There is a command line version of Emacs included on Mac OS X, though using the Meta key is a pain there (you have to either set your Terminal preferences to use Option as meta, or always use Esc). You can also use MacPorts to install an X11 version of Emacs, which won't have the Mac style keybindings.
Also, try using Emacs keybindings in other Cocoa text editing views. It's not something that a lot of people know, but a few common Emacs keybindings also work in the standard Cocoa text controls, such as C-a to go to the beginning of a line, C-e to go to the end, C-k to kill to the end of the line, C-y to yank from the kill buffer (which is different than the pasteboard). C-t transposes two characters, and I'm sure there are more that I can't think of at the moment. Using these on a regular basis will get your fingers used to Emacs keybindings (many of these also generally work in most shells, and in programs that use GNU Readline for being able to accept editable input).
For any technology you use on a regular basis, seek out the best Emacs mode you can for that technology, and learn it inside and out. For instance, if you're a Git user, I find Magit indispensable. If you program JavaScript, make sure you use Steve Yegge's js2-mode. If you use Common Lisp, learn SLIME, if you use Erlang learn distel. Sometimes, the best Emacs mode won't be the best tool you can find for a job, but for many, many things it's pretty good, and great to have it all integrated in to the same editor and environment.
Keep practicing everything you learn, over and over. I find that I frequently learn a new Emacs keybinding, and then promptly forget it because I don't use it for another 6 months. You can alleviate this problem by looking for any excuse you can to use a new keybinding after you first learn it, to help get it ingrained in your memory.

Don't use Mail.app, Gmail, or whatever -- use Gnus.
Don't use a web browser for programming information, use Info pages
where possible.
Don't use Terminal, use M-x shell.
Make sure you have a right and a left control key. I have a MacBook and have mapped the right option key to control.
Swap left control and capslock.
Read Steve Yegge's advice.
Find a killer app.
Always, always, always read the Emacs manual and use M-x apropos when you want to do something but don't quite know how. Emacs probably has the best online help of any program, ever.

I found the only way to master anything is to do it daily (practice, practice, practice).
As far as Mac OS X-isms... I'm not sure that's a problem per-say. Personally, in my quest to master Vim, I ditched Mac OS X entirely and have been happily living in GNU/Linux-land since.
Good luck!

Practice.
Try to answer questions here that are tagged Emacs.
Practice more.
Visit the Emacs Wiki and try ideas from it.
Practice even more.
Good luck!

Step 1: Notice you are doing something complicated.
Step 2: Read the manual to see if there's an easier way.
Step 3: Undo your changes.
Step 4: Do things the "new way".
Step 5: You've just learned one more new feature. Go to Step 1.

Switch to Carbon Emacs which doesn't have all the Mac bindings. It's a lot closer to the Unix Emacs experience but doesn't require X11 installed. The only real downside to Carbon Emacs is that Apple has no 64 bit Carbon and is probably phasing Carbon out, so Carbon Emacs might not have a long life ahead of it.

Related

working effectively with gdb

Whenever possible, I usually tend to learn keyboard shortcuts. It's really amazing to see an experienced coder works with VI effectively.
I've been trying for sometime switching to debugging with gdb, instead of eclipse debugger (based on gdb)
And I still find it hard to actually navigate through the code, inspecting variables, etc.
Actually, I have never seen an experienced gdb user, so I'm wondering... does it worth it? Is it possible to work effectively with gdb ?
Note: I also tried cgdb, which is a curses extension of gdb. It's better, but I still feel that its still not effective enough...
GDB has a curses interface, which can be activated via the command line option -tui.
This interface has a single key mode, which makes the most common operation available with a single keystroke. If additionally you make use of automatic command execution e.g. to display variable values, when a breakpoint is reached, then this is as comfortable and quick as it gets. But if you use Eclipse anyway, I see no point in avoiding the Eclipse UI for gdb.
I used GDB inside emacs for some time, but found the time to transfer information between GDB and emacs unacceptable, so I switched to this TUI mode mentioned above. I don't know, if the transfer of information between GDB and Eclipse is faster, but at least startup time of complex programs might be much better in GDB directly than in Eclipse.
You could also try the ddd debuger:
http://www.gnu.org/software/ddd/
This question didn't get much attention, although a bounty was offered.
So I decided to investigate further the issue for myself.
Finally I stumbled upon a solution which I think can be quite effective.
It's called tmux, and it's basically similar to gnu screen.
This tool allows splitting the console to several panes, each containing different process.
Therefore it's possible to have a single window with gdb and emacs.
switching between the windows is very easy using a dedicated hot key.

win cmd.exe in Vim tab

I'm looking for Vim/gVim plugin to use Windows shell (cmd.exe) (executing commands, retrieving output) in separate tab/frame.
There are a lots of such solutions for Linux, but I'm unable to do it in Win...
Unlike Emacs, Vim is an editor, not an environment (thank Gawd :) and it is not (nor will ever be, according to what the developers have been saying for the past 20 years) designed to house a command prompt/shell in one of its buffers.
That being said, there are a couple of plugins that try to imitate that functionality. Some work better, some worse ... check'em out, and see what works best for you:
cmd.vim
Shell.vim
Conque
Just to add, I don't use any of the above - just found them on vim.org, so you're on your own from here on.

Vi keys in Xcode

I'm surprised no one has asked this yet. What's the best way (if any) to get a Vi experience in Xcode? I know about ViMate but TextMate doesn't come close to Xcode in terms of integration and code completion.
BTW, I am using Xcode 4.
You might want to try out xVim which seems to be an active project. The currently indicate that it works with XCode 4.2, Espresso and Chocolat. Presumably you could selectively enable it with other applications.
Here's another plugin which I made a few weeks ago.
http://programming.jugglershu.net/softwares/xvim.html
This is currently developed for personal (my) use. So you may feel bad with some lack of implementation. Give me a feed back(feature request) then. I'll add some keybinds if I have enough time.
The closest you'll get is http://www.corsofamily.net/jcorso/vi/, or configuring an external editor. This has been a long-standing deficiency with XCode. (If you ask any vi user that is..)
OSX and XCode in general favors Emacs key bindings.
More info on general key-binding strategy for OSX: http://hints.macworld.com/article.php?story=20060317045211408
Right now, I productively use XVim†. I'll probably try $20 ViCiOUS, which seems more polished; I like having source access to my tool-chain, but this is for Xcode, so c'mon me.
† Not xVim, which I just discovered, but apparently face down in the pool. In the [Xx][Vv]im namespace, Xvim (à la Xcode) would have made more sense to me. There, I said it.
Here's another choice: KeyRemap4MacBook.

Programming a terminal emulator, what's in it?

This is related somewhat to this question about a better shell terminal/gui-interface for cmd.exe
In my quest to find a better shell terminal, the only useful thing I came across was Console2, other alternatives weren't free and generally didn't offer much more than Console2 to make them worth their price.
I can't help but wonder, "how come"? The shell terminal is a very valuable tool to a programmer, yet no one came around to try and do a better job than cmd.exe (except for the guys # console2)??
Surely designing a command line shell terminal emulator can't be such a hard task!
Has anyone tried writing a shell terminal emulator before? What's in it? Any resources out there (say, if I want to program my own shell)?
UPDATE
17/07/2009
I rephrased the question, what I was referring to as a "shell" is actually called a terminal emulator (at least in the linux world). I only realized this recently so I thought I should revisit this question and fix it.
There are plenty of shells around for Windows, bash under Cygwin is the one I use the most, and it's certainly free. I have to be honest here, cmd.exe has come a long way since the batch file processor of MSDOS. It's actually quite powerful, but still not a pimple on the rear end of bash :-).
You should try to write a command line shell, it will be an education for you. It's not that hard to do the basics if all you want is a program launcher.
But, if you want all the power of a real shell, including a full blown programming language, job control, piping, output redirection and (seriously) too many other things to list, we probably won't be hearing from you for a while. Except when you pop up your head to ask us esoteric questions about how shells should do this or that.
What about PowerShell from Microsoft? AFAIK it's free, and gives you C# power right in the shell, and tons of other features. But, it DOES require the NET Framework...
I won't endorse it yet, as I haven't really used it, but it's on my list to do...
My bets are on Powershell for the future if you are a Windows guy.
PowerShell will be installed by default on Windows Server 08 R2 (WS08R2) and Windows 7 according to MS.
I have used Powershell myself and found it to be very useful, and if you are familiar with .NET then its all the more easier.
Download a two page reference document here, this is all you will need to get started.
I mean the gui-interface part that displays the text,
Ah! you mean what we call a "pseudo-tty" or a "terminal emulator" in unix. In windows, I guess it is called a "console host". I do not use windows, but I heard that console2 is very good.
Seems there are others:
http://www.powershellanalyzer.com/
http://powershellide.com/
http://www.codeplex.com/PoshConsole
and, of course, for real programmers, you have the shell mode of (x)emacs :-)
Erm... what about all the ports of Unix command shells to Windows?
Just go with cygwin and log on using PuTTY. So much better than the standard console. :)
Also, Python (or perl for that matter) can replace the shell entirely.
You might want to try Take Command Console, formerly 4NT, formerly 4DOS.
Quick summary of points you might care about:
Command line editing with filename completion, history, and cut & paste
Integrate PERL, Ruby, REXX, Python, and any Active Scripting language
Fast - 20-200% faster output display than the standard Windows console
Integrated file explorer - examine directories, drag and drop files
Upwardly compatible with CMD.EXE with literally thousands of additions
Not free (except trial version) and not open source. I haven't tried it myself, but I was a 4DOS junkie back in the day, before Cygwin.
If you need handy terminal - give a try to ConEmu (I'm the author). It is a Windows console window enhancement (local terminal emulator), which presents multiple consoles and simple GUI applications as one customizable tabbed GUI window with dozens of features.
Another answer and comments

List of macOS text editors and code editors [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I searched for this and found Maudite's question about text editors but they were all for Windows.
As you have no doubt guessed, I am trying to find out if there are any text/code editors for the Mac besides what I know of. I'll edit my post to include editors listed.
Free
Textwrangler
Xcode
Mac Vim
Aquamacs and closer to the original EMacs
JEdit
Editra
Eclipse
NetBeans
Kod
TextMate2 - GPL
Brackets
Atom.io
Commercial
Textmate
BBEdit
SubEthaEdit
Coda
Sublime Text 2
Smultron
WebStorm
Peppermint
Articles related to the subject
Faceoff, which is the best text editor ever?
Maceditors.com, mac editors features compared
Thank you everybody that has added suggestions.
I thought TextMate was everyone's favourite. I haven't met a programmer using a Mac who is not using TextMate.
I haven't used it myself, but another free one that I've heard good thing about is Smultron.
In my own research on this, I found this interesting article:
Faceoff: Which Is The Best Mac Text Editor Ever?
Emacs
Vim
But I use TextMate, and can say that it is, without a doubt, worth every penny I paid for it.
Sublime text is awesome (http://www.sublimetext.com/2). Excellent search features, very fast and lightweight. Very decent code completion.
I also use RubyMine and WebStorm a lot (http://www.jetbrains.com/). They are excellent but not all purpose like TextMate.
MacVim and SubEthaEdit are two nice options
I've tried Komodo out a bit, and I really like it so far. Aptana, an Eclipse variant, is also rather useful for a wide variety of things. There's always good ole' VI, too!
If you ever plan on making a serious effort at learning Emacs, immediately forget about Aquamacs. It tries to twist and bend Emacs into something it's not (a super-native OS X app). That might sound well and all, but once you realize that it completely breaks nearly every standard keybinding and behavior of Emacs, you begin to wonder why you aren't just using TextEdit or TextMate.
Carbon Emacs is a good Emacs application for OS X. It is as close as you'll get to GNU Emacs without compiling for yourself. It fits in well enough with the operating system, but at the same time, is the wonderful Emacs we all know and love. Currently it requires Leopard with the latest release, but most people have upgraded by now anyway. You can fetch it here.
Alternatively, if you want to use Vim on OS X, I've heard good things about MacVim.
Beyond those, there are the obvious TextEdit, TextMate, etc line of editors. They work for some people, but most "advanced" users I know (myself included) hate touching them with anything shorter than a 15ft pole.
CotEditor is a Cocoa-based open source text editor. It is popular in Japan.
Best open source one is Smultron in my opinion, but it doesn't a torch to TextMate.
There's a new kid on the block - PHPStorm. I used it for a whole year. Its not free but offers an individual license of 49$ for a year, free for Open Source Developers.
Speedy for an IDE - Its based on Java so looks somewhat like Eclipse/Netbeans but smokes them to dust in terms of speed (not as fast as Coda/Textmate as this is an IDE).
Keyboard shortcuts galore - I seldom touched the mouse while developing using PHPStorm (that's what I didn't like about Coda)
Subversion support built-in - Didn't need to touch Versions or any other SVN client on Mac
Supports snippets, templates - zen-coding is supported as well
Supports projects, though in separate windows
File search, code search
code completion, supports PHPDoc code completion too
BBEdit makes all other editors look like Notepad.
It handles gigantic files with ease; most text editors (TextMate especially) slow down to a dead crawl or just crash when presented with a large file.
The regexp and multiple-file Find dialogs beat anything else for usability.
The clippings system works like magic, and has selection, indentation, placeholder, and insertion point tags, it's not just dumb text.
BBEdit is heavily AppleScriptable. Everything can be scripted.
In 9.0, BBEdit has code completion, projects, and a ton of other improvements.
I primarily use it for HTML, CSS, JS, and Python, where it's extremely strong. Some more obscure languages are not as well-supported in it, but for most purposes it's fantastic.
The only devs I know who like TextMate are Ruby fans. I really do not get the appeal, it's marginally better than TextWrangler (BBEdit's free little brother), but if you're spending money, you may as well buy the better tool for a few dollars more.
jEdit does have the virtue of being cross-platform. It's not nearly as good as BBEdit, but it's a competent programmer's editor. If you're ever faced with a Windows or Linux system, it's handy to have one tool you know that works.
Vim is fine if you have to work over ssh and the remote system or your computer can't do X11. I used to love Vim for the ease of editing large files and doing repeated commands. But these days, it's a no-vote for me, with the annoyance of the non-standard search & replace (using (foo) groups instead of (foo), etc.), painfully bad multi-document handling, lack of a project/disk browser view, lack of AppleScript, and bizarre mouse handling in the GVim version.
jEdit runs on OS X, being Java-based. It's somewhat similar to TextMate, I think.
Editra looks interesting, but I've not tried it myself.
TextMate not for "advanced programmers". That does not make sense, TextMate contains everything an "advanced programmer" would want. It allows them to define a bundle that allows them to quickly set up the way they want their source code formatted, or one that follows the project guidelines, quick easy access to create entire structures and classes based on typing part of a construct and hitting tab.
TextMate is my tool of choice, it is fast, lightweight and yet contains all of the features I would want in a tool to program with. While it is not tightly integrated in Xcode, that is not a problem for me as I don't write software for Mac OS X. I write software for FreeBSD.
Definitely BBEdit. I code, and BBEdit is what I use to code.
You might consider one of the classics - they're both free, extensible and have large user bases that extend beyond the Mac:
Aquamacs - emacs for OS X (emacs in a shell window is also an option)
Mac Vim - VI with a Mac-specific GUI (vim in a shell window is also an option)
I prefer an old-school editing setup. I use command-line vim embedded in a GNU Screen "window" inside of iTerm.
This may not integrate well with XCode, but I think it works great for developing and using command-line programs. If you spend any significant time working in a terminal, GNU Screen is worth the 30 minutes it takes to master the basic terminal multiplexing concepts.
Coda's great for PHP/ASP/HTML style development. Great interface, multiple-file search and replace with regexp support, slick FTP/SFTP/etc integration for browsing and editing remote files, SVN integration, etc.
It now supports plugins and the plugin editor can import TextMate bundles, so there's a bright future there. There aren't a lot of must-have plugins yet because the plugin support was newly introduced with version 1.6 a few months back. It's a popular app, though, so I expect more in the future.
The "killer features" for me are:
* Seamless editing of remote files
* Code navigator (symbol browser; pane that lists functions etc)
Most people aren't really into using symbol browsers but as I have to maintain a lot of unfamiliar code I find them invaluable.
I'm not sure that Coda has the "raw power" of TextMate though. I plan on getting familiar with TextMate next.
I make use of Komodo IDE. It supports a huge number of languages, and is customisable but is a bit expensive (my company bought me a copy). A really good alternative is the free version called Komodo Edit. Loads really quickly and has a decent feature list and I find myself turning to it rather than the full IDE for a lot of jobs.
Smultron is another good (and free) one.
I actually prefer EditRocket over TextMate. I use it on both my Mac and Ubuntu machines. It is nice to use the same editor on multiple operating systems.
Textmate is state of the Art editor, but if someone is thinking about developing on several platforms without awkward memory eaters monsters like jedit, eclipse, netbeans etc take a look at geany (geany.org). It is free. The only problem the editor has not esthetic look and feel on Mac OS X :)
Fraise is a nice free option. It has some rough edges, but you can't beat the price. I believe it's a fork or successor of Smultron.
SubEthaEdit
Coda
DashCode with OS X 10.8 or older
Eclipse and its variants.
Netbeans
I use Eclipse as my primary editor (for Python) but I always keep SubEthaEdit handy as my supplemental text editor (free trial, 30 euros to license). It's not super-complicated but it does what I need.
Another vote for Smultron. I used it when doing some XQuery programming and being able to define a keyword files for syntax color highlighting was great.
I have installed both Smultron and Textwrangler, but find myself using Smultron most of the time.
I would love to use a different editor than XCode for coding, but I feel, that no other editor integrates tightly enough with it to be really worthwhile.
However, given some time, TextMate might eventually get to that point. At the moment though, it primarily lacks debugging features and refactoring.
For everything that does not need XCode, I love TextMate. If I had another Mac-user in my workgroup I would probably consider SubEthaEdit for its collaboration features. If it is Emacs you want, I would recommend Aquamacs (more Mac-like) or Carbon Emacs (more GNU-Emacs-like)
I've been using BBEdit for years. It's rock-solid, fast, and integrates into my Xcode workflow decently well. (I'm not sure anything integrates into Xcode as well as the built-in editor, but who has time to wait for the built-in editor?)
For small team projects which don't use a source control system, or for single user editing on multiple machines, SubEthaEdit comes highly recommended.
Eclipse and Netbeans have text editors among a whole lot of other stuff. I don't think you would want to wait 10 seconds for your text editor to become ready :/...If you are going to spend some serious time coding then spend some time and learn to use vim (emacs too but, I recommend vim)

Resources