From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alin Soare Newsgroups: gmane.emacs.devel Subject: please help concerning specpdl Date: Sat, 4 Dec 2010 07:33:50 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00151750df04f18d8f04968effdc X-Trace: dough.gmane.org 1291440844 12235 80.91.229.12 (4 Dec 2010 05:34:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 4 Dec 2010 05:34:04 +0000 (UTC) To: Emacs Dev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 04 06:34:00 2010 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 1POkkx-0005yw-Lp for ged-emacs-devel@m.gmane.org; Sat, 04 Dec 2010 06:33:59 +0100 Original-Received: from localhost ([127.0.0.1]:51415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POkkw-0006qi-NN for ged-emacs-devel@m.gmane.org; Sat, 04 Dec 2010 00:33:58 -0500 Original-Received: from [140.186.70.92] (port=40212 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POkkq-0006ni-Rl for emacs-devel@gnu.org; Sat, 04 Dec 2010 00:33:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POkkp-0000JS-VA for emacs-devel@gnu.org; Sat, 04 Dec 2010 00:33:52 -0500 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:47485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POkkp-0000Iq-SW for emacs-devel@gnu.org; Sat, 04 Dec 2010 00:33:51 -0500 Original-Received: by gyg10 with SMTP id 10so19845364gyg.0 for ; Fri, 03 Dec 2010 21:33:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=5t+JJPFDdvxpREUAjGLmgXiDMLIJ7dB2qTtwVpYsHw8=; b=Mh8l2jywq5tF6mHG7jw7sNE4SgOaOZ9FGWpUV3x8IaCcjxrOat3RNe9aJjgL2qBUY6 ATK3/eTs8sSSV7NtiTZgJFZ9s/IS40ITYxr1bw03Om4/96+NqQFHS6QK/VyWg2Nv0czM nJIAWLWa49DozoYGav/UN9PHYQrpJ31YzNvOM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=WDyu1X86i3Hx+xB/3vURlt7/e/gSpLBoZ/7vw+QZYskppCqFMzPNw/uIVdzBow5cfH xx2ybiKdqK5Xm1OileedG8msj7u0MyRoLKMIXtRoYmfY7AwBtY7FJKxh+KcdKaOFACy2 igFHXO7L9UNqACyvxZy2fsZe8eg1XRbuwxKPE= Original-Received: by 10.151.146.16 with SMTP id y16mr5173364ybn.331.1291440830385; Fri, 03 Dec 2010 21:33:50 -0800 (PST) Original-Received: by 10.150.95.21 with HTTP; Fri, 3 Dec 2010 21:33:50 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:133393 Archived-At: --00151750df04f18d8f04968effdc Content-Type: text/plain; charset=UTF-8 Many functions in emacs contain the sequence { count = SPECPDL_INDEX (); record_unwind_protect val = Fprogn (args); return unbind_to (count, val); } like the function attached below, Can you explain me the logic of specpdl please ? DEFUN ("save-current-buffer", Fsave_current_buffer, Ssave_current_buffer, 0, UNEVALLED, 0, .... (Lisp_Object args) { Lisp_Object val; int count = SPECPDL_INDEX (); record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); val = Fprogn (args); return unbind_to (count, val); } --00151750df04f18d8f04968effdc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Many functions in emacs contain the sequence
{
count =3D SPECPDL= _INDEX ();
record_unwind_protect
val =3D Fprogn (args);
return unb= ind_to (count, val);
}


like the=C2=A0 function attached below= ,

Can you explain me the logic of specpdl please ?



DEFUN (&quo= t;save-current-buffer", Fsave_current_buffer, Ssave_current_buffer, 0,= UNEVALLED, 0,
....
=C2=A0 (Lisp_Object args)
{
=C2=A0 Lisp_Obj= ect val;
=C2=A0 int count =3D SPECPDL_INDEX ();

=C2=A0 record_unwind_protect = (set_buffer_if_live, Fcurrent_buffer ());

=C2=A0 val =3D Fprogn (arg= s);
=C2=A0 return unbind_to (count, val);
}



--00151750df04f18d8f04968effdc--