Commits

Dan Villiom Podlaski Christiansen committed feefd0d

New patches.

Comments (0)

Files changed (3)

auto-term256.diff

+# HG changeset patch
+# Parent 61d106092548d54b36fa4d86e7cb63b3dc8eefce
+# User Dan Villiom Podlaski Christiansen  <danchr@gmail.com>
+Use the terminal256 formatter by default under a *-color256 terminal.
+
+diff --git a/pygments/cmdline.py b/pygments/cmdline.py
+--- a/pygments/cmdline.py
++++ b/pygments/cmdline.py
+@@ -8,6 +8,7 @@
+     :copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS.
+     :license: BSD, see LICENSE for details.
+ """
++import os
+ import sys
+ import getopt
+ from textwrap import dedent
+@@ -18,7 +19,7 @@ from pygments.lexers import get_all_lexe
+      find_lexer_class, guess_lexer, TextLexer
+ from pygments.formatters import get_all_formatters, get_formatter_by_name, \
+      get_formatter_for_filename, find_formatter_class, \
+-     TerminalFormatter  # pylint:disable-msg=E0611
++     TerminalFormatter, Terminal256Formatter  # pylint:disable-msg=E0611
+ from pygments.filters import get_all_filters, find_filter_class
+ from pygments.styles import get_all_styles, get_style_by_name
+ 
+@@ -340,7 +341,10 @@ def main(args=sys.argv):
+             return 1
+     else:
+         if not fmter:
+-            fmter = TerminalFormatter(**parsed_opts)
++            if os.getenv('TERM', '').endswith('-256color'):
++                fmter = Terminal256Formatter(**parsed_opts)
++            else:
++                fmter = TerminalFormatter(**parsed_opts)
+         outfile = sys.stdout
+ 
+     # select lexer

default-emacs.diff

+# HG changeset patch
+# Parent ae43491e97c01cb382edd6dcd29054e59b5cc765
+# User Dan Villiom Podlaski Christiansen  <danchr@gmail.com>
+Use the Emacs style by default.
+
+diff --git a/pygments/formatter.py b/pygments/formatter.py
+--- a/pygments/formatter.py
++++ b/pygments/formatter.py
+@@ -64,7 +64,7 @@ class Formatter(object):
+     unicodeoutput = True
+ 
+     def __init__(self, **options):
+-        self.style = _lookup_style(options.get('style', 'default'))
++        self.style = _lookup_style(options.get('style', 'emacs'))
+         self.full  = get_bool_opt(options, 'full', False)
+         self.title = options.get('title', '')
+         self.encoding = options.get('encoding', None) or None
+auto-term256.diff
+default-emacs.diff
 # Placed by Bitbucket
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.