Anders Johansson writes:
> When looking through the code in org-fold-core (while debugging a tricky
> problem that seems to be an interaction with org-modern, I may get back to
> it) I noticed that all the macros that wrap a “body” argument have (indent
> 1), but I gather that they should have (indent 0), similar to for example
> `with-silent-modifications`.
Thanks for the heads up! This was just a blind kill-yank from a macro
with extra arg.
> I didn’t want to create a patch, since it would involve whitespace changes
> on quite a lot of places, but I thought it could be good to highlight now
> that org-fold just got merged.
Still, it needs to be done.
Attaching the patch with fixed indent statements and reindented code.
Best,
Ihor
>From 6412cc974afa3a4701a784f331b7182278ba5bef Mon Sep 17 00:00:00 2001
Message-Id: <6412cc974afa3a4701a784f331b7182278ba5bef.1651895053.git.yanta...@gmail.com>
From: Ihor Radchenko
Date: Sat, 7 May 2022 11:34:10 +0800
Subject: [PATCH] Fix macro indentation and re-indent code misindented by
nameless
* lisp/org-fold-core.el (org-fold-core-cycle-over-indirect-buffers):
(org-fold-core-ignore-modifications):
(org-fold-core-ignore-fragility-checks):
* lisp/org-macs.el (org-element-with-disabled-cache): Fix incorrect
indentation declare statement. Body-only macros should use (indent 0)
to avoid indenting first line differently from other body.
* lisp/org-capture.el:
* lisp/org-clock.el:
* lisp/org-fold-core.el:
* lisp/org-fold.el:
* lisp/org-id.el:
* lisp/org-list.el:
* lisp/org-macs.el:
* lisp/org.el: Reindent.
Reported in https://orgmode.org/list/cakjdto_z4lbgek3suc6-a_z0-ddd6l26_yfmypztn7f92ux...@mail.gmail.com
---
lisp/org-capture.el | 2 +-
lisp/org-clock.el | 58 ++--
lisp/org-element.el | 458 +++-
lisp/org-fold-core.el | 140 -
lisp/org-fold.el | 91 +++---
lisp/org-id.el| 48 +--
lisp/org-list.el | 90 +++---
lisp/org-macs.el | 2 +-
lisp/org.el | 688 +-
9 files changed, 812 insertions(+), 765 deletions(-)
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 068e3eda2..5ca4e1f2f 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1174,7 +1174,7 @@ (defun org-capture-place-entry ()
(t (goto-char (point-max))
;; Make sure that last point is not folded.
(org-fold-core-cycle-over-indirect-buffers
-(org-fold-region (max 1 (1- (point-max))) (point-max) nil
+ (org-fold-region (max 1 (1- (point-max))) (point-max) nil
(let ((origin (point)))
(unless (bolp) (insert "\n"))
(org-capture-empty-lines-before)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index ec87aaf8a..e2c2688e1 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1582,8 +1582,8 @@ (defun org-clock-find-position (find-unclosed)
(cond
((null positions)
(org-fold-core-ignore-modifications
- ;; Skip planning line and property drawer, if any.
- (org-end-of-meta-data)
+ ;; Skip planning line and property drawer, if any.
+ (org-end-of-meta-data)
(unless (bolp) (insert-and-inherit "\n"))
;; Create a new drawer if necessary.
(when (and org-clock-into-drawer
@@ -1607,28 +1607,28 @@ (defun org-clock-find-position (find-unclosed)
;; Skip planning line and property drawer, if any.
(org-end-of-meta-data)
(org-fold-core-ignore-modifications
- (let ((beg (point)))
- (insert-and-inherit
- (mapconcat
- (lambda (p)
- (save-excursion
- (goto-char p)
- (org-trim (delete-and-extract-region
- (save-excursion (skip-chars-backward " \r\t\n")
- (line-beginning-position 2))
- (line-beginning-position 2)
- positions "\n")
- "\n:END:\n")
- (let ((end (point-marker)))
- (goto-char beg)
- (save-excursion (insert-and-inherit ":" drawer ":\n"))
- (org-fold-region (line-end-position) (1- end) t 'outline)
- (org-indent-region (point) end)
- (forward-line)
- (unless org-log-states-order-reversed
- (goto-char end)
- (beginning-of-line -1))
- (set-marker end nil)
+ (let ((beg (point)))
+ (insert-and-inherit
+ (mapconcat
+ (lambda (p)
+ (save-excursion
+ (goto-char p)
+ (org-trim (delete-and-extract-region
+ (save-excursion (skip-chars-backward " \r\t\n")
+ (line-beginning-position 2))
+ (line-beginning-position 2)
+ positions "\n")
+ "\n:END:\n")
+ (let ((end (point-marker)))
+ (goto-char beg)
+ (save-excursion (insert-and-inherit ":" drawer ":\n"))
+ (org-fold-region (line-end-position) (1- end) t 'outline)
+ (org-indent-region (point) end)
+ (forward-line)
+ (unless org-log-states-order-reversed
+ (goto-char end)