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
0
votes
1answer
111 views

M-RET to open buffer in new frame in helm-mini?

Is it possible to add a key binding M-RET to helm-mini which would open the selected buffer in a new frame instead of in the current window?
3
votes
2answers
151 views

How can I create a new buffer for the second run of grep, to avoid overwriting the results of the first run of grep?

When I run grep by M-x grep, I get results in a buffer. When i run grep again M-x grep, the new results overwrite the previous ones in the same buffer. How can I create a new buffer for the second ...
2
votes
1answer
47 views

How modify this function, that it will detect the visibile buffers in all windows?

I found a function, that will kill all buffers except the current buffer that's open. (defun kill-other-buffers () "Kill all buffers but the current one. Doesn't mess with special buffers." (...
3
votes
1answer
504 views

how to restore last helm session?

Is there a way to reopen the last helm buffer including minibuffer content and cursor position ? This would be especially convenient, when using helm-find-files to navigate remote filesystems.
0
votes
1answer
137 views

helm-find-files (and others): how to prevent C-j from creating buffer when no match

When hitting C-j in the minibuffer while executing helm-find-files and no match is possible, helm creates a new buffer with the name of the completion. E.g. I do M-x helm-find-files, type foo there is ...
4
votes
1answer
183 views

How to revert a buffer without changing active modes?

M-x revert-buffer resets the active minor modes to the defaults for the underlying file. How can I preserve the minor modes active while reverting the buffer? My attempt so far: (defun revert () (...
1
vote
0answers
133 views

how to prevent buffer menu from folding

Is there a way to prevent emacs from folding the buffer menu? Example, when I Control + 'right click' on a buffer I see a menu like this: Buffer Menu ----------- JavaScript > XQuery > Custom &...
7
votes
2answers
439 views

How to always kill dired buffer when deleting a folder?

If I'm in dired and have a subfolder with another dired buffer (a common situation when navigating up/down directory) and want to delete a folder, I hit Dx to mark for deletion, then execute. Emacs ...
3
votes
2answers
232 views

Show the matching line in the center of the screen instead of the bottom when opening a grep result

When I grep something inside emacs and click to open one of the matching files. The matching line is always displayed at the bottom of the screen, and I have to scroll it up for a better view. Is it ...
1
vote
0answers
82 views

Weird emacs graphics on popup windows

I have emacs 25.1.1 installed on my kubuntu 16.10 with gtk-3.18.9. Those popup messages that you get with emacs when you exit without saving: Those are looking very strange and taking up my full ...
1
vote
1answer
436 views

Is it possible to change the font size in specific buffers?

I would like to have different font sizes for the buffer windows in Emacs. That is, I would like to have a bigger font in the buffer where i write the code, and a smaller font in the buffer where i ...
0
votes
1answer
55 views

Interactive Function to Create a Buffer in a Default Folder with Autocompletion of the File Name with the Predefined Prefix

Could you please tell me how I can write a function which creates and visits a buffer in a particular directory (a default directory name is hard coded, but it would be nice to have an opportunity to ...
8
votes
1answer
3k views

Find position in file by character number

When an error occur in compiling a program in Ghostscript, the error message gives a "Current file position is ..." with a number. I use emacs to edit the program file, so I would like to be able ...
1
vote
1answer
137 views

How to show process in another already opened frame?

I have two frames opened in emacs (one in each monitor, but this is irrelevant). I would like to have a lisp function to switch the buffer in the other frame (in the other monitor), whose focus is in ...
3
votes
3answers
1k views

Dired-like browser for buffers?

I use Spacemacs, and I often use SPC b b to list buffers so that I can kill the buffers I no longer want. Unfortunately, this process takes a while because I have to repeatedly press SPC b b, navigate ...
0
votes
1answer
207 views

How to check if there exists a frame in which a given buffer is visible

this question is related to the question How to know my buffer's visible/focused status?. I would like to check if there exists a frame in which a given buffer is visible. I tried the following ...
1
vote
1answer
217 views

Switching between sets of buffers [duplicate]

I often work with Tmux and I really like the ability to have multiple windows where each window has a custom set of panes. This allows me to quickly switch between layouts without losing anything. So ...
1
vote
0answers
40 views

Calling `doc-view-goto-page` in other buffer

I'm trying to control paging of a PDF file in doc-view mode. Say we have the following snippet (let ((origin-frame (window-frame))) (with-selected-frame (make-frame-command) (let ((pdf-buffer (...
2
votes
1answer
61 views

Better way to find regexp in emacs buffer

I'm trying to make a function to read a whole buffer and find lines that match with regexp, I think to read the whole buffer and save to list of strings but I read that it's very inefficient. Whats ...
1
vote
1answer
209 views

Save REPL buffer as file?

I've seen a discussion on someone trying to save the actual state of a Lisp Slime REPL. I just want to save a text version of a Geiser Racket REPL session, e.g., *ch1*, while using org-mode. (Then I ...
1
vote
1answer
331 views

Disable tabbar in special buffers

I have Tabbar installed and when I am using some function like describe-key in emacs the resulting *help* buffer has a tab bar at the top. This is a waste of space and is distracting. How can I ...
4
votes
1answer
202 views

How to check, if a file is already visited?

I have the following code, which opens a file, inserts some text, saves the file and closes it. (defun batch (file) (find-file file) (end-of-buffer) (insert "nix") (save-buffer) (kill-...
4
votes
2answers
447 views

Checking if there exists a buffer whose name starting with a particular string

According to the documentation the function get-buffer checks if there is a buffer with a specific name. More precisely (get-buffer name) Return the buffer named name (a string). If there is no ...
7
votes
4answers
10k views

Spacemacs: kill buffer and kill window in one command?

Is there a spacemacs command that both closes the window and kills the buffer? In other words, the equivalent of Vim's :q?
3
votes
4answers
340 views

Only enable auto-revert-mode for the current buffer

I use auto-revert-mode and ideally I would like the auto-revert-interval to be very small, e.g. 0.5 seconds or less. But I am concerned about performance problems when I have many buffers open, ...
16
votes
2answers
2k views

Why is (point-min) much more popular than 1?

I searched accross all Emacs Lisp files in Emacs Git repo, and found (goto-char (point-min)) occurs 3621 times and (goto-char 1) occurs 31 times. Personally, I see lots of (point-min) but none 1, even ...
0
votes
1answer
107 views

Switching buffer to special mode or any mode?

I have written some code to create a new buffer, it starts up in fundamental mode, the buffer is to display output from commands. I am using this to create the buffer (get-buffer-create "*My Buffer*"...
4
votes
2answers
550 views

How to make buffer name in mode-line be bold when its window is selected? [duplicate]

In Emacs, on the modeline: I would like the name of the currently focused buffer to be bold, but only when its window is selected. My modeline looks something like this: (setq mode-line-format (...
1
vote
1answer
933 views

how to modify buffer display behaviour?

I use display-buffer-alist to Configure buffer display. For example I have this snippet to display flycheck errors buffer. (add-to-list 'display-buffer-alist `(,(rx bos "*Flycheck errors*...
2
votes
1answer
131 views

How can I tell if a buffer is already visible?

I'd like to have the following code in my library: (when (not (buffer-visible-p es-results-buffer)) (delete-other-windows) (view-buffer-other-window es-results-buffer)) However, I haven't been ...
3
votes
2answers
443 views

Go to window by buffername

I would like to be able to switch to an open window by typing the name of the buffer which is displayed in it. It would be something like C-x b which opens the selected buffer only if it is not opened ...
0
votes
0answers
93 views

open the shell buffer in the same frame as compilation buffer — C compilation

I'm regularly compiling some C programs and one thing is annoying : after I've compiled, I'm opening a shell with M-x shell ./foo, but the shell open in place of the source code's window. I would ...
2
votes
3answers
465 views

Multiple grep results buffers

Let's say I want to grep word1 and word2. If I use the grep command for word1 I get the results in the *grep* buffer. If I then use the grep command for word2 I loose the old results and get the ...
2
votes
2answers
383 views

Hide dired buffers from IBuffer list?

I have a dired workflow that I like. From a file-visiting buffer, I'll use dired-jump to pop up to the containing directory. Dired renders the directory in a new buffer with the cursor on the file-...
0
votes
1answer
523 views

how to automatically adjust window size to buffer height?

I want to optimize my gdb window setup. The idea is to automatically resize the gdb-breakpoints window to the current buffer length. In my setup this buffer is at the bottom and I want it to auto-...
6
votes
1answer
443 views

How can I hide unwanted buffers when cycling with C-x <left/right> [duplicate]

I often have various files open and cycle through them using C-x <left> and C-x <right>. However, this means I also need to cycle through various "informative" buffers that I really don't ...
6
votes
1answer
937 views

`switch-to-buffer` vs. `pop-to-buffer-same-window`

What is the difference between pop-to-buffer-same-window and switch-to-buffer? switch-to-buffer-other-window is basically an alias for pop-to-buffer, so I'm surprised that pop-to-buffer-same-window ...
4
votes
1answer
116 views

How to empty a buffer before it gets to0 large

I'm browsing with erc to some channels which are mainly used by bot request. Therefore the buffer size will scale up very fast. Since It's a read-only buffer I cannot empty it by hand. Is there a way ...
0
votes
1answer
283 views

How can I make icomplete/ido behave like iswitchb?

Emacs has recently (between 24.0 and 25 ish?) removed iswitchb in favor of some combination of ido and icomplete mode, which I've seen claims are 99% compatible; which I can live with, I don't have ...
3
votes
1answer
254 views

emacsclient, c-x #, c-x c-f and other confusion

I have used emacs for several years now and wanted to make the leap to daemon mode and using emacsclient. What has prevented me so far is getting ride(closing) of buffers opend via emacsclient. Note ...
5
votes
1answer
464 views

Insert into specific buffer (not the active buffer)?

Is there any way to insert text into a buffer that isn't the active buffer with Elisp? Perhaps there is an equivalent to with-temp-buffer that takes a specific, existing buffer as an argument?
0
votes
1answer
65 views

In a new shell, move to directory of other current buffer being edited?

I am using emacs to edit Latex. My work flow is to open the latex file, open a new buffer in a separate window via C-x 2. Then moving the context into the new windowbuffer via C-x o, I type M x shell ...
0
votes
1answer
90 views

Dashes (or strippled line, dashed) in tabbar for emacs with X

I'm trying to go full minimalist over here... But I can't figure out how to remove the strippled line next to "untitled". I'd like it to be nothing at all. The customizations I've done so far for ...
5
votes
2answers
848 views

Restore welcome screen buffer when closed

How do I open startup/splash/welcome screen/message buffer (*GNU Emacs*) when it's not listed in list-buffers ?
4
votes
2answers
654 views

How to make emacs automatically kill buffer after invoking delete-file command?

Whenever I delete a file that I no longer need in emacs using delete-file command, the buffer associated with the file is still open in emacs. Is there a way I can change this behaviour so that ...
1
vote
0answers
63 views

How to trigger function on particularly named buffer creation?

How does one trigger a function to run when a buffer of a particular name is created? My use case is connecting to freenode with ERC for Emacs related channels. I manually call a function to create a ...
2
votes
1answer
67 views

Error when folder of an open buffer is deleted outside emacs

I get this error when I am trying to swtch buffer and a folder of an open buffer is deleted outside emacs: Error in post-command-hook (evil-mode-check-buffers): (file-error "Setting current directory"...
3
votes
1answer
433 views

How to be notified when a buffer/window becomes selected - no hook available?

I'm trying to run a piece of code when a buffer/window becomes selected. For an example use case, suppose I'm editing a buffer, save it, and kill it. Suppose also the buffer "below" (that appears ...
3
votes
1answer
184 views

Elisp nested function stops execution

I can not figure out why does when I factored out function it started to work wrong. Here's the my function to kill all dired buffers, its bound to dired-mode-map that work as expected and ...
0
votes
1answer
84 views

Return nth line from (current) buffer

I want to get the first line of the buffer I'm actually in. More generally, I'm looking for a utility that returns Nth line from a supplied buffer. Is there some built-in for that?