Skip to content

Commit 7b8fa1e

Browse files
author
Vladimir Eremeev
committed
gracefully format None
(cherry picked from commit dda23962d8e15f95202c1dce9efcd3aea057ed6c)
1 parent 66cd7ee commit 7b8fa1e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ftplugin/orgmode/plugins/Agenda.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def list_timeline(cls):
261261
# format text of agenda
262262
final_agenda = []
263263
for i, h in enumerate(raw_agenda):
264-
tmp = u"%s %s" % (h.todo, h.title)
264+
tmp = fmt.format('{} {}', h.todo, h.title)
265265
final_agenda.append(tmp)
266266
cls.line2doc[len(final_agenda)] = (get_bufname(h.document.bufnr), h.document.bufnr, h.start)
267267

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
import sys
2+
from string import Formatter
3+
24

35
if sys.version_info < (3,):
46
VIM_PY_CALL = u':py'
57
else:
68
VIM_PY_CALL = u':py3'
9+
10+
11+
class NoneAsEmptyFormatter(Formatter):
12+
def get_value(self, key, args, kwargs):
13+
v = super().get_value(key, args, kwargs)
14+
return '' if v is None else v
15+
16+
17+
fmt = NoneAsEmptyFormatter()

0 commit comments

Comments
 (0)