Function: documentation-property

documentation-property is a function defined in doc.c.

Signature

(documentation-property SYMBOL PROP &optional RAW)

Documentation

Return the documentation string that is SYMBOL's PROP property.

Third argument RAW omitted or nil means pass the result through substitute-command-keys if it is a string.

This differs from get in that it can refer to strings stored in the etc/DOC file; and that it evaluates documentation properties that aren't strings.

View in manual

Probably introduced at or before Emacs version 18.

Source Code

// Defined in /usr/src/emacs/src/doc.c
{
  bool try_reload = true;
  Lisp_Object tem;

 documentation_property:

  tem = Fget (symbol, prop);

  /* If we don't have any documentation for this symbol (and we're asking for
     the variable documentation), try to see whether it's an indirect variable
     and get the documentation from there instead. */
  if (EQ (prop, Qvariable_documentation)
      && NILP (tem))
    {
      Lisp_Object indirect = Findirect_variable (symbol);
      if (!NILP (indirect))
	tem = Fget (indirect, prop);
    }

  if (BASE_EQ (tem, make_fixnum (0)))
    tem = Qnil;

  /* See if we want to look for the string in the DOC file. */
  if (FIXNUMP (tem) || (CONSP (tem) && FIXNUMP (XCDR (tem))))
    {
      Lisp_Object doc = tem;
      tem = get_doc_string (tem, 0, 0);
      if (NILP (tem) && try_reload)
	{
	  /* The file is newer, we need to reset the pointers.  */
	  try_reload = reread_doc_file (Fcar_safe (doc));
	  if (try_reload)
	    {
	      try_reload = false;
	      goto documentation_property;
	    }
	}
    }
  else if (!STRINGP (tem))
    /* Feval protects its argument.  */
    tem = Feval (tem, Qnil);

  if (NILP (raw) && STRINGP (tem))
    tem = call1 (Qsubstitute_command_keys, tem);
  return tem;
}