Subject: bug#19706: 25.0.50; (+ nil nil -1) in desktop-restore-frameset

From: Alan Mackenzie <[email-masked]>
Date: Mon, 18 Jan 2016 21:41:04 +0000

Hello again, Sam.

On Tue, Jan 27, 2015 at 01:12:38PM -0500, Sam Steingold wrote:
> I get this error invariably when starting emacs:

> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>   +(nil nil -1)
>   frameset-move-onscreen(#<frame Emacs 0x103146560> t)
>   frameset--restore-frame(((font-backend mac-ct) (fontsize . 0) (font . "-*-Menlo-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1") (border-width . 0) (internal-border-width . 2) (vertical-scroll-bars . right) (horizontal-scroll-bars) (foreground-color . "DarkSlateBlue") (background-color . "LightGray") (line-spacing) (left-fringe . 4) (right-fringe . 4) (menu-bar-lines . 1) (tool-bar-lines . 0) (title) (icon-type) (auto-raise) (auto-lower) (cursor-type bar . 2) (scroll-bar-width . 15) (scroll-bar-height . 0) (alpha) (fullscreen . maximized) (display . "sds-MacBook-Pro.local") (display-type . color) (background-mode . light) (cursor-color . "Blue") (mouse-color . "Magenta") (visibility) (environment) (frameset--id . "062B-C257-B510-848F") (frameset--mini t) (modeline . t) (minibuffer . t) (unsplittable) (right-divider-width . 0) (bottom-divider-width . 0) (icon-name) (explicit-name) (tool-bar-position . top) (height . 35) (width . 81) (left + -1200) (top . 32)) (((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 56) (min-pixel-width . 70) (min-pixel-height-ignore . 28) (min-pixel-width-ignore . 42) (min-pixel-height-safe . 14) (min-pixel-width-safe . 14)) leaf (pixel-width . 590) (pixel-height . 476) (total-width . 84) (total-height . 34) (normal-height . 1.0) (normal-width . 1.0) (buffer "*scratch*" (selected) (hscroll . 0) (fringes 4 4 nil) (margins nil) (scroll-bars nil 3 t nil 0 nil) (vscroll . 0) (dedicated) (point . 1) (start . 1))) ((background-color . frameset-filter-sanitize-color) (buffer-list . :never) (buffer-predicate . :never) (buried-buffer-list . :never) (font . frameset-filter-shelve-param) (foreground-color . frameset-filter-sanitize-color) (fullscreen . frameset-filter-shelve-param) (GUI:font . frameset-filter-unshelve-param) (GUI:fullscreen . frameset-filter-unshelve-param) (GUI:height . frameset-filter-unshelve-param) (GUI:width . frameset-filter-unshelve-param) (height . frameset-filter-shelve-param) (outer-window-id . :never) (parent-id . :never) (tty . frameset-filter-tty-to-GUI) (tty-type . frameset-filter-tty-to-GUI) (width . frameset-filter-shelve-param) (window-id . :never) (window-system . :never) (name . :never) (left . frameset-filter-iconified) (minibuffer . frameset-filter-minibuffer) (top . frameset-filter-iconified)) t)
>   frameset-restore([frameset 1 (21703 54246 125901 0) (desktop . "206") "[email-masked]" nil nil ((((font-backend mac-ct) (fontsize . 0) (font . "-*-Menlo-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1") (border-width . 0) (internal-border-width . 2) (vertical-scroll-bars . right) (horizontal-scroll-bars) (foreground-color . "DarkSlateBlue") (background-color . "LightGray") (line-spacing) (left-fringe . 4) (right-fringe . 4) (menu-bar-lines . 1) (tool-bar-lines . 0) (title) (icon-type) (auto-raise) (auto-lower) (cursor-type bar . 2) (scroll-bar-width . 15) (scroll-bar-height . 0) (alpha) (fullscreen . maximized) (display . "sds-MacBook-Pro.local") (display-type . color) (background-mode . light) (cursor-color . "Blue") (mouse-color . "Magenta") (visibility) (environment) (frameset--id . "062B-C257-B510-848F") (frameset--mini t) (modeline . t) (minibuffer . t) (unsplittable) (right-divider-width . 0) (bottom-divider-width . 0) (icon-name) (explicit-name) (tool-bar-position . top) (height . 35) (width . 81) (left + -1200) (top . 32)) ((min-height . 4) (min-width . 10) (min-height-ignore . 2) (min-width-ignore . 6) (min-height-safe . 1) (min-width-safe . 2) (min-pixel-height . 56) (min-pixel-width . 70) (min-pixel-height-ignore . 28) (min-pixel-width-ignore . 42) (min-pixel-height-safe . 14) (min-pixel-width-safe . 14)) leaf (pixel-width . 590) (pixel-height . 476) (total-width . 84) (total-height . 34) (normal-height . 1.0) (normal-width . 1.0) (buffer "*scratch*" (selected) (hscroll . 0) (fringes 4 4 nil) (margins nil) (scroll-bars nil 3 t nil 0 nil) (vscroll . 0) (dedicated) (point . 1) (start . 1))) (((font-backend mac-ct) (fontsize . 0) (font . "-*-Menlo-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1") (border-width . 0) (internal-border-width . 2) (vertical-scroll-bars . right) (horizontal-scroll-bars) (foreground-color . "DarkSlateBlue") (background-color . "LightGray") (line-spacing) (left-fringe . 4) (right-fringe . 4) (menu-bar-lines . 1) (tool-bar-lines . 0) (title) (icon-type) (auto-raise) (auto-lower) (cursor-type bar . 2) (scroll-bar-width . 15) (scroll-bar-height . 0) (alpha) (fullscreen . maximized) (display . "sds-MacBook-Pro.local") (display-type . color) (background-mode . light) (cursor-color . "Blue") (mouse-color . "Magenta") (visibility . t) (environment) (frameset--id . "57B5-D002-B07E-BCE3") (frameset--mini t . t) (modeline . t) (minibuffer . t) (unsplittable) (right-divider-width . 0) (bottom-divider-width . 0) (icon-name) (explicit-name) (tool-bar-position . top) (height . 60) (width . 201) (left . 0) (top . 30)) ((min-height . 4) (min-width . 20) (min-height-ignore . 2) (min-width-ignore . 12) (min-height-safe . 1) (min-width-safe . 4) (min-pixel-height . 56) (min-pixel-width . 140) (min-pixel-height-ignore . 28) (min-pixel-width-ignore . 84) (min-pixel-height-safe . 14) (min-pixel-width-safe . 28)) hc (pixel-width . 1434) (pixel-height . 826) (total-width . 205) (total-height . 59) (normal-height . 1.0) (normal-width . 1.0) (combination-limit) (leaf (pixel-width . 720) (pixel-height . 826) (total-width . 103) (total-height . 59) (normal-height . 1.0) (normal-width . 0.5) (buffer "[email-masked]" (selected . t) (hscroll . 0) (fringes 4 4 nil) (margins nil) (scroll-bars nil 3 t nil 0 nil) (vscroll . 0) (dedicated) (point . 470743) (start . 467481))) (leaf (last . t) (pixel-width . 714) (pixel-height . 826) (total-width . 102) (total-height . 59) (normal-height . 1.0) (normal-width . 0.5) (buffer "util.py" (selected) (hscroll . 0) (fringes 4 4 nil) (margins nil) (scroll-bars nil 3 t nil 0 nil) (vscroll . 0) (dedicated) (point . 2996) (start . 2942)))))] :reuse-frames t :cleanup-frames t :force-display nil :force-onscreen t)
>   desktop-restore-frameset()
>   desktop-read()
>   #[0 "\305\211\235\203
>   command-line()
>   normal-top-level()

> In GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.0.0, NS appkit-1343.16 Version 10.10.1 (Build 14B25))
>  of 2015-01-27 on sds-MacBook-Pro.home
> Repository revision: c7effd7cacc5505933c32221bb25bea791b589e0
> Windowing system distributor `Apple', version 10.3.1343
> Configured using:
>  `configure --with-ns'

[ .... ]

[The following patch might help (it solves a similar problem on a Linux
 TTY), but this is unlikely:

diff --git a/lisp/frameset.el b/lisp/frameset.el
index b8d86c6..ced35a7 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -812,8 +812,8 @@ frameset-move-onscreen
   (pcase-let* ((`(,left ,top ,width ,height) (cl-cdadr (frame-monitor-attributes frame)))
 	       (right (+ left width -1))
 	       (bottom (+ top height -1))
-	       (fr-left (frameset-compute-pos (frame-parameter frame 'left) left right))
-	       (fr-top (frameset-compute-pos (frame-parameter frame 'top) top bottom))
+	       (fr-left (frameset-compute-pos (or (frame-parameter frame 'left) 0) left right))
+	       (fr-top (frameset-compute-pos (or (frame-parameter frame 'top) 0) top bottom))
 	       (ch-width (frame-char-width frame))
 	       (ch-height (frame-char-height frame))
 	       (fr-width (max (frame-pixel-width frame) (* ch-width (frame-width frame))))

 .]  

After starting Emacs, which fails as above, could you possibly do

    M-: (frame-monitor-attributes (selected-frame))

and post the result here, please.

> -- 
> Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1343
> http://www.childpsy.net/ http://www.memritv.org http://ffii.org
> http://camera.org http://mideasttruth.com http://dhimmi.org
> I am always late to my punctuality class.

-- 
Alan Mackenzie (Nuremberg, Germany).