emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] org-mobile.el: Skip <after> and <before> elements


From: Viktor Rosenfeld
Subject: [O] [PATCH] org-mobile.el: Skip <after> and <before> elements
Date: Sun, 11 Aug 2013 04:11:27 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

  * org-mobile.el (org-mobile-add-after): Variable to turn off
  printing of information inside <after> element.
  (org-mobile-add-before): Variable to turn off printing of
  information inside <before> element.
  (org-mobile-sumo-agenda-command): Optionally skip printing of
  information inside <after> element.
  (org-mobile-write-agenda-for-mobile): Optionally skip printing
  of information inside <before> element.

  The MobileOrg push command adds some information inside an
  <after> element on the heading, e.g., the agenda key and name,
  and inside a <before> element in the body, e.g., the category
  and time information. This patch adds the ability to disable
  this behavior. It is not very sophisticated; a better way
  would be to support custom layouts of the data shown in
  MobileOrg.

TINYCHANGE
---
 lisp/org-mobile.el | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index 7cdaf34..a866293 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -255,6 +255,16 @@ using `rsync' or `scp'.")
 (defvar org-mobile-files-alist nil)
 (defvar org-mobile-checksum-files nil)
 
+(defcustom org-mobile-add-after t
+  "Add information inside <after> element."
+  :group 'org-mobile
+  :type 'boolean)
+
+(defcustom org-mobile-add-before t
+  "Add information inside <before> element."
+  :group 'org-mobile
+  :type 'boolean)
+
 (defun org-mobile-prepare-file-lists ()
   (setq org-mobile-files-alist (org-mobile-files-alist))
   (setq org-mobile-checksum-files nil))
@@ -581,10 +591,11 @@ The table of checksums is written to the file 
mobile-checksums."
        settings (nth 4 e))
  (setq settings
        (cons (list 'org-agenda-title-append
-       (concat "<after>KEYS=" key " TITLE: "
-         (if (and (stringp desc) (> (length desc) 0))
-             desc (symbol-name type))
-         "</after>"))
+       (when org-mobile-add-after
+         (concat "<after>KEYS=" key " TITLE: "
+           (if (and (stringp desc) (> (length desc) 0))
+         desc (symbol-name type))
+           "</after>")))
        settings))
  (push (list type match settings) new))
        ((or (functionp (nth 2 e)) (symbolp (nth 2 e)))
@@ -601,9 +612,10 @@ The table of checksums is written to the file 
mobile-checksums."
    (setq settings (append gsettings settings))
    (setq settings
    (cons (list 'org-agenda-title-append
-         (concat "<after>KEYS=" gkey "#" (number-to-string
-                  (setq cnt (1+ cnt)))
-           " TITLE: " atitle "</after>"))
+         (when org-mobile-add-after
+           (concat "<after>KEYS=" gkey "#" (number-to-string
+                    (setq cnt (1+ cnt)))
+             " TITLE: " atitle "</after>")))
          settings))
    (push (list type match settings) new)))))
     (and new (list "X" "SUMO" (reverse new)
@@ -650,7 +662,9 @@ The table of checksums is written to the file 
mobile-checksums."
              pl
              (point-at-eol))))
    (delete-region (point-at-bol) (point-at-eol))
-   (insert line "<before>" prefix "</before>")
+   (insert line)
+   (when org-mobile-add-before
+     (insert "<before>" prefix "</before>"))
    (beginning-of-line 1))
      (and (looking-at "[ \t]+") (replace-match "")))
    (insert (if in-date "***  " "**  "))
-- 
1.8.3.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]