Package: emacs;
Reported by: Dan Torop <dant <at> pnym.net>
Date: Fri, 29 Jan 2016 20:32:02 UTC
Severity: normal
Found in version 24.5
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Dan Torop <dant <at> pnym.net> To: 22490 <at> debbugs.gnu.org Subject: bug#22490: 24.5; (newline 0) fails when point not after newline Date: Fri, 29 Jan 2016 13:46:47 -0500
The function "newline" with an argument of 0 will fail unless called when the character before the point is a newline. To test, start a new Emacs session, type space, then evaluate "(newline 0)". It should fail with a backtrace: Debugger entered--Lisp error: (cl-assertion-failed (eq 10 (char-before))) signal(cl-assertion-failed ((eq 10 (char-before)))) #[0 "`Sf\304=\204^N^@\305\306\307C\"\210^K\203^[^@\310`\311\300!Z`\"\210\212\302b\210\312 \210\313\314!\2034^@\315 \316V\2034^@`\317 |\210)\301\206=^@\320\321\322\"\207" [0 nil 193 use-hard-newlines 10 signal cl-assertion-failed (eq 10 (char-before)) set-hard-newline-properties prefix-numeric-value beginning-of-line looking-at "[ ]$" current-left-margin 0 line-end-position move-to-left-margin nil t] 4 "\n\n(fn)"]() self-insert-command(0) newline(0) eval((newline 0) nil) eval-expression((newline 0) nil) call-interactively(eval-expression nil nil) command-execute(eval-expression) If one instead types a newline then (newline 0), the call will be a NOP, as expected. This appears to be the result of commit 62ee8b1a59d5343197cb59d9f0a52e07a23af1d8, intended to catch bug # 18913, in particular the (cl-assert (eq ?\n (char-before))) in post-self-insert-hook. While it may seem absurd to execute (newline 0), this can have a purpose, e.g. when programmatically inserting an arbitrary number of newlines at the start of an empty buffer. In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.6) of 2016-01-22 on binet, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11703000 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: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Entering debugger... Back to top level. Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu debug time-date 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 72870 4889) (symbols 48 17717 0) (miscs 40 39 113) (strings 32 9443 4228) (string-bytes 1 261156) (vectors 16 9072) (vector-slots 8 385056 15878) (floats 8 65 84) (intervals 56 229 4) (buffers 960 13) (heap 1024 16429 964))
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.