From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 QDfqAsO0xWJsFAAAbAwnHQ (envelope-from ) for ; Wed, 06 Jul 2022 18:13:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id EATfAsO0xWIZUwAA9RJhRA (envelope-from ) for ; Wed, 06 Jul 2022 18:13:55 +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 12C972D17A for ; Wed, 6 Jul 2022 18:13:53 +0200 (CEST) Received: from localhost ([::1]:44422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o97ey-0003Fm-3N for larch@yhetil.org; Wed, 06 Jul 2022 12:13:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o97e7-0003Fb-NI for emacs-orgmode@gnu.org; Wed, 06 Jul 2022 12:12:59 -0400 Received: from mail.mojserwer.eu ([195.110.48.8]:54328) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o97e5-00013a-E5 for emacs-orgmode@gnu.org; Wed, 06 Jul 2022 12:12:59 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 3C150E729C; Wed, 6 Jul 2022 18:12:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qwKojMjRRCks; Wed, 6 Jul 2022 18:12:46 +0200 (CEST) Received: from localhost (79.163.182.32.ipv4.supernova.orange.pl [79.163.182.32]) by mail.mojserwer.eu (Postfix) with ESMTPSA id D08FBE65CA; Wed, 6 Jul 2022 18:12:45 +0200 (CEST) References: <87h73up918.fsf@mat.ucm.es> User-agent: mu4e 1.1.0; emacs 29.0.50 From: Marcin Borkowski To: Kaushal Modi Cc: emacs-org list Subject: Re: how to convert a non-org list to org headings In-reply-to: Date: Wed, 06 Jul 2022 18:12:45 +0200 Message-ID: <877d4qb4oy.fsf@mbork.pl> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=195.110.48.8; envelope-from=mbork@mbork.pl; helo=mail.mojserwer.eu 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: 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-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1657124034; 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; bh=GY+XoK798dft6XbLVza5MPPOLaPLFRLNlYEddUFnBe0=; b=ctfRb5QW8behBGU6/ocCl+rY6scSYokt3wh2CKCnyioPIU8WYUE/rhtaUajUgOSorgDVes 3Tu1msKVsYgzYJJBdeu/m6vHtNQDQFqbjiSo+4gEvbggMckJEeJJEXMO3to3roghaMXZHg heK1aqzMSu0x6eKu3z5IwdFCRcYgmzPLilDQqNs7y+7rIIbi6cy6DkZ+D8+6gM6RnzlbKV JfpEFoAb6siKyUbZKwuY51oi6LRPonpYL/XTdObjB92RZzU7387k1pK1BN7aw6y/EJKPLj xxrlv7cg8Ngwx23kIm5UDK1RzQWqSuwnsTceQgN30uZ+NzOwZo2XLRdeqXdoAg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657124034; a=rsa-sha256; cv=none; b=SAKug5aAGEGUk1la+BUOzd8JYGoZsCT2RkYgLQuydMcHvXxRw60ENLHvwuSq+5IGvNk53/ Lwh8YgnVhfSqvCN6hQhD/KVQkjNbZB95shMDHjNgulMScf4p4HFHAl1/bVfprSDOzn8nP3 oQmLB332yfUsmT81drnH5IBuDJiE2Jz4n4cCWXAWSB9qczbNIbzJaaXYamfJO1ofcqXL4w 64t8h0DyLfe/xle6f2BzZDC8ANo8DbyTLGxbFec1dIuZ5qjDZEFcjzBoQ1V5k2zKEOzL7u vqxG6Cttk/eSa08Iwg9YLLW6corKEFXHpKYVQ+cyFn6m9g+9lPr6Ujvlv4pHVQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; 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: -3.35 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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: 12C972D17A X-Spam-Score: -3.35 X-Migadu-Scanner: scn0.migadu.com X-TUID: f2UE+3xjMsoL On 2022-07-06, at 17:31, Kaushal Modi wrote: > On Wed, Jul 6, 2022 at 11:17 AM Uwe Brauer wrote: > >> Hi >> >> I have a file that contains a list as: >> >> >> 1.1 Funciones de una variable No period after "1.1" above - makes things slightly more difficult. > The method that I show below is quick but not robust. You'll need to review > all the replacements. > > - Do query-replace-regexp [default binding: C-M-%] > - Search for [0-9]+\. > - Replace with * This might be a bit overzealous if there are more numbers with a period after them. Another way would be to add ^\(\**\) at the beginning of the regex (and a \1 in the replacement) and go through the file as many times as there are nesting levels. You could also try Elisp as the replacement - see https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Replace.html, https://www.masteringemacs.org/article/evaluating-lisp-forms-regular-expressions and http://mbork.pl/2013-09-18_Selective_replacement_in_LaTeX_documents_(en) . You could probably use keyboard macros, too - see e.g. http://mbork.pl/2021-02-20_Using_keyboard_macros_to_emulate_query_replace . Hth, -- Marcin Borkowski http://mbork.pl