Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make an arbitrary Emacs buffer "hidden"?

Tags:

emacs

Several emacs extensions create "junk" buffers, and I have to manually remove them from various buffer lists.

Emacs has a concept of "hidden buffers", which is used for instance for the minibuffer.

How can I make an arbitrary buffer a hidden buffer?

like image 685
sabof Avatar asked Jan 12 '12 21:01

sabof


People also ask

How do I delete a buffer in Emacs?

C-x k ( kill-buffer ) kills one buffer, whose name you specify in the minibuffer. The default, used if you type just RET in the minibuffer, is to kill the current buffer.

How do I use buffers in Emacs?

Most buffers are created by visiting files, or by Emacs commands that want to display some text, but you can also create a buffer explicitly by typing C-x b bufname RET . This makes a new, empty buffer that is not visiting any file, and selects it for editing. Such buffers are used for making notes to yourself.

What is an Emacs buffer?

Buffers in Emacs editing are objects that have distinct names and hold text that can be edited. Buffers appear to Lisp programs as a special data type. You can think of the contents of a buffer as a string that you can extend; insertions and deletions may occur in any part of the buffer. See Text.


1 Answers

Emacs does have a concept of uninteresting/hidden buffers - and designates them as such by making their names begin with a space. See the documentation for buffer names. You can make a buffer "uninteresting" by changing its name to begin with a space.

Try M-x make-buffer-uninteresting:

(defun make-buffer-uninteresting ()
  "rename the current buffer to begin with a space"
  (interactive)
  (unless (string-match-p "^ " (buffer-name))
    (rename-buffer (concat " " (buffer-name)))))
like image 170
Trey Jackson Avatar answered Oct 23 '22 06:10

Trey Jackson