Permalink
Browse files

autotag: describing and better errorhandling

Signed-off-by: Armin Wieser <armin.wieser@gmail.com>
  • Loading branch information...
awieser committed Apr 16, 2012
1 parent 97e34cb commit 2843b72faccf40090d6fd194878efe55ffe4ab86
Showing with 14 additions and 2 deletions.
  1. +7 −1 docs/FAQs_and_Best_Practices.org
  2. +7 −1 memacs/lib/memacs.py
@@ -1,4 +1,4 @@
-## Time-stamp: <2012-04-16 23:14:33 armin>
+## Time-stamp: <2012-04-16 23:21:36 armin>
## This file is best viewed with GNU Emacs Org-mode: http://orgmode.org/
* Best Practices
@@ -237,6 +237,12 @@ By now autotagging is only available for the <headline> of the entry.
: haha=foo, fooo bar, foobar
: lala=bar, baaar
+*Autotag file style:*
+: [autotag]
+: <TAG>=names to match for that tag seperated by a comma
+: <TAG>=....
+: ....
+
*Example file without Autotag:*
: ** <1970-01-01 Thu 00:00> foo
: ** <1970-01-01 Thu 00:00> bar :tag1:tag2
View
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Time-stamp: <2012-04-16 22:59:05 armin>
+# Time-stamp: <2012-04-16 23:19:39 armin>
import logging
import traceback
@@ -214,9 +214,15 @@ def __handle_autotagfile(self):
@return - return autotag_dict
"""
autotag_dict = {}
+
if self._args.autotagfile:
cfgp = ConfigParser()
cfgp.read(self._args.autotagfile)
+
+ if "autotag" not in cfgp.sections():
+ logging.error("autotag file contains no section [autotag]")
+ sys.exit(1)
+
for item in cfgp.items("autotag"):
tag = item[0]
values = item[1].split(",")

0 comments on commit 2843b72

Please sign in to comment.