From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cPeSGfA6HmFvigAAgWs5BA (envelope-from ) for ; Thu, 19 Aug 2021 13:05:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id UOhhFfA6HmFdFgAAB5/wlQ (envelope-from ) for ; Thu, 19 Aug 2021 11:05:20 +0000 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 9840A153BB for ; Thu, 19 Aug 2021 13:05:19 +0200 (CEST) Received: from localhost ([::1]:38442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGfrJ-0004L4-Tz for larch@yhetil.org; Thu, 19 Aug 2021 07:05:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGfqG-0003ps-Cr for emacs-orgmode@gnu.org; Thu, 19 Aug 2021 07:04:12 -0400 Received: from mout02.posteo.de ([185.67.36.66]:54097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGfqC-0003LE-KT for emacs-orgmode@gnu.org; Thu, 19 Aug 2021 07:04:12 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 5B98E240103 for ; Thu, 19 Aug 2021 13:04:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1629371043; bh=a5bOXnOru37VXFHjOEWgRUvN8sq7zAdq2Cr2UfdKVSM=; h=From:To:Subject:Date:From; b=k/TDhPMNM0zdnrJxucNk4VXd1DrA5ux203c4ZstyPKeu9ux9Tu+Ioz9LiWpKJVBSM tpQoqYQJD/0h9HcJFN5q9rPFRYgtDlrAS9Qt9JiJxSYhyoPRc4mXmXHZvCHqxkRWqT N8LNXgH66/XOXSD2ONHuOPO1qN5zmGS1EdEM7CJcaJpX1l34m1HvDAEvUXwCDSf0Av YPI4kZjJCAGNAFh1cztv45GsEtNnu1rAKqUXdhi3gawDTfdX8ObZb7zYvV2VdZ89+s NpYlbjJ0QmAZcpamW+t7AExXJgnxY8MFbvLofRLuFR/eA7EegEHthPU7elcBhG6S2A NL1wa5kBzyy8g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Gr22V4dphz9rxN for ; Thu, 19 Aug 2021 13:04:02 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Search in descriptive plain lists Date: Thu, 19 Aug 2021 11:04:01 +0000 Message-ID: <87bl5tzof2.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: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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.23 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629371120; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=R7OD6jfD3bDkZbUtH+TG2ZNFb3Ggp9SuFyYwLyrsXjQ=; b=W26+0lBUyXZ0nmoA2kiyQq4hx6k5cohTFeBifK7J4n8eAPhnh2bLv5kVuCh60vR/dX3zi1 44wRS2cNrdtTXr95h/bOBfNMW+eQDDarieS+uFKLVz3bm6eIMEUvKIqoxuG7bX2ny0XtDe XgRJT4RconNcbFg/+2tOWA8l2rTttWBbqdSAobUk6AYg9b59weqgK69RCaREvMMZ6Z/2ii FQmMc7LV/jCcebBwDvaGQJFgH2yIHCNAEvpFVK3lckiT/i1dMlwxuC27Wv27+ptxe7ctaB vAMAaPuK8bxV9NuMI2n/em3wn11lb4qN7w3orYWH6jhkEI8XUjyXFsFG6xn6aA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629371120; a=rsa-sha256; cv=none; b=dzquSw8tvw+mVDJslQ3casVklzOVWETUKcwRv9oa19ZrJAeV0MRM0kgMZuSeejue9GbPrS 34CQPoJpeRWitO+nQIm0N50lyX5ssicwnfJh502Bc1lxZg4eu8kv/Bc94sn89vY4AM47vW z6e1/P/L3A7Knch+S4OOtirfRHryVFPzEjpexdIWb0UYnGq2grTyC1YuZdIg2HH378yXh7 dGUPBC+7sUctkj5dyFcO3iWgZyK5zEcFg9sCXg4ADBquBudYz+5R0sKJDD+b+nZ/ctdp59 hkzCVj+4uVwdlhasATo4o4Bq5MW9Pj/c6M5UiLF6vrWn9KOwd1/k6hGFPxi9LQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="k/TDhPMN"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="k/TDhPMN"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 9840A153BB X-Spam-Score: -3.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: tZ869creagBV Hi all, For my translation (work in progress) of Homer's Odyssey I am writing a long descriptive plain list which is a glossary of Homeric formulas (in Homer a 'formula' is a passage that is repeated exactly the same, or with slight variations, throughout the work: a very typical resource of traditional poems). This glossary helps me remember how I have translated a certain formula before. But it was a bit awkward for me having to query the list every time so I wrote a function which returns as a message the item searched after writing or marking a few words. I have redone a bit the code to give it a more general use, and I share it here, in case someone found useful or perhaps would like to improve it. The idea is to search in descriptive lists within sections containing the tag :makealist: (one list per section). And has more sense when the descriptive lists work as a kind of glossary. #+begin_src emacs-lisp (setq my-org/desc-plainlist-alist nil) (defun my-org/search-desc-plainlist () (interactive) (org-map-entries (lambda () (save-restriction (org-narrow-to-subtree) (when (re-search-forward "^- " nil t) (beginning-of-line) (mapc (lambda (el) (add-to-list 'my-org/desc-plainlist-alist el)) (cdr (org-list-to-lisp)))))) "makealist") (let ((element-re (if (region-active-p) (buffer-substring-no-properties (region-beginning) (region-end)) (read-from-minibuffer "Search in descriptive lists: ")))) (setq my-org/desc-plainlist-candidate (assoc-if (lambda (x) (string-match-p element-re x)) my-org/desc-plainlist-alist)) (message (mapconcat 'identity my-org/desc-plainlist-candidate "")))) #+end_src Best regards, Juan Manuel