Subject: 26.1; Wrong type argument: number-or-marker-p, nil in window-edges

From: "Pascal J. Bourguignon" <[email-masked]>
Date: Sun, 09 Dec 2018 22:34:12 +0100

Launching emacs in a terminal (DISPLAY=:0.0, but no X server running),
including my .emacs, I get 
Wrong type argument: number-or-marker-p, nil in window-edges
errors on C-n and C-p.
The error come from window-edges.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  window-edges(nil t nil t)
  window-inside-pixel-edges()
  window-screen-lines()
  line-move-partial(1 nil)
  line-move(1 nil nil 1)
  next-line(1 1)
  funcall-interactively(next-line 1 1)
  call-interactively(next-line nil nil)
  command-execute(next-line)

Running with a window-edges not compiled, we find that the problem is
that border-width is nil. I would therefore suggest to patch
window-edges, to use 0 when frame-internal-border-width returns nil
(which occurs when running in a terminal):

    (let (…
          (border-width (or (frame-internal-border-width frame) 0))
          …)

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.31)
 of 2018-12-09 built on proteus
System Description:	Debian GNU/Linux 9.6 (stretch)

Recent messages:
Wrote /home/pjb/src/public/rc/emacs-common.el [2 times]
save-buffer "/home/pjb/src/public/rc/emacs-common.el"
Mark set
Entering debugger...
previous-line: Beginning of buffer [2 times]
Back to top level
The footer should be: (provide 'emacs-common)\n;;; emacs-common.el ends here
window-edges
Mark set
Quit

Configured using:
 'configure --prefix=/usr/local --with-x --without-ns --with-gif=no
 --with-gnutls=no'

Configured features:
XPM JPEG TIFF PNG SOUND GSETTINGS NOTIFY LIBXML2 FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 THREADS

Important settings:
  value of $LC_COLLATE: C
  value of $LC_CTYPE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: nil

Major mode: Emacs-Lisp

Minor modes in effect:
  global-flycheck-mode: t
  flycheck-mode: t
  erc-truncate-mode: t
  erc-track-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-ring-mode: t
  erc-replace-mode: t
  erc-netsplit-mode: t
  erc-match-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-mode: -1
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-autoaway-mode: t
  show-paren-mode: t
  auto-image-file-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  erc-log-mode: t
  erc-irccontrols-mode: t
  erc-readonly-mode: t
  paredit-mode: t
  diff-auto-refine-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  unify-8859-on-decoding-mode: t
  unify-8859-on-encoding-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/pjb/src/public/emacs/scratch hides /home/pjb/emacs/emacs-utils/scratch
/home/pjb/emacs/emacs-utils/utils hides /home/pjb/emacs/emacs-cl/src/utils
/home/pjb/emacs/coffee-mode/test/test-helper hides /home/pjb/emacs/emacs-gradle-mode/test/test-helper
/home/pjb/src/public/emacs/scratch hides /home/pjb/emacs/emacs-utils/examples/scratch
/home/pjb/src/public/emacs/scratch hides /home/pjb/emacs/emacs-utils/parser-pres/scratch
/home/pjb/emacs/paredit hides /home/pjb/.emacs.d/elpa/paredit-24/paredit
/home/pjb/emacs/emacs-gradle-mode/features/support/env hides /usr/local/share/emacs/26.1/lisp/env
/usr/share/emacs/site-lisp/rst hides /usr/local/share/emacs/26.1/lisp/textmodes/rst
/home/pjb/emacs/emacs-utils/thunk hides /usr/local/share/emacs/26.1/lisp/emacs-lisp/thunk

Features:
(shadow sort mail-extr emacsbug yasnippet misearch multi-isearch
cl-print help-fns radix-tree org-rmail org-mhe org-irc org-info org-gnus
nnir org-docview org-bibtex bibtex org-bbdb org-w3m term/screen
term/xterm xterm ob-dot ob-latex server find-lisp textmate robe inf-ruby
ruby-mode highlight-indentation smartparens-config
smartparens-javascript smartparens-text smartparens-html
smartparens-ruby smartparens enh-ruby-mode android-mode inf-lisp
slime-media slime-indentation slime-cl-indent slime-mrepl inferior-slime
slime-hyperdoc slime-sprof slime-asdf slime-fancy slime-trace-dialog
slime-fontifying-fu slime-package-fu slime-references
slime-compiler-notes-tree slime-scratch slime-presentations bridge
slime-macrostep macrostep slime-mdot-fu slime-enclosing-context
slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-repl elp slime-parse slime
flycheck rx subr-x dash flymake-proc flymake warnings lisp-mnt gud
apropos etags xref project arc-mode archive-mode hyperspec
slime-autoloads erc-truncate erc-track erc-services erc-networks
erc-ring erc-replace erc-netsplit erc-match erc-pcomplete erc-button
erc-fill erc-stamp erc-join erc-autoaway paren grep delsel image-file
canlock freerdp-c-style cl-indent w3m doc-view jka-compr image-mode
timezone w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon
w3m-image w3m-proc w3m-util w3m-load org-element avl-tree generator org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs auto-complete-config auto-complete popup
bash-completion iso-transl rst compile emacs-uptime debug gnus-art mm-uu
mml2015 mm-view mml-smime smime dig gnus-sum gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo
gnus-spec gnus-int gnus-range gnus-win cus-edit cus-start cus-load
rmailsum rmailsort asm-mode pjb-constants pjb-cl-magic pcase
pjb-echo-keys pjb-erc erc-log pjb-make-depends pjb-erc-filter
pjb-erc-speak pjb-speak erc-goodies erc erc-backend erc-compat pp
pjb-mail sendmail pjb-pgp pgp pjb-shell pjb-work pjb-xresources pjb-thi
pjb-c-style pjb-java pjb-http pjb-objc-edit paredit semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
pjb-objc-ide cedet pjb-objc-parser pjb-objc-gen android-classes
mhtml-mode css-mode smie color eww mm-url gnus nnheader wid-edit
url-queue shr svg xml js json map imenu flyspell ispell pl1 pjb-cvs
pjb-dot pjb-graph pjb-class pjb-cvspass pjb-i2p-expression
pjb-s2p-expression pjb-layers pjb-roman pjb-server pjb-queue pjb-banks
pjb-bourse pjb-object pjb-euro pjb-html pjb-emacs edmacro kmacro cookie1
morse fortune sgml-mode dom picture browse-url pjb-sources filecache
add-log cal-menu calendar cal-loaddefs forms forms-mode pjb-utilities
pjb-font pjb-selftrade pjb-strings pjb-list pjb-cl eieio-compat
eieio-opt speedbar sb-image ezimage dframe find-func cl-extra help-mode
vc-git diff-mode easy-mmode elec-pair time goto-addr thingatpt tramp-sh
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs tramp tramp-compat tramp-loaddefs trampver ucs-normalize
shell pcomplete comint ansi-color ring advice parse-time cl mm-archive
message dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util
rmail rmail-loaddefs time-date mailabbrev gmm-utils mailheader mm-decode
mm-bodies mm-encode mail-utils format-spec network-stream starttls
url-http tls gnutls mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr url-gw nsm rmc puny url-cache url-auth url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap epg finder-inf info package easymenu
epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib disp-table mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded 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 inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 1152520 37629)
 (symbols 48 69507 85)
 (miscs 40 890 1345)
 (strings 32 299694 3548)
 (string-bytes 1 7049053)
 (vectors 16 98122)
 (vector-slots 8 2328274 44702)
 (floats 8 892 1235)
 (intervals 56 1023 676)
 (buffers 992 19))