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

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

Re: Underline the current line (function inside)


From: Eli Zaretskii
Subject: Re: Underline the current line (function inside)
Date: Fri, 11 Jun 2021 20:55:25 +0300

> Date: Fri, 11 Jun 2021 18:33:45 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: help-gnu-emacs@gnu.org
> 
> (defun underline-line ()
>   "Underline the current line."
>   (interactive)
>   (let* ((start (line-beginning-position))
>        (end (line-end-position))
>        (length (string-width (buffer-substring-no-properties start end))))
>     (end-of-line)
>     (newline)
>     (insert (make-string length ?=))
>     (newline)))

Right.  I suggest to try the alternative that uses current-column, it
will allow you to avoid consing a string, and I think will also be
faster.



reply via email to

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