unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: 30834@debbugs.gnu.org
Subject: bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode
Date: Fri, 16 Mar 2018 16:34:30 +0100	[thread overview]
Message-ID: <93a3e457-2f6a-c8c4-5b5d-210c5f3b6bac@easy-emacs.de> (raw)
In-Reply-To: <CAN2HsvwiVOiuCM7W9UqP5r4DqmkOyUVcEoMO=MOAfA=7KembSg@mail.gmail.com>

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






  reply	other threads:[~2018-03-16 15:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16 10:45 bug#30834: 27.0.50; posn-at-point and display-line-numbers-mode Sébastien Chapuis
2018-03-16 15:34 ` Andreas Röhler [this message]
2018-03-16 16:19   ` Sebastien Chapuis
2018-03-16 21:41     ` Andreas Röhler
2018-03-16 17:17 ` Eli Zaretskii
2018-03-17 12:59   ` Sebastien Chapuis
2018-03-17 13:42     ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=93a3e457-2f6a-c8c4-5b5d-210c5f3b6bac@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=30834@debbugs.gnu.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 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).