emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-mobile.el: Skip <after> and <before> elements
@ 2013-08-11  2:11 Viktor Rosenfeld
  2013-08-11  7:03 ` Achim Gratz
  0 siblings, 1 reply; 3+ messages in thread
From: Viktor Rosenfeld @ 2013-08-11  2:11 UTC (permalink / raw)
  To: emacs-orgmode

  * 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-11 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-11  2:11 [PATCH] org-mobile.el: Skip <after> and <before> elements Viktor Rosenfeld
2013-08-11  7:03 ` Achim Gratz
2013-08-11 13:13   ` Viktor Rosenfeld

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).