emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Patch] to correctly sort the items with emphasis marks in a list


From: Nicolas Goaziou
Subject: Re: [Patch] to correctly sort the items with emphasis marks in a list
Date: Mon, 19 Apr 2021 10:33:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hello,

Juan Manuel Macías <maciaschain@posteo.net> writes:

> I wonder if this other approach can be viable or if it is something
> crazy: if the spaces in org-sort-remove-invisible are a
> problem only for the first emphasis of each item, how about this
> fix to org-sort-list? (not modifying org-sort-remove-invisible):

I think `org-sort-remove-invisible' is wrong, so it is the one that
needs to be fixed.

Could you try the following instead?

--8<---------------cut here---------------start------------->8---
(defun org-sort-remove-invisible (s)
  "Remove invisible part of links and emphasis markers from string S."
  (let ((remove-markers
         (lambda (m)
           (concat (match-string 1 m)
                   (match-string 4 m)
                   (match-string 5 m)))))
    (remove-text-properties 0 (length s) org-rm-props s)
    (replace-regexp-in-string
     org-verbatim-re remove-markers
     (replace-regexp-in-string org-emph-re remove-markers 
(org-link-display-format s) t tt)
     t t)))
--8<---------------cut here---------------end--------------->8---

Regards,
--
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]