From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: after-find-file-from-revert-buffer Date: Wed, 06 Apr 2011 12:51:55 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1302108730 12075 80.91.229.12 (6 Apr 2011 16:52:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 6 Apr 2011 16:52:10 +0000 (UTC) Cc: Emacs developers To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 06 18:52:06 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q7Vxd-0006Xp-Kt for ged-emacs-devel@m.gmane.org; Wed, 06 Apr 2011 18:52:05 +0200 Original-Received: from localhost ([127.0.0.1]:55627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7Vxd-0003oL-8j for ged-emacs-devel@m.gmane.org; Wed, 06 Apr 2011 12:52:05 -0400 Original-Received: from [140.186.70.92] (port=53202 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7VxX-0003nq-OA for emacs-devel@gnu.org; Wed, 06 Apr 2011 12:52:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7VxW-0005Qv-Jw for emacs-devel@gnu.org; Wed, 06 Apr 2011 12:51:59 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:11967 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7VxW-0005QO-8b for emacs-devel@gnu.org; Wed, 06 Apr 2011 12:51:58 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EABmZnE1FpZU1/2dsb2JhbACES6EteIh5qGSQd4Eog0x4BJZr X-IronPort-AV: E=Sophos;i="4.63,311,1299474000"; d="scan'208";a="103435800" Original-Received: from 69-165-149-53.dsl.teksavvy.com (HELO pastel.home) ([69.165.149.53]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 06 Apr 2011 12:51:56 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 6591258FA9; Wed, 6 Apr 2011 12:51:55 -0400 (EDT) In-Reply-To: (Juanma Barranquero's message of "Wed, 6 Apr 2011 17:18:33 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.183 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138252 Archived-At: > The issue is that saveplace does not need or want a > revert-buffer-function. What it wants is to piggyback on > find-file-hook to restore the point in other buffers, but detect the > cases where that's caused by revert-buffer, to avoid unexpectedly > moving the point. I was thinking of using a revert-buffer-function of the form (=CE=BB (&rest args) (let ((save-place-in-revert-buffer t)) (apply revert-buffer-default args))) > (defun revert-buffer (...) > (let ((revert-buffer-in-progress t)) > ...)) > which isn't not much better that which we have today, but at least is > better focused: it's cleaner to have a flag to signal use of > revert-buffer, than one to signal use of after-find-file inside > revert-buffer... Yes, that's is better. > @@ -5047,8 +5048,10 @@ > (interactive (list (not current-prefix-arg))) > (if revert-buffer-function > - (funcall revert-buffer-function ignore-auto noconfirm) > + (let ((revert-buffer-in-progress-p t)) > + (funcall revert-buffer-function ignore-auto noconfirm)) > (with-current-buffer (or (buffer-base-buffer (current-buffer)) > (current-buffer)) > - (let* ((auto-save-p (and (not ignore-auto) > + (let* ((revert-buffer-in-progress-p t) > + (auto-save-p (and (not ignore-auto) > (recent-auto-save-p) > buffer-auto-save-file-name I guess you could use a single let that covers both branches of the `if'. Stefan