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
145
votes
14 answers

How to achieve code folding effects in Emacs?

What's the best way to achieve something like code folding, or the type of cycling that org-mode uses. What would be the best solution in elisp to create this type of behavior? EDIT: I'm sorry I was not clear. I want to program something in elisp…
jacob
  • 2,284
  • 3
  • 20
  • 21
136
votes
9 answers

How to change the indentation width in emacs javascript mode

I'd like to use 2 spaces for my indents instead of 4. I can change the default behavior of C mode using: (setq c-basic-offset 2) How do I change this in javascript mode?
mksuth
  • 1,999
  • 4
  • 17
  • 24
135
votes
3 answers

Inline code in org-mode

Markdown allows for embedded code. How can this be done in org-mode? I know about source-code blocks: #+begin_example blah-blah #+end_example But what I want is something like this (obviously, with the right syntax, which I do not know): This is…
blueFast
  • 41,341
  • 63
  • 198
  • 344
133
votes
13 answers

How to automatically install Emacs packages by specifying a list of package names?

I am using package to manage my Emacs extensions. In order to synchronize my Emacs settings on different computers, I'd like a way to specify a list of package names in .emacs file and then package could automatically search and install the…
RNA
  • 146,987
  • 15
  • 52
  • 70
131
votes
1 answer

Emacs Ruby autocomplete almost working

I've been updating my emacs config with the use of Rsense to allow for an autocomplete drop down box to appear whilst typing code. This works well in most files except I've found it doesn't allow me to select an answer from the table when I'm…
map7
  • 5,096
  • 6
  • 65
  • 128
129
votes
9 answers

How do I change read/write mode for a file using Emacs?

If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs?
Ray
  • 187,153
  • 97
  • 222
  • 204
128
votes
5 answers

Open file via SSH and Sudo with Emacs

I want to open a file inside Emacs which is located on a remote server, with sudo powers on the server. I can open local files with sudo via Tramp like this: C-x C-f /sudo::/home/user/file But I want to use sudo on the server: C-x C-f…
Fernando Briano
  • 7,699
  • 13
  • 58
  • 75
127
votes
13 answers

How to copy text from Emacs to another application on Linux

When I cut (kill) text in Emacs 22.1.1 (in its own window on X, in KDE, on Kubuntu), I can't paste (yank) it in any other application.
memius
  • 4,045
  • 5
  • 26
  • 25
127
votes
16 answers

Where can I find my .emacs file for Emacs running on Windows?

I tried looking for the .emacs file for my Windows installation for Emacs, but I could not find it. Does it have the same filename under Windows as in Unix? Do I have to create it myself? If so, under what specific directory does it go?
Ray
  • 187,153
  • 97
  • 222
  • 204
125
votes
4 answers

emacs/elisp: What is the hash (pound, number sign, octothorp) symbol used for?

What does this do? (add-hook 'compilation-mode-hook #'my-setup-compile-mode) ...and is it different than (add-hook 'compilation-mode-hook 'my-setup-compile-mode)
Cheeso
  • 189,189
  • 101
  • 473
  • 713
124
votes
5 answers

Given an emacs command name, how would you find key-bindings ? (and vice versa)

If I know an emacs command name, says, "goto-line"; what if I want to query whether if there are any key-sequences bound to this command ? And vice versa, given a key sequence, how can I find its command name ?
Sake
  • 4,033
  • 6
  • 33
  • 37
123
votes
13 answers

The function to show current file's full path in mini buffer

I need to get the full path of the file that I'm editing with emacs. Is there a function for that? If not, what would be the elisp function for getting that? How can I copy the result (path name) to a clipboard so that I can reuse it? I'm using…
prosseek
  • 182,215
  • 215
  • 566
  • 871
123
votes
1 answer

Emacs Interactive-Haskell repl non-response if either the cabal or working directory set to project directory

I'm running into odd behavior with the Interactive-Haskell repl in emacs. When I source a file, the emacs mini buffer shows a series of interactive prompts: Start a new project named 'myproject'? Cabal dir (guessed from myproject.cabal): Build…
daj
  • 6,962
  • 9
  • 45
  • 79
122
votes
6 answers

How do you list the active minor modes in emacs?

How do you list the active minor modes in emacs?
readonly
  • 343,444
  • 107
  • 203
  • 205
120
votes
6 answers

How to load program reading stdin and taking parameters in gdb?

I have a program that takes input from stdin and also takes some parameters from command line. It looks like this: cat input.txt > myprogram -path "/home/user/work" I try to debug the code with gdb inside emacs, by M-x gdb, I try to load…
vinc456
  • 2,862
  • 5
  • 23
  • 30