From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Bj=C3=B6rn?= Bidar Newsgroups: gmane.emacs.help Subject: Re: [External] : Exiting from mapc Date: Wed, 01 Jan 2025 21:40:04 +0200 Message-ID: <38521.53879577$1735760439@news.gmane.org> References: <7cSjmNb9wbuuXOPxnBml1e6cPaldn8EPTGZ2LZdnm-ZjIANwQBYOYq9a-nJDcaCG8QKkb09TGeUjlQ6vLFyFVzOPZfJniDINxCNXT1TW6vQ=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33586"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Heime , Heime via Users list for the GNU Emacs text editor To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 01 20:40:31 2025 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 1tT4Zy-0008ZL-NB for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 01 Jan 2025 20:40:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tT4Zi-0000zl-6L; Wed, 01 Jan 2025 14:40:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tT4Zg-0000zc-PX for help-gnu-emacs@gnu.org; Wed, 01 Jan 2025 14:40:13 -0500 Original-Received: from thaodan.de ([2a03:4000:4f:f15::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tT4Zd-0006b3-RA for help-gnu-emacs@gnu.org; Wed, 01 Jan 2025 14:40:12 -0500 Original-Received: from odin (dsl-trebng12-50dc7b-49.dhcp.inet.fi [80.220.123.49]) by thaodan.de (Postfix) with ESMTPSA id E125AD00051; Wed, 1 Jan 2025 21:40:05 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1735760406; bh=Pq6SoSrMIiNjCfoNdnX7xkYeHn+zlYEsPMizayfJRr0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=HuI3Jr0K4LlvjGMZ8tkDF6pYMYqwRUoRZcxNM/oufTst4EuGIazJfdvLTpl68Qs/0 Sx4z5i1W1GeLcvMxk5aPmhlPklC1QdVcUONNJ2nKxaVinKLfZL/lf57OanEXSaoZvz KeWz/mzcvo0outujJsFXu4m1aYBBfntyfeTIAfqaERu7KS7TKRNpIyr4U9g3ZtCiOn WyP4AgqxzUkx8RaFLafe4TsvTJ8oixQZ6waMtsMpetHOhHjV3dmqshBYZ3kZJ/cSGS Ms3/mKxP0U2i3wnVZvaYksrZXNkNIMUq75fCyERPBV1ONxqG8slPHfCjVjxzQJKIj3 cAPU/jl3of76iTzxBjOSiAUWveqUt7CCdrHt3HYifAcMDNH9tghJxcyoo6zioKDhTU A+e/KPASBor4BVsosHXa+9azADylUV1qFFJGh8cAAGPQEscgaVOptNg1jUI1n3V7ef KuJOdIDS1ZDUey6q5WQSaARBReaScQH/WgnTsYgoyxOvg9VOCiMjHEOHWUW1/Esd4j tAAY8Pvz2qImOGFWy5tD1AjZYrLCzDv6z1HVjZcXFtUMGGCOFV8jjk7DkR9rpndqnS zA48Xun1JosDgfC2ndCcmNmwaaJiW1BnTYJBuVQI5U6q3ZPgdvBkjOmYxVlTEj4YYj p28lNjshxC303cRN1Xx7MtRg= In-Reply-To: (Drew Adams's message of "Wed, 1 Jan 2025 02:02:44 +0000") Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlH Received-SPF: pass client-ip=2a03:4000:4f:f15::1; envelope-from=bjorn.bidar@thaodan.de; helo=thaodan.de X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, INVALID_MSGID=0.568, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:149093 Archived-At: Drew Adams writes: >> >> How can I exit when encountering 'safg or 'nogo >> > >> > As usual, wrap with a `catch', and `throw' to it whenever you like. >> >> Should dolist be better in this context anyway? > > Of course, but it doesn't answer his question. ;-) Sure I'm just saying this as an added comment. macp can be expensive unless you invoke a handler for function anyway or use a mapc style filter function such as seq-filter. > If a plain iteration, with no intermediate escape > to throw a value, is appropriate for what you want > to do, then by all means use it. > > IOW, don't go catching and throwing willy nilly. > Like `GO TO'. > > `dolist' and `mapc' etc. don't let you escape; > you must go through the whole list. Catch and > throw are available for when you need to get out > and return or do something directly, and not > waste time running down the rest of the list for > nothing. Another approach is to use second status variable when using while. Are there instances where a throw and catch does not work in while loop?