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: bounds for strings with - between subwords Date: Fri, 7 May 2021 01:58:43 +0200 Message-ID: References: <871raj32ba.fsf@zoho.eu> <87h7jf1l7s.fsf@zoho.eu> 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="7459"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: moasenwood@zoho.eu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 07 01:59:10 2021 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 1lente-0001li-8Q for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 07 May 2021 01:59:10 +0200 Original-Received: from localhost ([::1]:35318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lentd-0006ic-8A for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 06 May 2021 19:59:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lentJ-0006iK-FT for help-gnu-emacs@gnu.org; Thu, 06 May 2021 19:58:49 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:54719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lentF-0000lL-LX for help-gnu-emacs@gnu.org; Thu, 06 May 2021 19:58:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620345523; bh=mkTVBNc82DHoYxQuX8LYKmHcxlMIbwzJmLyymudWNBI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=IAyA7QEdkZAjUPT+72feTa/QElf11n/D/YDnZsY/n9ZOmuy30Re1/g9Fv/iN/yz28 oG56Vi1kkxydt77ywOljyDbmJjy64y0TObihPq9fm/jmlDl3GHdEql4oUamBKQD9k5 98+XBVrWWIc4pw7CRoQea7e7rZGFOTCRPNtdO50g= 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-bs12.server.lan [172.19.170.180]) (via HTTP); Fri, 7 May 2021 01:58:43 +0200 Importance: normal Sensitivity: Normal In-Reply-To: <87h7jf1l7s.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:mTeq3VJPqSPVVj5LUt2AAa5onYoenuTzKmhrlX47x9VkJ8pVbDbbBllReGXcpYL+xGjPN KIGzxLIfoeRv2Biy8GWBsKMVorbKyoWV4vk84nW7e2Jh1UEtWcpYI1ctNhWovABzuLO7pFV0tykc 3QB4EUrdn+z/XuzRDPrgsmqD/HwPIuSwmov02f2kk0yuOv+wqOtpto4ouLAH/3b0pUnJckWnFiXT 79sywJIz3ZntY8olJJwR1IUW1RSzQZ+GmpZ0ruprMEGiNnNa7vuc3jUL3rXpNzOePPeW9qCXfV0+ E8= X-UI-Out-Filterresults: notjunk:1;V03:K0:DSOZqx7XPX4=:M5AHp5V9/zONdo9hQyfkBR bGcZ5GnCwUCW3hiuh4vGx+992IFa744h6H3oYa3clep2KNAfRgp4SDr+o8xvKCT0+2jE0PvBa FkXmInw1YPoa1fWyWRb3ohoIYwL+NCCNT3rNE1uvg1xW9XbGq/uFmn0aK8ftke1iUGtqAU03s st3eIwY8bUGxxJRYjj5Y4KSKSShgcqwcJOZ3vgSGJ92oUjeg6ZLjBwqqXJi/Ib1i6ZS4HOAbJ 8j+PkNMgZOjEV21jWySgN/id/PE4IzjRdKeN6aQLdLp90AjmWjlNUemYogkVLM9yMoEzQvC9N VnNkHagp2UDmt1SwKIMcgKs15jkwiIE2JQbuXjg6/R34pCQNvoWQ2MuO1p3VSU0CCfW5eoeny fNxVlTxa1TI/6E8KYZQZ9VkSbY0QNoo8U4pVJ3QW00MLEs5UnqWSZ/91FWk71xuhaN4YMLKQc ZjgceTxf2PXUxO7KjFjXNVInmET2sJ2C2uEoVc1fjmkU+1pDFKY5xvmzC7m+mke+rRe1hDVgy Sda0+rJtJITfpQToMtrgldx1cO9fhLH4UeE6Kj0RCGXoUXXQNO0sAjJacFSxWX4WQRquGEOKh phGNdoumJQrym3Y8mXUbM13MVidyQD1SLNfAY3piKSP6fIHNI8kXSsStDQb2ZOolL+udSfTZ8 y3zo1hWLIew/wmAkTPfVV+9jb3K1Z7PcsvTnGY+VCvnSBpIAQRFSZ0W+SvtjPDvuj36jYz9cP 1fbSeFNsItDuX9lchN2usYEzTfRe6Lj0MeQ8K0l0XlHfrRRoncv5Vxg64qdLznVnpFaqTBj7 Received-SPF: pass client-ip=212.227.15.18; envelope-from=dimech@gmx.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:129539 Archived-At: > Sent: Friday, May 07, 2021 at 11:44 AM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu.org > Subject: Re: bounds for strings with - between subwords > > Christopher Dimech wrote: > > >> > (defun alpha-bounds () > >> > "Gets bounds of a subword unit defined by regular expression [a-= zA-Z]." > >> > (let ( ($bounds nil) $ma $mb ) > >> > (skip-chars-backward "[:alpha:]") > >> > (setq $ma (point)) > >> > (skip-chars-forward "[:alpha:]") > >> > (setq $mb (point)) > >> > (setq $bounds (bounds-of-thing-at-point 'word)) > >> > (cons $ma $mb) )) > >> > >> You can put all that in the `let' to avoid the use of `setq'. > >> > >> Also $bounds doesn't seem to do anything? > > > > bounds are used in another function. You can see there is > > (cons $ma $mb) at the end, > > which is used as output when you call "alpha-bounds". > > $bounds still isn't used anywhere else and cannot be, either. You are right, the use of the function is merely to set $ma and $mb. The last $bounds can be removed. > >> And what's the purpose of the $? > > > > I use $ no tell me the variable is local and not being > > modified from outside. It is coming from the $1, $2, $3, ... > > function parameter idea. > > But they cannot be modified from the outside so no need to > worry about that. It is a question of readability, particularly for long functions so not to get confused when making changes or debugging. The function is very short as you say. It is simply a standard I put in anyway. > -- > underground experts united > https://dataswamp.org/~incal > > >