[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: |
Juan Manuel Macías |
Subject: |
Re: [Patch] to correctly sort the items with emphasis marks in a list |
Date: |
Sun, 18 Apr 2021 21:20:32 +0000 |
Juan Manuel Macías writes:
> It seems that what I was proposing as a patch at the beginning is not,
> finally, a viable solution for all contexts...
>
> The problem is that, if the first space is removed, we get this
> abnormal result:
>
> #+begin_src emacs-lisp
> (org-sort-remove-invisible "- lo /bueno/")
> #+end_src
>
> #+RESULTS:
> : - lobueno
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):
@@ -2940,10 +2940,20 @@ function is being called interactively."
(org-sort-remove-invisible
(buffer-substring (match-end 0) (point-at-eol)))))
((= dcst ?a)
- (funcall case-func
- (org-sort-remove-invisible
- (buffer-substring
- (match-end 0) (point-at-eol)))))
+ (if (save-excursion
+ (beginning-of-line)
+ (forward-char)
+ (looking-at-p org-emph-re))
+ (replace-regexp-in-string
+ "\\(^\\)\s+" "\\1"
+ (funcall case-func
+ (org-sort-remove-invisible
+ (buffer-substring
+ (match-end 0) (point-at-eol)))))
+ (funcall case-func
+ (org-sort-remove-invisible
+ (buffer-substring
+ (match-end 0) (point-at-eol))))))
((= dcst ?t)
(cond
;; If it is a timer list, convert timer to seconds
- Re: [Patch] to correctly sort the items with emphasis marks in a list, (continued)
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/14
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/15
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/15
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/16
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/16
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/17
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Juan Manuel Macías, 2021/04/18
- Re: [Patch] to correctly sort the items with emphasis marks in a list,
Juan Manuel Macías <=
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Greg Minshall, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Tom Gillespie, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Greg Minshall, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Nicolas Goaziou, 2021/04/19
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/20
- Re: [Patch] to correctly sort the items with emphasis marks in a list, Maxim Nikulin, 2021/04/20