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: Fri, 08 Jan 2021 00:08:51 +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?

:O

I don't understand why YOU ask this?

But for everyone else's information, it can be better
explained like this, I think, than the examples I just posted.

If we want to cover the distance between A to B on a line,
this distance is B - A. However B is reported not the       _
desired B but B + 1. So by subtracting 1 we get the real B |_|

:)

-- 
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]