From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: save-excursion and the mark Date: Sat, 25 Apr 2015 15:23:50 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1429968268 28025 80.91.229.3 (25 Apr 2015 13:24:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 25 Apr 2015 13:24:28 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 25 15:24:18 2015 Return-path: Envelope-to: ged-emacs-devel@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 1Ym049-0002MS-8A for ged-emacs-devel@m.gmane.org; Sat, 25 Apr 2015 15:24:17 +0200 Original-Received: from localhost ([::1]:48416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ym048-0005hx-Fr for ged-emacs-devel@m.gmane.org; Sat, 25 Apr 2015 09:24:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ym03u-0005hg-Dk for emacs-devel@gnu.org; Sat, 25 Apr 2015 09:24:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ym03o-00046I-RL for emacs-devel@gnu.org; Sat, 25 Apr 2015 09:24:02 -0400 Original-Received: from lamora.getmail.no ([84.210.184.7]:52238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ym03o-000458-LB for emacs-devel@gnu.org; Sat, 25 Apr 2015 09:23:56 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by lamora.getmail.no (Postfix) with ESMTP id BF7B4AD4B0; Sat, 25 Apr 2015 15:23:54 +0200 (CEST) Original-Received: from lamora.getmail.no ([127.0.0.1]) by localhost (lamora.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 73uAuxz4llXt; Sat, 25 Apr 2015 15:23:51 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by lamora.getmail.no (Postfix) with ESMTP id F3E54AD4AD; Sat, 25 Apr 2015 15:23:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at lamora.get.c.bitbit.net Original-Received: from lamora.getmail.no ([127.0.0.1]) by localhost (lamora.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 65cSP76ESpWF; Sat, 25 Apr 2015 15:23:50 +0200 (CEST) Original-Received: from stories (cm-84.215.51.58.getinternet.no [84.215.51.58]) by lamora.getmail.no (Postfix) with ESMTPS id C84D4AC66E; Sat, 25 Apr 2015 15:23:50 +0200 (CEST) X-Hashcash: 1:26:150425:monnier@iro.umontreal.ca::gSP9wGIIk9PrTBqU:00000000000000000000000000000000000014vgi X-Hashcash: 1:26:150425:emacs-devel@gnu.org::zyqJ1kLnkv0GfDtH:000000000000000000000000000000000000000003YHsz In-Reply-To: (Lars Magne Ingebrigtsen's message of "Sat, 25 Apr 2015 14:45:04 +0200") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 84.210.184.7 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185867 Archived-At: Lars Magne Ingebrigtsen writes: > Stefan Monnier writes: > >> (cl-letf (((mark))) ...) might do the trick. > > Thanks; that kinda cryptic incantation seems to do the trick Actually, it just made things break in a different way. The following code used to work, and is run from a process filter (asynchronously): (defun hashcash-insert-payment-async-2 (buffer process pay) (when (buffer-live-p buffer) (with-current-buffer buffer (save-excursion (save-restriction (setq hashcash-process-alist (delq (assq process hashcash-process-alist) hashcash-process-alist)) (message-goto-eoh) (when pay (insert-before-markers "X-Hashcash: " pay))))))) If I put the mark somewhere in the buffer, and the text is then inserted, then the mark suddenly has the same value as point. If I wrap this code in the `cl-letf', the mark value doesn't change at all, which means that it now points to somewhere else in the buffer. (Since the X-Hashcash header is inserted before the mark.) That is, the numerical value of the mark doesn't change, so it visually moves backwards in the buffer, since text has been inserted before the mark. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no