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

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

Re: point-at-final-line


From: Emanuel Berg
Subject: Re: point-at-final-line
Date: Sat, 27 Jan 2018 03:56:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

John Mastro wrote:

> This should do it too, without needing
> line-number-at-pos

Right, what is better to not have?
`line-number-at-pos' or `save-excursion'?
Normally, I'd say `save-excursion' is better to
not have than most other functions. But here,
`line-number-at-pos' is implemented with
`save-excursion'! But at least it doesn't
show...

> (defun point-at-final-line ()
>  (save-excursion
>    (end-of-line)
>    (= (forward-line 1) 1)))
>
> Since forward-line returns "the count of
> lines left to move".

Indeed, I thought about it this, but the code
sure looks cryptic, especially for such
a trivial task. Again, this won't show when
"point-at-final-line" is called!

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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