From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Terje Larsen Newsgroups: gmane.emacs.bugs Subject: bug#33492: 27.0.50; desktop-locals-to-save won't consider buffer-undo-list as local Date: Sat, 24 Nov 2018 21:54:12 +0100 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1543092788 18307 195.159.176.226 (24 Nov 2018 20:53:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 24 Nov 2018 20:53:08 +0000 (UTC) To: 33492@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 24 21:53:04 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQevI-0004da-0R for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Nov 2018 21:53:04 +0100 Original-Received: from localhost ([::1]:57705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQexO-0006yu-96 for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Nov 2018 15:55:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQexD-0006yp-Rk for bug-gnu-emacs@gnu.org; Sat, 24 Nov 2018 15:55:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQexC-0001bo-JU for bug-gnu-emacs@gnu.org; Sat, 24 Nov 2018 15:55:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQexC-0001bg-Ei for bug-gnu-emacs@gnu.org; Sat, 24 Nov 2018 15:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gQexC-00035q-Cn for bug-gnu-emacs@gnu.org; Sat, 24 Nov 2018 15:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Terje Larsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Nov 2018 20:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33492 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.154309287711851 (code B ref -1); Sat, 24 Nov 2018 20:55:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Nov 2018 20:54:37 +0000 Original-Received: from localhost ([127.0.0.1]:45830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQewm-000354-ON for submit@debbugs.gnu.org; Sat, 24 Nov 2018 15:54:37 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54149) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gQewk-00034p-Bx for submit@debbugs.gnu.org; Sat, 24 Nov 2018 15:54:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQewd-0000xq-R1 for submit@debbugs.gnu.org; Sat, 24 Nov 2018 15:54:28 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gQewd-0000xj-OL for submit@debbugs.gnu.org; Sat, 24 Nov 2018 15:54:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gQewc-0006yE-Hq for bug-gnu-emacs@gnu.org; Sat, 24 Nov 2018 15:54:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gQewb-0000up-DA for bug-gnu-emacs@gnu.org; Sat, 24 Nov 2018 15:54:26 -0500 Original-Received: from mail-yw1-xc2f.google.com ([2607:f8b0:4864:20::c2f]:34848) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gQewb-0000uV-8G for bug-gnu-emacs@gnu.org; Sat, 24 Nov 2018 15:54:25 -0500 Original-Received: by mail-yw1-xc2f.google.com with SMTP id h32so6056889ywk.2 for ; Sat, 24 Nov 2018 12:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=Lq5H6FdR9jpLiZx7M9KkYL4QMREtxMIGO4y/JasV/hw=; b=WGIBEwAKxQ97+OkiwGi+DPrB8Tir07V6CUoLKb2+7oG9ORKmuApaLMKqw3hHQVB0pe ph6f/9BLDDuByb5QTHHR+oNSRN43/EKicfiRDx32InZQIp8lom4ixh8okv2VVoqJstMz 2b14aPDn6XoaK5GndWAuKp8xHSDKIqO81HBNe/fe3Gk9oZdlxDmpe9ZzG1PBjGyWiUOz EN5JsuHgrZKYf2wBranpGoW2qAc0qNqbFyRORF6RThYaKdRhC4/GeNUieOoLQTsEZ6Nd eZeZxyMCC41LZYBacXhDYgaqTWLqLrdS1um5WW0ZWJTOFdnvLIYqy4ekO3lY3c1s6loi 1qpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=Lq5H6FdR9jpLiZx7M9KkYL4QMREtxMIGO4y/JasV/hw=; b=n8FsCm3QUy413QwAJyHtjYtmY2zpjs4UET90TsoCVRtph326GtgFVIvi7JxO6uBNQq PXVtsW9FlW5k4xTYoc+xLRLvKynHOsVEI/005BXE9BW4znWDxoWlxn67Z6KscBjObzRs toPDS6+JzC4K+uhX2jqf8GD1i1I99NMUBnCbq5F+liIA7XAuTnLY+Tk9R0vHV5i4RVCO JM9WIgVXIzyhovqYglNgVcFKJBgaLZqFgbx5EMTn7Ru1q7qV3ikKL4uIOD/+Awp8ojuX 5IdEFwCEF/ajfjd1o3JTo+0WxUmLObYTityVKh/HMmSJWMNHZNNd7T5iix22R1JiuQHE ZF3Q== X-Gm-Message-State: AGRZ1gLNfNQ3aDf83Q4AAYNz96UiI86OJcUUJlhi0C9zfycS5Xb0RAjk 2TIamaD/gMlJ0e3f5CG4x+gpZkU1kxVcW5IQz9/eqGvVt1s= X-Google-Smtp-Source: AJdET5fZ67Xz2hO85JJvs50vscXs9ifDSxd/KHTmcDKQZ7f1iYiKgzc1YsIurf1ofDvHLNmM/zGFvCyxRI2uPi8eGLE= X-Received: by 2002:a0d:ca43:: with SMTP id m64mr22679337ywd.145.1543092864213; Sat, 24 Nov 2018 12:54:24 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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: 208.118.235.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:152742 Archived-At: Add buffer-undo-list to be saved by desktop-save: (cl-pushnew 'buffer-undo-list desktop-locals-to-save :test #'equal) Open a file: C-x C-f ~/sample.txt Input text such as: Lorem ipsum dolor sit amet Remove the two last words: M-2 M-DEL Save the desktop: M-x desktop-save ... Restart Emacs ... Load the desktop: M-x desktop-read Execute undo operation: C-/ At this point I expect the undo operations from the previous session to be successful. It seems like this has been mentioned at StackExchange amongst other places before: https://emacs.stackexchange.com/questions/3725/why-is-the-buffer-undo-list-= excluded-from-buffer-local-variables I can verify that the issue stems from desktop-save relying on the C-functi= on buffer-local-variables and this function does not include the variable buffer-undo-list. Due to this it will be ignored from being saved by the desktop-save command= . Proposed in the StackExchange post is to append the buffer-undo-list in the desktop-save function. But perhaps it should be included in the C-function? Or does that perhaps cause other issues? Personally I have solved it by using an advice: (defun +append-buffer-undo-list-to-buffer-local-variables-advice (orig-fn &rest args) "Override `buffer-local-variables' and call ORIG-FN with ARGS. There is a bug in Emacs where the `buffer-undo-list' data is missing from the output of `buffer-local-variables'. This advice temporarily overrides the function and appends the missing data." (let ((orig-buffer-local-variables-fn (symbol-function 'buffer-local-variables))) (cl-letf (((symbol-function 'buffer-local-variables) #'(lambda () (append (funcall orig-buffer-local-variables-fn) `(,(cons 'buffer-undo-list buffer-undo-list)))))) (apply orig-fn args)))) (advice-add #'desktop-buffer-info :around #'+append-buffer-undo-list-to-buffer-local-variables-advice) I hope this "long-standing" bug would allow more people to utilize a persistent undo without jumping through hoops. Thanks! In GNU Emacs 27.0.50 (build 2, x86_64-apple-darwin18.0.0, NS appkit-1671.00 Version 10.14 (Build 18A391)) of 2018-11-07 built on C02V91MHHV2Q.local Repository revision: 811d9291fcfb12d87bad277d4e8b25152129d73d Windowing system distributor 'Apple', version 10.3.1671 System Description: Mac OS X 10.14.1 Recent messages: Desktop: 1 frame, 1 buffer restored. You can run the command =E2=80=98desktop-read=E2=80=99 with M-x d-rea RET Desktop: 1 frame, 1 buffer restored. user-error: No further undo information [2 times] user-error: Beginning of history; no preceding item user-error: End of history; no default available Configured using: 'configure --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=3D/usr/local/share/emacs/site-lisp --infodir=3D/usr/local/Cellar/emacs/HEAD-811d929_1/share/info/emacs --prefix=3D/usr/local/Cellar/emacs/HEAD-811d929_1 --with-gnutls --without-x --with-xml2 --without-dbus --with-imagemagick --with-rsvg --with-ns --disable-ns-self-contained' Configured features: RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS THREADS LCMS2 GMP Important settings: value of $LC_ALL: en_US.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Text Minor modes in effect: tooltip-mode: t global-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. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils thingatpt cl-seq cl-extra help-mode easymenu desktop frameset cl-loaddefs cl-lib elec-pair tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win 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 threads kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 208523 10884) (symbols 48 20326 1) (strings 32 30075 1669) (string-bytes 1 808523) (vectors 16 35932) (vector-slots 8 729980 19992) (floats 8 51 198) (intervals 56 240 0) (buffers 992 13))