如何检查缓冲区是否为空?

upd*_*liu 6 emacs elisp

如何检查缓冲区是否为空?count-lines我认为检查是否为0是过度杀戮.

更新: 是的,菲尔斯的答案应该有效.把它写出来:

(defun buffer-empty-p (&optional buffer)
  (= (buffer-size buffer) 0))
Run Code Online (Sandbox Code Playgroud)

phi*_*ils 12

buffer-size is a built-in function in `C source code'.

(buffer-size &optional BUFFER)

Return the number of characters in the current buffer.
If BUFFER, return the number of characters in that buffer instead.
Run Code Online (Sandbox Code Playgroud)