GNU bug report logs - #30834
27.0.50; posn-at-point and display-line-numbers-mode

Previous Next

Package: emacs;

Reported by: Sébastien Chapuis <sebastien <at> chapu.is>

Date: Fri, 16 Mar 2018 10:46:02 UTC

Severity: normal

Found in version 27.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30834 in the body.
You can then email your comments to 30834 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#30834; Package emacs. (Fri, 16 Mar 2018 10:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sébastien Chapuis <sebastien <at> chapu.is>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 16 Mar 2018 10:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sébastien Chapuis <sebastien <at> chapu.is>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Fri, 16 Mar 2018 11:45:43 +0100
Hi,

When display-line-numbers-mode is on and the (point) is on the
beginning of line, posn-at-point returns a wrong value.

Reproducible in emacs -Q:

```
(save-excursion
  (message "Without display-line-numbers:")
  (display-line-numbers-mode -1)
  (goto-char (line-beginning-position))
  (message "column 0: %s" (car (nth 2 (posn-at-point))))
  (forward-char)
  (message "column 1: %s" (car (nth 2 (posn-at-point))))
  (message "With display-line-numbers:")
  (display-line-numbers-mode)
  (goto-char (line-beginning-position))
  (message "column 0: %s" (car (nth 2 (posn-at-point))))
  (forward-char)
  (message "column 1: %s" (car (nth 2 (posn-at-point))))
  )
```

Output:
```
Without display-line-numbers:
column 0: 0
column 1: 19
With display-line-numbers:
column 0: 0
column 1: 114
```

On the bol, it returns zero but it should return (- 114 19)


In GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2018-03-13 built on XPS13
Repository revision: ae80854e9a9f8f6733870b5b5a88467867dceb6c
Windowing system distributor 'Fedora Project', version 11.0.11906000
System Description: Fedora 27 (Twenty Seven)

Configured using:
 'configure --prefix=/opt/emacs-git --with-modules --with-xwidgets
 --with-imagemagick CC=clang'

--
Sebastien Chapuis




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30834; Package emacs. (Fri, 16 Mar 2018 15:35:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Fri, 16 Mar 2018 16:34:30 +0100
On 16.03.2018 11:45, Sébastien Chapuis wrote:
> Hi,
> 
> When display-line-numbers-mode is on and the (point) is on the
> beginning of line, posn-at-point returns a wrong value.
> 
> Reproducible in emacs -Q:
> 
> ```
> (save-excursion
>    (message "Without display-line-numbers:")
>    (display-line-numbers-mode -1)
>    (goto-char (line-beginning-position))
>    (message "column 0: %s" (car (nth 2 (posn-at-point))))
>    (forward-char)
>    (message "column 1: %s" (car (nth 2 (posn-at-point))))
>    (message "With display-line-numbers:")
>    (display-line-numbers-mode)
>    (goto-char (line-beginning-position))
>    (message "column 0: %s" (car (nth 2 (posn-at-point))))
>    (forward-char)
>    (message "column 1: %s" (car (nth 2 (posn-at-point))))
>    )
> ```
> 
> Output:
> ```
> Without display-line-numbers:
> column 0: 0
> column 1: 19
> With display-line-numbers:
> column 0: 0
> column 1: 114
> ```
> 
> On the bol, it returns zero but it should return (- 114 19)
> 
> 
> In GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
>   of 2018-03-13 built on XPS13
> Repository revision: ae80854e9a9f8f6733870b5b5a88467867dceb6c
> Windowing system distributor 'Fedora Project', version 11.0.11906000
> System Description: Fedora 27 (Twenty Seven)
> 
> Configured using:
>   'configure --prefix=/opt/emacs-git --with-modules --with-xwidgets
>   --with-imagemagick CC=clang'
> 
> --
> Sebastien Chapuis
> 
> 
> 

In use here:

(defun ar-count-lines (&optional beg end)
  "Count lines in accessible part of buffer.

See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7115"
  (interactive)
  (let ((beg (or beg (point-min)))
	(end (or end (point)))
	erg)
    (if (bolp)
	(setq erg (1+ (count-lines beg end)))
      (setq erg (count-lines beg end)))
    (when (called-interactively-p 'any) (message "%s" erg))
    erg))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30834; Package emacs. (Fri, 16 Mar 2018 16:20:02 GMT) Full text and rfc822 format available.

Message #11 received at 30834 <at> debbugs.gnu.org (full text, mbox):

From: Sebastien Chapuis <sebastien <at> chapu.is>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 30834 <at> debbugs.gnu.org
Subject: Re: bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Fri, 16 Mar 2018 17:19:26 +0100
> In use here:
>
> (defun ar-count-lines (&optional beg end)
>   "Count lines in accessible part of buffer.
>
> See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7115"
>   (interactive)
>   (let ((beg (or beg (point-min)))
> 	(end (or end (point)))
> 	erg)
>     (if (bolp)
> 	(setq erg (1+ (count-lines beg end)))
>       (setq erg (count-lines beg end)))
>     (when (called-interactively-p 'any) (message "%s" erg))
>     erg))

Sorry, I forgot to mention that the interesting value is the X position.
Is it still related to count-lines ?

--
Sebastien Chapuis




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30834; Package emacs. (Fri, 16 Mar 2018 17:18:02 GMT) Full text and rfc822 format available.

Message #14 received at 30834 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sébastien Chapuis <sebastien <at> chapu.is>
Cc: 30834 <at> debbugs.gnu.org
Subject: Re: bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Fri, 16 Mar 2018 19:17:40 +0200
> From: Sébastien Chapuis <sebastien <at> chapu.is>
> Date: Fri, 16 Mar 2018 11:45:43 +0100
> 
> When display-line-numbers-mode is on and the (point) is on the
> beginning of line, posn-at-point returns a wrong value.

Thanks, should be fixed now on the master branch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30834; Package emacs. (Fri, 16 Mar 2018 21:42:01 GMT) Full text and rfc822 format available.

Message #17 received at 30834 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: Sebastien Chapuis <sebastien <at> chapu.is>
Cc: 30834 <at> debbugs.gnu.org
Subject: Re: bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Fri, 16 Mar 2018 22:41:10 +0100
On 16.03.2018 17:19, Sebastien Chapuis wrote:
> 
>> In use here:
>>
>> (defun ar-count-lines (&optional beg end)
>>    "Count lines in accessible part of buffer.
>>
>> See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7115"
>>    (interactive)
>>    (let ((beg (or beg (point-min)))
>> 	(end (or end (point)))
>> 	erg)
>>      (if (bolp)
>> 	(setq erg (1+ (count-lines beg end)))
>>        (setq erg (count-lines beg end)))
>>      (when (called-interactively-p 'any) (message "%s" erg))
>>      erg))
> 
> Sorry, I forgot to mention that the interesting value is the X position.
> Is it still related to count-lines ?
> 
> --
> Sebastien Chapuis
> 

Sorry, my fault. Referred to a bug in count-lines, which occurs at BOL.

As its docu says, the return value may differ: "but can be one more if 
START is not equal to END and the greater of them is not at the start of 
a line."

Seems unrelated here.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30834; Package emacs. (Sat, 17 Mar 2018 13:00:02 GMT) Full text and rfc822 format available.

Message #20 received at 30834 <at> debbugs.gnu.org (full text, mbox):

From: Sebastien Chapuis <sebastien <at> chapu.is>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 30834 <at> debbugs.gnu.org
Subject: Re: bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Sat, 17 Mar 2018 13:59:10 +0100
Eli Zaretskii writes:

>> From: Sébastien Chapuis <sebastien <at> chapu.is>
>> Date: Fri, 16 Mar 2018 11:45:43 +0100
>>
>> When display-line-numbers-mode is on and the (point) is on the
>> beginning of line, posn-at-point returns a wrong value.
>
> Thanks, should be fixed now on the master branch.

Thanks, it works now.

--
Sebastien Chapuis




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 17 Mar 2018 13:44:01 GMT) Full text and rfc822 format available.

Notification sent to Sébastien Chapuis <sebastien <at> chapu.is>:
bug acknowledged by developer. (Sat, 17 Mar 2018 13:44:01 GMT) Full text and rfc822 format available.

Message #25 received at 30834-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sebastien Chapuis <sebastien <at> chapu.is>
Cc: 30834-done <at> debbugs.gnu.org
Subject: Re: bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Sat, 17 Mar 2018 15:42:55 +0200
> From: Sebastien Chapuis <sebastien <at> chapu.is>
> Cc: 30834 <at> debbugs.gnu.org
> Date: Sat, 17 Mar 2018 13:59:10 +0100
> 
> 
> Eli Zaretskii writes:
> 
> >> From: Sébastien Chapuis <sebastien <at> chapu.is>
> >> Date: Fri, 16 Mar 2018 11:45:43 +0100
> >>
> >> When display-line-numbers-mode is on and the (point) is on the
> >> beginning of line, posn-at-point returns a wrong value.
> >
> > Thanks, should be fixed now on the master branch.
> 
> Thanks, it works now.

OK, thanks for testing.  I'm therefore closing the bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 15 Apr 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 146 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.