Useful or not, from you.
beginend Going to the beginning of an Org buffer fails if there is any text before the first heading

In Org buffers M-< seems to only work if the buffer starts with a *. When it fails it does so with the message:

Invalid function: org-with-limited-levels

It fails for (1) an empty Org buffer, (2) a buffer containing just a, (3) a buffer that has * a as the second line after an empty first line, (4) a buffer with, say a title:

#+TITLE: a

* b

I think it might be due to the declaration (declare-function org-with-limited-levels "org-macs"). My theory is that that tells the byte compiler to emit a function call sequence for org-with-limited-levels, but since it's actually a macro and not a function, this causes the invalid function error.

It seems that simply commenting out the declaration fixes the problem and causes no warning from the byte-compiler, but I'm not sure if that's the right fix.

That's a useful answer
Without any help


I'm commenting on this because I want to note that for me, on Windows 10 and Emacs 27.2, the (setf (point) (point-min)) idiom doesn't work. I get an error:

beginend-org-mode-goto-beginning: Symbol’s function definition is void: \(setf\ point\)

Changing the definition to (goto-char (point-min)) fixes the issue.

Let me know if I need to open a fresh issue for this.