All Questions

Filter by
Sorted by
Tagged with
30
votes
3answers
7k views

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, ...
30
votes
2answers
4k views

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) (...
57
votes
12answers
6k views

Synchronize packages between different machines

I use emacs in different places and I want to have a similar setup and packages installed everywhere. I guess I can use a version control repository for the setup files. Since I use Prelude, that ...
36
votes
1answer
2k views

What is the difference between a function and a command?

When posting questions and answers here, people sometimes use the terms "function" and "command" interchangeably. In other cases, people only use one of the two terms to discuss specific pieces of ...
21
votes
1answer
2k views

How do I troubleshoot Emacs problems?

In a situation where Emacs is not behaving like I want, what can I do to troubleshoot the problem? What steps can I take to find and fix the problem myself? Or, failing that, how can I gather useful ...
38
votes
4answers
8k views

How to override major mode bindings

Sometimes my global keybindings are overridden by a major mode. An easy example is the following setting in my init file (global-set-key (kbd "C-j") 'newline-and-indent) But annoyingly this ...
64
votes
4answers
8k views

How can I find out in which keymap a key is bound?

I have rebound a the 'd' key in gnus-article-mode, but its old behavior is still active when the point is on an attachment. I can see that the rebinding did not take effect there by doing C-h k d, but ...
28
votes
2answers
5k views

What's the difference between a buffer, a file, a window, and a frame?

When posing questions on this site, people sometimes talk about "windows" when they mean "frames," and "buffers" or "files" when they mean "windows." So: Q: What is the difference between a buffer, ...
31
votes
5answers
3k views

Is there a way to use query-replace from grep/ack/ag output modes?

I'm aware of find-grep-dired, marking the corresponding files and then pressing Q to run dired-do-query-replace-regexp on the marked files. Unfortunately that requires restarting the grep and no ...
16
votes
3answers
7k views

Why do I have to add each package to load-path? (or Problem with require 'package in my init file)

Each time I install a package from the Package Menu, if I try to require it in my init file I get an error unless I manually add it to the load-path: (add-to-list 'load-path "/home/nick/.emacs.d/elpa/...
26
votes
1answer
4k views

Why do regular expressions created with the regex builder use syntax different from the interactive regular expressions?

So, using the regular expression builder (M-x re-builder), finding lines that end in \ takes "\\$", while in search and replace by regex, it only takes "\$". I would have expected the regex builder ...
22
votes
5answers
11k views

Browser-style 'tabs' for emacs?

I would like tabs like firefox but for emacs. I found this: http://emacswiki.org/emacs/TabBarMode But it just add to each buffer (window in Emacs terminology) a bar that shows currently open buffers....
12
votes
1answer
1k views

Why can't I bind my function to a key or call it with M-x?

I wrote a function, and I want to call it via M-x, and bind it to a key. This is my function: (defun my-function () (message "This is a great function")) If I try to call it with M-x my-function,...
10
votes
1answer
891 views

How to get the raw data for an org-mode agenda without an agenda view?

Q: How can I have org-mode return the raw data for an agenda view without actually creating an agenda view? I'd like to access my agenda for an arbitrary day. However, I do not want to create an ...
5
votes
2answers
2k views

Defining key-bindings within `helm-map`: getting a `void-variable helm-map` error

Am going through this Helm tutorial at the moment; I pasted in the code verbatim (for now, I'll adapt it to suit my preferences later). I did a quick google search for this particular error but it ...
28
votes
2answers
5k views

Is it possible to export content of subtrees without their headings?

I draft documents in org-mode and export them to LaTeX, HTML, etc. as needed. I frequently use the tag :no_export: whenever I don't want a certain subtree to show up in the output. What I also want ...
30
votes
4answers
3k views

When to sharp-quote a lambda expression?

Q: When, if ever, is it useful to sharp-quote a lambda, and when, if ever, must we not sharp-quote a lambda? People use lambdas in three ways: plain: (lambda (x) x) quoted: '(lambda (x) x) sharp-...
15
votes
2answers
4k views

Shift+Up isn't recognized by Emacs in a terminal

Very often I use Shift+Up/Down to select a region in Emacs. It works fine in GUI mode, but when emacs is invoked with -nw option I can select lines only with Shift+Down. The Shift+Up doesn't work, I ...
19
votes
2answers
3k views

A faster method to obtain `line-number-at-pos` in large buffers

The function line-number-at-pos (when repeated about 50 times) is causing a noticeable slow-down in semi-large buffers -- e.g., 50,000 lines -- when point is near the end of the buffer. By slow-down, ...
12
votes
1answer
457 views

Why does a constant in `let` change with repeated calls? [duplicate]

Say we have such a foo function: (defun foo (e) (let ((lst '(a b c))) (delq e lst))) Then we use it in following way (sequentially evaluating one by one): (foo 'c) ; => (a b) (foo 'b) ; =&...
3
votes
1answer
440 views

How to create a new buffer with ivy-switch-buffer that shares a substring with an existing buffer?

Suppose I have a file opened called "analysis-evaluation.tex" and I'd like to create a new buffer called "eval". When using Ido, I would press C-j to create a new buffer rather than switching to an ...
16
votes
1answer
2k views

How do I debug an emacs crash?

I am debugging why emacs crashes when using a function from a package1. The aim of this debug process is to get useful data to submit using M-x report-emacs-bug. To get help on how to debug emacs ...
24
votes
1answer
8k views

How to highlight text permanently in org-mode

I know I can use *bold*, /italic/, _underlined_, =verbatim= and ~code~, and, if you must, ‘+strike-through+’ to do some markup to text according to org-mode documentation, but they are not enough for ...
17
votes
2answers
540 views

Collapsing undo history

I'm working on an Emacs mode that lets you control Emacs with speech recognition. One of the problems I've ran into is that the way Emacs handles undo doesn't match how you would expect it to work ...
4
votes
2answers
2k views

How to modify-face for a specific buffer?

I work with a lot of tabular data files and use stripe-buffer.el make them easier to read. But I also work with more than one, so I'd like to make it easier to distinguish among them as well and want ...
3
votes
2answers
776 views

How to define a function that calls a console process using ansi-term?

I'm using Julia within emacs, and I've found that despite the existence of ess and julia-mode, the best way for me to do that seems to be to use ansi-term and execute: ipython3 console --kernel=julia-...
48
votes
2answers
6k views

Debugging a frozen Emacs

I am using mew for my e-mail. I need to use TLS with my email provider for SMTP. However, when I try to invoke that, Emacs freezes. I would like to take this opportunity to learn more about Emacs ...
7
votes
1answer
513 views

Multiple major modes in one buffer (e.g., python-mode & LaTeX-mode)

Using the LaTeX-package pythontex I one can insert python code into the latex document which is executed (and printed to your latex file if you want) if you run latex. I use auctex for editing latex ...
11
votes
2answers
3k views

How to build Emacs master branch (aka trunk) on MS-Windows

I took the plunge today and started out on my quest to build the most recent Emacs master branch developer build -- aka Emacs Trunk -- for MS-Windows. I found an old blog and went through the ...
6
votes
3answers
3k views

Emacs bind key to prefix

suppose I want to bind a key to a partial key sequence (i.e. a key sequence that is a prefix of some other bound keybindings). I've tried the obvious (global-set-key (kbd "C-x C-x") (kbd "C-c")) ...
50
votes
9answers
25k views

Using Emacs as a full-featured C/C++ IDE

I have been trying off and on for over a year now to use Emacs as a C/C++ IDE. I have only been marginally successful thus far, but have run into a few brick walls along the way. Currently I am ...
73
votes
10answers
10k views

How do I prevent extremely long lines making Emacs slow?

I see hugely varied performance depending on how many newlines there are in the file I'm visiting. Here's an example. I have two JSON files: $ wget https://github.com/Wilfred/ReVo-utilities/blob/...
37
votes
3answers
7k views

Inline verbatim and code with quotes in Org-mode

In Org-mode I can surround text with = or ~ to place text in inline verbatim or code mode. However this fails if the text has quotes, and I couldn't find an explanation or workaround in the ...
23
votes
2answers
3k views

Exporting org file breaks when upgrading to orgmode 8.3

My orgmode was recently updated to the recent 8.3, and I found that I can't export my init.org file as HTML any more. I'm getting the following output in *Messages* buffer: org-babel-exp process ...
53
votes
4answers
3k views

Practical benefits of new advice system in Emacs 24.4

Emacs 24.4 comes with a new advice system. The NEWS file says: ** New package nadvice.el offers lighter-weight advice facilities. It is layered as: *** add-function/remove-function, which ...
26
votes
2answers
2k views

Extending org-mode with more markups

I want to add a markup and formatting for such markup, i.e. <kbd>...</kbd> with a box surrounds such markup. I also want the mark up to be compatible with (setq org-hide-emphasis-markers t)...
14
votes
1answer
2k views

Correct indentation for wrapped lines

I have the following wrapped text, especially when you use a lot of windows: I'm wondering if the indentation of wrapped text could be changed like in Vim: ) When figuring out, it seems the ...
12
votes
3answers
1k views

Treat symbols as words in prog modes

There are a number of commands in Emacs which apply to "words." Examples include forward-word, kill-word, upcase-word, mark-word, transpose-words, etc. The definition of "word" seems to vary a bit ...
8
votes
2answers
3k views

How i can open shell in current buffer?

In function "shell" this line display shell buffer and almost always its open new shell in random frame. And I have to swap the buffers, it's annoying. ... (pop-to-buffer buffer) ... In docs says: ...
5
votes
1answer
2k views

how do I quickly remove lines from emacs buffer

In an emacs buffer when editing a file called "log/development.log" how do I quickly remove all lines containing the word "Render"
4
votes
2answers
366 views

Bind `C-x 8 l` to typing lambda (λ)

When I try to do this: (global-set-key (kbd "C-x 8 l") (lambda () (insert "λ"))) It just doesn't work: Wrong type argument: commandp (lambda nil (insert "λ")) Does anyone know a decent way to do ...
58
votes
5answers
7k views

What options are there for writing better non-programming text in Emacs?

This is a fork from the question What options are there for doing spell-checking in Emacs? Because I'm currently doing a lot of non-programming tasks in Emacs I'm wondering whether Emacs can support ...
64
votes
4answers
17k views

Quickly insert source blocks in org mode

org-mode has the ability to render source code, with blocks of the following syntax: #+NAME: <name> #+BEGIN_SRC <language> <switches> <header arguments> <body> #+...
41
votes
3answers
3k views

What can I do to speed up my start-up?

What are some basic things I could do to reduce the start-up time? Is there anything in particular I should pay attention to, for that matter? Note: Startup time can be mitigated by starting Emacs ...
69
votes
4answers
11k views

Advantages of setting variables with setq instead of custom.el?

I see a lot of people (extension authors and others) give configuration examples with setq: (setq foo 'bar) These parameters are often defined with defcustom, making them available for customization ...
44
votes
7answers
3k views

How can I use my local Emacs client as the $EDITOR for remote machines I access over TRAMP?

I often use TRAMP to manage several remote servers, both for editing files and running remote shells in shell-mode. However, this does not work when a command uses the EDITOR variable to edit a file, ...
55
votes
5answers
11k views

Edit file with super-user rights

When you have to edit system files, it's an usual situation that you launched Emacs with a normal user before, so the file will be write-protected. What can I do to gain root privileges? I mean ...
41
votes
3answers
4k views

How to save a keyboard macro as a Lisp function?

Very frequently I would need to perform the set of steps requiring multiple key strokes. For the same session those steps can be recorded in a keyboard macro. An example is saving a frequently ...
25
votes
7answers
14k views

Copy text from Emacs to OS X clipboard

When I run Emacs in a text terminal instead of the normal GUI mode, I can copy in Emacs by activating the start of a region with C-SPC, and then select what I want, and then do M-w. Is there any way ...
24
votes
6answers
6k views

Switching between window layouts

When I configure a custom layout and then just need to temporary look into one file fullscreen and once I want that layout back - I need manually to reflow it. I would like a plugin/elisp code to ...

15 30 50 per page