From 8a3777e35b3ccebb1d24d75f386f25f974c7c347 Mon Sep 17 00:00:00 2001 From: Bastien Date: Sat, 5 Sep 2020 07:59:27 +0200 Subject: [PATCH 1/2] org.el: Use `string-match-p' in two functions * lisp/org.el (org-remove-empty-overlays-at) (org-cycle-internal-global): Use `string-match-p' as match data are not used. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d92da78bb..5f41418ce 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5937,7 +5937,7 @@ and subscripts." "Remove outline overlays that do not contain non-white stuff." (dolist (o (overlays-at pos)) (and (eq 'outline (overlay-get o 'invisible)) - (not (string-match "\\S-" (buffer-substring (overlay-start o) + (not (string-match-p "\\S-" (buffer-substring (overlay-start o) (overlay-end o)))) (delete-overlay o)))) @@ -6352,7 +6352,7 @@ Use `\\[org-edit-special]' to edit table.el tables")) (defun org-cycle-internal-global () "Do the global cycling action." ;; Hack to avoid display of messages for .org attachments in Gnus - (let ((ga (string-match "\\*fontification" (buffer-name)))) + (let ((ga (string-match-p "\\*fontification" (buffer-name)))) (cond ((and (eq last-command this-command) (eq org-cycle-global-status 'overview)) From ee3c3b554799c9f0fbe387848cd9eec7e9ab9d95 Mon Sep 17 00:00:00 2001 From: Bastien Date: Sat, 5 Sep 2020 08:01:58 +0200 Subject: [PATCH 2/2] org.el: Allow empty subtrees to be folded back * lisp/org.el (org-cycle-internal-local): Allow empty subtrees to fold back. See Reported-by: Dmitrii Korobeinikov --- lisp/org.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 5f41418ce..4068a4149 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6433,8 +6433,7 @@ Use `\\[org-edit-special]' to edit table.el tables")) (goto-char eos) (outline-next-heading) (when (org-invisible-p) (org-flag-heading nil)))) - ((and (or (>= eol eos) - (not (string-match "\\S-" (buffer-substring eol eos)))) + ((and (>= eol eos) (or has-children (not (setq children-skipped org-cycle-skip-children-state-if-no-children))))