From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cMGDHeXeT2POKwEAbAwnHQ (envelope-from ) for ; Wed, 19 Oct 2022 13:26:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id CNRgHeXeT2MvbgEAauVa8A (envelope-from ) for ; Wed, 19 Oct 2022 13:26:29 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9D16F1A301 for ; Wed, 19 Oct 2022 13:26:28 +0200 (CEST) Received: from localhost ([::1]:46870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ol7DP-0002E1-NK for larch@yhetil.org; Wed, 19 Oct 2022 07:26:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol7Bn-0002Be-8K for emacs-orgmode@gnu.org; Wed, 19 Oct 2022 07:24:47 -0400 Received: from mout02.posteo.de ([185.67.36.66]:55373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ol7Bi-0003nk-KC for emacs-orgmode@gnu.org; Wed, 19 Oct 2022 07:24:46 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 81164240105 for ; Wed, 19 Oct 2022 13:24:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1666178680; bh=jSmb0FKnVQpXaMQDxMdLybA/WFGm2udXBszw1EX8i5Y=; h=From:To:Cc:Subject:Date:From; b=Df5GNpIlF/UDF6y+7RFiJOlSNq5dss0JevxS1dAoodVljVPaEMdkM2ZHiHWDGD63X pHYoC8HZd2JDy/7AOGMQJYLssTxXnNolQYRN+44wvbAST5+tRoMzF00KV8JS/wt7qL CAmVC3UEfIAORCO8OLaoE1WVh7G/AWvbfwy36yKojFdQRRTpTaJ8cHiPMF2RJ7om7a yQpg7rspvF/5wmRj74H1b3PaVh+493hjV1bXKcRkCcNXMixPjQiba+37YJ3TV69fbB cnXOe7XrnBERkLib3duThBYkUAvQdhcPJrLpcvO4Wb43kX3P09e0BzCMs7A3zxzaMZ uJMeSJq4WnN7g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MspKg6Dzbz9rxf; Wed, 19 Oct 2022 13:24:38 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: Verse block and separations References: <875ygk6a8z.fsf@posteo.net> <87h703iv8t.fsf_-_@posteo.net> <7d0019ad-cf64-3e76-c52a-1ccb4edfd1b2@gmail.com> Date: Wed, 19 Oct 2022 11:24:35 +0000 In-Reply-To: <7d0019ad-cf64-3e76-c52a-1ccb4edfd1b2@gmail.com> (Max Nikulin's message of "Wed, 19 Oct 2022 18:08:32 +0700") Message-ID: <87r0z4ys24.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de 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, RCVD_IN_DNSWL_NONE=-0.0001, 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: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666178789; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=4FS/5RjALBizQfnfGz38Vz+ZO7ZjzKt5ytYktXdswlU=; b=iJJzVTg9JczR9KmxiGwifA41DzlCuIJIfNB9FPvPMnAwUgW/CdNdc4wX2DLY1J/P12Fhvy +5wEAc7SrPoFJQ0Zj4tLcJCkGXwB+43gGgxxlFihxz7SLREtZpA7DQOCvV6n7CsW8wQ645 yeGNJHT96h2IQsFuxQoZXohovf2Bk8j3QjNKstHF7+P0I9fw+1k/uaPN4oWe+CXhhNRNBD VqaPCpx5ibdBk0wmx5bboNVuLs6HdwYLMA2WFZ/9yBmJe7juMdj/b+rkiGwMEBkvVaFEdC FNvbyI3xCqRLzEYsLiA79f+CW172jsIpOBAYiNEGs5d0s8CNdsT5A5zoisLa4g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666178789; a=rsa-sha256; cv=none; b=VEBfEHD9sdiJ42ikhHE1TZEnI8lAExjB8Q22yZLhfr7a73KnLERKO8bmnrkAyeC20Tt2qS RbXZYv88yiRWCltxMIryIOTt9PSlJf8iIHX4ZoLWyJi3XUmYm/5XIGxNwC7BWN/L06sPzj OC0cIyobGKPnhlYnrMoITVulP0O0Kkmo3TioySeRO5VyII4iqZYOHXdkO/vuZhd2sjZt/o uzoFk2P91WSjqn0wmcyQNHhOcmfHUGn+5x0N/5m3TvhYpZPkNIksk1zoO5cEc5U1Nao6Wp 5CS0g40m1p9kMWGtn4hobFhaJGC5WSTnboNzTEvvq76qV/ZDXTWT3Z+Nx45NWw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Df5GNpIl; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.43 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Df5GNpIl; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9D16F1A301 X-Spam-Score: -2.43 X-Migadu-Scanner: scn1.migadu.com X-TUID: hBQJYlbcVNm+ Max Nikulin writes: > I still prefer to avoid replacement of latex newlines back to empty > string. Though I am really happy with the following code, I expected a > more concise snippet. Unit tests may found bugs in it. > > (let ((contents "\n\n 0 \n\n\na b\nc d e \n\n\nf g \n h i\n\n")) > ;; Strip leading newlines. > (setq contents > (replace-regexp-in-string > (rx string-start (1+ (0+ blank) ?\n)) "" > contents 'fixed-case 'literal)) > ;; Add explicit line breaks and strip trailing spaces. > (setq contents > (replace-regexp-in-string > (rx (0+ blank) ?\n > (optional (group (1+ (0+ blank) ?\n))) > (optional (group (0+ blank) (not (any blank ?\n))))) > (lambda (m) > (let ((par (match-string 1 m)) > (next (match-string 2 m))) > (if next > (concat (if par "\n\n" "\\\\\n") > next) > ""))) > contents 'fixed-case 'literal)) > ;; Indented lines. > (replace-regexp-in-string > (rx line-start (1+ blank)) > (lambda (m) (format "\\hspace*{%dem}" (length m))) > contents 'fixed-case 'literal)) > > Feel free to use it for inspiration during your work on a patch. OK, thanks a lot. (BTW, I have yet to reply to some interesting things you mention in this thread about the verse environment).