Variable: python-ffap-setup-code

python-ffap-setup-code is a customizable variable defined in python.el.gz.

Value

"\ndef __FFAP_get_module_path(objstr):\n    try:\n        import inspect\n        import os.path\n        # NameError exceptions are delayed until this point.\n        obj = eval(objstr)\n        module = inspect.getmodule(obj)\n        filename = module.__file__\n        ext = os.path.splitext(filename)[1]\n        if ext in ('.pyc', '.pyo'):\n            # Point to the source file.\n            filename = filename[:-1]\n        if os.path.exists(filename):\n            return filename\n        return ''\n    except:\n        return ''"

Documentation

Python code to get a module path.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
;;; FFAP

(defcustom python-ffap-setup-code
  "
def __FFAP_get_module_path(objstr):
    try:
        import inspect
        import os.path
        # NameError exceptions are delayed until this point.
        obj = eval(objstr)
        module = inspect.getmodule(obj)
        filename = module.__file__
        ext = os.path.splitext(filename)[1]
        if ext in ('.pyc', '.pyo'):
            # Point to the source file.
            filename = filename[:-1]
        if os.path.exists(filename):
            return filename
        return ''
    except:
        return ''"
  "Python code to get a module path."
  :type 'string)