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

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

Re: hline


From: Emanuel Berg
Subject: Re: hline
Date: Thu, 07 Jan 2021 23:44:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Marcin Borkowski wrote:

>> (defun hline (&optional char)
>>   (interactive "P")
>>   (let ((len (- (window-width) (current-column) 1))
>>         (c (or char ?-)) )
>>     (insert (make-string len c)) ))
>
> Funny how I wrote an almost identical function just two days
> ago... Though I used (1- (window-width)), since in my use
> case I knew that (current-column) would be zero.
>
> Anybody knows why it is necessary to subtract 1?

Eh... "anybody"? ...

[74] column number 74
[X] you are here
* = you want to write the char here
$ = but not here
.. = etc

               *   *    *    *    $    ..
[01] ... [74] [X] [76] [77] [78] [79] [80]

so 4 chars.

compute:

(- 80 75 1) ; 4

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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