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: [Emacs-diffs] master 255a011: Add `save-mark-and-excursion', which has the old `save-excursion' behavior Date: Mon, 04 May 2015 18:16:30 -0400 Message-ID: References: <20150504184829.1108.13525@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1430777808 29511 80.91.229.3 (4 May 2015 22:16:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 May 2015 22:16:48 +0000 (UTC) Cc: Daniel Colascione To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 05 00:16:40 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 1YpOfH-0006Y3-Jl for ged-emacs-devel@m.gmane.org; Tue, 05 May 2015 00:16:39 +0200 Original-Received: from localhost ([::1]:36147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpOfG-0003Sk-VO for ged-emacs-devel@m.gmane.org; Mon, 04 May 2015 18:16:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpOfD-0003SU-Uv for emacs-devel@gnu.org; Mon, 04 May 2015 18:16:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpOf9-0001AU-1M for emacs-devel@gnu.org; Mon, 04 May 2015 18:16:35 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:13588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpOf8-0001AQ-Tl for emacs-devel@gnu.org; Mon, 04 May 2015 18:16:30 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRFpYts/2dsb2JhbAA3gVOhb4EIgXYBBVYjEAs0BwsUGA2qSIwnPQkDA4M+A1KDHgSjY4RY X-IPAS-Result: AgUFAGvvdVRFpYts/2dsb2JhbAA3gVOhb4EIgXYBBVYjEAs0BwsUGA2qSIwnPQkDA4M+A1KDHgSjY4RY X-IronPort-AV: E=Sophos;i="5.11,557,1422939600"; d="scan'208";a="118243481" Original-Received: from 69-165-139-108.dsl.teksavvy.com (HELO pastel.home) ([69.165.139.108]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 May 2015 18:16:30 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 372A82115; Mon, 4 May 2015 18:16:30 -0400 (EDT) In-Reply-To: (Daniel Colascione's message of "Mon, 04 May 2015 18:48:29 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:186210 Archived-At: > + (let ((mark (mark-marker))) > + (and mark (marker-position mark) (copy-marker mark))) Here you consider that (mark-marker) can return nil. > +(defun save-mark-and-excursion--restore (saved-mark-info) > + (let ((saved-mark (car saved-mark-info)) > + (omark (marker-position (mark-marker))) But here you assume it's always a marker. > + (setf nmark (marker-position saved-mark)) ^^^^ Old habits die hard. > + (let ((cur-mark-active mark-active)) > + (setf mark-active saved-mark-active) > + ;; If mark is active now, and either was not active or was at a > + ;; different place, run the activate hook. > + (if saved-mark-active > + (unless (eq omark nmark) > + (run-hooks 'activate-mark-hook)) IIUC activate-mark-hook should also be run when (eq omark nmark) but cur-mark-active was nil. Stefan