branch: externals/org
commit b2f9cb36ff2824faa48fe5ebe40a274abb047bfb
Author: Kenny Chen <[email protected]>
Commit: Ihor Radchenko <[email protected]>
org-macs.el: Construct `buffer-invisibility-spec' directly
* lisp/org-macs.el (org-string-width): Construct the
`buffer-invisibility-spec' with only one iteration.
---
lisp/org-macs.el | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index d8e6229b8d..9ae1437641 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1208,7 +1208,14 @@ STRING width. When REFERENCE-FACE is nil, `default'
face is used."
'(org-fold-drawer
org-fold-block
org-fold-outline))))
- (push el result)))
+ (push
+ ;; Consider ellipsis to have 0 width.
+ ;; It is what Emacs 28+ does, but we have
+ ;; to force it in earlier Emacs versions.
+ (if (and (consp el) (cdr el))
+ (list (car el))
+ el)
+ result)))
result)))
(current-char-property-alias-alist char-property-alias-alist))
(with-current-buffer (get-buffer-create " *Org string width*" t)
@@ -1216,16 +1223,7 @@ STRING width. When REFERENCE-FACE is nil, `default'
face is used."
(setq-local line-prefix nil)
(setq-local wrap-prefix nil)
(setq-local buffer-invisibility-spec
- (if (listp current-invisibility-spec)
- (mapcar (lambda (el)
- ;; Consider ellipsis to have 0 width.
- ;; It is what Emacs 28+ does, but we have
- ;; to force it in earlier Emacs versions.
- (if (and (consp el) (cdr el))
- (list (car el))
- el))
- current-invisibility-spec)
- current-invisibility-spec))
+ current-invisibility-spec)
(setq-local char-property-alias-alist
current-char-property-alias-alist)
(let (pixel-width symbol-width)