emacs-devel
[Top][All Lists]
Advanced

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

Re: visual-line-mode


From: David Reitter
Subject: Re: visual-line-mode
Date: Fri, 4 Jul 2008 17:21:13 +0100

On 4 Jul 2008, at 16:49, Stefan Monnier wrote:

If we had a way to determine the buffer position for given pixel
coordinates (something like posn-point, without requiring the event
structure that contains the information),

Does posn-at-x-y provide the info you need?

That's a pretty good suggestion, thanks.
This should make it possible to write a non-iterative algorithm, as below.

I'll see if I can make it work for the scrolling case and insert goal columns etc.

- D


(defun go-up (point)
  (interactive "p")
  (let ((x (car (posn-x-y (posn-at-point)))))
    (vertical-motion -1)
    (let ((y (cdr (posn-x-y (posn-at-point)))))
      (posn-set-point (posn-at-x-y x y)))))




reply via email to

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