Why does this function print non-zero integers on non-empty lines?
;; taken from https://emacs.stackexchange.com/a/16826/10896
(defun current-line-empty-p ()
(interactive)
(setq answer (string-match-p "^\\s-*$" (thing-at-point 'line)))
(message "%s" answer)
answer)
I would like the answer to be displayed as t
or nil
. But on a non-empty line, it prints 35 or some other non-zero integer depending on which line I called it via M-x
. On blank lines it prints 0.
Sure non-zero means false and zero means true but I am curious why this behaviour happens? I would have thought string-match-p
already returned booleans.