From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Executing part of the code instead of another Date: Wed, 7 Oct 2020 20:01:31 +0200 Message-ID: References: <87imbm3llg.fsf@ebih.ebihd> <87blhe3kxg.fsf@ebih.ebihd> <87pn5uvtaj.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30040"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Nick Dokos Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 07 20:03:31 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQDmk-0007i1-Gw for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 07 Oct 2020 20:03:30 +0200 Original-Received: from localhost ([::1]:57050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQDmj-0007Ob-Cx for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 07 Oct 2020 14:03:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQDkw-0007OL-1R for help-gnu-emacs@gnu.org; Wed, 07 Oct 2020 14:01:39 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:48159) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQDks-0004b7-81 for help-gnu-emacs@gnu.org; Wed, 07 Oct 2020 14:01:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602093691; bh=TlfPBLIfEE7Ya+Bnhu/wkutmPiN/2pddp21XoBgSit8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=KCxT7NZ209u+ky7COkgbSHKBPIrjwB2OAN45z6q5pcaGPlwkjV0C11UaZ3RXlNONa Q+gBrBM7DJgpA1UgAbbl5InYg7AzPbjQrteA/fniUN6sLyC4GUgUFNj96FAF/uuAjn wx4lZ3RKTNSg2LgZzPRiR7XpavQ7/c4ODDVkfY8c= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs01.server.lan [172.19.170.58]) (via HTTP); Wed, 7 Oct 2020 20:01:31 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <87pn5uvtaj.fsf@alphaville.usersys.redhat.com> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:jOOAxAEDs7rTyCDHKU7CqS/Pq7DWdj4BypZkaNmK4wBzqtPTQOe+Uq3TpKx5JNpi3ukY9 7YJsMw8CAAj58RIOSL7N3DglrzDRlDUVcUpDPJCjxM4BKlu9GVCdQ6BnVE+1gSESzdBUTKNbR4QF B+nUMKWZAbmxwl6PrFkO4ePj+XunyQPQ5FrfDMj8YfSeUc7DUdqzQ77KgVnJrugGoMpfgS3NAWFp zmePMAXmevFdEYhtkcFTi9CMiWZUtm2zsnZ5xkO5LI/2tIHZNnErbXx4NcBM85LP1YXga+56Bt92 Yo= X-UI-Out-Filterresults: notjunk:1;V03:K0:SaNZblo+jyM=:+LDQuGZlEPHkSACsxrswRR FiXfrJA1FP2DehTRbcd4DMoKDjDWXjZEHOP/8ts7i7aLuJyyI3wyAF5Pd6tXSoRt8C5lWyArZ EWkYZut5X7q7q3q2dRsL0rQO2hBUMtw+4aYR/Dd+/3ikZDcY+ZW1s4FgW4Zs50bc40ZsFaYj/ y10U62TXcwzFlZ7bZJd4cfJhFpXXZ3q3CD8zeHztCEaWKiJreWABvVVGjW9B1AFwbIvhvqQ9A XjBd+6S+B5MRSOGMT0GWbAYoeh6Lfi6OzJ3R6+KtSlQ4HqkHIYt+0p+zF8qoNP2ci8o0f2Jjh B61Tk1e3BMjM4DAJ8+IZU+u6P4wqCblHj1e6iM+vZKcYR9p++39veXCrvKMXbQgpFvoZyYtlU 1BOALGKzuaxQWK6qlDSQi7FA/epLRuMy1fbQwlduSyZj8yaClevpQi15p2miqUGssDyjuCra9 4GCEexz0HDrSO5RzpOWJM+WiFTyixT6wcMjGWQhGYHzOh1F1b5FIpA84L6RjoBKvIsgHf/6AI /rFvgzDPt1r4c9NEB5yGTjdoLBbIu6ifK3HLz/mr1XyeELpq6eFB/M4h+j5JMeQx6xLmWg1Jl fKrjKmCk5w1021twB99iG1Q0m+p6uF2h+iaOITkyvl/5/zCBd98zDRWb89/jHCLoo67L6Y/GY A+GqEFGrEhe71cifx972vkklut1DDOFI3OmE+lqsdMuwyjahYSOi77PhpovWxMDHLtJA= Received-SPF: pass client-ip=212.227.15.18; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/07 14:01:32 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124366 Archived-At: Noted Nick. Thank you. =2D-------------------- Christopher Dimech Chief Administrator - Naiad Informatics - GNU Project (Geocomputation) - Geophysical Simulation - Geological Subsurface Mapping - Disaster Preparedness and Mitigation - Natural Resource Exploration and Production - Free Software Advocacy > Sent: Wednesday, October 07, 2020 at 7:29 PM > From: "Nick Dokos" > To: help-gnu-emacs@gnu.org > Subject: Re: Executing part of the code instead of another > > Christopher Dimech writes: > > > I have tried executing the following condition (if (nb > na)) > > > > (setq na 2) > > (setq nb 5) > > ( if (> nb na) > > (message "nb > na [condition true]") > > (message "condition false") > > ) > > > > I highlighted the region then pressed C-x C-e > > It returned the first message as expected, but when I tried > > the next one, I still got the first message. > > > `C-x C-e` is bound to `eval-last-sexp` which evaluates the *last* > sexp: the if. It does not evaluate the setq's (setting the region does > *NOT* matter for it - try `M-x eval-region' for that) > > > > (setq na 2) > > (setq nb 1) > > ( if (> nb na) > > (message "nb > na [condition true]") > > (message "condition false") > > ) > > > > > > > > > >> Sent: Wednesday, October 07, 2020 at 9:20 AM > >> From: "Robert Pluim" > >> To: "Christopher Dimech" > >> Cc: moasenwood@zoho.eu, help-gnu-emacs@gnu.org > >> Subject: Re: Executing part of the code instead of another > >> > >> >>>>> On Wed, 7 Oct 2020 09:01:00 +0200, Christopher Dimech said: > >> > >> Christopher> What can one use if there is an else branch with mul= tiple commands, as I would > >> Christopher> like to use it. > >> > >> From 'C-h f if' > >> > >> if is a special form in `C source code'. > >> > >> (if COND THEN ELSE...) > >> > >> Probably introduced at or before Emacs version 1.1. > >> > >> If COND yields non-nil, do THEN, else do ELSE... > >> Returns the value of THEN or the value of the last of the ELSE's. > >> =3D> THEN must be one expression, but ELSE... can be zero or more ex= pressions. > >> If COND yields nil, and there are no ELSE's, the value is nil. > >> > >> > >> Robert > >> -- > >> > > > > > > -- > Nick > > "There are only two hard problems in computer science: cache > invalidation, naming things, and off-by-one errors." -Martin Fowler > > >