No subject
Mon Jan 5 15:53:30 GMT 2009
So far, to get a suitable progress bzr under my emacs shells I
was doing:
(setenv "BZR_PROGRESS_BAR" "tty")
in my '.emacs'.
This is not working anymore with the new progress
bars. Investigating I cam up the following patch and also
realized my previous settings was overzealous.
The are two cases were bzr in run from emacs:
- shells.
- compile buffers (or more generally processes as the ones spawn
by start-process and the like).
While the former deserve a proper progress bar, the later
doesn't.
There is no obvious way, in emacs, do avoid the spurious '^M' in
the process buffers if the tty progress bar is used (while shell
modes have output filters, processes doesn't provide a single
hook to add, say, comint-strip-ctrl-m).
There is also no obvious way for bzr to distinguish between
shells and processes.
I ended up with the attached patch that provides a way to force
the text UI when needed and use the following in my ~/.bashrc:
# If we are inside an emacs shell, tell bzr it can use a text UI
# an a tty progress bar
emacs_shell=`echo $INSIDE_EMACS | grep comint`
if [ "$emacs_shell" != "" ] ; then
export BZR_USE_TEXT_UI=1
export BZR_PROGRESS_BAR=tty
fi
The default for bzr is to use no progress bars under emacs, which
is guaranteed to work even if not very user-friendly.
Vincent
--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=emacs-ui-fixes-3946.patch
Content-Description: BZR merge
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: v.ladeuil+lp at free.fr-20090119130947-1ldks301mpsymf8r
# target_branch: http://bazaar-vcs.org/bzr/bzr.dev
# testament_sha1: 1f4be1a283b1063610766b6c2ae522c474c57dce
# timestamp: 2009-01-19 14:15:38 +0100
# base_revision_id: pqm at pqm.ubuntu.com-20090119102507-0ue83url4iguuol1
#
# Begin patch
=== modified file 'NEWS'
--- NEWS 2009-01-15 22:51:27 +0000
+++ NEWS 2009-01-19 13:09:47 +0000
@@ -52,6 +52,13 @@
INTERNALS:
+ * Default User Interface (UI) is CLIUIFactory when bzr runs in a dumb
+ terminal. It is sometimes desirable do override this default by forcing
+ bzr to use TextUIFactory. This can be achieved by setting the
+ BZR_USE_TEXT_UI environment variable (emacs shells, as opposed to
+ compile buffers, are such an example.
+ (Vincent Ladeuil)
+
* ``TreeDelta.show()`` now accepts a ``filter`` parameter allowing log
formatters to retrict the output.
(Vincent Ladeuil)
=== modified file 'bzrlib/ui/__init__.py'
--- bzrlib/ui/__init__.py 2009-01-13 05:07:27 +0000
+++ bzrlib/ui/__init__.py 2009-01-19 13:09:47 +0000
@@ -172,6 +172,11 @@
def prompt(self, prompt):
"""Emit prompt on the CLI."""
+ self.stdout.write(prompt)
+
+ def note(self, msg):
+ """Write an already-formatted message."""
+ self.stdout.write(msg + '\n')
def clear_term(self):
pass
@@ -195,6 +200,8 @@
def get_password(self, prompt='', **kwargs):
return None
+ def prompt(self, prompt):
+ pass
def note(self, msg):
pass
@@ -225,7 +232,9 @@
elif os.environ.get('TERM') in (None, 'dumb', ''):
# e.g. emacs compile window
cls = CLIUIFactory
- else:
+ # User may know better, otherwise default to TextUIFactory
+ if ( os.environ.get('BZR_USE_TEXT_UI', None) is not None
+ or cls is None):
from bzrlib.ui.text import TextUIFactory
cls = TextUIFactory
return cls(stdin=stdin, stdout=stdout, stderr=stderr)
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWTNdeecAApZfgFQQWf///18l
n9S////wYAYvvO5coRd1dcbaqCQboSSTQTCammSY9TZJ6QmTzQmp+lDRgmmjTQAkomTRk0yIykZM
jQ8oABo00AANAOaZGQyYIaMJgjTRoxA0yZGAAINNEalHppqNpqPSG0QG1AaANAAaGgDmmRkMmCGj
CYI00aMQNMmRgACCSIRoCaZAIPSnkk/Kh6gaMjIeoPUGQ0ekpSnfyZM0PpXO887PQ7ss2aSf+09/
hP3UvbhzujJWxLImUDSv1YRkJeB4RhR4QJ0VbkJFKSzfz5bsSnXkvIvGZkJT39UzQkIuGF9cFFMY
uriRneEYwbDZZf2K5wxi7YaXpk3LsQT7ShW/FfLCe3OyuDUuWOR4Ji+L6xmE1qOJTB420gOhyM5X
w1ZC1zRrCyEFPF4aWNJYXSaX1t4+I8u6lsnf06Is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