Skip to content

Commit 6be4207

Browse files
afriedersebastinas
authored andcommitted
Add default_autoreload config option
1 parent 128e4b5 commit 6be4207

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

bpython/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def loadini(struct, configfile):
7171
'color_scheme': 'default',
7272
'complete_magic_methods': True,
7373
'dedent_after': 1,
74+
'default_autoreload': False,
7475
'editor': os.environ.get('VISUAL', os.environ.get('EDITOR', 'vi')),
7576
'flush_output': True,
7677
'highlight_show_source': True,
@@ -176,6 +177,7 @@ def get_key_no_doublebind(command):
176177
struct.hist_length = config.getint('general', 'hist_length')
177178
struct.hist_duplicates = config.getboolean('general', 'hist_duplicates')
178179
struct.flush_output = config.getboolean('general', 'flush_output')
180+
struct.default_autoreload = config.getboolean('general', 'default_autoreload')
179181

180182
struct.pastebin_key = get_key_no_doublebind('pastebin')
181183
struct.copy_clipboard_key = get_key_no_doublebind('copy_clipboard')

bpython/curtsiesfrontend/repl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ def __init__(self,
420420
self.paste_mode = False
421421
self.current_match = None
422422
self.list_win_visible = False
423-
self.watching_files = False # whether auto reloading active
423+
# whether auto reloading active
424+
self.watching_files = config.default_autoreload
424425

425426
# 'reverse_incremental_search', 'incremental_search' or None
426427
self.incr_search_mode = None
@@ -435,6 +436,8 @@ def __init__(self,
435436
self.status_bar.message(banner)
436437

437438
self.watcher = ModuleChangedEventHandler([], self.request_reload)
439+
if self.watcher and config.default_autoreload:
440+
self.watcher.activate()
438441

439442
# The methods below should be overridden, but the default implementations
440443
# below can be used as well.

bpython/sample-config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
# always prompt.
5454
# single_undo_time = 1.0
5555

56+
# Enable autoreload feature by default (default: False).
57+
# default_autoreload = False
58+
5659
[keyboard]
5760

5861
# All key bindings are shown commented out with their default binding

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy