help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: empty-line-p


From: Joost Kremers
Subject: Re: empty-line-p
Date: 29 Mar 2007 14:32:05 GMT
User-agent: slrn/0.9.8.1 (Linux)

Andreas Roehler wrote:
> needed a check at several occassions, if the current line
> contains printable characters.
>
> What about the following to solve this?
>
> (defun empty-line-p ()
>   "Returns t if cursor is at an empty line "
>   (interactive)
>   (save-excursion
>     (beginning-of-line)
>   (if
>       (looking-at "^[ \t\f\r]*$")
>       t
>     nil)))

you don't need the if-statement here:

(defun empty-line-p ()
  "Returns t if cursor is at an empty line "
  (interactive)
  (save-excursion
    (beginning-of-line)
    (looking-at "^[ \t\f\r]*$")))

looking-at already returns t or nil.

-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]