From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nikolay Kudryavtsev Newsgroups: gmane.emacs.help Subject: =?UTF-8?Q?Re=3A_the_=C2=ABinverse=C2=BB_function_of_join-lines?= Date: Thu, 23 Nov 2023 18:50:06 +0300 Message-ID: <68695a9c-367e-4dc4-b687-6db750dfc066@gmail.com> References: <87zg08pe1q.fsf@mat.ucm.es> <87sf602uwq.fsf@vagabond.tim-landscheidt.de> <874jigozch.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5916"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 23 16:50:59 2023 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 1r6Byk-0001Mn-8g for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Nov 2023 16:50:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6By2-0004kW-ND; Thu, 23 Nov 2023 10:50: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 1r6By1-0004kO-CU for help-gnu-emacs@gnu.org; Thu, 23 Nov 2023 10:50:13 -0500 Original-Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r6Bxz-0000VY-Ez for help-gnu-emacs@gnu.org; Thu, 23 Nov 2023 10:50:13 -0500 Original-Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50aab0ca90aso1385462e87.0 for ; Thu, 23 Nov 2023 07:50:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700754607; x=1701359407; darn=gnu.org; h=in-reply-to:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:from:to:cc:subject:date :message-id:reply-to; bh=RaxS/1h+J585KNY7zHIl5OBavBM5wZ3SkKzupTqckkA=; b=FGLdzCWql28iXSERJ6uN0NGNrq69Ijpw+0WhvLbr2styojt/fDRa/yRyMWuYFIe7pZ 7iOsBzc1jYeoB/hH3BRZiJaDriS+AmUzGtI4v0a/q7fOwacNgnsELlcRAltyCYkRM42s pf49EbxVL+weInLmJZG8vgAIK/GxLOyAeOs1TQj/sIHYD1eKRjOUbqpE2X784SJRd3JL dqnR2UU43UQLw44owWGbAtZvk5GFR2n8x3b39CYCKe8xQd5rLKLDSu+WIYOaw2hQrV9a 70aEE3dcKPjYW34hMTSZ+BBsG3RnyECPJHmh/oajU+wCH1h6jbQ0juvKEXhobxjxm3iO HfIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700754607; x=1701359407; h=in-reply-to:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RaxS/1h+J585KNY7zHIl5OBavBM5wZ3SkKzupTqckkA=; b=Grpotlp65qPQkBcMXfjJz2QAlGk1JiQ+qGucj+zBFIXc3QZicgSmZoV7+fL3t1Ye3l VzZr6wKlG8qFMUKa/gswmYhskWCH5aH7xb5v/qrXZ32IklbAnuTmN7qzKqXR8R82eytp 5DaCSuURXDAM9eySbKTq0zDTY4Uk+lq8RTWmkjlMoJF5U+O9MfSaFJtBoPZmd33x6LNV /KxlzflT7meLaFqb5O3yurLljW+Kuc5o65Rwp9nBFzz0tEvm71A+3FsULd77HrsVttzF 3/yrmlBGk10xYDQ+6Iru2AhwF4aR4G6qrMViAjanrUzO07YP6zeHFQmZyNlF6Lbdj29f +UfQ== X-Gm-Message-State: AOJu0Yy/2ss5IDzelzfN6Wst3t+7rqRyJeEmWQWKejwdIFuQJG4fiDaC 99DlAfwut6flQUxZJ/0C1itRtzdry4gooG76 X-Google-Smtp-Source: AGHT+IG9MYR78syt7t/542eJeonH9MxnHEd41rz0UBWZY5AdGPAsiGhgi31jbUphkaVZ3N69824mAQ== X-Received: by 2002:ac2:43a5:0:b0:509:8fb3:8937 with SMTP id t5-20020ac243a5000000b005098fb38937mr3739155lfl.42.1700754607165; Thu, 23 Nov 2023 07:50:07 -0800 (PST) Original-Received: from ?IPV6:2a02:2168:b215:9000:5f14:1526:3bf:f056? ([2a02:2168:b215:9000:5f14:1526:3bf:f056]) by smtp.gmail.com with ESMTPSA id r4-20020a19ac44000000b00503f39e6bcesm231293lfc.95.2023.11.23.07.50.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Nov 2023 07:50:06 -0800 (PST) X-Google-Original-From: Nikolay Kudryavtsev Content-Language: ru, en-US In-Reply-To: <874jigozch.fsf@mat.ucm.es> Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=nikolay.kudryavtsev@gmail.com; helo=mail-lf1-x131.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, HTML_MESSAGE=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-Content-Filtered-By: Mailman/MimeDel 2.1.29 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:145564 Archived-At: Weirdly I have not found unfill-paragraph-or-region anywhere in the org mode. But there are different unfill paragraph\region functions on EmacsWiki. None of them had the advanced functionality I was looking for, so I hacked up a better one for myself: (defun unfill-region (beg end)   (interactive "*r")   (replace-regexp-in-region    "\\([^\.\\!\\?:]\\)\n\s*\\([^-\\*[:digit:][:upper:]\s]+\\)"                 "\\1 \\2" beg end)) This works just about perfectly, since it checks both sides of the line break, before removing it. You know, there's the famous quote by H. L. Mencken that "For every complex problem there is an /answer/ that is clear, /simple/ and wrong." I guess what's also true is that for every complex problem there's a simple and incomprehensible regular expression solution. Me starting to like regexps nowadays also probably means that, I'll end up in a mental asylum soon enough. ;-) P.S. I don't really understand why do I have to put \s into the second group, but without explicitly doing that it just keeps eating whitespace from the first \s. I guess, sometimes the less you know, the longer you live.