emacs Buffers


Example

  • Example of a buffer list

    CRM Buffer                Size  Mode              Filename[/Process]
    . * .emacs                3294  Emacs-Lisp        ~/.emacs
     %  *Help*                 101  Help
        search.c             86055  C                 ~/cvs/emacs/src/search.c
     %  src                  20959  Dired by name     ~/cvs/emacs/src/
      * *mail*                  42  Mail
     %  HELLO                 1607  Fundamental       ~/cvs/emacs/etc/HELLO
     %  NEWS                481184  Outline           ~/cvs/emacs/etc/NEWS
        *scratch*              191  Lisp Interaction
      * *
    Messages*            1554  Messages
    

    The first field of a line indicates:

    • ‘.’ the buffer is current.
    • ‘%’ a read-only buffer.
    • ‘*’ the buffer is modified.
  • Select buffer. You can select out of any open buffer with the following keybinding:

    C-x b

    You will be prompted for the buffer name you wish to switch to.

  • List buffers:

    C-x C-b

  • Save-some-buffer, giving the choice which buffer to save or not:

    C-x s

  • Kill one buffer:

    C-x k

  • Operations on marked buffers:

    S Save the marked buffers

    A View the marked buffers in this frame.

    H View the marked buffers in another frame.

    V Revert the marked buffers.

    T Toggle read-only state of marked buffers.

    D Kill the marked buffers.

    M-s a C-s Do incremental search in the marked buffers.

    M-s a C-M-s Isearch for regexp in the marked buffers.

    U Replace by regexp in each of the marked buffers.

    Q Query replace in each of the marked buffers.

    I As above, with a regular expression.

    P Print the marked buffers.

    O List lines in all marked buffers which match a given regexp (like the function `occur').

    X Pipe the contents of the marked buffers to a shell command.

    N Replace the contents of the marked buffers with the output of a shell command.

    ! Run a shell command with the buffer's file as an argument.

    E Evaluate a form in each of the marked buffers. This is a very flexible command. For example, if you want to make all of the marked buffers read only, try using (read-only-mode 1) as the input form.

    W - As above, but view each buffer while the form is evaluated.

    k - Remove the marked lines from the Ibuffer buffer, but don't kill the associated buffer.

    x - Kill all buffers marked for deletion.

  • Save-some-buffer, giving the choice which buffer to save or not:

    C-x s

  • Switch to the next buffer:

    C-x RIGHT

  • Switch to previous buffer:

    C-x LEFT