I just want to check if the current line is empty or not (if it contains only whitespace, then I still consider it empty).
Here is my initial version:
(defun strip-text-properties(txt)
(set-text-properties 0 (length txt) nil txt)
txt)
(defun is-current-line-empty ()
(interactive)
(setq c-line (thing-at-point 'line))
(string-match "^\s*$" (strip-text-properties c-line)))
What is the easiest way to check if current line is empty?
\s
is equivalent to writings
. Perhaps you meant"^\\s*$"
.\\s-
instead of\\s
. That hyphen is required in elisp regexp.