From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cAoFAy6sRmALCwAA0tVLHw (envelope-from ) for ; Mon, 08 Mar 2021 22:58:54 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MPZEOi2sRmDgeAAAbx9fmQ (envelope-from ) for ; Mon, 08 Mar 2021 22:58:53 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 353FB8EC9 for ; Mon, 8 Mar 2021 23:58:53 +0100 (CET) Received: from localhost ([::1]:42584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJOpv-0004kF-9L for larch@yhetil.org; Mon, 08 Mar 2021 17:58:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJOom-0004jt-Ue for emacs-orgmode@gnu.org; Mon, 08 Mar 2021 17:57:41 -0500 Received: from mx1.riseup.net ([198.252.153.129]:33112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJOok-0007zZ-JS for emacs-orgmode@gnu.org; Mon, 08 Mar 2021 17:57:40 -0500 Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4DvYdW6kMkzDq8x for ; Mon, 8 Mar 2021 14:57:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1615244256; bh=8ttDDVbsizadAtCQn9r/soUPRjycme7wjRnMIK1fH+E=; h=From:To:Subject:Date:From; b=rN75W7W3fWkXoUdZgnwjixAfQssAN1qsLIhm6AHWmTTeCwxAN5DrTEVsxD9iFkQrL Xbfn5SveVSRj0J6z4BAcr0OVGEfNSGdF8OeEZts4dMXBiT+CaNKPKd6cc5OCX18mIX 01zfkIe9fUlaQCrER1+yu9aqvvtRGpdVV6nH4U5M= X-Riseup-User-ID: 6420257E8703969FA9B4389821743ACE19143F20D6C60EA47A16BF9EC3B344DC Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4DvYdW0KtMz5vNX for ; Mon, 8 Mar 2021 14:57:34 -0800 (PST) From: pillule To: emacs-orgmode@gnu.org Subject: [PATCH] org-src.el Do not ask to revert unmodified buffers Date: Mon, 08 Mar 2021 22:57:23 +0000 Message-ID: <87blbtxnho.fsf@host.localdomain> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=198.252.153.129; envelope-from=pillule@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615244333; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=kIMspU8iXHp2Lw/Wx2sJKfUV1uT6appOhynFptABUNo=; b=E9wn67cQO9duRU9b+kQikZW0Djntd7LaexWUonqHc5WWX6CgBAz++J3Hlmwz5Q9+xglg3k P4i8z8McCyxYCkn90qcPpfEO2hQiIllru6G554LtUAme0yi59yDFDpUe7dQ58IXXEVAOsi ibAx6uyhuaCNJ/+4Y9EbaY+UBhJocFr8YoLzkhNQSgah6opL0fS4RSb9zvJsLQ5KnIsA3O hgHqU94nObe+HP145DDH30plbkRkt6oTx1cp+sjtrrgGAC/bW2pyoVIxejQypxqtlzl1aI VGUiWJ7zqBIK7tulyzECshp7PcE94J1JJQoROzFH93npOExduANvLESa24XEjg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615244333; a=rsa-sha256; cv=none; b=dV1sg2WK247kfSCZ0BFTrCdvD/IKNd5Wj5XdLlCxs+p2h3D2Pkrke2v5sMc+pPIERXulYf OTbIeW4xNufkm1c8gpc+JHm8Sw4vUkEBXEbd84+RAG02Ze3CQkUqjesxIP66MgVLa4MMla Q0ts4XCGGYuyPtUs/tcBnHfw+6bXGOhilwN+1bo1qZmtOSq64J6FYcHwuxyjgvOOAQNeBd bO0yxrAw41XdHxjFFc3lxI3kyFFO9GvUqjSff6VNCRuXhdS4w71XII675UayY1uHypaxOA /aHHiOupABdr5TK8GFk/LbM3KM0MtlAkumktg+p9mXJZo0hfXLEQOE4ERy3YKA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=rN75W7W3; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.08 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=rN75W7W3; dmarc=pass (policy=none) header.from=riseup.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 353FB8EC9 X-Spam-Score: -3.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: NSCwlKiVFFNg Hi, it is asked to the user if we want to revert changes when re-entering in a org-source buffer. Even if the buffer have no modifications. This patch ask to revert the buffer only if there are modifications to the source buffer. @@ -493,8 +493,9 @@ (old-edit-buffer (org-src--edit-buffer beg end)) (contents (or contents (nth 2 area)))) (if (and old-edit-buffer - (or (not org-src-ask-before-returning-to-edit-buffer) - (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? "))) + (or (not org-src-ask-before-returning-to-edit-buffer) + (or (not (buffer-modified-p old-edit-buffer)) + (y-or-n-p "Return to existing edit buffer ([n] will revert changes)? ")))) ;; Move to existing buffer. (org-src-switch-to-buffer old-edit-buffer 'return) ;; Discard old edit buffer. --