From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#33492: 27.0.50; desktop-locals-to-save won't consider buffer-undo-list as local Date: Tue, 29 Jan 2019 19:30:58 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="192511"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) Cc: Terje Larsen To: 33492@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 30 01:32:12 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1godnX-000nrL-3s for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Jan 2019 01:32:11 +0100 Original-Received: from localhost ([127.0.0.1]:57584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1godnW-0005YU-3F for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Jan 2019 19:32:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1godnP-0005Y7-69 for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 19:32:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1godnO-0007RI-CD for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 19:32:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51678) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1godnO-0007RC-8p for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 19:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1godnO-0005YY-10 for bug-gnu-emacs@gnu.org; Tue, 29 Jan 2019 19:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Jan 2019 00:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33492 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 33492-submit@debbugs.gnu.org id=B33492.154880826921286 (code B ref 33492); Wed, 30 Jan 2019 00:32:01 +0000 Original-Received: (at 33492) by debbugs.gnu.org; 30 Jan 2019 00:31:09 +0000 Original-Received: from localhost ([127.0.0.1]:50956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1godmX-0005XF-Cp for submit@debbugs.gnu.org; Tue, 29 Jan 2019 19:31:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40913) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1godmV-0005Wt-KE for 33492@debbugs.gnu.org; Tue, 29 Jan 2019 19:31:07 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1godmM-0006vD-G1; Tue, 29 Jan 2019 19:31:00 -0500 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1godmM-00063v-Bs; Tue, 29 Jan 2019 19:30:58 -0500 X-Spook: Malware Hugo Chavez Plane Dock North Korea Water borne X-Ran: sP^lo=5s*pHl^u_SS6?yrMUYWoD%j*Y}oIUaA@V=TV,x]#74}aN39+ZPdTxH%|3QZ_y#?A X-Hue: red X-Attribution: GM In-Reply-To: (Glenn Morris's message of "Wed, 28 Nov 2018 16:49:02 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:154878 Archived-At: Glenn Morris wrote: >> This issue (buffer-local-variables does not include buffer-undo-list) >> is present since Emacs 24.3, due to 36429c8, which moved undo_list to >> the end of struct buffer. > > The following works, but I don't know if it is the best solution. > > --- i/src/buffer.c > +++ w/src/buffer.c > @@ -1266,6 +1266,20 @@ buffer_lisp_local_variables (struct buffer *buf, bool clone) > return result; > } > > +Lisp_Object > +buffer_local_variables_1 (struct buffer *buf, int offset) > +{ > + int idx = PER_BUFFER_IDX (offset); > + if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) > + && SYMBOLP (PER_BUFFER_SYMBOL (offset))) > + { > + Lisp_Object sym = PER_BUFFER_SYMBOL (offset); > + Lisp_Object val = per_buffer_value (buf, offset); > + return EQ (val, Qunbound) ? sym : Fcons (sym, val); > + } > + return Qnil; > +} > + > DEFUN ("buffer-local-variables", Fbuffer_local_variables, > Sbuffer_local_variables, 0, 1, 0, > doc: /* Return an alist of variables that are buffer-local in BUFFER. > @@ -1277,6 +1291,7 @@ No argument or nil as argument means use current buffer as BUFFER. */) > { > struct buffer *buf = decode_buffer (buffer); > Lisp_Object result = buffer_lisp_local_variables (buf, 0); > + Lisp_Object tem; > > /* Add on all the variables stored in special slots. */ > { > @@ -1284,18 +1299,16 @@ No argument or nil as argument means use current buffer as BUFFER. */) > > FOR_EACH_PER_BUFFER_OBJECT_AT (offset) > { > - idx = PER_BUFFER_IDX (offset); > - if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) > - && SYMBOLP (PER_BUFFER_SYMBOL (offset))) > - { > - Lisp_Object sym = PER_BUFFER_SYMBOL (offset); > - Lisp_Object val = per_buffer_value (buf, offset); > - result = Fcons (EQ (val, Qunbound) ? sym : Fcons (sym, val), > - result); > - } > + tem = buffer_local_variables_1 (buf, offset); > + if (!NILP (tem)) > + result = Fcons (tem, result); > } > } > > + tem = buffer_local_variables_1 (buf, PER_BUFFER_VAR_OFFSET (undo_list)); > + if (!NILP (tem)) > + result = Fcons (tem, result); > + > return result; > } I was going to apply this, there having been no comments, but then I noticed that since the advent of portable dumper (or since 978cf88 at least), it's not completely right. It adds an entry for buffer-undo-list to buffer-local-variables, but with key = "nil" rather than "buffer-undo-list". Which implies that PER_BUFFER_SYMBOL (PER_BUFFER_VAR_OFFSET (undo_list)) now returns nil instead of 'buffer-undo-list.