Most Popular
1500 questions
20
votes
3 answers
convert a text buffer to a pdf file?
How can we convert the current text buffer to a pdf file, preferably turning those headings started with * into bookmarks of the pdf file.
For example, turning the Emacs integrated tutorial (shown by C-h t) into a bookmarked pdf file. Thanks.

Tim
- 4,987
- 7
- 31
- 60
20
votes
4 answers
How to setup default windows at startup?
Every time I open up Emacs I tend to set up 3 windows by doing C-x 3 (split-window-right) and then C-x2 (split-window-below). After that I have to switch to each window to open the files I want to edit.
How can I set this to be done…

El Diego Efe
- 1,601
- 1
- 19
- 24
20
votes
2 answers
How do you return from a function at an arbitrary point?
How do you return early from a function before it's ended? For example:
(defun my-func ()
"for example."
(unless something (return nil))
; continue as usual...
(+ 42 1))

ocodo
- 1,202
- 11
- 20
20
votes
2 answers
Code-folding extensions for JSON
I am dealing with JSON files with multiple repeated blocks with just one field value (integer) changed - in fact, every changed value is just the previous corresponding value incremented. To make such files easy to read, I would like to be able to…

Pradhan
- 2,330
- 14
- 28
20
votes
2 answers
Save lock-files to a directory instead of disabling them
Emacs 24 introduced the ability to disable the creation of the infamous .#file-name lock files.
Evaluating the following lisp form will completely disable Emacs ability to lock files to prevent concurrent changes.
Is there a way to set Emacs to…
user66
20
votes
2 answers
How can I toggle displaying images in eww without a page refresh?
I use eww to browse the internet and more often than not I do not want images to load, there doesn't seem to be much in terms of customizations built in for eww and none dealing with images.
Currently I have a system setup that allows me to start…

Jordon Biondo
- 12,332
- 2
- 41
- 62
20
votes
2 answers
How to let eshell remember sudo password for two minutes?
In a general term runing bash, when I run a sudo ... command, bash will remember my password for a while. This makes package management task easier.
For example:
sudo apt-get update
# password ......
sudo apt-get install turing-brain
# execute…

Nick
- 4,423
- 4
- 24
- 41
20
votes
2 answers
Convention about using C-x or C-c as prefix keys
What are the conventions for using C-x, C-c, or M- as prefix keys?
For example: is C-x, etc., for saving or visiting buffers? Is C-c, etc., for text editing?
Background
Maybe this is a silly question. I use a Spanish keyboard, and sometimes…

anquegi
- 739
- 5
- 21
20
votes
4 answers
Why does lisp-interaction-mode exist, and do we ever need it?
Q: Why does lisp-interaction-mode exist, and are there any reasons to use it instead of emacs-lisp-mode?
The manual states that emacs-lisp-mode and lisp-interaction-mode are identical except that the latter binds C-j to eval-print-last-sexp. Beyond…

Dan
- 32,584
- 6
- 98
- 168
20
votes
4 answers
How to change the current working directory?
how to change the current working directory of emacs?
set default-directory doesn't not affect the emacs process's current working directory, which can be verified via lsof -p pid.

FunkyBaby
- 767
- 1
- 4
- 10
20
votes
2 answers
When should sharp quotes be used?
I see sharp quotes being used in other people's eLisp code, and I use them myself, but I'm not completely clear on when they are appropriate and when not.
Could anyone clarify on exactly when it's appropriate to use sharp quotes and when ordinary…

izkon
- 1,798
- 10
- 23
20
votes
5 answers
Result of arithmetic evaluation in buffer, not echo area
Windows 10, Emacs 25.1
I want to do some arithmetic operation I do this:
The result is in the echo area, but I want the result to be in cursor place in the buffer. Something like this:
How do I do this?

user8542613
- 643
- 6
- 16
20
votes
2 answers
How to find out what command I just accidentally ran with a keyboard shortcut?
Is there a place where emacs stores commands the user has recently executed, in particular via keyboard shortcuts, and if not, would it be possible to tell it to store them somewhere? I sometimes type the wrong keyboard shortcut by accident and I…

Zorgoth
- 810
- 6
- 14
20
votes
3 answers
Loading bibtex file in org-mode file
I'm trying to use org-mode to do almost everything. In my scientific writing activity, I would like to sketch a whole paper in an .org file and then export in LaTeX. I don't want to load the .bib bibtex file in the init.el as I could have multiple…

petrux
- 665
- 1
- 5
- 18
20
votes
1 answer
Magit - Undo last commit - History Manipulation
This StackOverflow question has the best solutions/approaches to undo last commits.
I started using Magit a couple a weeks ago and after looking through all its documentation I still don't have a definitive/best way to undo a mistakenly committed…

Alexandro de Oliveira
- 767
- 1
- 6
- 17