开发者

Check if current Emacs buffer contains a string

I have a buffer open in emacs. I want a function that will return t if the current buffer contains the string, oth开发者_Python百科erwise it returns nil.

(defun buffer-contains-substring (string)
    ...
)


This is careful to not change where you are, or damage any match data.

(defun buffer-contains-substring (string)
  (save-excursion
    (save-match-data
      (goto-char (point-min))
      (search-forward string nil t))))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜