[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: posn-at-point get strange info when flycheck enable and (setq trunca
From: |
Feng Shu |
Subject: |
Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t) |
Date: |
Thu, 18 Jan 2018 07:04:23 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
>> From: "Feng Shu" <address@hidden>
>> Date: Wed, 17 Jan 2018 19:11:44 +0800
>> Cc: "address@hidden" <address@hidden>
>>
>> The problem I faced is that when I use posn-at-point to
>> get buffer POS's pixel position. it will get the picture's pixel position.
>>
>> The two (X .Y) position is not equal, for example
>>
>> (#<window 3 on test.el> 31 (65 . 111) 0 (! . 0) 31 (5 . 3) nil (0 . 24)
>> (13 . 29))
>> (#<window 3 on test.el> 31 (65 . 87) 0 nil 31 (5 . 3) nil (0 . 0) (13 .
>> 29))
>>
>> Is it possible force get buffer POS's pixel position?
>
> Is the character at buffer position 32 visible in the window? Or is
> it "covered" by an overlay or display property? If it's visible, this
> could be a bug. Can you prepare a short Lisp fragment that would
> generate the same kind of overlay as flycheck does, and which exhibits
> the same problem with posn-at-point? Then I could look into fixing
> that if necessary.
#+BEGIN_EXAMPLE
test test
;; Eval the below code, and move point to (point)=5, then run command: `mytest'
;; you will get like: (#<window 3 on test.el> 5 (48 . 23) 0 (! . 0) 5 (4 . 0)
nil (0 . 23) (12 . 28))
;; (remove-overlays 5 10)
;; move point to (point)=5, run `mytest'
;; you will get like: (#<window 3 on test.el> 5 (48 . 0) 0 nil 5 (4 . 0) nil (0
. 0) (12 . 28))
(progn
(require 'flycheck)
(setq truncate-lines t)
(setq overlay (make-overlay 5 10))
(setf (overlay-get overlay 'before-string)
(flycheck-error-level-make-fringe-icon
'error flycheck-indication-mode))
(defun mytest ()
(interactive)
(princ (posn-at-point))))
#+END_EXAMPLE
>
> Btw, note that if you subtract the DX/DY pair from the X/Y coordinates
> in the first position data, you get the X/Y coordinates of the second
> data. Maybe that's all you need.
Yes, Thanks :-)
--