2013-09-01 end-of-visual-line-p (en)

Am I the only one to hit C-t at the end of line in visual-line-mode and to get a nasty surprise? And then, to find that there’s no visual-line-mode-compatible counterpart to eolp? Well, here it is, due to StackOverflow’s user Jon O. (see this question):

(defun end-of-visual-line-p ()
  (= (point)
     (save-excursion
       (end-of-visual-line)
       (point))))

Notice how elegantly you don’t have to explicitly use a temporary variable, leveraging save-excursion and its implicit progn.

CategoryEnglish, CategoryBlog, CategoryEmacs