pyorg.interface module

class pyorg.interface.Org(emacs, orgdir=None, loader=None)[source]

Bases: object

Interface to org mode.

emacs
Type:pyorg.emacs.Emacs
orgdir

Directory org files are read from.

Type:pyorg.files.OrgDirectory
loader

Loader used to read .org file data.

Type:pyorg.files.OrgFileLoader
open_org_file(file, focus=False)[source]

Open an org file in the org directory for editing in Emacs.

Parameters:
  • file (str or pathlib.Path) – Path to file to open. If not absolute it is taken to be relative to orgdir.
  • focus (bool) – Switch window system focus to the active Emacs frame.
Raises:
read_org_file(file, raw=None)[source]

Read and parse an org file.

Parameters:
  • file (str or pathlib.Path) – Path to file to load (relative paths are interpreted relative to org directory).
  • raw (bool) – Don’t parse and just return raw JSON exported from Emacs.
Returns:

Return type:

pyorg.ast.OrgDocument

Raises:
read_org_file_direct(file, raw=False)[source]

Read and parse an org file directly from Emacs.

Always reads the current file and does not use cached data, or perform any additional processing other than parsing.

Parameters:
  • file (str or pathlib.Path) – Path to file to load (relative paths are interpreted relative to org directory).
  • raw (bool) – Don’t parse and just return raw JSON exported from Emacs.
Returns:

Return type:

pyorg.ast.OrgDocument or dict

Raises: