emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: orgmode <emacs-orgmode@gnu.org>
Subject: Search in descriptive plain lists
Date: Thu, 19 Aug 2021 11:04:01 +0000	[thread overview]
Message-ID: <87bl5tzof2.fsf@posteo.net> (raw)

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

#+begin_src emacs-lisp
  (setq my-org/desc-plainlist-alist nil)
  (defun my-org/search-desc-plainlist ()
     (lambda ()
	     (re-search-forward "^- " nil t)
	   (mapc (lambda (el)
		   (add-to-list 'my-org/desc-plainlist-alist el))
		 (cdr (org-list-to-lisp))))))
    (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
	     (lambda (x)
	       (string-match-p element-re x))
       (mapconcat 'identity
		  my-org/desc-plainlist-candidate ""))))

Best regards,

Juan Manuel 

                 reply	other threads:[~2021-08-19 11:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bl5tzof2.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).