Skip to content

Commit 70a657e

Browse files
committed
add suffix option to NamedTemporaryFile for filetype syntax highlighting/detection
1 parent 0f99b34 commit 70a657e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

editor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ def get_tty_filename():
7373
return '/dev/tty'
7474

7575

76-
def edit(filename=None, contents=None, use_tty=None):
76+
def edit(filename=None, contents=None, use_tty=None, suffix=None):
7777
editor = get_editor()
7878
args = [editor] + get_editor_args(os.path.basename(os.path.realpath(editor)))
7979

8080
if use_tty is None:
8181
use_tty = sys.stdin.isatty() and not sys.stdout.isatty()
8282

8383
if filename is None:
84-
tmp = tempfile.NamedTemporaryFile()
84+
tmp = tempfile.NamedTemporaryFile(suffix=suffix)
8585
filename = tmp.name
8686

8787
if contents is not None:

0 commit comments

Comments
 (0)