pyorg.interface module¶
-
class
pyorg.interface.Org(emacs=None, orgdir=None)[source]¶ Bases:
objectInterface to org mode.
-
emacs¶ Type: pyorg.emacs.Emacs
-
orgdir¶ Directory org files are read from.
Type: OrgDirectory
-
agenda(key='t', raw=False)[source]¶ TODO Read agenda information.
Parameters: key (str) – TODO Returns: Return type: list[dict]
-
open_org_file(path, focus=False)[source]¶ Open an org file in the org directory for editing in Emacs.
Parameters: - path (str or pathlib.Path) – File path relative to org directory.
- focus (bool) – Switch window/input focus to opened buffer.
-
read_org_file(path, assign_ids=True)[source]¶ Read and parse an org file.
Parameters: - path (str or pathlib.Path) – File path relative to org directory.
- assign_ids (bool) – Assign IDs to outline nodes. See
pyorg.ast.assign_outline_ids().
Returns: Return type: Raises:
-
read_org_file_direct(path, 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: - path (str or pathlib.Path) – File path relative to org directory.
- raw (bool) – Don’t parse and just return raw JSON exported from Emacs.
Returns: Return type: Raises:
-
-
class
pyorg.interface.OrgDirectory(path)[source]¶ Bases:
objectThe directory where the user’s org files are kept.
- path : pathlib.Path
- Absolute path to org directory.
-
get_abs_path(path)[source]¶ Get absolute path from path relative to org directory.
Path will be normalized with “..” components removed.
Returns: Return type: pathlib.Path Raises: ValueError– If the path is not relative or is outside of the org directory (can happen if it contains “..” components).
-
list_files(path=None, recursive=False, hidden=False)[source]¶ List org files within the org directory.
Paths are relative to the org directory.
Parameters: - path (str or pathlib.Path) – Optional subdirectory to search through.
- recursive (bool) – Recurse through subdirectories.
- hidden (bool) – Include hidden files.
Returns: Return type: Iterator over
pathlib.Pathinstances.