emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Viktor Rosenfeld <listuser36@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-mobile.el: Skip <after> and <before> elements
Date: Sun, 11 Aug 2013 04:11:27 +0200	[thread overview]
Message-ID: <20130811021127.GB30350@kenny.local> (raw)

  * 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	other threads:[~2013-08-11  2:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-11  2:11 Viktor Rosenfeld [this message]
2013-08-11  7:03 ` [PATCH] org-mobile.el: Skip <after> and <before> elements Achim Gratz
2013-08-11 13:13   ` Viktor Rosenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130811021127.GB30350@kenny.local \
    --to=listuser36@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).