Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
1 vote
1 answer
46 views

Get current point position in elisp function

I want to make a logger that display line number of the point. In init.el I wrote the following function: (defun logger () "Print logger" (print (concat "print(\"" (what-...
user avatar
  • 27
0 votes
0 answers
38 views

Most recently visited buffer appears at bottom of buffer-list

I have a function key bound to the command buffer-menu-other-window. But sometimes when I hit that key, while I am editing file foo.py, file foo.py appears at the bottom of my buffer list instead of ...
user avatar
  • 181
1 vote
1 answer
38 views

Is there a reliable way to determine in the minibuffer from which buffer the interactive command was invoked?

Simply checking the buffer-list is not enough, because an interactive command can be invoked via various ways, not just directly or via M-x. E.g. if you invoke it via a Helm-like selector package ...
user avatar
  • 1,058
0 votes
1 answer
24 views

AucTex: Output PDF Buffer Location

When hitting C-c C-a to display a PDF, the buffer opens automatically below the TeX source code. How can I force it to open on the right side? I am currently using shackle to manually control the ...
user avatar
0 votes
0 answers
24 views

Helm get current user input

I am trying to write a custom source for Helm. This source, however, should also give me the opportunity to create new objects, and not just select between those existing. The problem is, when what ...
user avatar
  • 1
0 votes
1 answer
32 views

org-agenda tag selection buffer is too small to view any tags

when using C-c C-q to run org-set-tags-command on an existing headline, i am unable to see the list of tags because the buffer window is so small. all i see is inherited tags and current tags lines. ...
user avatar
  • 31
0 votes
2 answers
47 views

How to ignore dired buffers and buffers that begin with * or SPC when switching buffer in Vertico + Consult?

I am currently an ivy user, trying out vertico + consult. For ivy I am using the following (defun rit-check-buffer-mode (str mode) "Check whether the buffer's major mode is `mode'." (let ...
user avatar
0 votes
0 answers
11 views

display-buffer-reuse-frames with server-mode

I have been using display-buffer-reuse-frames for a long time. It works fine when creating multiple frames with X11, or MS-Windows. Today I was using emacs via ssh. So I tried to use this feature, ...
user avatar
2 votes
2 answers
61 views

next-buffer: Browse through all open buffers using arrow keys but using C-x just one time

Via C-x+→ (next-buffer) I can go to the next buffer. For every next buffer I have to do C-x+→ again and again. But I would like to do something like C-x+→+→+→+→... Is it possible? Of course I also ...
user avatar
  • 499
0 votes
1 answer
31 views

Force one window when opening multiple files spacemacs

Looking for the spacemacs answer to this question. How do I have spacemacs open as if I had issued SPC w m (spacemacs/toggle-maximize-buffer)? I thought it might be dotspacemacs-maximized-at-startup, ...
user avatar
3 votes
1 answer
42 views

Emacs recent buffers use `~` abbreviation?

I have my entire Spacemacs config syncing between a Mac and a Linux machine, which provides a lot of benefits. My packages are always up to date on both systems, a configuration change on one machine ...
user avatar
2 votes
2 answers
65 views

Why does emacs recognize my wildcard with finding file but not with searching buffer?

In the linux terminal, i often use wildcards (*) as a shorter alternative to type in the whole file name: if the file is named foo-and-cats I just type in something like fo* in order to pull up the ...
user avatar
0 votes
1 answer
36 views

How to define a command to switch to the current candidate buffer in Ido?

I'm trying to write a command that I would call while using ido-switch-buffer or ido-kill-buffer to open the current candidate in another window. Ideally it would be able to open virtual buffers as ...
user avatar
  • 1,392
0 votes
1 answer
27 views

Bookmarks for non-file buffers?

I know about Book Marks, which is a great way to save shortcuts to certain files and locations within them. However, when I C-x r m in a non-file buffer, say Python or Shell, I only get: bookmark-...
user avatar
  • 314
1 vote
1 answer
69 views

Focus a buffer window if already visible; open a window with the buffer if not

I'd like to use a single function (and later keybind it to a single key) that would do the following: if treemacs is visible in the frame, focus to its window; if not, call treemacs. I took a look ...
user avatar
1 vote
2 answers
37 views

Exotic dired-based window-splitting mode

NOTE: I added more info to this query. Initially, I didn't mention dired, but after experimenting, I see that it needs to be explicitly discussed here, because of how it manages buffers. I'm using ...
user avatar
  • 522
2 votes
1 answer
51 views

How to create independent Dired buffers for the same directory?

I'm trying to programmatically define the windows in my frame. I have 4 windows, two with dired buffers in them so that I can select the file I want to visit. (delete-other-windows) (split-window-...
user avatar
  • 3,845
3 votes
2 answers
73 views

Forcing buffers whose names start with "*" to be skipped in many commands?

I'm using Emacs 26. There are many Elisp commands which offer the "next" buffer as part of the command's execution or after the command completes. I am looking for a way to keep buffers ...
user avatar
  • 522
1 vote
2 answers
42 views

How to warn before editing or saving a buffer whose underlying file no longer exists?

(NB: In this post, I will use expressions like "a buffer's underlying file" to mean, in the Emacs' documentation's terminology, "the file a buffer is visiting", i.e. the value of (...
user avatar
  • 2,889
5 votes
1 answer
167 views

Is there a "switch to buffer" hook?

I'm running emacs 26.3. I want to run a hook every time I switch to a buffer. However, I have not been able to find any kind of "buffer switch hook". If I want to always run a function when ...
user avatar
  • 522
0 votes
0 answers
61 views

How to prevent org-id-update-id-locations from opening all files?

From what I am experiencing, org-id-update-id-locations opens all files in my org-directory and more that it knows of, and if inlineimages is set even loads the images in that process. This creates a ...
user avatar
  • 224
0 votes
1 answer
61 views

How to know (in Elisp) what buffer was current when a command is invoked?

I want to give an arbitrary command some buffer-local behavior without advising it. (I can do it by advising, but I want to also be able to do it without advising.) E.g., just looking at some ...
user avatar
  • 69.2k
2 votes
1 answer
35 views

How to switch windows to specific visible buffer?

Is there a command that allows me to have my cursor switch windows to a specified buffer? Something that looks like (switch-to-specific-window-command "buffer-name")
user avatar
  • 288
0 votes
1 answer
37 views

How can I sort a list of buffers according to a buffer-local variable?

I am setting a buffer-local variable called my/tab-order in (some) of my buffers. I have written the following function to return a list of buffers only where my/tab-order has been set and is greater ...
user avatar
0 votes
1 answer
51 views

How can I jump beginning of the buffer under import section in python-mode

I am using beginning-of-buffer to the jump beginning of a buffer. Is it possible to achive same behavior but to the first line under the import or from` section in the Python mode. In this example I ...
user avatar
  • 1,112
0 votes
1 answer
98 views

How to make buffer order in tab-line persistent?

I'm using global-tab-line-mode, and I would like the order of tabs to persist. Say my buffer/tab order is: | a.el | b.el | c.el | and b.el is the current buffer. If I call (find-file "a.el") ...
user avatar
1 vote
2 answers
45 views

How to ask for confirmation before killing any new modified buffer?

What's the best way to prompt for confirmation before killing any modified buffer, including new buffers created by evil-buffer-new, which creates a buffer without an associated filename. Modified ...
user avatar
  • 163
0 votes
2 answers
203 views

Filter text of buffer in a grep-like way

I want to filter the text of an emacs buffer, a bit like you can filter text with grep. Sounds simple, but I tried googling it and I only get results from people who want to search in a buffer or to ...
user avatar
  • 113
0 votes
0 answers
17 views

Close buffer switching to next buffer without leaving or closing the window

I am using the Emacs-terms here. I want to close the current file/buffer. But I do not want to leaver or close the current emacs-window. In the current window there should just appear the next open ...
user avatar
  • 499
4 votes
1 answer
75 views

Automatically Uniquify Certain Buffers

Emacs does a wonderful job of disambiguating buffer names when I have several files with the same name open. That is, if I open a single main.cpp, the buffer is simply called main.cpp, but if I open ...
user avatar
0 votes
1 answer
89 views

Key chord for org refresh buffer?

Due to my Ubuntu 21.04 Wayland being flaky (I suspect), I can't always get the org menu to drop down properly, and I like to do a "Refresh setup current buffer" often. How could I do this ...
user avatar
  • 2,717
2 votes
1 answer
67 views

preview and edit side-by-side, maybe by syncronizing buffers?

Many major modes provide a function to switch between editing and preview rendering a file. I am specifically looking at ps-mode but an answer that applies to others would be nice. I can open the same ...
user avatar
  • 137
0 votes
0 answers
30 views

How can a buffer be programmatically moved to be the second most recent buffer in the buffer-list, so just behind the current buffer?

Is there a simpler way to do this than manipulating the buffer list itself directly?
user avatar
  • 1,058
0 votes
0 answers
23 views

Org-mode agenda custom commands settings not persistent when enable org-agenda-sticky

I want to switch between multiple agenda buffers quickly and have enabled org-agenda-sticky. I set different configs like org-agenda-prefix-format and org-agenda-archives-mode in different custom ...
user avatar
  • 133
2 votes
0 answers
50 views

global-auto-revert-mode with confirmation first?

I know I can use (global-auto-revert-mode 1) to automatically revert a buffer if the buffer has been changed in another editor. However, when Emacs detects (automatically) that the buffer has changed, ...
user avatar
  • 173
1 vote
1 answer
48 views

Create a new named buffer with a function

I want to create a keyboard shortcut that will prompt me for a string and then open a new ansi-term buffer with that string as the buffer name. How would I do this?
user avatar
  • 471
1 vote
1 answer
17 views

How to resolve key-binding conflict between Icicles and `super-save-mode`?

I noticed that if Icicles is loaded then super-save-mode doesn't save a buffer when you switch to another buffer, though switching frames works. Icicles seems so technically advanced, yet there is no ...
user avatar
0 votes
1 answer
29 views

terraform tfls server always asks if restart when edit a .tf file in spacemacs

When I use terraform layer with spacemacs, after operate a .tf file, at the status bar it always notices the message below: Server tfls:3869 exited with status exit(check corresponding stderr buffer ...
user avatar
  • 105
1 vote
1 answer
87 views

How to quickly cycles through buffers of the same major mode as current one?

I'd like to find a way to cycle through all buffers that use the same major mode as the current buffer. For all major modes, including the special buffers. Use case example: when refactoring code I ...
user avatar
  • 581
1 vote
1 answer
135 views

Using Shackle to manage WoMan buffers

I would like shackle.el to manage the buffers created by WoMan. Here's the configuration I'm using: (use-package shackle :config (setq shackle-rules '((woman-mode :select t :align below :size 0.5))...
user avatar
  • 1,740
1 vote
2 answers
157 views

How to kill all buffers except the buffer current one and *other*?

I use this: (defun kill-other-buffers () "kill all other buffers." (interactive) (mapc 'kill-buffer (delq (current-buffer) (buffer-list)))) I need to add one more buffer
user avatar
0 votes
2 answers
69 views

Switch to the most recently selected buffer in the current window

I am looking for a command that would switch to the buffer I most recently selected in the current window. The command mode-line-other-buffer will switch to the most recently selected buffer not ...
user avatar
  • 166
1 vote
1 answer
139 views

How to switch to `flycheck-list-errors` buffer/window/minibuffer?

For starters I use Doom Emacs. Here's the scenario: I have a python/perl/js buffer and flycheck-mode activated. Flycheck does its job and tells me that there are some errors that need attention. I go ...
user avatar
  • 11
1 vote
1 answer
52 views

Switch to most recent buffer in a given mode

I am trying to create a function that switches to the most recent buffer in major mode major-mode. An answer to a related question supplies a function that should require the smallest of tweaks to ...
user avatar
  • 166
1 vote
0 answers
50 views

magit status buffer disappears

Magit status used to create a buffer with the buffer name magit: repo name. I recently upgraded Spacemacs and the Magit status buffer started to disappear whenever its window was not visible, and it ...
user avatar
0 votes
1 answer
30 views

`pop-to-buffer` in other frame if file is already visited

Say I have two frames open. Frame A is visiting a file foo.org. Calling (pop-to-buffer "foo.org") in the other frame (B) opens foo.org in frame B instead of moving the focus to frame A where ...
user avatar
2 votes
1 answer
22 views

Why does `next-error` change my buffer as keyboard macro, but not in lisp code?

My goal is to use grep to find other Org files, use next-error to switch to those files, copy the link to the grep match, then go back and paste that link. It worked for a long time as a macro, but ...
user avatar
0 votes
0 answers
33 views

Remove stale buffers after switching to a different branch

This is the scenario: Switch to a new git branch Open some "new files" in that branch Switch back to an older branch that doesn't have these "new files" I want these opened ...
user avatar
  • 554
1 vote
1 answer
47 views

Storing some text from a buffer into a variable

What is the "standard" way to store some text obtained from a buffer into a variable? The only way I could think of was to use something along the lines of (let ((beg (point))) (end-of-line) ...
user avatar
  • 231
0 votes
1 answer
61 views

How to prompt to save the modified buffer before switching?

Vim prompts to save the buffer before switching if no other window is holding it. In other words, it prompts to save the buffer before putting it in background. How can I get the same behavior in ...
user avatar
  • 151

1
2 3 4 5
11