From 66b4ce43d2d0b40b0c8955d87017cea013ca66ea Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Tue, 28 Nov 2023 21:04:15 -0600 Subject: [PATCH] pythonrc and other dotfiles --- dotfiles/pythonrc | 17 +++++++++++++++++ workstation/configuration.org | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 dotfiles/pythonrc diff --git a/dotfiles/pythonrc b/dotfiles/pythonrc new file mode 100644 index 0000000..f3f86a5 --- /dev/null +++ b/dotfiles/pythonrc @@ -0,0 +1,17 @@ +import os +import atexit +import readline + +history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history') +try: + readline.read_history_file(history) +except OSError: + pass + +def write_history(): + try: + readline.write_history_file(history) + except OSError: + pass + +atexit.register(write_history) diff --git a/workstation/configuration.org b/workstation/configuration.org index 0d6312d..47d4d3c 100644 --- a/workstation/configuration.org +++ b/workstation/configuration.org @@ -827,6 +827,7 @@ xdg = { "npm/npmrc".source = ../dotfiles/npm/npmrc; "gallery-dl/config.json".source = ../dotfiles/gallery-dl/config.json; "htop/htoprc".source = ../dotfiles/htop/htoprc; + "python/pythonrc".source = ../dotfiles/pythonrc; }; }; #+end_src @@ -944,6 +945,8 @@ environment = { PSQL_HISTORY="${XDG_DATA_HOME}/psql_history"; REDISCLI_HISTFILE="${XDG_DATA_HOME}/redis/rediscli_history"; WINEPREFIX="${XDG_DATA_HOME}/wine"; + PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/pythonrc"; + STACK_ROOT="${XDG_DATA_HOME}/stack"; # OPTIONS HISTFILE = "${XDG_STATE_HOME}/bash/history";