I asked in a prior question about what might be causing my emacsclient widows to shutdown immediately with the following output on stderr: "ERROR: Beginning of buffer". I have tried to use bug-hunter to bisect my init file, but the error is happening sporadically, so that bore no fruit.

I decided to ask the hopefully simpler question: how can I get the debugger to trigger to show me what's hapenning.

I know that, even with the debugger on, it normally ignores beggining-of-buffer errors. So I wrote the following function to change that and toggle on the debugger:

(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))

I then attempted to run this by adding it to several hooks, including this one:

(add-hook 'before-make-frame-hook #'ded:bugon)

Others I tried were:

(add-hook 'server-after-make-frame-hook #'ded:bugon)
(add-hook 'window-setup-hook #'ded:bugon)
(add-hook 'focus-in-hook #'ded:bugon)
(add-hook 'find-file-hook #'ded:bugon)

None of these triggered the debugger, much to my frustration. I also tried running strace on the emacsclient invocation, and the part immediately before the error was this:

write(1, "Waiting for Emacs...", 20)    = 20
recvfrom(3, "-emacs-pid 2923799\n", 8192, 0, NULL, NULL) = 19
recvfrom(3, "-emacs-pid 2923799\n", 8192, 0, NULL, NULL) = 19
recvfrom(3, 0x7ffd5cfb9d00, 8192, 0, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = -1 EINTR (Interrupted system call)
kill(2923799, SIGWINCH)                 = 0
recvfrom(3, "-error Beginning&_of&_buffer", 8192, 0, NULL, NULL) = 28
write(1, "\n", 1)                       = 1
write(2, "*ERROR*: Beginning of buffer", 28*ERROR*: Beginning of buffer) = 28
ioctl(1, TIOCGPGRP, [3565004])          = 0
getpgrp()                               = 3565004
write(1, "\n", 1)                       = 1
close(3)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

Anybody out there have an idea of what else to try?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.