From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pietru@caramail.com Newsgroups: gmane.emacs.help Subject: Re: Optional Arguments Date: Mon, 7 Dec 2020 19:13:06 +0100 Message-ID: References: <20201207130630.GA10719@tuxteam.de> <20201207153847.GB15617@tuxteam.de> 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="4075"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 07 19:21:49 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 1kmL8u-0000ub-I6 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Dec 2020 19:21:48 +0100 Original-Received: from localhost ([::1]:55040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmL8t-0003mh-5z for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Dec 2020 13:21:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmL0d-0000DR-K0 for help-gnu-emacs@gnu.org; Mon, 07 Dec 2020 13:13:15 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:38583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmL0b-00062e-JU for help-gnu-emacs@gnu.org; Mon, 07 Dec 2020 13:13:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607364786; bh=lQG/1DqC8GtCs9TjvO8Fx8XYe63RJYtQIQBz0X1z/jw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=cn4Lp9Q3NOF8euc6RGtSQgkoVEsTe4G+r8QeSEQNqUBQJKG6Qr8/v+N4Jg0I4Dz8g sYXlptSGcTKt5A7AYjQuzBdzTHhqpwRwqByHyAg/fXXXIW4b9IoJ61nIpH4yFdJa2t LhahhdKAVaaDTJX9NJvpGWNBler3EQfzvXbJqbZU= 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-bs11.server.lan [172.19.170.179]) (via HTTP); Mon, 7 Dec 2020 19:13:06 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <20201207153847.GB15617@tuxteam.de> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:M22Dvsl9z0AdyZiIXKlHQH8C/gAn+Z2y/eQNtn5LvpX0j6HmNB+eUtGv1neipnoFfWisx yAKbV+j63pYfcfFeNjqF+42VpXNMyZuGtOvBvJDQGq+QrnJ10WvFb8MOgfLu9f3b8tuD35Ytz03m zdhlaASp1pPCvkIIajDlYNXUoWRKC22iB7Bi0z1Wtt4dqhHy5oUuhfsVr4ZKc41ySj2npNPdRA4z bixwo/4qEG91ZbE/ZXYZyqEQh59enaMb81T17hHpeaLy3RSFhFatpY/ImvjE7skqcpEHZV+283Su 5s= X-UI-Out-Filterresults: notjunk:1;V03:K0:wW0rRsPOmCU=:gAxCCop3pYfxs3wBlj9a9z utk4v8e5cvrepSa5eIFaKR7bmFFXPXV9QkuUn2vwohUJt1e0hdcz6JJFxStcQurs877ytIdhS RoJpesxSIOgC7W/G/rpUEzeiknM8zm2I6kLCtIY595tcf2mFtpV7LzET8400j1UyMfpn/J1mk qh1Bn4q2rUjIeKp6CbCWZUzg5SC9pVL7PPi/I7aRnGkQVC2534HWGJKOpyBwbTq87EZfAhJAm UA0Em6gG2nOurhRU5tYtwQUe97rLIKHMgbz7laLjSsv2x77RyYv+h8ICoR+XCVXQkasW+HJbJ vfyGsHSUbO8ziFeb5OsHYDJgXREefe+XI87BAU5qq5zLtH06P8YmAubBIO9TK3ujAcPn+AiEJ n0xKs1+iZ6jDqigd+m2WJ0Lz2szmmWHh+kl7D+Eti9/r7h+mZxfqnSBVJz1qXA5crx6+T+lVQ 8P1+LD+W2qICPJiuMdTKqr6Hi4kXAUXUHdKVc0MtclV4oG1B9JAwc9kgHI343SsaZW/SkVyXa Dh22KuOlZKWKqY4hMmcdi7Q6nbPYgSgZWi8e+nUhOE2N92CTbiv3lOvPbCSORAcx/B1nZaxZz ZSKX3HkioLwBI= Received-SPF: pass client-ip=212.227.15.18; envelope-from=pietru@caramail.com; helo=mout.gmx.net 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:126159 Archived-At: I'm having a go at returning the two values from a function (defun word-markers () (let ((ma mb)) (skip-chars-backward "[:alpha:]") (setq ma (point)) (skip-chars-forward "[:alpha:]") (setq mb (point)) (cons ma mb) )) (defun test () (interactive) (let ((deactivate-mark nil) bounds $ma $mb) (if (use-region-p) (setq $ma (region-beginning) $mb (region-end)) (save-excursion (setq bounds (word-markers)) (setq $mu (car bounds)) (setq $mv (car bounds)) )) (message "Bounds: %s" $bounds) (message "Region: [%s, %s]" $ma $mb) )) But something's not right=2E > Sent: Monday, December 07, 2020 at 4:38 PM > From: tomas@tuxteam=2Ede > To: pietru@caramail=2Ecom > Cc: "Help Gnu Emacs" > Subject: Re: Optional Arguments > > On Mon, Dec 07, 2020 at 03:24:36PM +0100, pietru@caramail=2Ecom wrote: >=20 > [=2E=2E=2E] >=20 > > > =3D> "ma: 15 mb: 26" > >=20 > > Hmmm=2E Variables local to function=2E >=20 > Yes=2E "Local" meaning here either dynamical extent (called functions > "see" the variables up the call chain, think Unix shells) or > lexical extent (code contexts "see" the variables of enclosing > code contexts (think C or Java or=2E=2E=2E), depending on whether you > chose lexical binding [1]=2E >=20 > [=2E=2E=2E] >=20 > > > =2E=2E=2Ewould you expect it to change the number 15 to whatever the= word's > > > beginning position is? You would mess up maths with that :) > >=20 > > Yes, it would mess up=2E >=20 > G=C3=B6del's nothing against that :-D >=20 > Cheers >=20 > [1] Cf=2E Chapter "Lexical Binding" in the Elisp manual, or here > https://www=2Egnu=2Eorg/software/emacs/manual/html_node/elisp/Lexica= l-Binding=2Ehtml >=20 > - t >