2013-08-19 5 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. 
관련 문제