How to quickly get started at using and learning Emacs [closed] - emacs

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
There are all sorts of advantages to using Emacs, but for someone comfortable with the usual Win32 applications it comes with a wall-like learning curve. With most other editors it’s possible to just start using them and then learn about their other features and enhancements as you go along.
How to just get on with using Emacs straight away, with the aim of reaching that point where you actually prefer to use Emacs over other editors or applications?
Edit - To try and clarify the question: I’ve done the tutorial, read some docs, etc. then soon after when I’ve wanted to quickly edit some text it’s been easier to just use another editor, that I already know. What do I need to do so that not only I don’t just go for another easier editor, but that I actually prefer to use Emacs, and how to get here as quickly as possible? What if any are the training wheels for Emacs?

The biggest thing about learning how to use Emacs is ... (drumroll please) learning how to use Emacs.
Okay, okay, okay. It's a silly answer, and it's a tautology, but it's true. If you start up Emacs, and think to yourself "How could I find every instance of the word 'foobar' in my source tree?" the worst thing you could do is hit Alt + Tab and visit Google.
Seriously.
Learning the help system and how it works is the best thing you can do. It's so nice to just hit C-h a find, and suddenly get all the information you need, right at your fingertips.
The next best thing you could do is install a wonderful little package called Icicles which has some seriously groovy completion functions. After you get it installed, just know that anytime the minibuffer is asking for some kind of input, you can now use regular expressions.
How would this apply to finding every file in your source tree? Well, you'd hit M-x, and then type "find". After that, you could hit (for instance) Shift + Tab and Icicles would kick in, finding every command that prefixes with "find". Alternatively, you could do M-x .find. and it would give you any command with find in it.
Build a cheat sheet. Just keep a saved buffer somewhere that has all of the keyboard shortcuts you use frequently in it. Remove the ones that you know off by heart, and pick up new ones. In most cases when you do a M-x command, the message buffer will tell you what the keyboard shortcut was for that command (if there was one).
Learn. Keyboard. Macros.
Learn. Emacs. Lisp.
Steven Huwig's idea of using some killer applications is a good one. Emacs is easier to use when you want to use it. For me, it was Planner Mode. (I've just moved to Org-mode, and it's even better.)

spend 20 minutes running the tutorial
ctrl-h t
That will get you to the point where you can be productive (and that "meta" key that you will read about is probably either Escape or alt).

I think it is easiest to find a "killer app" or two that just works best in Emacs. For me, it was the SQL editing and interaction mode for Oracle. Once you're already using Emacs for this killer app, then it will be more attractive to just open up other documents in Emacs rather than another editor.
Potential killer apps:
SQL editing and interaction modes
nxml-mode
AUCTeX
CPerl mode (best Perl mode there is)
PCL-CVS
SLIME
js2-mode (Javascript)

Learning to use Emacs effectively is inherently a slow process, but it's worth it.
Set up a .emacs file right away. You'll want to customize it quite a bit. It sounds silly, but having some kind of source control on that file will help, too.
To make it easier to find out about Emacs' innards, add to your .emacs:
(defalias 'ap 'apropos)
Then when you want to see if there's a command to do "something", type "[Alt-x] ap [enter] something [enter]". Emacs has its own name for stuff, so it can be hard to find things sometimes ("yank"? Seriously? Call it "cut" like everyone else!)
"[Ctrl-h f] function-name [enter]" looks up the help for that function.
"[Ctrl-h m]" shows you details about the current mode, like the keybindings specific to that mode.
Learn to use Ctrl-s and Ctrl-r for incremental search. All text editors need to come with this feature.
Add keybindings to your .emacs like:
(define-key global-map (kbd "M-z") 'redo)
(define-key global-map (kbd "C-z") 'undo)
Get the redo.el package to make Emacs' redo suck less.
iswitchb-mode is invaluable. It lets you have dozens of buffers open at once and switch between them in a blink of an eye. Set up iswitchb and add to your .emacs:
(iswitchb-mode)
(define-key global-map (kbd "M-RET") 'iswitchb-buffer)
To evaluate an emacs-lisp expression, type the expression into a buffer, put the cursor just after it, and type "[Ctrl-x Ctrl-e]". This lets you experiment with different customizations easily.
Remember, you don't have to let go of ctrl when typing a sequence like that.
See where a string occurs in a buffer with the "occur" function. Here are some handy functions and keybindings for that:
(defun word-at-point ()
(thing-at-point 'word)
)
(defun word-at-point-or-selection ()
(if mark-active
(regexp-quote (buffer-substring (mark) (point)))
(concat "\\")
)
)
(defun find-word-at-point ()
(interactive)
(occur (word-at-point-or-selection))
)
(define-key global-map (kbd "C-o") 'find-word-at-point)
(define-key isearch-mode-map (kbd "C-o")
(lambda ()
(interactive)
(let ((case-fold-search isearch-case-fold-search))
(occur (if isearch-regexp isearch-string
(regexp-quote isearch-string))))))

My ideas on how to come up to speed faster:
Find another Emacs user and watch them a few minutes every day
Have the Emacs user watch you (and provide feedback)
Find more Emacs users and repeat steps 1&2
Subscribe to the planet emacsen feed to see what other Emacs folks are learning
Follow the emacs tip of the day twitter
Try to answer folks Emacs questions on SO
I've been using Emacs for 15+ years and I learn a new thing every day by doing the things above.

Like #Claudiu said, just use it. Just bumble through and let your needs drive your learning curve.
Eventually you will get to a point where you "know enough to be dangerous", while not really mastering the environment. That's OK. Because at this point you'll likely be quite productive. You'll have the basic skills and tools.
In time, you'll run in to things that you do every day that you're simply sick enough of to try and take the time to find a "better way". Normally, your base skill set is enough to get by, enough that the (potentially unknown) time invested in to some alternate path isn't worth the cost, especially for something rare.
But, you may have free time, or the task might be big enough to justify looking deeper.
At these points you'll become more of an expert Emacs person than a journeyman user.
While I personally no longer use Emacs (instead relying on an IDE), I will say that while Emacs is quite complex, you need only know a small subset to make it useful and fun. I will also say that I've never "screamed at Emacs", whereas I scream at my IDE all the time. Yes, Emacs was doing less than what my IDE was doing, but I am seriously getting to the point that it might be worth my time to go back to it, and stop the screaming.
I just get this sense that Emacs is more "deterministic" than my IDE which likes to go traipsing off in to lala land every now and then, or require a restart, or whatever.
I've never personally crashed Emacs (which some will say means I'm not using it hard enough...)

Basic text editing with emacs is no more complicated than doing the same with Notepad. Just use it like it's notepad, but as you explore the menus, take note of the keyboard shortucts. Slowly you'll start to pick up things. When you want to do something and you don't know how, there's help available as a pulldown from menus, just like with other editors.
I guess the only "trick" I'd suggest is that after you open up a file for editing, try ctrl-h m to pull up a list of the keyboard bindings that work in that buffer's mode.

My advice is:
Learn the very basics (how to type, save a document, turn on syntax highlighting, maybe copy and paste). You can look up how to do these online (google "emacs tutorial" maybe)
Start using it.
Whenever you wish you knew how to do something, then look up how to do it. You might have to look the same thing up 3-4 times before you get it, but then you will learn it.
Keep doing this. It'll be annoying at first, but then you'll get used to it, and then you might even enjoy using it!
(DISCLAIMER: Personally I just use another editor).

Turn on icomplete-mode and you will often see functions that look useful when poking around.
(icomplete-mode t)
In your .emacs file.
C-h f will let you look up the docstring for a function, and C-h v will do the same for a variable. With icomplete, this is great for exploring.

As you learn basics like key commands, make your own cheat sheet. Of course find and plunder existing cheat sheets, but be sure to make your own and categorise the shortcuts / key bindings to groups that make sense to you. This will help you learn the basics and retain the memory.
Aim to customize Emacs into the editor you want, this is the single biggest advantage to using Emacs, and it will help you learn about all it's features and how it's extended.
Be glad that, relatively speaking, learning Emacs is much easier thanks to the community here on SO and other places like EmacsWiki. :)
Work from this point onward... a) Key bindings and customize. b) Macros and the macro editor. c) Elisp and your own custom libraries.
It's also worth noting that setting Emacs up to work like a more modern App, can be painful, you will need to do things like run the emacs server, and use the emacs client.
Thankfully (re: 3) there is a lot of help available on the net, but if you have direct access to a seasoned Emacs user, consider yourself lucky.

Related

Definitive guide for Emacs learners [duplicate]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am about to learn Emacs, have been through the tutorial and borrowed the O'Reilly book on Emacs. But the question still is - how do you learn good Emacs workflow? I guess, you don't use Emacs as you'd use, for example, Vim.
This question seems revelant to mine:
- Where can I find a video of a professional using Emacs?
I can't believe nobody has mentioned this, but reading the info pages bundled with Emacs is a great way to learn about obscure features. Whenever you need a break from coding, hit M-x info and pick a random page to read. Your emacs ability will improve incredibly quickly.
It is also important to realize how emacs' self-documenting-ness helps you work. Say, for example, you are wondering how you can scale the font size. Instead of interrupting your flow and asking here, or on IRC, or Google, you can ask emacs! Just hit C-h a (M-x command-apropos) and type a search term, in our case scale. If there are matching functions, their names, keybindings, and documentation will appear. There are, and now you've just discovered text-scale-increase and text-scale-decrease.
There are other self-documentation functions that are good to learn C-h m will tell you what keybindings and commands are available in the current major and minor modes. This is a great way to discover features you didn't know existed.
Another way to "learn by osmosis" is to M-x customize-group for the modes you use regularly. (customize is the interactive configuration editor that almost all modes support.)
The final thing to do is to learn Emacs Lisp. It is nice to use existing tools, but sometimes you will need your own. If you try to avoid learning Lisp, you will always be stuck with things not quite working right, and that's a shame.
Emacs is a great environment for customizing itself. Emacs includes two Lisp manuals that are viewable via M-x info. It is self-documenting, so you can say C-h f or M-x describe-function to get the documentation for any function. You can even press TAB ENT to jump to the source code of that function, to see how it's implemented. This is great when you think "I wish I had something that worked like foo, but just slightly different." You can read how foo is implemented, make your change in the *scratch* buffer, and then see if you like the change. There is no edit/compile/test cycle. You press a key and your emacs session immediately has the feature you just wrote.
The more effort you put into learning emacs, the more emacs will do to make your work easier.
Once you mastered the basics (opening/closing files, navigating, basic editing) just use it. As with a lot of other tools, practise makes perfect...
I would, however, set some time aside to work on improving how you use the editor currently, but as part of your normal workflow as opposed to just going off on a tangent and learning things for the sake of it.
I find some useful resources are the EmacsWiki and the Planet Emacsen blog. I use both, mainly by using Planet Emacsen for "inspiration" and then wandering over to EmacsWiki and having a trawl on there for a specific topic. I found that unless you're having at least a vague idea what you're looking for, the available information is just going to swamp you instead of it actually being helpful.
Not to mention that there are a few very useful resources here on StackOverflow, for example this question here. Emacs is a very powerful tool that tends to be able to do a lot more than a single person needs, but in the end that allows you to pick and choose exactly those parts that you need.
My suggestion is just stop using anything but Emacs, when you come across a problem see if you can solve it in Emacs, and then fall back (if you don't have the time or it just won't work). As for work flow, it is pretty much the same as you would normally work. i.e. for a normal ide session you would open/edit a file as normal, then commit (in C-x v v) just as normal.
I agree with the other posters here, you just have to use it! Here's how I did it:
Once I got the very basics (can get between buffers, open/save files, etc), I printed out a reference card and kept it handy. This is a good one. Review it just so you know what is on it, then whenever you find yourself doing something repeatedly that is on the card, start using the shortcut! Before you know it you'll have memorized quite an arsenal of commands. But remember, probably no one uses everything that emacs can do.
When you eventually find yourself doing something repeatedly that doesn't have a shortcut, that's a good time to learn keyboard macros. Once you get them, you'll find uses for them everywhere! From there it's a short jump to writing elisp (if you're a programmer).
The great thing about emacs is that you don't need an "emacs workflow", emacs works around your workflow!
You don't need to learn emacs workflow. Once you complete the tutorial and master the essentials, you'll have to adopt some degree of monogamy and use nothing but Emacs. Eventually you will think of functionality that you really wished existed; most of the time somebody else will have as well and the solution is just one search away! Over time you just can't help but learn and eventually you'll pick up enough that you'll develop your own personal workflow.
If you're looking to accelerate the process, the Emacs wiki has a variety of tips but really the best way is just to do stuff with Emacs.
You could have a look at Bram Molenaar's talk about efficient textediting, http://video.google.com/videoplay?docid=2538831956647446078&ei=EqiGSau8KZ-QiQLi-Nn8Cg&q=bram+molenaar+editing
Although he's a vim guy (he wrote it), you might get some ideas about how best to go about becoming more proficient with your text editor that'll apply to emacs.
To be honest, all I do is learn the keybindings I need. I don't use emacs to its full potential, because I don't need its full potential. My suggestion is to just learn what you need, and don't worry about what you don't. Learn a new key binding everyday, and in about 300 years will you know them all ;)
I am using the emacs since the old Amiga days on all platforms i am currently working on.
The best way to use emacs is curiosity. I still use often apropos (C-h a) and M-x (for a long functionname instead of key-binding) to find a functionality.
a key-concept to "proper use" Emacs is, to learn the very easy elisp (a simple derivate of lisp) and write your own little helpers (own commenting style, underlining, templates) and to know where to look to change values (tab-size, compiler, email)
And the third thing: everything is in emacs: I use the dired (directory editor) for navigating through files. I use a lot of buffers for all textual files (with proper modes for each type of file (c, ruby, list, sql, latex, ...)) which are stored when quitting emacs and recovered when invoking. I start the compiler from emacs and use the jump-to-error-functionality.
Macros are a daily routine (scimming throu code and changing it on the way).
I like the picture-mode, which allows to type downward with replacing, which makes it easy to renumber block of constants (good old c #defines))
There is a hugh mountain to climb, but if you have reached the top, you can see the whole world down your feet, and never want to miss this experience again. I know, there are many good editors around (i work myself thru Eclipse)
As previously stated, the best advice is to use nothing but Emacs for the next year. Once you develop your finger memory, things get to be much easier.
How do you learn a "good workflow" for anything? By using it, getting to know it, making it yours. There is no "proper" use of Emacs.
As for getting to know it: ask Emacs -- use its help system. This can help too: http://www.emacswiki.org/emacs/EmacsNewbieWithIcicles
That's the power of Emacs, you use it the way you like. You just have to configure it before for your liking.

What guide should I read to start learning Emacs? [duplicate]

This question already has answers here:
How do you learn proper Emacs? [closed]
(11 answers)
Closed 9 years ago.
I don't really know if this is a decent question or not, but I am fairly new to programming and looking for a good text editor to use. I have read this question on Unix.SE and this question on SO which have convinced me that Emacs is the way to go. But I can't really find any good documentation that is aimed at people who have no idea what "M-x-foobar" means. Once again, this is probably too subjective for SO, but I thought I would try anyway.
If you're just starting programming, you've probably got enough on your plate without dealing with a crazy moon editor! gedit (Linux), Notepad++ (Win) or TextWrangler (OS X) are all free and may be more familiar to you.
Still, Emacs is great if you're game. I learned from a couple of resources:
O'Reilly's Learning GNU Emacs
Emacs' built-in tutorial - press Ctrl-h and then t.
These got me up-and-running quickly.
After you've learned the very basics, you'll want customize Emacs to make it more confortable. Download someone's Emacs configuration off GitHub and tweak that. The Emacs Prelude is very good.
From then on, it's all about building muscle-memory:
Try to use Emacs for all the random mundane typing and editing you normally do
Use the Emacs movement keys wherever you can, such as in your terminal program
If you use OS X, most of the emacs movement keys work in text fields. Use those instead of the arrow keys to move around.
Emacs has a reputation for being hard on your hands - the key combos were designed for older keyboards from a more civilized age. If your pinky starts to hurt while you're learning, it's a good idea to remap your Caps-Lock key as Ctrl.
According to my experience, Emacs is a huge topic to cover. I'd suggest you to start with its tutorial by selecting the first entry in the "Help" menu (or pressing Ctrl+h, then pressing t, which is denoted C-h t in Emacs style).
Then just follow your needs by reading specialized articles or documentation. A bunch of useful information you may find in an Emacs Info, which can be called by C-h i (Ctrl+h, then i).
Knowing at least a bit of Emacs Lisp would be very useful as it's used to configure the editor and sometimes helps understanding how some things work. For that you may find useful An Introduction to Programming in Emacs Lisp (but you may find it in Emacs Info as well).

Do I need to know Emacs Lisp in order to use GNU/Emacs

Recently, I began studying GNU/Emacs. Was very easy to use program. Studied its structure. Tuned nice color for me. Configure it to class on C programming. Everything seemed normal. But now the question arose of GNU/Emacs lisp. Should I really spend time to study Emacs Lisp if I did not develop itself Emacs and will only use it like ide for C/C++ development, mail, jabber and etc...
The fact is that when I edit my .emacs I understand that I write. But I write mostly ready-made scripts or if its something they are very simple.
Thank you.
No, it's not strictly necessary. You will probably write elisp, but mostly just set variables and insert the necessary snippets for any mode or package you want to use (setq, require etc). Most of that is done by copying and pasting, so no real knowledge of elisp is required.
Having said that, defining small functions can be quite useful, and learning enough Emacs Lisp for that might prove useful. Look at Xah Lee's tutorial, it's quite short and succinct.
Emacs Lisp is what you turn to if you want to automate some kind of editing in your document where going through the UI is just too tedious or slow.
Here's an example: I had to do some refactoring in my company a while back. It involved moving around a bunch of methods to a bunch of files. To help people who would be merging our code during the transition, we left "headstone" comments in the old location telling them where the new code would be. The headstones involved commenting out the entire function (including the declaration), deleting the body of the function, and putting a comment in the body's place instead.
After a handful of these, and dozens to go, I was ready to tear my hair out from boredom. So I cobbled the following commands together and stuck them in my ~/.emacs file. You may be able to get the gist of what they do, even without much in the way of comments.
(defun reheadstone-region (fname beg end)
(interactive "sFilename to use: \nr")
(save-excursion
(save-restriction
(narrow-to-region beg end)
;; comments around entire thing
(goto-char (point-min))
(insert "/*\n")
(goto-char (point-max))
(insert "\n*/\n")
;; zap the method body
(goto-char (point-min))
(search-forward "{")
(forward-line)
(push-mark (point))
(goto-char (point-max))
(search-backward "}")
(beginning-of-line)
(kill-region (region-beginning) (region-end))
(pop-mark)
;; new headstone body
(headstone-in fname))))
(defun headstone-in (fname)
(interactive "sFilename to use: ")
(save-excursion
(beginning-of-line)
(insert (format "\tThis method has been moved to %s." fname))))
This was a quick and dirty hack, and far from perfect in its operation no doubt. But after loading it up and binding it to a key, and directing it a bit by selecting the region surrounding the function I wanted to headstone before executing the command, I was doing a whole series of tedious edits with practically no effort at all. Plus, I got the rush of pleasure from the instant gratification that this code afforded me. My coworkers were wondering why I looked so cheerful as I breezed my way home for the day, especially after looking so grumpy at lunchtime.
That's the sort of thing Emacs Lisp can do for you. I suppose you could argue that this is no different from "developing Emacs itself", since these commands hardly look any different from Emacs's built-in commands from the UI point of view, but the psychological effect is very different. I'm extending the editor with very specific commands in very specific ways to achieve tasks for my project that would be difficult or impossible without a full scripting language and editor API at my disposal. From my point of view (and I've come to this view lately), an Emacs user without some basic facility with Emacs Lisp has not yet become a power user.
The short answer in "No", however having some knowledge of Emacs Lisp will empower your productivity greatly in some areas.
If you decide to spend some time studying Emacs Lisp I cannot recommend you a better starting point than the excellent book "Introduction to Emacs Lisp"(it also comes bundled with Emacs in info format - C-h i m Emacs Lisp Intro).
A basic amount of Emacs Lisp is really good to know, in my opinion (for example: customizing key bindings, understanding the .emacs file).
If a deeper knowledge of Emacs Lisp is required, depends on whether you're content with emacs as it is or not.
I suppose, that most problems you'll encounter are already solved by someone else. So there's quite a good chance of getting a nice .el file somewhere doing exactly what you want.
However, if there are some exotic features that you want to implement, learning Emacs Lisp might be an option. Another point is that Lisp is an actually used programming language in industry, so it's never bad to know it (ok, it's Emacs Lisp, but it's similar to it).
I've been using Emacs for a while and can tell that if you're ok with features provided with modes you're using, and hence have no need to improve them, there's no real need to study elisp. A little of elisp is required to write your emacs config, but there's fairly small range of language features you will need.
By the way, if you will want to extend some functionality, there's possibility to script emacs using other languages (like python, perl, don't remember which ones are there), so learning elisp isn't so critical. Probably, you may find out more starting with this emacs wiki page: http://www.emacswiki.org/emacs/CategoryExtensionLanguage
As you are a beginner, don't worry too much about Emacs Lisp. Become proficient with the editor. Most of the extensions/modes that we normally need are already there. But learning Emacs Lisp is a worthy effort. ELisp is not just for customizing Emacs, it is a full programming language. It can do a lot of stuff like interacting with the file system, networking, GUI etc. Once you get familiar with ELisp, there is a chance that you drop C/C++ and start developing your applications in ELisp itself! Deploying your application will also become easy as Emacs/ELisp has been ported to a lot of architectures and it can act as your deployment platform.
It's certainly not necessary to be able to write your own elisp, but it can be very useful. Probably the most useful ability this will give you is the ability to 'fix' things that don't work quite the way you want them to, often by writing your own hooks or advice. So if you enjoy using Emacs, but you find that things aren't always to your liking, then I would definitely recommend that you start to learn elisp.
Don't feel that you have to know it all, but just be willing to pick up bits and pieces over time, and you will undoubtedly find that Emacs becomes better and better as time goes on.
Make sure you search for solutions before you start coding something, though -- in a great many instances, someone has already done the hard work for you :)
I'm a Vim user myself, but I have played around with GNU/Emacs. Your .emacs file is emacs lisp, so if are writing your own configuration of things, you are already using Emacs Lisp. :) Also, you can eval lisp expressions to perform various operations, but I don't think you need to really worry about that - especially if you are sticking to highly-used/developed modes (C/C++, etc). It's all about if you want to open a single program - Emacs - and have it contain your email, irc, and web browser, or use it as a text editor. But most of those previously mentioned things are already written for you - so... it's a tossup.
Depends what your goals and your interests are. Some people learn Emacs Lisp in order to use Emacs. Some people learn Emacs in order to use Emacs Lisp. ;-)

How to change emacs config in Lisp In A Box

I have been a programmer for a decade now, but I believe this is the first time I've ever asked a question on a forum. I just can't figure this out and can't find the answer already online.
I am trying to turn on CUA mode so that emacs is more bearable for a windows user (normal copy paste functions). I am running Windows 7 and installed emacs through the Lisp In A Box package. I understand that I need to add a line to my .emacs file or init.el file. I'm not sure which, but I can't find either in my Lip In A Box install directory. The emacs package install also did not come with any tutorials or help files, so its really hard to pick this up.
I am stuck, any help is greatly appreciated!
The .emacs can be found by looking at the answers to this similar question.
Regarding documentation and tutorials, it looks like the link you provided for "Lisp in a Box" says:
If you are new to Emacs, it is
recommended that you read the Emacs
Tutorial which you can access from
with Emacs by going to the Help menu,
or by typing Control-h, letting go,
and hitting t. A more extensive manual
is also available from the Help menu,
or on the web at
http://www.gnu.org/software/emacs/manual/.
Which makes it sound like the manual is there, and certainly the tutorial (I made bold the directions to get to the tutorial).
As far as other places to get information, there is a collection of screencasts on the wiki.
Your question doesn't specify whether or not you what to add to your .emacs to activate CUA mode. You can check out the CUA mode documentation on the wiki (which has links to the manual). The minimal installation is just adding this to your .emacs: (cua-mode t).
For GNU/Emacs, you can choose to use any one of the following three file names as the start-up configuration file:
${HOME}/.emacs
${HOME}/.emacs.el
${HOME}/.emacs.d/init.el
It would probably be a good idea to decide on one of the three options and then stick to it - the first one seems to be the most widely used one. In any case, ${HOME} stands for your home directory -- which is likely to be different from the Lisp In A Box install directory!
Coming from a Unix tradition, Emacs understands ~ (tilde) as an abbreviation for your home directory, so you can visit the .emacs file by typing:
C-x C-f ~/.emacs [ENTER]
(Note that the capital C is Emacs standard notation for a combination of the CTRL key and a second key, i.e. here you press CTRL-x CTRL-f which stands for "find-file" and will then ask you for a file name in the bottom part of the Frame (aka mini-buffer).)
If these are your first customizations, you will just see an empty buffer. Enter
;; start CUA mode every time Emacs starts
(cua-mode t)
and save the buffer with C-x C-s.
Next time you start Emacs, CUA mode should be turned on automatically.
What the others have told you is true: Simply adding (cua-mode t) to your dotfile would be sufficient. HOWEVER: Lisp in a box' Emacs doesn't load this file by default.
Therefore, be sure to edit the shortcut so that it does load the dotfile. This is important, because otherwise you would get weird behavior, where you would add the correct line to the dotfile, start emacs, and then not get cua mode. That would suck.
The reason it does this is to ensure that it starts a vanilla emacs everytime, instead of finding, say C:/_emacs and loading that instead, giving you another user's customizations and confusing you.
The flag for not loading an init file is -q or --no-init-file. Also make sure that --no-site-file is not there.
(I realize that this is an old post, but I found this while looking for something related, and I don't want people walking away frustrated over something that doesn't work.)

How do you learn proper Emacs? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am about to learn Emacs, have been through the tutorial and borrowed the O'Reilly book on Emacs. But the question still is - how do you learn good Emacs workflow? I guess, you don't use Emacs as you'd use, for example, Vim.
This question seems revelant to mine:
- Where can I find a video of a professional using Emacs?
I can't believe nobody has mentioned this, but reading the info pages bundled with Emacs is a great way to learn about obscure features. Whenever you need a break from coding, hit M-x info and pick a random page to read. Your emacs ability will improve incredibly quickly.
It is also important to realize how emacs' self-documenting-ness helps you work. Say, for example, you are wondering how you can scale the font size. Instead of interrupting your flow and asking here, or on IRC, or Google, you can ask emacs! Just hit C-h a (M-x command-apropos) and type a search term, in our case scale. If there are matching functions, their names, keybindings, and documentation will appear. There are, and now you've just discovered text-scale-increase and text-scale-decrease.
There are other self-documentation functions that are good to learn C-h m will tell you what keybindings and commands are available in the current major and minor modes. This is a great way to discover features you didn't know existed.
Another way to "learn by osmosis" is to M-x customize-group for the modes you use regularly. (customize is the interactive configuration editor that almost all modes support.)
The final thing to do is to learn Emacs Lisp. It is nice to use existing tools, but sometimes you will need your own. If you try to avoid learning Lisp, you will always be stuck with things not quite working right, and that's a shame.
Emacs is a great environment for customizing itself. Emacs includes two Lisp manuals that are viewable via M-x info. It is self-documenting, so you can say C-h f or M-x describe-function to get the documentation for any function. You can even press TAB ENT to jump to the source code of that function, to see how it's implemented. This is great when you think "I wish I had something that worked like foo, but just slightly different." You can read how foo is implemented, make your change in the *scratch* buffer, and then see if you like the change. There is no edit/compile/test cycle. You press a key and your emacs session immediately has the feature you just wrote.
The more effort you put into learning emacs, the more emacs will do to make your work easier.
Once you mastered the basics (opening/closing files, navigating, basic editing) just use it. As with a lot of other tools, practise makes perfect...
I would, however, set some time aside to work on improving how you use the editor currently, but as part of your normal workflow as opposed to just going off on a tangent and learning things for the sake of it.
I find some useful resources are the EmacsWiki and the Planet Emacsen blog. I use both, mainly by using Planet Emacsen for "inspiration" and then wandering over to EmacsWiki and having a trawl on there for a specific topic. I found that unless you're having at least a vague idea what you're looking for, the available information is just going to swamp you instead of it actually being helpful.
Not to mention that there are a few very useful resources here on StackOverflow, for example this question here. Emacs is a very powerful tool that tends to be able to do a lot more than a single person needs, but in the end that allows you to pick and choose exactly those parts that you need.
My suggestion is just stop using anything but Emacs, when you come across a problem see if you can solve it in Emacs, and then fall back (if you don't have the time or it just won't work). As for work flow, it is pretty much the same as you would normally work. i.e. for a normal ide session you would open/edit a file as normal, then commit (in C-x v v) just as normal.
I agree with the other posters here, you just have to use it! Here's how I did it:
Once I got the very basics (can get between buffers, open/save files, etc), I printed out a reference card and kept it handy. This is a good one. Review it just so you know what is on it, then whenever you find yourself doing something repeatedly that is on the card, start using the shortcut! Before you know it you'll have memorized quite an arsenal of commands. But remember, probably no one uses everything that emacs can do.
When you eventually find yourself doing something repeatedly that doesn't have a shortcut, that's a good time to learn keyboard macros. Once you get them, you'll find uses for them everywhere! From there it's a short jump to writing elisp (if you're a programmer).
The great thing about emacs is that you don't need an "emacs workflow", emacs works around your workflow!
You don't need to learn emacs workflow. Once you complete the tutorial and master the essentials, you'll have to adopt some degree of monogamy and use nothing but Emacs. Eventually you will think of functionality that you really wished existed; most of the time somebody else will have as well and the solution is just one search away! Over time you just can't help but learn and eventually you'll pick up enough that you'll develop your own personal workflow.
If you're looking to accelerate the process, the Emacs wiki has a variety of tips but really the best way is just to do stuff with Emacs.
You could have a look at Bram Molenaar's talk about efficient textediting, http://video.google.com/videoplay?docid=2538831956647446078&ei=EqiGSau8KZ-QiQLi-Nn8Cg&q=bram+molenaar+editing
Although he's a vim guy (he wrote it), you might get some ideas about how best to go about becoming more proficient with your text editor that'll apply to emacs.
To be honest, all I do is learn the keybindings I need. I don't use emacs to its full potential, because I don't need its full potential. My suggestion is to just learn what you need, and don't worry about what you don't. Learn a new key binding everyday, and in about 300 years will you know them all ;)
I am using the emacs since the old Amiga days on all platforms i am currently working on.
The best way to use emacs is curiosity. I still use often apropos (C-h a) and M-x (for a long functionname instead of key-binding) to find a functionality.
a key-concept to "proper use" Emacs is, to learn the very easy elisp (a simple derivate of lisp) and write your own little helpers (own commenting style, underlining, templates) and to know where to look to change values (tab-size, compiler, email)
And the third thing: everything is in emacs: I use the dired (directory editor) for navigating through files. I use a lot of buffers for all textual files (with proper modes for each type of file (c, ruby, list, sql, latex, ...)) which are stored when quitting emacs and recovered when invoking. I start the compiler from emacs and use the jump-to-error-functionality.
Macros are a daily routine (scimming throu code and changing it on the way).
I like the picture-mode, which allows to type downward with replacing, which makes it easy to renumber block of constants (good old c #defines))
There is a hugh mountain to climb, but if you have reached the top, you can see the whole world down your feet, and never want to miss this experience again. I know, there are many good editors around (i work myself thru Eclipse)
As previously stated, the best advice is to use nothing but Emacs for the next year. Once you develop your finger memory, things get to be much easier.
How do you learn a "good workflow" for anything? By using it, getting to know it, making it yours. There is no "proper" use of Emacs.
As for getting to know it: ask Emacs -- use its help system. This can help too: http://www.emacswiki.org/emacs/EmacsNewbieWithIcicles
That's the power of Emacs, you use it the way you like. You just have to configure it before for your liking.