From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wolfgang Jenkner Newsgroups: gmane.emacs.devel Subject: Re: save-excursion and the mark Date: Sat, 18 Apr 2015 14:30:58 +0200 Message-ID: <85sibx4nuz.fsf@iznogoud.viz> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1429360458 4389 80.91.229.3 (18 Apr 2015 12:34:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Apr 2015 12:34:18 +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 18 14:34:12 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 1YjRwp-0004dp-0G for ged-emacs-devel@m.gmane.org; Sat, 18 Apr 2015 14:34:11 +0200 Original-Received: from localhost ([::1]:45573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjRwo-00043r-BA for ged-emacs-devel@m.gmane.org; Sat, 18 Apr 2015 08:34:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjRwk-00043g-P9 for emacs-devel@gnu.org; Sat, 18 Apr 2015 08:34:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YjRwf-0006yS-PA for emacs-devel@gnu.org; Sat, 18 Apr 2015 08:34:06 -0400 Original-Received: from b2bfep12.mx.upcmail.net ([62.179.121.57]:34103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjRwf-0006y9-Dx for emacs-devel@gnu.org; Sat, 18 Apr 2015 08:34:01 -0400 Original-Received: from edge11.upcmail.net ([192.168.13.81]) by b2bfep12.mx.upcmail.net (InterMail vM.8.01.05.11 201-2260-151-128-20120928) with ESMTP id <20150418123357.DVUK4373.b2bfep12-int.chello.at@edge11.upcmail.net> for ; Sat, 18 Apr 2015 14:33:57 +0200 Original-Received: from iznogoud.viz ([91.119.106.48]) by edge11.upcmail.net with edge id HQZx1q00B12gaNK0BQZxHs; Sat, 18 Apr 2015 14:33:57 +0200 X-SourceIP: 91.119.106.48 Original-Received: from wolfgang by iznogoud.viz with local (Exim 4.85 (FreeBSD)) (envelope-from ) id 1YjRwa-0000TI-Qc; Sat, 18 Apr 2015 14:33:56 +0200 Mail-Followup-To: Stefan Monnier , emacs-devel@gnu.org User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (berkeley-unix) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 62.179.121.57 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:185571 Archived-At: On Sat, Apr 18 2015, Stefan Monnier wrote: >> Code that previously relied on `save-excursion' restoring the mark no >> longer works, and that's fine. But could we have a new form like >> `save-mark' (or something) that we could just slap around forms that >> previously relied on this form behaving the old way? > > (cl-letf (((mark))) ...) might do the trick. > Or maybe you'll need (cl-letf (((mark)) (mark-active)) ...). > note that if the "..." activates or deactivates the mark, you're > probably somewhat in trouble in the sense that (de)activate-mark-hook > will be run, despite the cl-letf, and you can't really undo the effect > of running a hook. It would be useful to know which existing uses of (de)activate-mark-hook are worrisome. In lisp/ there are very few instances where functions are added to those hooks (only for rectangle marking and "enhanced edt keypad mode emulation", whatever that is). In elpa, there seems to be none at all. So, those uses seem too marginal to draw conclusions. In theory, of course, there are ways to set or bind symbols which are not amenable to grepping, so I might have missed something. The instance of emacs I'm running says activate-mark-hook is a variable defined in `simple.el'. Its value is (evil-visual-activate-hook t) Local in buffer *unsent wide reply to Stefan Monnier*; global value is nil I'd guess that most users of evil turn on evil-mode, which is a globalized minor mode, so any problem with some inadvertent use of save-excursion would have surfaced quickly. Wolfgang