I have an app where I call emacsclient to do some editing on an org file. When it calls it, the frame flashes for an instant, then closes immediately. On stderr, I get the following message:

*ERROR*: Beginning of buffer

Apparently, something is trying to move the cursor up when it is at the beginning of the buffer, signals an error, then closes the frame. I am trying to figure out what is doing this. My first thought was that it was the "find-file-hook" or the "org-mode-hook" but even after setting these nil, I get the same behaviour. Setting 'debug-on-error' does not produce a stack trace.

Any suggestions for how to diagnose this?

Additional Information

I tried getting the debugger to come up by evaluating the following elisp inside the host emacs:

;; Setup diagnosis of errors from emacsclient
(defun ded:bugon ()
  ;; Remove the normal value of beginning-of-buffer from list
  (setq debug-ignored-errors
        '(beginning-of-line end-of-line end-of-buffer
                            end-of-file buffer-read-only
                            file-supersession mark-inactive
  (setq debug-on-error t))

No success: the debugger does not get triggered. Also, per @NickD, I ran the command from the shell and got the same problem, except that once in every 20-30 attempts, it works. Really puzzled.

Per @NickD, here is the command being called:

$ emacsclient -a='' -c /home/ded/byr/tmp/registertransacts20220125-185348-smeoi7.org
Waiting for Emacs...

*ERROR*: Beginning of buffer

Of course, the temporary file name changes, but it always follows that pattern.

  • Can you reproduce the problem doing the emacsclient <whatever> by hand at a shell?
    – NickD
    Jan 24 at 16:33
  • Yes. It happens when I execute the same command from the shell. Jan 25 at 8:10
  • Weird. What does the command look like? Can you show an example?
    – NickD
    Jan 26 at 5:33
  • 1
    @NickD, I added the command being called to the question. So much easier than formatting a comment. Also, I should clarify, the intermittent working happens from both the command line and when called from the program. Jan 26 at 9:27
  • 1
    @NickD, all files report no problems with org-lint. They are all org-tables with a #+NAME: property at the top. When I set the hooks you nentioned to nil, it still happened, as well as with any other hooks I couls think of. You may be right, I may just have to try to bisect my init to see what's going on. Thanks for looking at this. Jan 27 at 22:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.