From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Braun =?UTF-8?Q?G=C3=A1bor?= Newsgroups: gmane.emacs.bugs Subject: bug#38316: 26.1; Undo with undo-inhibit-record-point set doesn't restore unmodified state Date: Thu, 21 Nov 2019 22:18:21 +0100 Message-ID: <1681190.f0pj01Nb2o@gabor> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="148315"; mail-complaints-to="usenet@blaine.gmane.org" To: 38316@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 21 22:19:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iXtr8-000cSJ-Hw for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Nov 2019 22:19:14 +0100 Original-Received: from localhost ([::1]:45904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXtr7-0004cZ-9M for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Nov 2019 16:19:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49091) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXtr0-0004b1-3z for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2019 16:19:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXtqy-0002g7-Jm for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2019 16:19:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iXtqy-0002fy-Ed for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2019 16:19:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iXtqy-00034H-AE for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2019 16:19:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Braun =?UTF-8?Q?G=C3=A1bor?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Nov 2019 21:19:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 38316 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.157437111411729 (code B ref -1); Thu, 21 Nov 2019 21:19:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Nov 2019 21:18:34 +0000 Original-Received: from localhost ([127.0.0.1]:53404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iXtqR-000334-L1 for submit@debbugs.gnu.org; Thu, 21 Nov 2019 16:18:32 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:47970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iXtqQ-00032u-3j for submit@debbugs.gnu.org; Thu, 21 Nov 2019 16:18:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48965) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXtqO-0004ab-Gz for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2019 16:18:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXtqM-0002Lc-Uh for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2019 16:18:28 -0500 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:38821) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iXtqM-0002K8-Nx for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2019 16:18:26 -0500 Original-Received: by mail-wr1-x434.google.com with SMTP id i12so6191647wro.5 for ; Thu, 21 Nov 2019 13:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cWB/kRlz9cAoz7RZygYWkez7WQ0c00HY3ebAL3tTl3U=; b=OEyIeh1gBY1BcADKKOIuFXZkKv9r4+h0mCQP1ZKjAB/sC6xCD0+QTSSWMHzyRxAdKo aEJeBEnuKVLXat7PK06T9XcGFwJX15eHDeTjQChogsu5nKicxz6yDhMwzaqtipjthO2f YGWSPoI0JYiZEn1VlG3XGU1FwFMTcBDlHSGWyDU6d834XhL1W6mgj3GXLR86+xnw0u2K cYzUIg5Sef17AGFs9MDmq+sPOlKuhzEx/gEk6vSO6sVSsthIdavEgR/MJktPSvXz9kKG zxQ/IabsMS9nlrWK+ZYuXTSM5Qgvnb5Wzo8rfsW020CtboaA/Zdqy16/vIuIeVt6aefh JPXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=cWB/kRlz9cAoz7RZygYWkez7WQ0c00HY3ebAL3tTl3U=; b=raqebMVsawELzd5i5FR33hSUPGdzQ3rqIusGm6DZK/KH20WpY3+Pake1u6tGf4PqUD 4wqnKVcIFnMZKq5OhdIDg+928mPEyE4l1u+xyThLX1yUGf2Jvv3U1e/U+G2ZicapkCoo u5n+gzzZfF9/o1s8Yw0cAgil2Xx6ZjGqbP83DTXbRl1x1MVg/FbDQwc8d6Hd7XKvQXXA GjHOkr1g/sSZ4uOKbfCPKE7kr2FQiQ8rRcwBrPNVBWQqEXqSUKknX6gA5w1NafgJNsNa hy9KwDV2VkNUxmfKM/G+VnhoMsNthWLYf6FmkltbPITDcpC9OTcLCaEN+vejpNQ0x44W Pcjw== X-Gm-Message-State: APjAAAV7uouIvJrz4FnMlEToLrhZdinZ6vt/kIW5dmwjJECho/xKX74k zpWU2Gc+32q8dU8Sw8k+1SrGGSBB X-Google-Smtp-Source: APXvYqzT+Olo778M9fbSb2sXBSiACTyY8K0Ni7VTJPF+4d6Kxf+/SbpmG8t7QHJuLz9LuJf9CZiYMw== X-Received: by 2002:a5d:414a:: with SMTP id c10mr14514121wrq.100.1574371104231; Thu, 21 Nov 2019 13:18:24 -0800 (PST) Original-Received: from gabor.localnet (254C5777.nat.pool.telekom.hu. [37.76.87.119]) by smtp.gmail.com with ESMTPSA id 17sm923911wmg.19.2019.11.21.13.18.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 13:18:23 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172164 Archived-At: 1. Start Emacs: emacs -Q --eval '(setq undo-inhibit-record-point t)' I see the scratch buffer with -- in the modeline indicating it is not=20 modified. 2. Enter 'abc' in the scratch buffer: press keys a b c. 3. Press C-_. The inserted 'abc' is deleted, but in the modeline I see ** indicating that the buffer is modified. The expectation is that the buffer is no longer modified. Do the same as above but start Emacs with 'emacs -Q', no additional options. Now after C-_ I see -- in the modeline indicating that the buffer is not modified, as expected. Discussion: 1. The value of buffer-undo-list is (as shown by C-h v buffer-undo-list) in the first case (nil (#("abc" 0 3 (fontified t)) . 146) (# . -3) nil (146 . 149) nil (1 . 146)) while in the second case (nil (#("abc" 0 3 (fontified t)) . 146) (# . -3) nil (146 . 149) (t . 0) nil (1 . 146) (t . 0)) The only change I see is the additional (t . 0) entries in buffer-undo- list. 2. The difference in buffer-undo-list is explained by the function record_point in src/undo.c, which I include here in an abbreviated form with ... denoting omissions: static void record_point (ptrdiff_t beg) { /* Don't record position of pt when undo_inhibit_record_point holds. =20 */ if (undo_inhibit_record_point) return; =20 ... =20 /* If this is the first change since save, then record this.*/ if (MODIFF <=3D SAVE_MODIFF) record_first_change (); /* We may need to record point ...*/ if (at_boundary && point_before_last_command_or_undo !=3D beg && buffer_before_last_command_or_undo =3D=3D current_buffer ) bset_undo_list (current_buffer, Fcons (make_fixnum (point_before_last_command_or_undo), BVAR (current_buffer, undo_list))); } here the call to record_first_change() is responsible for adding the (t . ...) entries. Note that record_first_change() is called only if undo-inhibit-record-point is nil regardles of whether point actually gets recorded in buffer-undo-list (i.e. the condition of the last `if' is true). By the way, functions record_insert and record_delete seem to rely on record_point adding necessary (t . ...) entries. So these functions never add (t . ...) entries when undo-inhibit-record-point is t, and that's why they are missing in the first example above. Best wishes, G=C3=A1bor System information: In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2019-09-23, modified by Debian built on x86-grnet-01 Windowing system distributor 'The X.Org Foundation', version=20 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) Recent messages: =46or information about GNU Emacs and the GNU system, type C-h C-a. Undo! Type C-x 1 to delete the help window, C-M-v to scroll help. Configured using: 'configure --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.1/site- lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/ usr/share/emacs/site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --build x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var/lib --infodir=3D/usr/share/info --mandir=3D/usr/share/man --enable-libsystemd --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs:/usr/local/share/emacs/26.1/site- lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1/site-lisp:/ usr/share/emacs/site-lisp --with-sound=3Dalsa --without-gconf --with-mailutils --with-x=3Dyes --with-x-toolkit=3Dgtk3 --with-toolkit-scroll-bars 'CFLAGS=3D-g -O2 -fdebug-prefix-map=3D/build/emacs-StqULU/emacs-26.1+1=3D. -fstack- protector-strong -Wformat -Werror=3Dformat-security -Wall' 'CPPFLAGS=3D-Wdate-time -D_FORTIFY_SOURCE=3D2' LDFLAGS=3D-Wl,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 THREADS LIBSYSTEMD LCMS2 Important settings: value of $LANG: hu_HU.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-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 Load-path shadows: None found. =46eatures: (shadow sort mail-extr emacsbug message rmc puny seq dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils pp cl-print byte-opt gv bytecomp byte-compile cconv thingatpt help-fns radix-tree help-mode easymenu cl-loaddefs cl-lib elec-pair time-date 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 dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 102224 12976) (symbols 48 20553 1) (miscs 40 55 104) (strings 32 30980 919) (string-bytes 1 777673) (vectors 16 15007) (vector-slots 8 501086 9156) (floats 8 56 171) (intervals 56 290 0) (buffers 992 12))