I've tried

#define DEFUN(lsym, csym, amin, amax, doc, data) \
  bind_function (env, lsym, env->make_function(env, amin, amax, csym, doc, data))

DEFUN("libgit2-core-status", Flibgit2_status, 1, 1, \
  "\\(fn PATH) libgit2 status test return branch \\(fn PATH)", NULL);

but I still get this for C-h f libgit2-core-status:

libgit2-core-status is a Lisp function.

(libgit2-core-status &rest ARGS)

\(fn PATH) libgit2 status test return branch \(fn PATH)
  • I think you should drop the backslashes. – npostavs Oct 15 '16 at 19:43
  • @npostavs That just gives libgit2 status test return branch (fn PATH) – Sean Allred Oct 15 '16 at 20:55
  • Oh, and also put a newline (inside the string) before the (fn PATH) part. – npostavs Oct 16 '16 at 4:44
  • @npostavs Two newlines did the trick! Care to write that up as an answer? – Sean Allred Oct 16 '16 at 12:06

The use of (fn ARGS) syntax is described in (elisp) Function Documentation:

   The last line of the documentation string can specify calling
conventions different from the actual function arguments.  Write text
like this:

     \(fn ARGLIST)

following a blank line, at the beginning of the line, with no newline
following it inside the documentation string.  (The `\' is used to
avoid confusing the Emacs motion commands.)  The calling convention
specified in this way appears in help messages in place of the one
derived from the actual arguments of the function.

The backslash is a single backslash in a string literal, not a doubled one to produce an actual backslash in the string value.

Since you are writing in C, where string literals must stop at the end of line, you have to use something like "The function description...\n\n(fn ARGLIST)". Since the opening parenthesis doesn't occur in the first column, there's no need to escape it with a backslash (although you can if you want).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.