Most Popular
1500 questions
42
votes
2 answers
What is the regex to match a newline character?
In Emacs regex, \n doesn't match a new line character \n.
Am I correct that $ matches the position between a new line
character and the character right before the new line character.
e.g. for a string abc\n, $ matches the position between c…

Tim
- 4,987
- 7
- 31
- 60
42
votes
5 answers
How to shift a selected area of text in Emacs by a certain number of spaces?
I am writing python code so shifting/moving blocks of lines is important to avoid going through each line individually. How can I do this without an add-on? Is there a type of operation keystroke command to do this?

Vass
- 713
- 1
- 5
- 12
42
votes
3 answers
How to change the cursor type and color?
I would like to change the cursor, like in Terminal, from the block to the I-Beam cursor.
From this:
To this:
How would I do this?
Also, on a side note, how do I change the color of the cursor?

programking
- 7,064
- 9
- 41
- 62
42
votes
6 answers
Effectively using the mark ring
I have used the mark to select regions of a buffer. For example, I know the sequence C- C-s foo can be used to select all text between the current point and the point after a search for foo.
I recently discovered the existence of the mark…

Patrick Steele
- 1,105
- 9
- 10
41
votes
2 answers
How to evaluate the variables before adding them to a list?
The below obviously doesn't work and hence this question.
How do I correct the below code so that the value of somelist becomes '(("abc" . 123)) ?
(setq x "abc")
(setq y 123)
(setq somelist nil)
(add-to-list 'somelist '(x . y))

Kaushal Modi
- 25,203
- 3
- 74
- 179
41
votes
2 answers
Intelligent spell-checking in org-mode
By default, the results of running M-x ispell-buffer in org-mode are
very disappointing.
Ispell looks inside :PROPERTY: drawers, which commonly contain things like
:ID: 797495bd-581b-4a42-883b-c2a55a08f08a
It tries to correct org…

Malabarba
- 22,878
- 6
- 78
- 163
41
votes
4 answers
Weird shell output when using IPython 5
I just upgraded to the latest version of IPython and now something is wrong when using it in emacs.
When using it in a regular terminal it works fine (colors, tab-completion, etc.), however either in M-x eshell or M-x shell, instead of outputing In…

Literal
- 675
- 5
- 10
41
votes
1 answer
Command to insert code block?
I found the command SPC m x c to insert a small code snippet like ~~. I would like to insert a longer snippet like
#+BEGIN_SRC
#+END_SRC
Is there a command to do this? I found a way to add it for markdown, which is SPC m x c

JuanCaicedo
- 679
- 1
- 6
- 11
41
votes
6 answers
Problems with keybindings when using terminal
I have the following line in init.el:
(global-set-key [(control \;)] 'comment-region)
It works very well in GUI window, but if emacs is invoked with the -nw option then C-; doesn't comment region, only inserts ; character. M-x comment-region RET…

WeSenseASoulInSearchOfAnswers
- 1,383
- 2
- 14
- 16
39
votes
5 answers
What is the easiest way to search all useful files inside a single project?
What is the easiest way to search for a regexp throughout the contents all files in the current project, skipping files that are not useful?
Useless files are things like compiled files, imported libraries,
version-control files, etc.
I’m aware of…

Malabarba
- 22,878
- 6
- 78
- 163
39
votes
5 answers
Exporting from org-mode to markdown
The emacs functions mentioned in the docs don't seem to exist in my org version 7.9.3f.
http://orgmode.org/manual/Markdown-export.html
Any idea how I can get org-mode to export to markdown for me without pulling my hair out?

Alex Baranosky
- 1,069
- 1
- 8
- 17
39
votes
3 answers
How to stash individual files with magit
git is capable of stashing of individual hunks.
With --patch, you can interactively select hunks from the diff between HEAD and the working tree to be stashed. The stash entry is constructed such that its index state is the same as the index state…

ayvango
- 575
- 4
- 6
39
votes
3 answers
How to set up elpy to use python3?
When setting up my emacs for a new work environment, I am unable to get the elpy configuration to correctly use python 3. I have installed all of the required packages in /usr/local/bin and have installed them using python3.
Right now, when I run…

adam
- 491
- 1
- 4
- 3
39
votes
2 answers
Optional parameter defaults
Emacs Lisp does not have syntactical support for non-nil defaults of optional parameters. What is the recommended idiom for supplying these parameters?
To clarify my point, here is one overly explicit way of doing so.
(defun command (a &optional…

Matthew Piziak
- 5,958
- 3
- 29
- 77
39
votes
2 answers
How to clear cache of projectile file in spacemacs?
I am using spacemacs and often use the SPC p f key binding to find files in a projectile project. But even after removing a file from a git, SPC p f will show me that deleted file.
I tried using SPC p I to invalid the cache, but that didn't work.…

Daniel Wu
- 1,711
- 2
- 17
- 26