emacs-devel
[Top][All Lists]
Advanced

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

How to add a temporary blank line at the end of buffer safely


From: tumashu
Subject: How to add a temporary blank line at the end of buffer safely
Date: Thu, 11 Jan 2018 16:45:43 +0800 (CST)

-----------------------------------------------------------------------
> Date: Mon, 11 Dec 2017 16:29:16 +0800 (CST)
> From: tumashu  <address@hidden>
> Cc: "address@hidden" <address@hidden>
> 
> by the way, does emacs has a function, which can get the point's left-bottom 
> pixel position,  if not,
> is it possible to add it to emacs?

Doesn't vertical-motion fit the bill?  If not, why not?
------------------------------------------------------------------------
@Eli Zaretskii Thanks for your suggestion, it works very well,  the only problem is that
it can not work when point at the end line of buffer, I use the below code to handle this problem,
(add a temp "\n" then remove) but it seem to hacky.  any good way to solve this problem:

  (if (= (line-end-position) (point-max))
      (let (posn)
        (goto-char (point-max))
        (insert "\n")
        (setq posn (posn-at-point (point) window))
        (delete-char -1)
        posn)
    (vertical-motion 1)
    (posn-at-point (point) window))



reply via email to

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