Questions tagged [buffers]

The text you are editing in Emacs resides in an object called a buffer. Each time you visit a file, a buffer is used to hold the file's text. Each time you invoke Dired, a buffer is used to hold the directory listing.

Filter by
Sorted by
Tagged with
4
votes
1answer
655 views

How to get a list of all the buffers in elisp?

I am trying to get a list of buffers through elisp. So I created the following function: (mapcar (function buffer-name) (buffer-list)) This works when I do something like: (minibuffer-message (...
8
votes
4answers
1k views

How can I run a keyboard macro in selected buffers from Ibuffer or selected files from dired?

If I have to do some variable name refactoring, I use ag and multiple-cursors. But when I have to do some code block removal/addition/moving, I use keyboard macros. But I need to switch to each ...
2
votes
2answers
149 views

Switch to next buffer under certain circumstances

I have the following line of code in my .emacs file: (global-set-key (kbd "C-<tab>") 'next-buffer) This key-binding allows me to C-<tab> my way around Emacs. However, because of certain ...
4
votes
1answer
555 views

How do I make ido switch to the buffer suggested by the tab-completion candidate?

I use ido for switching buffers, and it is awesome. I also have (flx-ido mode t) in my init file. I have run into a problem that causes me to switch to a buffer different from what I was expecting. I ...
6
votes
1answer
334 views

Why must I set and reset `buffer-multibyte` to correctly view multibyte buffers?

In an ongoing project, we are inserting multibyte text into a buffer and experiencing strange behavior. When the question is first viewed, we receive something like: Quote Environment à la Strunk\...
0
votes
1answer
82 views

Buffer widening not working in Org-mode

I am using emacs 24.4 in Org-mode and try to narrow/widen to/from subtrees using C-x n s and C-x n w, repsectively. However Widening is not working and once I have narrowed down to a particular ...
51
votes
1answer
3k views

How to view diff when emacs suggests to recover this file?

Sometimes it happens: emacs prompts you about recovering unsaved changes to a file, but you cannot remember if you want those changes or not. Starting at the recover-this-file buffer, is there a way ...
3
votes
2answers
252 views

How can I refer to an already open eww buffer without knowing its current name?

Say I open a new buffer by eww-browse-url "emacs.stackexchange.com". Then, I navigate for a while, so the eww-se buffer updates its name to the current url. Same history for another buffer eww-ew, ...
13
votes
1answer
993 views

When switching buffers, prevent emacs from automatically switching frame

When I switch buffers, emacs will switch to an existing frame if the buffer is already opened there. I found how to prevent that when switching with ido using : (setq ido-default-buffer-method '...
2
votes
3answers
1k views

Open a frame for the first time (using `emacsclient -c`) showing other buffer than *scratch*

I have emacs configured to start org-agenda automatically and show it instead of *scratch*. Like this: (add-hook (quote after-init-hook) (lambda () ;; ... (...
1
vote
0answers
66 views

Suppress new buffer when running typeset command (C-c C-c) in AUCTeX

When running C-c C-c to typeset/compile the LaTeX code in the current buffer, a second buffer pops up to show the compilation -- is there a way to suppress this buffer if there are no errors?
36
votes
6answers
4k views

How to reopen just killed buffer, like C-S-t in Firefox Browser?

Sometimes I accidentally kill a buffer and want to reopen it, just like C-S-t to undo closed tab in Firefox, but there is no built-in command in Emacs, the defun undo-kill-buffer in http://www....
8
votes
2answers
232 views

Kill-buffer prompt with option to diff the changes

The save-some-buffers command prompts to save or ignore each modified file, and also provides an option to diff the modified file against the file it is visiting. I'd like the same behavior from kill-...
8
votes
3answers
891 views

Highlighting text in open (displayed) buffers/windows — searching for text from one buffer in another

Right now, I have my Emacs frame vertically split, and am looking at two different buffers in the two windows. I'd like to go to a word in one buffer, hit some keys, and have the ocurrences of that ...
8
votes
2answers
459 views

How should I get the filename of the original buffer in an indirect cloned buffer?

I wanted to look at different portions of a buffer in two different frames, as I have two monitors of different shapes that I can't easily span a single frame over. Some googling led me to use clone-...
5
votes
1answer
227 views

How to non-interactively dump list of open buffers, associated filenames and saved/unsaved state?

I'm trying to develop a git hook that warns me if any files that belong to a repo are unsaved in the editor. For that I need a list of open files/buffers and their state, so basically a non-...
9
votes
2answers
664 views

How can I create a dired buffer listing all open files?

I have a mechanism for burning items to disc from a dired buffer. Unfortunately, the file's I've patched are strewn accross the file system. How can I create a dired buffer from all open files?
8
votes
2answers
189 views

Killed buffer still shown by an earlier Ctrl-x Ctrl-b

I found that a killed buffer is still shown by a buffer created earlier by C-x C-b. How can we get the up-to-date buffer list?
17
votes
1answer
2k views

How to know my buffer's visible/focused status?

I'm writing an extension that talks to an outside process, so it is a given to lower the amount of 'hey whats up' requests when my buffer isn't focused. So, what is the best way to recognize: When ...
12
votes
3answers
908 views

Kill buffer when frame is deleted

When I close a frame, I'd like for its buffer to be killed. If the buffer is displayed in other frames, the buffer should not be killed. Do nothing if more than one buffer is displayed in a frame. ...
6
votes
3answers
231 views

Creating function to move top-buffer to other window

TL;DR: Any suggestions as to what function(s) can help me restore (to any given window) the buffer that was visible most recently? It's important that the currently visible buffer is not killed, just ...
13
votes
6answers
845 views

how to get buffers (not just files) to honor auto-mode-alist?

Q: how can I get new buffers to honor the mapping in auto-mode-alist? When finding a file, Emacs compares the file extension to the auto-mode-alist to determine which major mode to use for the file's ...
8
votes
2answers
1k views

Rapidly preview files

Similar to this question, I'd like a tool/minor mode to quickly preview my files by merely having the cursor positioned over them (e.g. the currently selected file is displayed in the active buffer ...
13
votes
2answers
2k views

How do I force a specific buffer to open in a new window?

When committing changes in Magit, it is useful to have the diff view open while adding details about the commit. In Magit, we see the diff in the *magit ..* buffer. When you hit cc while the cursor ...
8
votes
4answers
2k views

copy contents of current buffer in a temp buffer and operate on that

I need to copy the contents of the current buffer to a temp buffer, set that buffer to a particular major mode to take advantage of its benefits and get the information I need back to the main logic. ...
16
votes
2answers
2k views

How can I prevent a command from using specific windows?

Typically, I have a frame split into four windows, where two at the bottom are dedicated to my *compilation* and *grep* buffers. When browsing compilation errors, next-error will eventually replace my ...
11
votes
2answers
2k views

How can I make ibuffer auto-refresh the list of buffers?

M-x ibuffer Select a buffer Kill that buffer After the buffer is killed, the ibuffer buffer re-appears, but it still shows the buffer name killed in step 3. Is it possible to have ibuffer auto-...
5
votes
3answers
840 views

How to open and rename several multi-term buffers on start-up?

After each reboot, I have to painfully re-create and rename the multi-term buffers I use in my daily routine. I am completely new to Lisp, but nonetheless, I searched for similar problem on the web ...
14
votes
2answers
4k views

How can I set different font sizes for buffers and for the mode-line?

I have this line in my init.el file to set the size of the font in all frames: (push '(font . "DejaVu Sans Mono-10") default-frame-alist) It works but i'd like to have a bigger font in all buffers ...
6
votes
2answers
839 views

How to save multiple buffers

After modifying multiple files, how can I save all their buffers?
3
votes
3answers
201 views

Inserting org-style links from external program

I have written this function to insert an org-style link to a file: (defun jay/insert-file-link (fname) "Insert link to file (called by Midnight Commander)." (interactive "s") (insert "[[") (...
11
votes
2answers
1k views

Make Buffer List take focus?

How can I make it so that when I press C-xC-b to access the Buffer List that that buffer automatically takes focus instead of having to switch to it manually with C-xo? I can't find a variable that ...
9
votes
4answers
2k views

How to check whether a buffer is visiting a file?

I'd like to check whether some (say, current) buffer is visiting a file or not. I could say: (if (buffer-file-name) ...) but it seems to be not very elegant - what I'm interested in is only the ...
41
votes
8answers
8k views

How do I find text across many open buffers?

Lets say I have 10 buffers open, and I want to find all occurrences of blah in all 10 buffers. How would I do this?
73
votes
21answers
37k views

How do I switch buffers quickly?

In vanilla Emacs, I have to do C-x b and then manually type out the buffer name to switch. If I forget the name of the buffer, I have to hit TAB to list possible completions. Is there anything I can ...
15
votes
1answer
4k views

Get content of a buffer

So buffer-string gets the content of the current buffer. But it doesn't allow specifying other buffers. How can I get around that? Do I need something like save-window-excursion to make it work?
3
votes
1answer
631 views

How to better control Emacs buffers in StumpWM?

I have been using Emacs more and more, to the point that I would like to start using StumpWM as my default window manager with it, so that I can integrate the missing bits of my workflow that ...
16
votes
3answers
1k views

Set column widths in `ibuffer`

Is there a way to customize the widths of the columns in ibuffer? Specifically, I want to widen the Name column to be able to read more of the buffer names before they get truncated. I have tried ...
10
votes
1answer
220 views

What is the significance of Emacs buffers having names with *earmuffs*?

There are a number of Emacs buffers where their names have "earmuffs", i.e. they have names like *scratch* *R* *ESS* *helm-mode-circe* What is the significance of the earmuffs, and is there a reason ...
16
votes
1answer
2k views

Switch window split orientation, fastest way

Say you have two buffers open like so: ------------------------------------ | | buffer 1 | buffer 2 | | | ------...
28
votes
4answers
2k views

How to auto-save buffers when Emacs loses focus?

I recently had a Sublime Text user try out Emacs for a while, and he was interested in getting the same auto-save behavior in Emacs. Basically, he wanted all buffers to be saved whenever the frame ...
23
votes
8answers
5k views

Close all dired buffers

Sometimes my buffer list has 10+ dired windows, and I end up using buffer-menu to manually mark and kill all of them. Is there a faster way to close all open dired windows?
4
votes
4answers
793 views

Per Frame Buffers

How to make buffers accessible only from one frame(window) and not accessible from another and vice versa? So I want to have each frame with its own buffers. I'm on OS X.
4
votes
1answer
327 views

Creating permanent fixed buffer for CLHS lookup

Suppose I open one window with a Common Lisp file in it, and a second window with SLIME REPL in it (using M-x slime or whatever). Now, doing C-c C-d h with point on a Common Lisp keyword brings up a ...
28
votes
5answers
4k views

Re-open *scratch* buffer

If I accidentally closed the scratch buffer in Emacs, how do I create a new scratch buffer?

1
5 6 7 8
9