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 22:21:22 +0100 Message-ID: References: <20201207130630.GA10719@tuxteam.de> <20201207153847.GB15617@tuxteam.de> <87y2i9e6j3.fsf@web.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="2256"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , help-gnu-emacs@gnu.org To: Arthur Miller Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 07 22:26:13 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 1kmO1N-0000Tz-3c for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Dec 2020 22:26:13 +0100 Original-Received: from localhost ([::1]:60838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmO1K-0003Ps-PK for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 07 Dec 2020 16:26:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmNwn-0003OL-Ai for help-gnu-emacs@gnu.org; Mon, 07 Dec 2020 16:21:29 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:40231) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmNwl-0002OA-2n for help-gnu-emacs@gnu.org; Mon, 07 Dec 2020 16:21:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607376082; bh=oaNkdBbtXYuG3bzwgugt4k2CJYxGybOJrrIot9BC7gM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Hy5k5c72LMPiFULMbr/uNF2X9odCy46bu9/+nESaVBnn8L/ePa3doKZf4/5i5psQi W0FUDfjUpxkC1zfQCFKFIGN7ANE9dpSgUvXB9KrUniV6kXLd6j2n8Qit5COh9FR4fR LGoI4PDoqhxWcYYRa5MPAsgJfjndovytYX/7extA= 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-bs08.server.lan [172.19.170.176]) (via HTTP); Mon, 7 Dec 2020 22:21:22 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:hLoKmy1WBPq3IVSCASH76dKL8YWYKdH1rr8gOq2gNtomuEN8q6xIhc6MZFyN/OO/MS3dx toP5AD3uAeh97b9Kjr6OlsC1/nYJ41VjfgsUZJSl/XpHDcQkxzCxejq1miQNTNZKfT8ZJTHaidAo irWLzYlMWqxOU2sWUR3JYq1ql/iFeVQly/uGwsXnGclX0H6zd301xWiyQdOdgts8qgj/mz1MobkC rGojBhvOkpITeN7pWPjMgbEPJtJOhGW3+54dasGiCfJKSp0zIEWN+dTsIyTQ8QEolvh12LQtv9G1 AE= X-UI-Out-Filterresults: notjunk:1;V03:K0:n8n9pEx0/g0=:ssfi7a2fPYAxfVAOXii9ag oEBy/xcQClLVxqTVdf2n50tKsc+zQ6fsbKhxXT4cZGka0kdJFgwyQB5mGMDsu5FXzLp1CWwUg HPx1bHmMNwShLSmIVVR7D6kWrMzFtXTujUSynxv2xTWq5cZyeQJpC7LSfqbmR6Yz8ZHLJDWT/ WAD9ufIhV+j83csTeL7Rd5/IsvQLUGenQSUCYrDBx/Melh1xftKc53XaCE8psuZO6FWYTN6qU GtNxEQwawM+iV80CHmX2dCqO8DqSzAZ1ZbUHHMJPK+Qd0giMhpZU/u3q6V8hfAaFmz5bAJ9Cb I0qQzRzs7BhSBak+CshdSvFPsddNU8mCFI34AJt7j0XcuaxX3xtqp6V7gHHsNfqtAxIWBDHl9 sA7iGVu+aA//ZlcAsfdc3SmueFcBddA5QIH4JRbP8kWUDCy3B3rQDnGlK+X8glWmnBAqlrdci F2UfVpqCVhUuE3djQze5FYuYDjSbS/gqu5J7VvEdJ75eWOeu24keAM5HN4AK4J1o3oaxCWfa6 WA3bjsH0+dC/4GDZ1SiVLMHFajS7LQXL69xM7VqhIYPMh02xsO5SGo1KqRkqx8e6EPUQyYOyf RFjh12NZWvfkk= Received-SPF: pass client-ip=212.227.15.19; 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:126175 Archived-At: > Sent: Monday, December 07, 2020 at 9:52 PM > From: "Arthur Miller" > To: "Michael Heerdegen" > Cc: help-gnu-emacs@gnu.org > Subject: Re: Optional Arguments > > Michael Heerdegen writes: > > > pietru@caramail.com writes: > > > >> Am getting an error with the following. > >> > >> (defun word-markers () > >> (let ((ma mb)) <-- I see it now, the parenthesis was assigning to ma other than nil. Thank you so very much. > > You bind `ma' to the value of `mb'. That's not what you want. > Exactly; this is what I had in my scratch when I tested: I just didn't > copy everything in previous answer: > > (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 ma (car bounds)) > (setq mb (cdr bounds)))) > (message "Bounds: %s" (pp bounds)) > (message "Region: [%s %s]" ma mb) > (message "Region-string: [%s]" (buffer-substring-no-properties ma mb)= ))) > > (test) > > Tou should drop one parenthesis around ma and mb in your let > expression. That will declare two variables and initialize them to nil b= oth. > >