summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/commands/__init__.py7
-rw-r--r--alot/commands/taglist.py2
2 files changed, 7 insertions, 2 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py
index 651b0130..d8f1248f 100644
--- a/alot/commands/__init__.py
+++ b/alot/commands/__init__.py
@@ -1,5 +1,6 @@
import os
import sys
+import re
import glob
import shlex
import logging
@@ -92,7 +93,11 @@ def commandfactory(cmdline, mode='global'):
# allow to shellescape without a space after '!'
if cmdline.startswith('!'):
cmdline = 'shellescape \'%s\'' % cmdline[1:]
- args = shlex.split(cmdline.encode('utf-8'))
+ cmdline = re.sub(r'"(.*)"', r'"\\"\1\\""', cmdline)
+ try:
+ args = shlex.split(cmdline.encode('utf-8'))
+ except ValueError, e:
+ raise CommandParseError(e.message)
args = map(lambda x: x.decode('utf-8'), args) # get unicode strings
logging.debug('ARGS: %s' % args)
cmdname = args[0]
diff --git a/alot/commands/taglist.py b/alot/commands/taglist.py
index 610dc2c1..8b896fc9 100644
--- a/alot/commands/taglist.py
+++ b/alot/commands/taglist.py
@@ -8,5 +8,5 @@ MODE = 'taglist'
class TaglistSelectCommand(Command):
def apply(self, ui):
tagstring = ui.current_buffer.get_selected_tag()
- cmd = SearchCommand(query=['tag:\"%s\"' % tagstring])
+ cmd = SearchCommand(query=['tag:"%s"' % tagstring])
ui.apply_command(cmd)