简体   繁体   English

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

[英]How to check if a buffer is empty?

How to check if a buffer is empty? 如何检查缓冲区是否为空? Checking if count-lines gives 0 is over-killing for this I think. 我认为检查count-lines为0是过度杀戮。

UPDATE: Yeah, phils's answer should work. 更新:是的,菲尔斯的答案应该有效。 Write it out: 把它写出来:

(defun buffer-empty-p (&optional buffer)
  (= (buffer-size buffer) 0))
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.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM