From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#23824: 25.0.95; Prevent compare one buffer with itself Date: Fri, 24 Jun 2016 14:07:29 +0900 (JST) Message-ID: References: <83wplh45fw.fsf@gnu.org> <83lh1w2aev.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: ger.gmane.org 1466744911 23642 80.91.229.3 (24 Jun 2016 05:08:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2016 05:08:31 +0000 (UTC) Cc: Tino Calancha , 23824@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 24 07:08:17 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bGJLj-0000cy-Me for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2016 07:08:15 +0200 Original-Received: from localhost ([::1]:40833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGJLi-0004Hq-FQ for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2016 01:08:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGJLb-0004Ef-O3 for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 01:08:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGJLW-0003PE-MC for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 01:08:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGJLW-0003PA-Ij for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 01:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bGJLW-0004sM-Cc for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2016 01:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2016 05:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23824-submit@debbugs.gnu.org id=B23824.146674486018713 (code B ref 23824); Fri, 24 Jun 2016 05:08:02 +0000 Original-Received: (at 23824) by debbugs.gnu.org; 24 Jun 2016 05:07:40 +0000 Original-Received: from localhost ([127.0.0.1]:53203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGJL9-0004rl-Ob for submit@debbugs.gnu.org; Fri, 24 Jun 2016 01:07:39 -0400 Original-Received: from mail-pa0-f43.google.com ([209.85.220.43]:33145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGJL7-0004rW-V4 for 23824@debbugs.gnu.org; Fri, 24 Jun 2016 01:07:38 -0400 Original-Received: by mail-pa0-f43.google.com with SMTP id b13so34026153pat.0 for <23824@debbugs.gnu.org>; Thu, 23 Jun 2016 22:07:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Apf1H9XtNjfv20UcoQRWL5Qsx4e1VwFuzmZtrh2+S6o=; b=QeELvo9aByj62fz/hvG7HApnT3MjdcIEeHt+XTnnfQLpjsm7+b+vGLVeoteLtdsU8u D51/RwyTaPX3wbqJaF3FR7jNwtVuttur/3oPRmDgW/Oob5hixbFHumgiKQ7a8jEJAJ6q U0l5juhHy5ocZ0qbWZ11S3tX2Bixj1DnfbsVvx30dTdsm0yferGjFXp7bD8JRDCXS3u6 2FF81w76W9B/d90iCGd0gsk4uyikhZkWTI45Sj8JNcUu5M52EHIvfay5wPDGS+GIWD2L eGTbTxkMrUsSNGcsKuGOawLJTuUwPeX3nvIZ10IwmGijdkZCXf4wMpDCUm8wUYx2ivQs AoYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Apf1H9XtNjfv20UcoQRWL5Qsx4e1VwFuzmZtrh2+S6o=; b=Id1CsjNmq0pGjOfIU7BqeIF2igMipiW3ypejQG7utgZmGUDdL3+3LyNPAin6IITbjG fZAIA1s2OQ1ejA6Ih9y8yqVVSb5/35ZtnzgpJ1ghHdfzdM66UK0ENsp+YOxsC/wU3pnN j9aD/Vm/SQEG/6RNAj1g+XwiJ+0gmIjweYga9PHrdzRzz4dHjvTWrzm03AizXttzM+ru GuSan8+0WwRZo/4gWSsJfwf1LbSDbLkQPj75zG15ROlXK/dYV6W69x9cCmk+mA4JnbYl TgnY1EgMsOLmMBiIFdMv1uxkJN+aOnvOpj6sZEJkNix9/ctw9Y7yRksY73CZso6k+UDy dM8g== X-Gm-Message-State: ALyK8tIwU6znzAZgK3mtE/7UiTJJorP7b3Vqy0DHGdER/VSDzNAVgJfPJ+KpUPHe6Ua3vA== X-Received: by 10.66.139.133 with SMTP id qy5mr4210897pab.4.1466744852247; Thu, 23 Jun 2016 22:07:32 -0700 (PDT) Original-Received: from calancha-pc (softbank126103139048.bbtec.net. [126.103.139.48]) by smtp.gmail.com with ESMTPSA id h77sm3808402pfj.86.2016.06.23.22.07.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jun 2016 22:07:31 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: <83lh1w2aev.fsf@gnu.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) 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:119995 Archived-At: On Thu, 23 Jun 2016, Eli Zaretskii wrote: >But then what is that "also" word doing in the doc string? Nothing special: It states that the person whom wrote this func took in account both cases: *) When buf-a is not visiting file-b (let's call it 'default' case). *) When buf-a is visiting file-b ('special' case). Something like: "Dear doc readers, i let you know that i have _also_ considered the case when buf-a is visiting file-b". >I think there's more here than meets the eye. Did you ask yourself >why the user is asked twice whether to save the same buffer to the >same file in your scenario? Why does it do that? What does it have >in mind? I guess is just a bug in the logic. The author of this code overlooked that (get-file-buffer file-b) may return the very same buffer that buf-a (when buf-a is visiting file-b). Then, calling (highlight-markup-buffers BUF-A FILE-B BUF-A FILE-B) will prompt you twice to save BUF-A when BUF-A is modified. It prompts you to save buf-a again even if you saved buf-a after the first prompt: this is because `highlight-markup-buffers' save the bit on the modification status of BUF-A and BUF-B at the top of the function. In my patch, for this case (buf-a visiting file-b), i explicitely create a temporary buffer whose content equals file-b content. Then, I call (set-buffer-modified-p nil) to prevent being prompted to save this temporary buffer. >Oh, it matters a lot. insert-file-contents-literally will bypass any >decoding and leave the CR-LF EOLs untranslated, something that you >don't want to affect the comparison. I see. Another example that reviewing a patch before applying it is a good thing. Then, my patch need to be modified: insert-file-contents-literally -> insert-file-contents