2013-08-19 25 views
6

如何检查缓冲区是否为空?我认为,检查count-lines是否为0会导致过度查杀。如何检查缓冲区是否为空?

更新: 是的,phils的答案应该工作。写出来:

(defun buffer-empty-p (&optional buffer) 
    (= (buffer-size buffer) 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. 
相关问题