org-delete-indentation: Fix Emacs 26 compatibility

* lisp/org.el (org-delete-indentation): `delete-indentation' in Emacs
26 does not yet accept region boundaries.  Provide compatibility
fallback.
This commit is contained in:
Ihor Radchenko 2023-08-06 10:22:18 +03:00
parent 4ea9a98f85
commit da8fabf464
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 24 additions and 2 deletions

View File

@ -17841,7 +17841,19 @@ ignoring region."
string)
(goto-char beg)
;; Join all but headline.
(save-excursion (save-match-data (delete-indentation nil (line-beginning-position 2) end)))
(save-excursion
(save-match-data
(if (version<= "27" emacs-version)
(delete-indentation nil (line-beginning-position 2) end)
;; FIXME: Emacs 26. `delete-indentation' does not yet
;; accept BEG/END arguments.
(save-restriction
(narrow-to-region beg end)
(goto-char beg)
(forward-line 2)
(while (< (point) (point-max))
(delete-indentation)
(forward-line 1))))))
(setq string (org-trim (delete-and-extract-region (line-end-position) (line-end-position 2))))
(goto-char (or (match-end 4)
(match-beginning 5)
@ -17853,7 +17865,17 @@ ignoring region."
((not tags-column)) ;no tags
(org-auto-align-tags (org-align-tags))
(t (org--align-tags-here tags-column)))) ;preserve tags column
(funcall-interactively #'delete-indentation arg beg end)))
(if (version<= "27" emacs-version)
(funcall-interactively #'delete-indentation arg beg end)
;; FIXME: Emacs 26. `delete-indentation' does not yet
;; accept BEG/END arguments.
(save-restriction
(narrow-to-region beg end)
(goto-char beg)
(forward-line 1)
(while (< (point) (point-max))
(delete-indentation)
(forward-line 1))))))
(defun org-open-line (n)
"Insert a new row in tables, call `open-line' elsewhere.