Questions tagged [emacs]

GNU Emacs is an extensible, customizable, self-documenting text editor, which can be extended with Lisp code. Although Emacs is a general-purpose editor, questions may be on-topic here if they are about extending Emacs itself (usually by writing Emacs Lisp functions) or about specific programming modes. Otherwise (and perhaps also in those cases), consider asking your question on Emacs Stack Exchange.

GNU Emacs is an extensible, customizable text editor. Begun in the mid-1970s as a set of macros on top of TECO, it was re-written using C and Emacs Lisp to provide portability and an extendable interface. It continues to be actively developed today.

Emacs provides context-sensitive editing modes with syntax coloring, is self documenting, has full Unicode support and extensions to do almost anything. It similarly has extensive packaging support through the built-in package.el package.

Emacs' package selection includes color themes, language-specific editing modes, RSS readers, email clients, web browsers, etc. Die-hard Emacs users do almost everything from within Emacs: write, compile, run and debug code; read/compose email; browse the web; do project planning, etc. Some other editors, like Visual Studio or Eclipse, provide Emacs key bindings.

Questions about using and configuring Emacs, not specific to programming, are off-topic for Stack Overflow, but they may be suitable for Emacs Stack Exchange. Questions about extending Emacs using Lisp or other languages, or about programming modes, are usually on-topic here.

Useful Links

Wisdom from Stack Exchange

Books

17686 questions
119
votes
12 answers

Changing the default folder in Emacs

I am fairly new to Emacs and I have been trying to figure out how to change the default folder for C-x C-f on start-up. For instance when I first load Emacs and hit C-x C-f its default folder is C:\emacs\emacs-21.3\bin, but I would rather it be the…
Anton
  • 12,285
  • 20
  • 64
  • 84
118
votes
10 answers

How to swap the buffers in 2 windows emacs

I am using emacs I find that sometimes I have 2 files separated into 2 windows. For example: I open 1 file using C-x C-f file1.c RET and I split the frame into two windows: C-x 3 I then open another file C-x C-f file2.c RET So I have 2 files: window…
ant2009
  • 27,094
  • 154
  • 411
  • 609
114
votes
5 answers

emacs create new file with ido enabled

I reciently switched to emacs starter kit which includes the ido package. ido has a nice feature that suggests paths when find-file which is usually very handy except when trying to create a new file. When the new file name matches a suggestion in…
Kurt Harriger
  • 2,507
  • 4
  • 20
  • 21
113
votes
2 answers

knitr Markdown highlighting in Emacs?

Is there any modification of an existing tool or new tool that will syntax-highlight (colour) blocks of R code in a knitr markdown document when opened in Emacs? The knitr chunks I am looking at are triple-backtick blocks [```] that contain R code…
719016
  • 9,922
  • 20
  • 85
  • 158
113
votes
6 answers

View a file's history in Magit?

View the change history of a file using Git versioning talks about other ways of viewing history of a file in Git. Can it be done in Emacs Magit?
eugene
  • 39,839
  • 68
  • 255
  • 489
113
votes
5 answers

Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctags

I work on C++ projects, and I went through Alex Ott's guide to CEDET and other threads about tags in StackOverflow, but I am still confused about how Emacs interfaces with these different tag systems to facilitate autocompletion, the looking up of…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
112
votes
7 answers

Evil Mode best practice?

I've been using Vim as my primary editor for years and tried Emacs several times during that time. Then I discovered Evil and decided that it meets my demand for speedy movement well enough that I can finally move on to Emacs. So, to all you Evil…
Daniel Duan
  • 2,493
  • 4
  • 21
  • 24
112
votes
1 answer

The difference between setq and setq-default in Emacs Lisp

I have a question about Emacs Lisp. What is the difference between setq and setq-default? Tutorials say setq takes effect in the local buffer while setq-default affects all buffers. For example, if I wrote (setq a-var a-vars-value) in init.el, I…
ruanhao
  • 4,663
  • 6
  • 28
  • 43
111
votes
10 answers

How do I set the size of Emacs' window?

I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my .emacs so that I always get a…
Tom Dunham
  • 5,779
  • 2
  • 30
  • 27
110
votes
4 answers

In Emacs Lisp, how do I check if a variable is defined?

In Emacs Lisp, how do I check if a variable is defined?
mike
  • 46,876
  • 44
  • 102
  • 112
110
votes
6 answers

Unable to hide welcome screen in Emacs

I want to hide the welcome screen. My .emacs file: (setq c-basic-offset 4) ; indents 4 chars (setq tab-width 4) ; and 4 char wide for TAB (setq indent-tabs-mode nil) ; And force use of spaces (turn-on-font-lock) ; same as syntax…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
110
votes
6 answers

Permanently summing a column in an Org-mode table

In an Emacs Org-mode table, when you have a column full of integers I know you can do C-c + followed by C-y to paste the sum of the values in the column. I want to know the formula to place in the last row to always sum the whole column. I've tried…
Mauvis Ledford
  • 40,827
  • 17
  • 81
  • 86
109
votes
8 answers

Globally override key binding in Emacs

How can I set a key binding that globally overrides and takes precedence over all other bindings for that key? I want to override all major/minor mode maps and make sure my binding is always in effect. This of course doesn't work: (global-set-key…
Brian Carper
  • 71,150
  • 28
  • 166
  • 168
108
votes
2 answers

emacs, unsplit a particular window split

I often want to unsplit window as follows: +--------------+-------------+ +--------------+-------------+ | | | | | | | | | | …
kindahero
  • 5,817
  • 3
  • 25
  • 32
108
votes
2 answers

Emacs: print key binding for a command or list all key bindings

In Emacs (GNU 23.2, *nix), how can I: list the key sequences bound to a particular command? For example, how can we list all the key sequences that execute save-buffers-kill-emacs, with the output of key sequences bound to it? Assuming we can do…
Yktula
  • 14,179
  • 14
  • 48
  • 71