unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
@ 2016-06-20 16:30 Lluís Vilanova
  2016-06-20 20:12 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Lluís Vilanova @ 2016-06-20 16:30 UTC (permalink / raw)
  To: 23809

To reproduce:

* Open a PDF on a separate window on the same frame using pdf-tools.
* Select that window.
* Scroll a bit down the first page of the PDF.
* Use windmove to move from the pdf-view-mode buffer to the first one.


With these steps, I get this backtrace:

  Debugger entered--Lisp error: (wrong-type-argument wholenump -14)
    posn-at-point(619194 #)
    (nth 2 (posn-at-point (window-point window) window))
    (let ((posn-cons (nth 2 (posn-at-point (window-point window) window)))) (if hor (+ (or (cdr posn-cons) 1) (window-pixel-top window)) (+ (or (car posn-cons) 1) (window-pixel-left window))))
    (cond ((and (numberp sign) (< sign 0)) (if hor (1- (+ (window-pixel-top window) (window-pixel-height window))) (1- (+ (window-pixel-left window) (window-pixel-width window))))) ((and (numberp sign) (> sign 0)) (if hor (window-pixel-top window) (window-pixel-left window))) ((let ((posn-cons (nth 2 (posn-at-point (window-point window) window)))) (if hor (+ (or (cdr posn-cons) 1) (window-pixel-top window)) (+ (or (car posn-cons) 1) (window-pixel-left window))))))
    (let* ((frame (window-frame window)) (hor (memq direction (quote (left right)))) (first (if hor (window-pixel-left window) (window-pixel-top window))) (last (+ first (window-size window hor t))) (posn (cond ((and (numberp sign) (< sign 0)) (if hor (1- (+ ... ...)) (1- (+ ... ...)))) ((and (numberp sign) (> sign 0)) (if hor (window-pixel-top window) (window-pixel-left window))) ((let ((posn-cons ...)) (if hor (+ ... ...) (+ ... ...)))))) (best-edge (cond ((eq direction (quote below)) (frame-pixel-height frame)) ((eq direction (quote right)) (frame-pixel-width frame)) (t -1))) (best-edge-2 best-edge) (best-diff-2 (if hor (frame-pixel-height frame) (frame-pixel-width frame))) best best-2 best-diff-2-new) (walk-window-tree (function (lambda (w) (let* ((w-top (window-pixel-top w)) (w-left (window-pixel-left w))) (cond ((or ... ...)) (hor (cond ... ...)) ((and ... ...) (if ... ...)) ((and ... ... ...) (setq best-edge-2 w-top) (setq best-diff-2 best-diff-2-new) (setq best-2 w)))))) frame nil (and mini t)) (or best best-2))
    window-in-direction(left nil nil nil nil t)
    windmove-find-other-window(left nil nil)
    windmove-do-window-select(left nil)
    windmove-left(nil)
    #(windmove-left nil nil)
    ad-Advice-call-interactively(# windmove-left nil nil)
    apply(ad-Advice-call-interactively # (windmove-left nil nil))
    call-interactively(windmove-left nil nil)
    command-execute(windmove-left)


Note how the argument to posn-at-point (returned by window-point) is actually
positive (619194), but the error raised by Emacs complains about the number
being negative (-14).

Thanks,
  Lluis


Auto-gathered information:

In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-08 on binet, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11803000
System Description:	Debian GNU/Linux testing (stretch)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: ca_ES.UTF-8
  locale-coding-system: utf-8

Major mode: Debugger

Minor modes in effect:
  pdf-occur-global-minor-mode: t
  TeX-PDF-mode: 1
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  recentf-mode: t
  ogc:--org-gnome-calendar-mode: t
  global-org-gnome-calendar-mode: t
  change-cursor-mode: t
  which-key-mode: t
  global-flycheck-mode: t
  global-semantic-idle-breadcrumbs-mode: t
  global-ede-mode: t
  shell-dirtrack-mode: t
  savehist-mode: t
  desktop-save-mode: t
  icomplete-mode: t
  flx-ido-mode: t
  ido-ubiquitous-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-hungry-delete-mode: t
  hungry-delete-mode: t
  global-auto-revert-mode: t
  global-anzu-mode: t
  anzu-mode: t
  show-smartparens-global-mode: t
  smartparens-global-mode: t
  cua-mode: t
  delete-selection-mode: t
  winner-mode: t
  ido-everywhere: t
  display-time-mode: t
  override-global-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  global-prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Guessed variable 'css-indent-offset' (2)
Ispell process killed
Starting new Ispell process aspell with default dictionary...
Winner undo (1 / 7)
1238378 (#o4562552, #x12e56a)
Type "q" in help window to restore its previous buffer.
Mark set [2 times]
Quit
(#<window 529 on *Backtrace*> 1 (0 . 0) 0 nil 1 (0 . 0) nil (0 . 0) (8 . 14))
nil [3 times]

Load-path shadows:
/home/lluis/.cache/emacs/elpa/dash-20160510.1127/dash hides /home/lluis/.cache/emacs/el-get/dash/dash
/home/lluis/.cache/emacs/elpa/s-20160508.2357/s hides /home/lluis/.cache/emacs/el-get/s/s
/home/lluis/.cache/emacs/elpa/avy-20160512.2252/avy hides /home/lluis/.cache/emacs/el-get/avy/avy
/home/lluis/.cache/emacs/el-get/hydra/lv hides /home/lluis/.cache/emacs/el-get/lv/lv
/home/lluis/.cache/emacs/elpa/diminish-20151215.915/diminish hides /usr/share/emacs24/site-lisp/emacs-goodies-el/diminish
/home/lluis/.cache/emacs/elpa/dedicated-20090428.1231/dedicated hides /usr/share/emacs24/site-lisp/emacs-goodies-el/dedicated
/usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/home/lluis/.config/emacs/loaddefs hides /usr/share/emacs/24.5/lisp/loaddefs
/home/lluis/.config/emacs/custom hides /usr/share/emacs/24.5/lisp/custom
/usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.5/lisp/language/thai-word

Features:
(shadow emacsbug pdf-sync pdf-annot pdf-outline pdf-links pdf-history pdf-occur
tablist tablist-filter semantic/wisent/comp pdf-isearch pdf-misc pdf-tools
pdf-view bookmark pdf-cache pdf-info tq pdf-util doc-view image-mode texmathp
preview prv-emacs tex-buf font-latex latex tex-style tex smartparens-latex
tex-mode latexenc tabify imenu man debug asm-mode eww mm-url log-view cua-rect
pylint semantic/wisent/python semantic/wisent/python-wy semantic/wisent
semantic/wisent/wisent smartparens-python python gnus-dup vc-bzr vc-sccs vc-svn
vc-cvs vc-rcs god-mode xterm supercite regi tramp-cache sh-script smie
executable dedicated wgrep find-dired grep ede/project-am ede/autoconf-edit
autoconf autoconf-mode ede/makefile-edit make-mode flow-fill dired-filter f s
ucs-normalize dired-hacks-utils dired-aux ede/dired dired-x gnutls url-queue
two-column iso-transl ibuf-ext semantic/db-file data-debug cedet-files
ede/locate semantic/tag-file semantic/edit narrow-or-widen-dwim fancy-narrow
iedit help-macro iedit-lib multiple-cursors-core rect aggressive-indent
elisp-slime-nav etags tar-mode url-handlers misearch multi-isearch
highlight-symbol auto-dictionary em-smart em-unix em-term em-script em-prompt
em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias
esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg eldoc esh-groups eshell
esh-module esh-mode esh-util ffap copyright magit-stgit linum magit-blame
magit-stash magit-bisect magit-remote magit-commit magit-sequence magit
magit-apply magit-wip magit-log magit-diff smerge-mode diff-mode magit-core
magit-autorevert magit-process magit-popup magit-mode magit-git crm
magit-section magit-utils git-commit log-edit pcvs-util add-log with-editor
async-bytecomp async tramp-sh vc vc-dispatcher semantic/bovine/c
semantic/decorate/include hideif semantic/bovine/c-by semantic/lex-spp
semantic/bovine/gcc semantic/dep semantic/bovine semantic/analyze/refs
semantic/analyze semantic/scope semantic/analyze/fcn macrostep-c cmacexp
macrostep fic-ext-mode cpp disaster doc-mode xcscope outshine outshine-org-cmds
outorg highlight-parentheses guess-style filladapt cc-langs recentf tree-widget
windmove shr-color bbdb-hooks sort url-http url-gw url-auth gnus-cite smiley
gnus-gravatar gravatar url-cache url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util url-parse url-vars shr
browse-url mm-archive gnus-bcklg qp gnus-async gnus-ml ede/linux ede/make
ede/cpp-root ede/emacs vc-git gnus-topic gnus-mlspl nndraft nnmh utf-7
network-stream starttls nnimap parse-time tls utf7 netrc nnfolder bbdb-gnus
bbdb-snarf mail-extr bbdb-com warnings nnnil gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-cache gnus-demon nntp nnir gnus-notifications
gnus-fun gnus-art mm-uu mml2015 mm-view mml-smime smime dig mailcap gnus-sum
nnoo gnus-group gnus-undo nnmail mail-source notifications gnus-start gnus-spec
gnus-int gnus-range message sendmail rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win org-gnome-calendar dbus hl-line+ hl-line ace-link avy xml
cursor-chg smart-mode-line-powerline-theme powerline powerline-separators color
powerline-themes smart-mode-line rich-minority which-key server flycheck derived
json rx subr-x seq seq-24 pcase jka-compr compile let-alist info tex-site
my-personal my-bindings hydra lv my-mail bbdb timezone my-org ob-screen ob-R
ob-python ob-perl ob-octave ob-latex ob-gnuplot ob-dot ob-ditaa ob-C cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
my-programming ede/generic ede/shell eieio-opt semantic/sb semantic/sort
inversion semantic/db-global semantic/symref/global semantic/symref
semantic/db-find semantic/db-ref cedet-global semantic/mru-bookmark
semantic/db-mode semantic/db semantic/idle semantic/format semantic/ctxt
semantic/decorate/mode semantic/tag-ls semantic/find semantic/decorate pulse
semantic/util-modes semantic/util semantic semantic/tag semantic/lex semantic/fw
mode-local my-writing my-writing-latex flyspell ispell my-ide ede/speedbar
ede/files ede ede/base ede/auto ede/source eieio-base eieio-speedbar speedbar
sb-image ezimage dframe eieio-custom cedet my-behaviour ediff-merg ediff-wind
ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff fuzzy cssh tramp
tramp-compat auth-source eieio eieio-core password-cache tramp-loaddefs trampver
shell term disp-table ehelp ibuffer savehist desktop frameset time-stamp
browse-kill-ring icomplete flx-ido flx ido-ubiquitous ido-completing-read+
cus-edit cus-start cus-load key-chord gnus gnus-ems nnheader gnus-util
mail-utils mm-util mail-prsvr wid-edit org org-macro org-footnote org-pcomplete
pcomplete org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint comint ansi-color ob-core ob-eval org-compat org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs undo-tree diff
hungry-delete autorevert filenotify whitespace anzu mule-util saveplace
smartparens-config smartparens thingatpt dash cua-base delsel winner ring smex
ido byte-opt my-appearance time time-date my-theme my-cmdline my-misc edmacro
kmacro cl-macs my-package use-package diminish bind-key finder-inf .loaddefs
advice el-get el-get-autoloading el-get-list-packages el-get-dependencies
el-get-build el-get-status pp el-get-methods el-get-fossil el-get-svn
el-get-pacman el-get-github-zip el-get-github-tar el-get-http-zip
el-get-http-tar el-get-hg el-get-go el-get-git-svn el-get-fink el-get-emacswiki
el-get-http el-get-notify help-mode easymenu el-get-emacsmirror el-get-github
el-get-git el-get-elpa package epg-config el-get-darcs el-get-cvs el-get-bzr
el-get-brew el-get-builtin el-get-apt-get el-get-recipes el-get-byte-compile
el-get-custom el-get-core autoload help-fns lisp-mnt bytecomp byte-compile
cl-extra cconv cl gv cl-loaddefs cl-lib dired debian-el debian-el-loaddefs
emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode
dpkg-dev-el dpkg-dev-el-loaddefs bbdb-autoloads tooltip electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind gfilenotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

Memory information:
((conses 16 2406107 245774)
 (symbols 48 81875 64)
 (miscs 40 30275 9176)
 (strings 32 289550 44816)
 (string-bytes 1 17523205)
 (vectors 16 229225)
 (vector-slots 8 6260146 165024)
 (floats 8 41178 7977)
 (intervals 56 93999 1175)
 (buffers 960 489)
 (heap 1024 198499 22150))





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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-06-20 16:30 bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative Lluís Vilanova
@ 2016-06-20 20:12 ` Eli Zaretskii
  2016-06-21 13:07   ` martin rudalics
  2016-06-21 13:17   ` Lluís Vilanova
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-06-20 20:12 UTC (permalink / raw)
  To: Lluís Vilanova; +Cc: 23809

> From: Lluís Vilanova <vilanova@ac.upc.edu>
> Date: Mon, 20 Jun 2016 18:30:51 +0200
> 
> To reproduce:
> 
> * Open a PDF on a separate window on the same frame using pdf-tools.
> * Select that window.
> * Scroll a bit down the first page of the PDF.
> * Use windmove to move from the pdf-view-mode buffer to the first one.

Sounds like a duplicate of bug #21732.

> With these steps, I get this backtrace:
> 
>   Debugger entered--Lisp error: (wrong-type-argument wholenump -14)
>     posn-at-point(619194 #)

What does pos-visible-in-window-p return for that buffer position?

> Note how the argument to posn-at-point (returned by window-point) is actually
> positive (619194), but the error raised by Emacs complains about the number
> being negative (-14).

That's not relevant: 619194 is a buffer position, whereas -14 is the
y-coordinate (in pixels) passed by posn-at-point to posn-at-x-y.  The
latter cannot cope with negative y coordinates, for reasons that
should be obvious.

The question is how that -14 coordinate came into existence.  If you
can step with a debugger into Fpos_visible_in_window_p, and see what's
going on there, that would be helpful.  (I cannot try that myself, as
my systems don't support pdf-view-mode.)

Thanks.





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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-06-20 20:12 ` Eli Zaretskii
@ 2016-06-21 13:07   ` martin rudalics
  2016-06-21 15:15     ` Eli Zaretskii
  2016-06-21 13:17   ` Lluís Vilanova
  1 sibling, 1 reply; 10+ messages in thread
From: martin rudalics @ 2016-06-21 13:07 UTC (permalink / raw)
  To: Eli Zaretskii, Lluís Vilanova; +Cc: 23809

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

 > Sounds like a duplicate of bug #21732.
 >
 >> With these steps, I get this backtrace:
 >>
 >>    Debugger entered--Lisp error: (wrong-type-argument wholenump -14)
 >>      posn-at-point(619194 #)

Without further forensics we could "fix" both bugs using the attached
patch.  WDYT?

martin

[-- Attachment #2: window.diff --]
[-- Type: text/plain, Size: 631 bytes --]

diff --git a/lisp/window.el b/lisp/window.el
index f7a547b..a06f334 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2068,7 +2068,9 @@ window-in-direction
 	    (if hor
 		(window-pixel-top window)
 	      (window-pixel-left window)))
-	   ((let ((posn-cons (nth 2 (posn-at-point (window-point window) window))))
+	   ((let ((posn-cons (condition-case nil
+                                 (nth 2 (posn-at-point (window-point window) window))
+                               (error nil))))
 	      (if hor
 		  (+ (or (cdr posn-cons) 1) (window-pixel-top window))
 		(+ (or (car posn-cons) 1) (window-pixel-left window)))))))


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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-06-20 20:12 ` Eli Zaretskii
  2016-06-21 13:07   ` martin rudalics
@ 2016-06-21 13:17   ` Lluís Vilanova
  2016-07-09 11:44     ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Lluís Vilanova @ 2016-06-21 13:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23809

Eli Zaretskii writes:

>> From: Lluís Vilanova <vilanova@ac.upc.edu>
>> Date: Mon, 20 Jun 2016 18:30:51 +0200
>> 
>> To reproduce:
>> 
>> * Open a PDF on a separate window on the same frame using pdf-tools.
>> * Select that window.
>> * Scroll a bit down the first page of the PDF.
>> * Use windmove to move from the pdf-view-mode buffer to the first one.

> Sounds like a duplicate of bug #21732.

>> With these steps, I get this backtrace:
>> 
>> Debugger entered--Lisp error: (wrong-type-argument wholenump -14)
>> posn-at-point(619194 #)

> What does pos-visible-in-window-p return for that buffer position?

If I evaluate it after the error (when in the Backtrace buffer), I get nil
(pos-visible-in-window-p (window-point window) window). Using gdb it's a
different value (see below).


>> Note how the argument to posn-at-point (returned by window-point) is actually
>> positive (619194), but the error raised by Emacs complains about the number
>> being negative (-14).

> That's not relevant: 619194 is a buffer position, whereas -14 is the
> y-coordinate (in pixels) passed by posn-at-point to posn-at-x-y.  The
> latter cannot cope with negative y coordinates, for reasons that
> should be obvious.

> The question is how that -14 coordinate came into existence.  If you
> can step with a debugger into Fpos_visible_in_window_p, and see what's
> going on there, that would be helpful.  (I cannot try that myself, as
> my systems don't support pdf-view-mode.)

I have zero knowledge on Emacs' source code, but here's the little information I
could gather:

  Fposn_at_point(...)
    Fvisible_in_window_p(...) -> (824 . -98)
      pos_visible_p(...) ->
        line 1713 : *x = it2.current_x;
        value            824
        line 1714 : *y = it2.current_y + it2.max_ascent - it2.ascent;
        value            -98             533              533
    Fposn_at_x_y(824, -98, window, nil)

After reading [1], it sounds to me that pdf-tools (and doc-view) let you scroll
the buffer, but never move point. That could be a reason to get a negative
position AFAIU.

Tell me if you want something more specific, since the problem is pretty easy to
reproduce. But remember I have zero knowledge on emacs' sources, some I'm pretty
blind here.


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21732#8

Thanks,
  Lluis





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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-06-21 13:07   ` martin rudalics
@ 2016-06-21 15:15     ` Eli Zaretskii
  2016-06-22  6:10       ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-06-21 15:15 UTC (permalink / raw)
  To: martin rudalics; +Cc: 23809, vilanova

> Date: Tue, 21 Jun 2016 15:07:57 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: 23809@debbugs.gnu.org
> 
>  > Sounds like a duplicate of bug #21732.
>  >
>  >> With these steps, I get this backtrace:
>  >>
>  >>    Debugger entered--Lisp error: (wrong-type-argument wholenump -14)
>  >>      posn-at-point(619194 #)
> 
> Without further forensics we could "fix" both bugs using the attached
> patch.  WDYT?

I don't like sweeping problems under the carpet.  We should understand
how come we get negative pixel coordinates in these cases, it's most
likely some bug in pos_visible_p or somesuch.





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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-06-21 15:15     ` Eli Zaretskii
@ 2016-06-22  6:10       ` martin rudalics
  2016-06-22 15:06         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2016-06-22  6:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23809, vilanova

 > I don't like sweeping problems under the carpet.  We should understand
 > how come we get negative pixel coordinates in these cases, it's most
 > likely some bug in pos_visible_p or somesuch.

A ‘condition-case’ would fix the problem on the release branch and give
you all the time to find the real cause.  Also, unless we guard against
‘posn-at-point’ ever returning a negative y-value, there's no guarantee
that finding the cause of the present problem will fix this issue once
and for all.

martin






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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-06-22  6:10       ` martin rudalics
@ 2016-06-22 15:06         ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-06-22 15:06 UTC (permalink / raw)
  To: martin rudalics; +Cc: 23809, vilanova

> Date: Wed, 22 Jun 2016 08:10:44 +0200
> From: martin rudalics <rudalics@gmx.at>
> CC: vilanova@ac.upc.edu, 23809@debbugs.gnu.org
> 
>  > I don't like sweeping problems under the carpet.  We should understand
>  > how come we get negative pixel coordinates in these cases, it's most
>  > likely some bug in pos_visible_p or somesuch.
> 
> A ‘condition-case’ would fix the problem on the release branch and give
> you all the time to find the real cause.

the problem doesn't seem grave enough to rush with a solution.

> Also, unless we guard against ‘posn-at-point’ ever returning a
> negative y-value, there's no guarantee that finding the cause of the
> present problem will fix this issue once and for all.

We will cross that bridge when we get to it.

Thanks.





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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-06-21 13:17   ` Lluís Vilanova
@ 2016-07-09 11:44     ` Eli Zaretskii
  2016-07-11 10:23       ` Lluís Vilanova
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2016-07-09 11:44 UTC (permalink / raw)
  To: Lluís Vilanova; +Cc: 23809

> From: Lluís Vilanova <vilanova@ac.upc.edu>
> Cc: 23809@debbugs.gnu.org
> Date: Tue, 21 Jun 2016 15:17:46 +0200
> 
> > The question is how that -14 coordinate came into existence.  If you
> > can step with a debugger into Fpos_visible_in_window_p, and see what's
> > going on there, that would be helpful.  (I cannot try that myself, as
> > my systems don't support pdf-view-mode.)
> 
> I have zero knowledge on Emacs' source code, but here's the little information I
> could gather:
> 
>   Fposn_at_point(...)
>     Fvisible_in_window_p(...) -> (824 . -98)
>       pos_visible_p(...) ->
>         line 1713 : *x = it2.current_x;
>         value            824
>         line 1714 : *y = it2.current_y + it2.max_ascent - it2.ascent;
>         value            -98             533              533
>     Fposn_at_x_y(824, -98, window, nil)
> 
> After reading [1], it sounds to me that pdf-tools (and doc-view) let you scroll
> the buffer, but never move point. That could be a reason to get a negative
> position AFAIU.
> 
> Tell me if you want something more specific, since the problem is pretty easy to
> reproduce. But remember I have zero knowledge on emacs' sources, some I'm pretty
> blind here.

Thanks, the above is already a lot of valuable info.

I have a couple of follow up questions:

  . Can you show the entire value returned by Fpos_visible_in_window_p
    when its call from Fposn_at_point returns, when this problem is
    reproduced?  If you load the file .gdbinit that is located in the
    Emacs src directory, then displaying the return value is simple:
    type "pp tem" at the GDB prompt, after Fpos_visible_in_window_p
    returns.

  . You say "pdf-tools (and doc-view) let you scroll the buffer, but
    never move point" -- can you point me to code in pdf-tools that
    does this?

Thanks.





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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-07-09 11:44     ` Eli Zaretskii
@ 2016-07-11 10:23       ` Lluís Vilanova
  2016-07-11 14:51         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Lluís Vilanova @ 2016-07-11 10:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23809

Eli Zaretskii writes:

>> From: Lluís Vilanova <vilanova@ac.upc.edu>
>> Cc: 23809@debbugs.gnu.org
>> Date: Tue, 21 Jun 2016 15:17:46 +0200
>> 
>> > The question is how that -14 coordinate came into existence.  If you
>> > can step with a debugger into Fpos_visible_in_window_p, and see what's
>> > going on there, that would be helpful.  (I cannot try that myself, as
>> > my systems don't support pdf-view-mode.)
>> 
>> I have zero knowledge on Emacs' source code, but here's the little information I
>> could gather:
>> 
>> Fposn_at_point(...)
>> Fvisible_in_window_p(...) -> (824 . -98)
>> pos_visible_p(...) ->
>> line 1713 : *x = it2.current_x;
>> value            824
>> line 1714 : *y = it2.current_y + it2.max_ascent - it2.ascent;
>> value            -98             533              533
>> Fposn_at_x_y(824, -98, window, nil)
>> 
>> After reading [1], it sounds to me that pdf-tools (and doc-view) let you scroll
>> the buffer, but never move point. That could be a reason to get a negative
>> position AFAIU.
>> 
>> Tell me if you want something more specific, since the problem is pretty easy to
>> reproduce. But remember I have zero knowledge on emacs' sources, some I'm pretty
>> blind here.

> Thanks, the above is already a lot of valuable info.

> I have a couple of follow up questions:

>   . Can you show the entire value returned by Fpos_visible_in_window_p
>     when its call from Fposn_at_point returns, when this problem is
>     reproduced?  If you load the file .gdbinit that is located in the
>     Emacs src directory, then displaying the return value is simple:
>     type "pp tem" at the GDB prompt, after Fpos_visible_in_window_p
>     returns.

Sorry, but strangely enough, I'm unable to reproduce the problem now. And I'm
not aware of having updated emacs nor the packages it uses. I'll reply with the
information if it happens again.


>   . You say "pdf-tools (and doc-view) let you scroll the buffer, but
>     never move point" -- can you point me to code in pdf-tools that
>     does this?

I'm actually not sure about it. It's just an intuition based on the fact that
the keys used to move point actually scroll the window, and there is no visible
point in it.


Thanks,
  Lluis





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

* bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative
  2016-07-11 10:23       ` Lluís Vilanova
@ 2016-07-11 14:51         ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2016-07-11 14:51 UTC (permalink / raw)
  To: Lluís Vilanova; +Cc: 23809

> From: Lluís Vilanova <vilanova@ac.upc.edu>
> Cc: 23809@debbugs.gnu.org
> Date: Mon, 11 Jul 2016 12:23:15 +0200
> 
> >   . Can you show the entire value returned by Fpos_visible_in_window_p
> >     when its call from Fposn_at_point returns, when this problem is
> >     reproduced?  If you load the file .gdbinit that is located in the
> >     Emacs src directory, then displaying the return value is simple:
> >     type "pp tem" at the GDB prompt, after Fpos_visible_in_window_p
> >     returns.
> 
> Sorry, but strangely enough, I'm unable to reproduce the problem now. And I'm
> not aware of having updated emacs nor the packages it uses. I'll reply with the
> information if it happens again.

Strange indeed.  Thanks in advance.

> >   . You say "pdf-tools (and doc-view) let you scroll the buffer, but
> >     never move point" -- can you point me to code in pdf-tools that
> >     does this?
> 
> I'm actually not sure about it. It's just an intuition based on the fact that
> the keys used to move point actually scroll the window, and there is no visible
> point in it.

That sounds like the normal image scrolling feature of Emacs.
The reason I asked is that I tried to reproduce the problem by
scrolling through a very large image, but couldn't.  So there's some
other factor at work here that I cannot grasp.





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

end of thread, other threads:[~2016-07-11 14:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-20 16:30 bug#23809: 24.5; Positive argument to 'posn-at-point' throws erros as being negative Lluís Vilanova
2016-06-20 20:12 ` Eli Zaretskii
2016-06-21 13:07   ` martin rudalics
2016-06-21 15:15     ` Eli Zaretskii
2016-06-22  6:10       ` martin rudalics
2016-06-22 15:06         ` Eli Zaretskii
2016-06-21 13:17   ` Lluís Vilanova
2016-07-09 11:44     ` Eli Zaretskii
2016-07-11 10:23       ` Lluís Vilanova
2016-07-11 14:51         ` 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).