From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione 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 15:37:47 -0700 Message-ID: <5547F4BB.1080804@dancol.org> References: <20150504184829.1108.13525@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SOWixxr549T1CLcNF7tuVV9aDuUudWSCT" X-Trace: ger.gmane.org 1430779095 16559 80.91.229.3 (4 May 2015 22:38:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 May 2015 22:38:15 +0000 (UTC) To: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 05 00:38:05 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 1YpP01-0001RY-JK for ged-emacs-devel@m.gmane.org; Tue, 05 May 2015 00:38:05 +0200 Original-Received: from localhost ([::1]:36210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpP00-0006zc-T8 for ged-emacs-devel@m.gmane.org; Mon, 04 May 2015 18:38:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpOzw-0006zH-TZ for emacs-devel@gnu.org; Mon, 04 May 2015 18:38:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpOzw-0000tY-0f for emacs-devel@gnu.org; Mon, 04 May 2015 18:38:00 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:41184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpOzv-0000i8-NG for emacs-devel@gnu.org; Mon, 04 May 2015 18:37:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:References:Subject:To:MIME-Version:From:Date:Message-ID; bh=zRzZtR0/47ci8znY/1hlWYJjKvAzkDA/ZitcElj+46I=; b=PKXXvsmuBc+zYbqG5tTXBP7cvHnw9zwZOAeu8uYQkvCPOjghvM1/LpXUxHQ2rTUJGb0HvL+VSMe3aVncW7nue5OFSPMjBXFyIpneDFkxXBM0SGtIGQ9m1+PYNRyn6y/ZoEzf/RgOJ4QUnVdy8LxhVtQY+07JIK1f7Z2iF51I4dy4Rqsc8tIThAW4PCT3Qd5NxQxTp2oBJErz/uDpm8PIeWafocf4Djf48WNLem1O2CQF88FH0wMKiEudkEXXb8DaJriudGqtyXk+Age4u1xMXz8BDVymDpzHI0m72xm9Fdezk03WV+z8qD2cdEwnE5TK1N1y8ni9/gaOeXHAOg9MNA==; Original-Received: from [2620:10d:c082:1054:2ab2:bdff:fe1c:db58] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1YpOzp-00009P-JK; Mon, 04 May 2015 15:37:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 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:186212 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --SOWixxr549T1CLcNF7tuVV9aDuUudWSCT Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 05/04/2015 03:16 PM, Stefan Monnier wrote: >> + (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. It is always a marker, isn't it? Some other parts of simple.el assume it always returns non-nil. I'll remove the nil check. >> + (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. Huh. I just mechanically translated the original save-excursion C code. Doesn't that code have the same mismatch between the comment and the behavior? /* If mark is active now, and either was not active or was at a different place, run the activate hook. */ tem =3D XSAVE_OBJECT (info, 3); // saved-mark-active ... if (! NILP (tem)) { if (! EQ (omark, nmark)) run_hook (intern ("activate-mark-hook")); } /* If mark has ceased to be active, run deactivate hook. */ else if (! NILP (tem1)) run_hook (intern ("deactivate-mark-hook")); I'll change the code to match the comment. --SOWixxr549T1CLcNF7tuVV9aDuUudWSCT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJVR/S7AAoJEN4WImmbpWBlTBUP/1Eh+y0lhlbVOCG1mOQCW4tu IgtslkSfnW7O3C13NNE1hUBnX5h/SWavmvPonSRLLXxf0r6alF7xwx3GER1C3wOs X5ltGiCJrpVAX0HqLt1OpUNs0g+CvCE3oIUt6SHSL252RXModA9vp+f4NfJnHfxR kLIm+N6KrjJhs7CpzaGMy5lHOOubBpDLSTxyDn1BYNKwZYEFLr5JYXk3QO6b2cIY iR2Zfwn/L2InddILNhTWwVDWZviA6G3kIb6kW8IhAZHhJBtb95apYFaPNtWUO+Tv X7tBQ5cog1MI45UvqHBcyAE/xXceG66ViMHBky4jQCe2cXHGVpj37uNXvVjPZeVz ykizpHQ+pG5lJFQD18QMPLpqwSW04xRuBpiTOywReG18HqoCBqPnh5Xk0qm30BEo zFKP/dJO6OuI7G+4TRMp//XDhZvH0pHz9AWH6eqwaqb80TokR/fjaWeRkk9xIj/Y OQq0pDEtb+BLXoteHG9TOncrNZN89g/gnDms6Y2M/z1AnB4+o06jHVP0IQv8GRTQ N/oWWEXqooMggYCqVOBZrutq0HZD2NrSt1evUG/JjMegvcp6UgyINrSflAPxHyoo E2fbgYNU1c2+ZMKAgKzWTCbFFZKwI7VGnQDC/tetJ2lJlmAuM11iRdXNZcxmCJMF o7l59CEi8px7hKulBg+o =BeGw -----END PGP SIGNATURE----- --SOWixxr549T1CLcNF7tuVV9aDuUudWSCT--