summaryrefslogtreecommitdiff
path: root/alot/command.py
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-08-30 12:52:45 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-08-30 12:57:22 +0100
commitb65d427c2af72d1894bb1d465cb61325e28c732c (patch)
treead1d7ee929ce397153dfdd20cc15af80d6b52387 /alot/command.py
parentfa295ef4b7cf1e1454c3b9a0574d9793527e9b92 (diff)
more sane defaults for printing:
issue #45: global.print_cmd defaults to none, PrintCommand handles it accordingly.
Diffstat (limited to 'alot/command.py')
-rw-r--r--alot/command.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/alot/command.py b/alot/command.py
index 41604eb6..67912f0a 100644
--- a/alot/command.py
+++ b/alot/command.py
@@ -661,16 +661,26 @@ class PrintCommand(Command):
self.confirm = confirm
def apply(self, ui):
- # get messages to print
+ # get print command and abort if unset
+ cmd = settings.config.get('general', 'print_cmd')
+ if not cmd:
+ ui.notify('no print command specified.\n'
+ 'set "print_cmd" in the global section.',
+ priority='error')
+ return
+ args = shlex.split(cmd.encode('ascii'))
+
+ # get messages to print and set up notification strings
if self.all:
thread = ui.current_buffer.get_selected_thread()
to_print = thread.get_messages().keys()
confirm_msg = 'print all messages in thread?'
- ok_msg = 'printed thread: %s' % str(thread)
+ ok_msg = 'printed thread: %s using %s' % (str(thread), cmd)
else:
to_print = [ui.current_buffer.get_selected_message()]
confirm_msg = 'print this message?'
- ok_msg = 'printed message: %s' % str(to_print[0])
+ ok_msg = 'printed message: %s using %s' % (str(to_print[0]), cmd)
+
# ask for confirmation if needed
if self.confirm:
@@ -682,9 +692,6 @@ class PrintCommand(Command):
if not self.separately:
mailstrings = ['\n\n'.join(mailstrings)]
- # get print command
- cmd = settings.config.get('general', 'print_cmd')
- args = shlex.split(cmd.encode('ascii'))
# print
try: