all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Feng Shu" <tumashu@163.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: schwab@linux-m68k.org, emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87o9ls84ug.fsf@163.com> (raw)
In-Reply-To: <83efmowk12.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 Jan 2018 18:02:33 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: "Feng Shu" <tumashu@163.com>
>> Date: Wed, 17 Jan 2018 19:11:44 +0800
>> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
>> 
>> 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 :-)

-- 




  parent reply	other threads:[~2018-01-17 23:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17  2:08 posn-at-point get strange info when flycheck enable and (setq truncate-lines t) tumashu
2018-01-17  3:42 ` Eli Zaretskii
2018-01-17 10:34 ` Andreas Schwab
2018-01-17 11:11   ` Feng Shu
2018-01-17 16:02     ` Eli Zaretskii
2018-01-17 16:45       ` Eli Zaretskii
2018-01-17 23:04       ` Feng Shu [this message]
2018-01-19 14:21         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9ls84ug.fsf@163.com \
    --to=tumashu@163.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.