I am reviewing the code in `org.el`, and I am wondering that the indentation is somehow not correct. Marking a function and hitting TAB will re-indent correctly.
Here's the original code (example) from `org.el`:
(defun org-hide-drawer-all ()
"Fold all drawers in the current buffer."
(save-excursion
(goto-char (point-min))
(while (re-search-forward org-drawer-regexp nil t)
(let* ((pair (get-char-property-and-overlay (line-beginning-position)
'invisible))
(o (cdr-safe pair)))
(if (overlayp o) (goto-char (overlay-end o)) ;invisible drawer
(pcase (get-char-property-and-overlay (point) 'invisible)
(`(outline . ,o) (goto-char (overlay-end o))) ;already folded
(_
(let* ((drawer (org-element-at-point))
(type (org-element-type drawer)))
(when (memq type '(drawer property-drawer))
(org-hide-drawer-toggle t nil drawer)
;; Make sure to skip drawer entirely or we might flag it
;; another time when matching its ending line with
;; `org-drawer-regexp'.
(goto-char (org-element-property :end drawer)))))))))))
Look at the "let\*" expression for instance.
Here is the same code correctly indented via TAB:
(defun org-hide-drawer-all ()
"Fold all drawers in the current buffer."
(save-excursion
(goto-char (point-min))
(while (re-search-forward org-drawer-regexp nil t)
(let* ((pair (get-char-property-and-overlay (line-beginning-position)
'invisible))
(o (cdr-safe pair)))
(if (overlayp o) (goto-char (overlay-end o)) ;invisible drawer
(pcase (get-char-property-and-overlay (point) 'invisible)
(`(outline . ,o) (goto-char (overlay-end o))) ;already folded
(_
(let* ((drawer (org-element-at-point))
(type (org-element-type drawer)))
(when (memq type '(drawer property-drawer))
(org-hide-drawer-toggle t nil drawer)
;; Make sure to skip drawer entirely or we might flag it
;; another time when matching its ending line with
;; `org-drawer-regexp'.
(goto-char (org-element-property :end drawer)))))))))))
I am wondering why this is the case?
Don't get me wrong: I am very thankful for what the maintainers offer with orgmode, just wondering why they follow a different kind of indentation?
## Update
Ok, I get it. The original code has TABS and spaces mixed in the same file.
See attached screenshot. Tabs marked in green.
https://preview.redd.it/q2ka2wczvt191.png?width=669&format=png&auto=webp&s=e0b332d2318e4a6efdeff839e9dec392f663a9c5
​
​