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.

emacs
Filter by
Sorted by
Tagged with
3352 votes
35 answers
1.4m views

How do I make git use the editor of my choice for editing commit messages?

How do I globally configure git to use a particular editor (e.g. vim) for commit messages?
brasskazoo's user avatar
  • 77.4k
797 votes
30 answers
531k views

Differences between Emacs and Vim

What practical, objective differences are there between Emacs and Vim? For example, what can be done using one but not the other (or done more easily with one than the other)? What should I know in ...
438 votes
18 answers
171k views

How can I reload .emacs after changing it?

How can I get Emacs to reload all my definitions that I have updated in .emacs without restarting Emacs?
yazz.com's user avatar
  • 58.1k
396 votes
36 answers
122k views

Why should I use an IDE? [closed]

In another question, Mark speaks highly of IDEs, saying "some people still just dont know "why" they should use one...". As someone who uses vim for programming, and works in an environment where ...
393 votes
17 answers
254k views

How to set the font size in Emacs?

I also want to save the font size in my .emacs file.
Juba's user avatar
  • 4,515
366 votes
7 answers
136k views

How do I control how Emacs makes backup files?

Emacs puts backup files named foo~ everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points ...
jfm3's user avatar
  • 37.4k
345 votes
6 answers
130k views

How can I replace a character with a newline in Emacs?

I am trying to replace a character - say ; - with a new line using replace-string and/or replace-regexp in Emacs. I have tried the following commands: M-x replace-string RET ; RET \n This will ...
Lei's user avatar
  • 3,501
304 votes
11 answers
172k views

How do you 'redo' changes after 'undo' with Emacs?

This article says that "Emacs has redo because you can reverse direction while undoing, thereby undoing the undo". What does this mean? How can a user 'redo' with Emacs?
prosseek's user avatar
  • 187k
298 votes
1 answer
18k views

How can I make nrepl-ritz-jack-in work remotely over TRAMP / Emacs

What I want: I have a clojure program on a remote site, let's call it mccarthy. What I want to do is connect to a nrepl-ritz from my laptop, preferably using nrepl-ritz-jack-in. The jack in works ...
MattoxBeckman's user avatar
278 votes
15 answers
92k views

How do I rename an open file in Emacs?

Is there a way to rename an open file in Emacs? While I'm viewing it? Something like save-as, but the original one should go away.
Pablo Fernandez's user avatar
229 votes
15 answers
66k views

Using Emacs to recursively find and replace in text files not already open

As a follow-up to this question, it's trying to find out how to do something like this which should be easy, that especially stops me from getting more used to using Emacs and instead starting up the ...
Rob Kam's user avatar
  • 10.1k
204 votes
16 answers
132k views

Step-by-step debugging with IPython

From what I have read, there are two ways to debug code in Python: With a traditional debugger such as pdb or ipdb. This supports commands such as c for continue, n for step-over, s for step-into etc....
Amelio Vazquez-Reina's user avatar
202 votes
15 answers
141k views

What are these ^M's that keep showing up in my files in emacs?

I think it may have to do with TextMate, but we work in a small team and are having some issues with full-file conflicts of nearly identical files in git – in one branch the files have a ^M appended ...
Neil Sarkar's user avatar
  • 6,894
197 votes
3 answers
42k views

How to have Emacs auto-refresh all buffers when files have changed on disk?

I have a non-emacs global search and replace function that causes my disk files to become more up-to-date than my emacs buffers (en masse). Is there any way to tell emacs to refresh all the buffers ...
Dave's user avatar
  • 2,683
190 votes
7 answers
68k views

How to change size of split screen emacs windows?

I have emacs split horizontally - on top I'm editing Perl code, the bottom is the shell. By default emacs makes the two windows equal in size, but I'd like the shell buffer smaller (maybe half the ...
Steve's user avatar
  • 1,903
190 votes
10 answers
67k views

Open a file with su/sudo inside Emacs

Suppose I want to open a file in an existing Emacs session using su or sudo, without dropping down to a shell and doing sudoedit or sudo emacs. One way to do this is C-x C-f /sudo::/path/to/file but ...
Chris Conway's user avatar
  • 55.6k
183 votes
21 answers
176k views

Set 4 Space Indent in Emacs in Text Mode

I've been unsuccessful in getting Emacs to switch from 8 space tabs to 4 space tabs when pressing the TAB in buffers with the major mode text-mode. I've added the following to my .emacs: (setq-...
Cristian's user avatar
  • 43.3k
180 votes
4 answers
133k views

Updating packages in Emacs

I have the following setup for packages (not sure if there is a better recommended one): (require 'package) (setq package-archives '(("ELPA" . "http://tromey.com/elpa/") ("...
Amelio Vazquez-Reina's user avatar
178 votes
18 answers
81k views

Using Emacs as an IDE

Currently my workflow with Emacs when I am coding in C or C++ involves three windows. The largest on the right contains the file I am working with. The left is split into two, the bottom being a ...
user7545's user avatar
  • 3,030
176 votes
35 answers
88k views

How do I duplicate a whole line in Emacs?

I saw this same question for VIM and it has been something that I myself wanted to know how to do for Emacs. In ReSharper I use CTRL-D for this action. What is the least number of commands to perform ...
Ray's user avatar
  • 190k
175 votes
16 answers
55k views

Re-open *scratch* buffer in Emacs?

If I accidentally closed the scratch buffer in Emacs, how do I create a new scratch buffer?
Fortepianissimo's user avatar
175 votes
4 answers
136k views

Who originally invented this type of syntax: -*- coding: utf-8 -*- [duplicate]

Python recognizes the following as instruction which defines file's encoding: # -*- coding: utf-8 -*- I definitely saw this kind of instructions before (-*- var: value -*-), so I assume Python did ...
hamstergene's user avatar
  • 24.2k
170 votes
7 answers
28k views

Emacs - Multiple columns one buffer

I'm trying to edit some assembly code which tends to be formatted in long but thin listings. I'd like to be able to use some of the acres of horizontal space I have and see more code on-screen at one ...
user119857's user avatar
  • 1,771
163 votes
7 answers
40k views

How to run multiple shells on Emacs

I am using Emacs 23.3.1 on windows 7. I know that I can run shell from emacs using M-x shell. I would like to have multiple shell windows in the same time, but typing M-x shell a second time just ...
S4M's user avatar
  • 4,581
160 votes
6 answers
65k views

How do I create a directory from within Emacs?

How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)
Ray's user avatar
  • 190k
158 votes
10 answers
48k views

Is there a (repeat-last-command) in Emacs?

Frequently, I've dug into apropos and docs looking for something like the following only to give up to get back to the task at hand: (repeat-last-command) do the last C- or M- command I just ...
ack's user avatar
  • 1,583
152 votes
8 answers
138k views

How to open Emacs inside Bash

I'm using Ubuntu 11.10 (Oneiric Ocelot). When I type the command "emacs" in the terminal, it opens Emacs as a separate window. How can I open it inside the terminal, like the nano editor?
jyriand's user avatar
  • 2,484
150 votes
14 answers
64k views

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 ...
jacob's user avatar
  • 2,354
148 votes
6 answers
47k views

How do I byte-compile everything in my .emacs.d directory?

I have decided to check out Emacs, and I liked it very much. Now, I'm using the Emacs Starter Kit, which sort of provides better defaults and some nice customizations to default install of Emacs. I ...
Mikka's user avatar
  • 2,123
148 votes
8 answers
50k views

Emacs bulk indent for Python

Working with Python in Emacs if I want to add a try/except to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at ...
Vernon's user avatar
  • 2,753
146 votes
6 answers
69k views

How can I delete the current line in Emacs?

What is the emacs equivalent of vi's dd? I want to delete the current line. Tried CTRL + k but it only deletes from current position.
Manoj Govindan's user avatar
140 votes
3 answers
46k views

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 ...
blueFast's user avatar
  • 42.7k
137 votes
9 answers
51k views

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's user avatar
  • 2,019
134 votes
13 answers
47k views

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 ...
RNA's user avatar
  • 150k
131 votes
9 answers
85k views

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's user avatar
  • 190k
131 votes
1 answer
5k views

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 ...
map7's user avatar
  • 5,126
128 votes
16 answers
98k views

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, ...
Ray's user avatar
  • 190k
128 votes
5 answers
48k views

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 ...
Fernando Briano's user avatar
127 votes
13 answers
78k views

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's user avatar
  • 4,095
126 votes
4 answers
20k views

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's user avatar
  • 191k
124 votes
13 answers
63k views

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 ...
prosseek's user avatar
  • 187k
124 votes
5 answers
33k views

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 ...
Sake's user avatar
  • 4,075
124 votes
6 answers
35k views

How do you list the active minor modes in emacs?

How do you list the active minor modes in emacs?
readonly's user avatar
  • 349k
123 votes
1 answer
2k views

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'? ...
daj's user avatar
  • 7,082
122 votes
12 answers
84k views

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:\...
Anton's user avatar
  • 12.4k
121 votes
6 answers
95k views

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

Question cribbed from here: 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&...
vinc456's user avatar
  • 2,872
119 votes
10 answers
38k views

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 ...
ant2009's user avatar
  • 25.2k
115 votes
6 answers
32k views

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's user avatar
  • 40.7k
114 votes
5 answers
14k views

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....
Kurt Harriger's user avatar
114 votes
5 answers
27k views

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 ...
Amelio Vazquez-Reina's user avatar

1
2 3 4 5
355