Subject: bug#17685: 24.3.91.1; help-C-file-name failes to create temp buffer " *DOC*"

From: Stefan Guath <[email-masked]>
Date: Wed, 4 Jun 2014 10:47:44 +0200

VERSION:
GNU Emacs 24.3.91.1 (x86_64-apple-darwin13.2.0, NS apple-appkit-1265.20) of 2014-05-23 on angelofdeaths-MacBook-Air.local

TO REPRODUCE BUG:
emacs -Q
(find-lisp-object-file-name 'visible-bell 'defvar) ;visible-bell is just an example and can be replaced with any variable.

RESULT:
C-source

EXPECTED RESULT:
"src/dispnew.c"
Note that I've compiled Emacs from source, and the source files are available. This is also proved by the work-around below.

WORK-AROUND:
emacs -Q
(get-buffer-create " *DOC*") ;That's a crazy line...
(find-lisp-object-file-name 'visible-bell 'defvar) ;...but now it suddenly works!

If you manually kill buffer " *DOC*", it stops working again.

GUESS OF SOLUTION:
According to help-fns.el, find-lisp-object-file-name calls help-C-file-name that in turn tries to create a temp buffer " *DOC*". Maybe this buffer creation somehow fails? It seems like it, since the bug disappears if we create the buffer in advance, and comes back when we manually delete the buffer. Or maybe there is some other error in help-C-file-name or even in get-buffer-create that manifests itself in this strange way?