From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: How to disable undo recording within a defun? Date: Thu, 16 Sep 2021 19:41:03 -0400 Message-ID: References: <1511127682.419039.1631642669435.ref@mail.yahoo.com> <1511127682.419039.1631642669435@mail.yahoo.com> <87v9333u36.fsf@telefonica.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40922"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:cp72ZlYWjUa5bWw12TqYsV08MJs= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 17 01:44:36 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR13T-000ATm-H2 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 17 Sep 2021 01:44:35 +0200 Original-Received: from localhost ([::1]:49858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR13S-0003Us-F3 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 16 Sep 2021 19:44:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR10I-0002Jf-TV for help-gnu-emacs@gnu.org; Thu, 16 Sep 2021 19:41:18 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:35592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR10B-0004RQ-GR for help-gnu-emacs@gnu.org; Thu, 16 Sep 2021 19:41:14 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mR109-0005yR-PD for help-gnu-emacs@gnu.org; Fri, 17 Sep 2021 01:41:09 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133075 Archived-At: >> I'm writting a defun, and would like to disable entirely the recording >> of undo information while this function is executing. Is this >> possible?  If so, what is the way to do this? Thanks, > See function buffer-disable-undo and variable buffer-undo-list. It's very unusual to disable recording undo, and it is usually problematic because the undo-records before and after the chunk you want to skip can't be used together unless the chunk you skip ends up doing "nothing". So maybe you're looking for `with-silent-modifications` which can be used when the modifications to the buffer are "negligible" (typically in the sense that they don't affect what would get saved into the file). Stefan