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?
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 user-error)) (setq debug-on-error t)) (ded:bugon)
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.