From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: [External] : How to get all paragraphs in list? Date: Wed, 7 Sep 2022 20:05:32 +0700 Message-ID: References: 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="19624"; mail-complaints-to="usenet@ciao.gmane.io" To: Drew Adams , Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 07 15:08:05 2022 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 1oVumi-0004kO-Sn for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 07 Sep 2022 15:08:04 +0200 Original-Received: from localhost ([::1]:36402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVumh-0003K5-RX for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 07 Sep 2022 09:08:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVukY-0002gL-Do for help-gnu-emacs@gnu.org; Wed, 07 Sep 2022 09:05:50 -0400 Original-Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:34634) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVukV-0001kl-L2 for help-gnu-emacs@gnu.org; Wed, 07 Sep 2022 09:05:48 -0400 Original-Received: by mail-wr1-x429.google.com with SMTP id d2so3208126wrn.1 for ; Wed, 07 Sep 2022 06:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=qt4CNMM/dxmBnTKod4GLxvySa6XFw/Y6iJwcuzoIqpY=; b=cUZPpLb7yXbYuUG4J2UwR34cIul9if2oIU0cipgQS2fhXK/5EiEWR8RAhG+xjx81lu X69rrkZWQ256vZ1TDDldMHVaOHoY4Q3LePuWAJK0If3Z1pulxrLYLPJL5AUQt8Xqn6Wa jfo0qGXWS4Wh973roCaluNhPN+ogWo4J0Vg8XDf7fS0lDe2Vdh08zCSBooQQvLxOZTW6 F/SnYEOwYf7HEifLoDZE/1kvHEopSEsJmzNiXz8Bd1XT7LTqQYSY7uMAkYylC9LP8C4t YHjfJrNXqZADF27afo+K7kc3reg5t/CUg9+nznF5hHJ1Z7PS1mqYVy1znodzW4njK9S4 NBCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=qt4CNMM/dxmBnTKod4GLxvySa6XFw/Y6iJwcuzoIqpY=; b=kQ3+2M6lskEwFLFjWHewtKzMQ6wenE9rQEVZYLvWGXXVLeBytLsmsR8wwqqiVOqvw8 lGMKcWmyyVJhDb8hgfBr8cGwtHh7a4nlm9QKmINxnxMw7ADlGPeb5Ahvyer5AaqZkzZW /DgzPZADfYnEZwCg7rN8NypibqcYH+um33zu/f6M/cOpP+PHIRTjqho9iC2S+zJ529hC oBrM6BdNsqoD/colVvg96yWDONQArw3SBhhfiTLUbIQH11v7cC0j5nn+FPtviUm2tI84 3JKuBk+1MkVnOxq4O6bS/3pKH3v5nm4VwYb3g5XwvhfqbyKHrcwKH6sEJCpn324odo0E KL6Q== X-Gm-Message-State: ACgBeo2Itr+jz+2/SQ/mDYprMTZchj1rB3kLGOSv3S/CR0F2R5acTXtu BIykfi0O9aTYJCCIHcqX/qhvdtnSpklO7/Xsi45bu6BeHXY= X-Google-Smtp-Source: AA6agR4fdUoXOyaMv+SGcFX6EGZ+atBG5ou9cIwFFmTmjg2D83JJpkGyBhoXkglRrwtx4xVo5b9OXAzd7+gaQwGPnDU= X-Received: by 2002:a05:6000:4005:b0:225:8b27:e6d5 with SMTP id cy5-20020a056000400500b002258b27e6d5mr2067257wrb.603.1662555945273; Wed, 07 Sep 2022 06:05:45 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=yurivkhan@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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" Xref: news.gmane.io gmane.emacs.help:139297 Archived-At: On Wed, 7 Sept 2022 at 13:06, Jean Louis wrote: > (while (< (point) end) > (funcall function) > (forward-paragraph))))) This loop is fragile: if FUNCTION moves point backward in the buffer, it may loop infinitely, or if it moves forward, it may skip some paragraphs. I=E2=80=99d maybe wrap the funcall in a save-excursion. More to the point[sic], you calculate and cache the END position as an integer. So if your FUNCTION reduces the length of the buffer text, you may never reach END. Should probably place a marker there, or check for (region-end) or (point-max) every time.