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

时间:2013-08-19 11:41:00

标签: emacs elisp

如何检查缓冲区是否为空?检查count-lines给出0是否过度杀死我认为。

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

(defun buffer-empty-p (&optional buffer)
  (= (buffer-size buffer) 0))

1 个答案:

答案 0 :(得分: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.