Emacs: what is the shortcut key to clear buffer?

后端 未结 7 1757
别跟我提以往
别跟我提以往 2021-01-30 12:45

Like, Control-A (select all) followed by delete?

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 13:11

    These macros build on the answers given above. To start using them paste them into your .emacs then restart emacs or (while in the .emacs buffer) type M-x eval-buffer.

    (defun clear-buffer ()
      "clear whole buffer add contents to the kill ring"
      (interactive)
      (kill-region (point-min) (point-max))
      )
    
    (defun clear-buffer-permenantly ()
      "clear whole buffer, contents is not added to the kill ring"
      (interactive)
      (delete-region (point-min) (point-max))
      )
    

提交回复
热议问题