I have a buffer open in emacs. I want a function that will return t
if the current buffer contains the string, otherwise it returns nil
.
(defun buffer-contains-substring (string)
...
)
I have a buffer open in emacs. I want a function that will return t
if the current buffer contains the string, otherwise 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))))