unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
@ 2018-01-17  2:08 tumashu
  2018-01-17  3:42 ` Eli Zaretskii
  2018-01-17 10:34 ` Andreas Schwab
  0 siblings, 2 replies; 8+ messages in thread
From: tumashu @ 2018-01-17  2:08 UTC (permalink / raw)
  To: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

When I enable flycheck and (setq truncate-lines t)
sometimes  posn-at-point get strange info like the below:


        (#<window 3 on test.el> 31 (65 . 111) 0 (! . 0) 31 (5 . 3) nil (0 . 24) (13 . 29))


At the same point, the normal info is like:


       (#<window 3 on test.el> 31 (65 . 87) 0 nil 31 (5 . 3) nil (0 . 0) (13 . 29))


is the overlay's problem?





[-- Attachment #2: Type: text/html, Size: 666 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2018-01-17  3:42 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel

> Date: Wed, 17 Jan 2018 10:08:31 +0800 (CST)
> From: tumashu <tumashu@163.com>
> 
> When I enable flycheck and (setq truncate-lines t)
> sometimes  posn-at-point get strange info like the below:
> 
>         (#<window 3 on test.el> 31 (65 . 111) 0 (! . 0) 31 (5 . 3) nil (0 . 24) (13 . 29))
> 
> At the same point, the normal info is like:
> 
>        (#<window 3 on test.el> 31 (65 . 87) 0 nil 31 (5 . 3) nil (0 . 0) (13 . 29))
> 
> is the overlay's problem? 

It could be, but if you can describe a recipe for how to get these
results, someone could look at that and tell for sure.

Thanks.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2018-01-17 10:34 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-devel@gnu.org

On Jan 17 2018, tumashu <tumashu@163.com> wrote:

> When I enable flycheck and (setq truncate-lines t)
> sometimes  posn-at-point get strange info like the below:
>
>
>         (#<window 3 on test.el> 31 (65 . 111) 0 (! . 0) 31 (5 . 3) nil (0 . 24) (13 . 29))

Strange in which way?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
  2018-01-17 10:34 ` Andreas Schwab
@ 2018-01-17 11:11   ` Feng Shu
  2018-01-17 16:02     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Feng Shu @ 2018-01-17 11:11 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel@gnu.org

Andreas Schwab <schwab@linux-m68k.org> writes:

> On Jan 17 2018, tumashu <tumashu@163.com> wrote:
>
>> When I enable flycheck and (setq truncate-lines t)
>> sometimes  posn-at-point get strange info like the below:
>>
>>
>>         (#<window 3 on test.el> 31 (65 . 111) 0 (! . 0) 31 (5 . 3) nil (0 . 24) (13 . 29))
>
> Strange in which way?

Sorry, it is flycheck's setting:

#+BEGIN_SRC emacs-lisp
(defcustom flycheck-indication-mode 'left-fringe
  "The indication mode for Flycheck errors and warnings.

This variable controls how Flycheck indicates errors in buffers.
May either be `left-fringe', `right-fringe', or nil.

If set to `left-fringe' or `right-fringe', indicate errors and
warnings via icons in the left and right fringe respectively.

If set to nil, do not indicate errors and warnings, but just
highlight them according to `flycheck-highlighting-mode'."
  :group 'flycheck
  :type '(choice (const :tag "Indicate in the left fringe" left-fringe)
                 (const :tag "Indicate in the right fringe" right-fringe)
                 (const :tag "Do not indicate" nil))
  :safe #'symbolp)

...
    (when flycheck-indication-mode
      (setf (overlay-get overlay 'before-string)
            (flycheck-error-level-make-fringe-icon
             level flycheck-indication-mode)))
...
#+END_SRC

flycheck will insert a picture with the help of overlay,

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?




>
> Andreas.

-- 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
  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
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2018-01-17 16:02 UTC (permalink / raw)
  To: Feng Shu; +Cc: schwab, emacs-devel

> 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.

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.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
  2018-01-17 16:02     ` Eli Zaretskii
@ 2018-01-17 16:45       ` Eli Zaretskii
  2018-01-17 23:04       ` Feng Shu
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2018-01-17 16:45 UTC (permalink / raw)
  To: tumashu; +Cc: schwab, emacs-devel

> Date: Wed, 17 Jan 2018 18:02:33 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: schwab@linux-m68k.org, emacs-devel@gnu.org
> 
> >   (#<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?

Sorry, I meant to write "31", not "32".



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
  2018-01-17 16:02     ` Eli Zaretskii
  2018-01-17 16:45       ` Eli Zaretskii
@ 2018-01-17 23:04       ` Feng Shu
  2018-01-19 14:21         ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Feng Shu @ 2018-01-17 23:04 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: schwab, emacs-devel

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 :-)

-- 




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: posn-at-point get strange info when flycheck enable and (setq truncate-lines t)
  2018-01-17 23:04       ` Feng Shu
@ 2018-01-19 14:21         ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2018-01-19 14:21 UTC (permalink / raw)
  To: Feng Shu; +Cc: schwab, emacs-devel

> From: "Feng Shu" <tumashu@163.com>
> Cc: schwab@linux-m68k.org,  emacs-devel@gnu.org
> Date: Thu, 18 Jan 2018 07:04:23 +0800
> 
> #+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

Thanks.  I decided that this is a bug, so I fixed this on the master
branch.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-19 14:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-01-19 14:21         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).