From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Micha=c5=82_Kondraciuk?= Newsgroups: gmane.emacs.help Subject: Re: Question about memory usage Date: Sat, 7 Apr 2018 15:15:08 +0200 Message-ID: References: <83sh8c6byb.fsf@gnu.org> <690641bc-fc49-922a-26bd-6f92322d0cc0@zoho.com> <83po3g40c3.fsf@gnu.org> <83bmez4g0b.fsf@gnu.org> <36b25160-eef1-73cf-c585-f798a7cef44c@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------9D04277BAE498E7C8994E0D4" X-Trace: blaine.gmane.org 1523106837 15985 195.159.176.226 (7 Apr 2018 13:13:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Apr 2018 13:13:57 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 07 15:13:53 2018 Return-path: Envelope-to: geh-help-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 1f4nfE-000429-G3 for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Apr 2018 15:13:52 +0200 Original-Received: from localhost ([::1]:56831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4nhI-00089B-FL for geh-help-gnu-emacs@m.gmane.org; Sat, 07 Apr 2018 09:16:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4ngl-00087Y-8O for help-gnu-emacs@gnu.org; Sat, 07 Apr 2018 09:15:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4ngk-0004F7-L7 for help-gnu-emacs@gnu.org; Sat, 07 Apr 2018 09:15:27 -0400 Original-Received: from sender-pp-092.zoho.com ([135.84.80.237]:25343) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f4nge-0004Bx-3W; Sat, 07 Apr 2018 09:15:20 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=subject:to:cc:references:from:message-id:date:user-agent:mime-version:in-reply-to:content-type; b=WM1j9fWRt9iRaK8qmmBY8gJeI75GVh9rM2vY96s5fszi2FxHGgfzFbk9vBds3IJtdBGif1E/A5+b RG0NnWbFSF9XWEk1iuXWXMqD/v7QWdvBh2FGs3VLV1Ik4leaT1C9 Original-Received: from [192.168.0.87] (84-10-171-192.static.chello.pl [84.10.171.192]) by mx.zohomail.com with SMTPS id 1523106910438104.57688857283074; Sat, 7 Apr 2018 06:15:10 -0700 (PDT) In-Reply-To: Content-Language: en-US X-Zoho-Virus-Status: 1 X-ZohoMailClient: External X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 135.84.80.237 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116392 Archived-At: This is a multi-part message in MIME format. --------------9D04277BAE498E7C8994E0D4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 04/05/2018 08:54 PM, Stefan Monnier wrote: > We could/should probably arrange to scan for dead buffers every time we > add a new buffer to it, or from kill-buffer-hook. Can you take a look at the attached patch? --------------9D04277BAE498E7C8994E0D4 Content-Type: text/x-patch; name="remove-killed-buffer-from-changed-list.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="remove-killed-buffer-from-changed-list.patch" diff --git a/lisp/simple.el b/lisp/simple.el index aad8d3b..23f7c4f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3014,6 +3014,13 @@ undo-auto--undoably-changed-buffers `undo-auto--boundaries' and can be affected by changes to their default values.") +(defun undo-auto--remove-buffer-from-changed-list () + "Remove current buffer from list of recently changed ones." + (setq undo-auto--undoably-changed-buffers + (delq (current-buffer) undo-auto--undoably-changed-buffers))) + +(add-hook 'kill-buffer-hook #'undo-auto--remove-buffer-from-changed-list) + (defun undo-auto--add-boundary () "Add an `undo-boundary' in appropriate buffers." (undo-auto--boundaries --------------9D04277BAE498E7C8994E0D4--