When calling org-sort-entries
on an outline item, I get the error
Region to sort contains a level above the first entry
with no indication of what or where the problem is.
What does this error mean, and how do you fix it?
Take an example like this, with a TAB before the 'd' - if you call org-sort-entries
on the 'a', you'll get the error - the '*[TAB]d' seems to confuse the function.
* a
** c
* d
** b
You can do a regexp search through the file to find problems like this, e.g. put this at the top of your file and hit C-x C-e
after it (eval-last-sexp
):
(re-search-forward "^[*]+[\t]")
(void-function find-regexp)
. Am I missing something or is this function not part of emacs? If the latter one please provide the function. Besides that, I find the whole issue rediculous. Why is org-mode not more robust? Either skipping the error or point to the problem line, so it can be fixed manually.
Commented
Jan 13, 2019 at 20:35
re-search-forward
- was trying to make things easier to remember and discover. But yes, maybe there's something we could do to patch org-mode for this error...
Commented
Jan 15, 2019 at 8:26
Lisp error: (search-failed "^[*]+[\11]")
. What should be done to fix the problem in that case ?
Simplified: Org thinks that your file has several top-level entries. As written above, this can happen if you have an org-file like
* task 1
** subtask 1
* task 2
** subtask 3