From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Sebold Subject: Bug: EOL needs to be converted to Unix for MobileOrg files [7.5 (release_7.5.125.g70fe)] Date: Fri, 01 Apr 2011 14:44:49 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=35572 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5kHF-0003b6-FV for emacs-orgmode@gnu.org; Fri, 01 Apr 2011 15:45:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5kHD-0006yo-O3 for emacs-orgmode@gnu.org; Fri, 01 Apr 2011 15:45:01 -0400 Received: from ctms100.concordiatech.org ([216.88.180.170]:20013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5kHB-0006yG-2C for emacs-orgmode@gnu.org; Fri, 01 Apr 2011 15:44:59 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain This has been a problem for me for some time, but I only just now had the chance to find the problem. I primarily use Org-mode on Windows, and my org files mostly have DOS line endings. A while back a patch from me was accepted to convert the checksum file to Unix EOLs (and Richard updated the iOS app to be agnostic about it, I think, at the same time), which saved a lot of syncing because the checksum file never looked right to MobileOrg. However, the files themselves are irritating because they appear to have double line feeds when they are viewed on the iOS device, and edits from MobileOrg never sync because stray ^Ms creep in. This patch makes all files pushed to MobileOrg into Unix files as far as line endings go. It's not a very elegant solution and my feelings won't be hurt if a better way is proposed. Diff is here, followed by the bug report data dump (edited to remove things that don't need to be public, and I wonder if it would be a good idea to modify the bug report to automatically leave out encryption passwords and the like?). ------------------------------------------------------------------------ diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el index 83462f0..fa1d4f4 100644 --- a/lisp/org-mobile.el +++ b/lisp/org-mobile.el @@ -472,6 +472,12 @@ agenda view showing the flagged items." target-file) (org-mobile-cleanup-encryption-tempfile)))) +(defun org-mobile-copy-file (file newname) + "Copy file, converting to Unix line endings." + (with-temp-file newname + (set-buffer-file-coding-system 'undecided-unix nil) + (insert-file-contents file))) + (defun org-mobile-copy-agenda-files () "Copy all agenda files to the stage or WebDAV directory." (let ((files-alist org-mobile-files-alist) @@ -485,7 +491,7 @@ agenda view showing the flagged items." (make-directory target-dir 'parents)) (if org-mobile-use-encryption (org-mobile-encrypt-and-move file target-path) - (copy-file file target-path 'ok-if-exists)) + (org-mobile-copy-file file target-path)) (setq check (shell-command-to-string (concat org-mobile-checksum-binary " " (shell-quote-argument (expand-file-name file))))) @@ -710,12 +716,15 @@ encryption program does not understand them." (defun org-mobile-encrypt-file (infile outfile) "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." - (shell-command - (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s" - (shell-quote-argument (concat "pass:" - (org-mobile-encryption-password))) - (shell-quote-argument (expand-file-name infile)) - (shell-quote-argument (expand-file-name outfile))))) + (let ((tempfile (make-temp-file "orgmobile"))) + (org-mobile-copy-file infile tempfile) + (shell-command + (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" + (org-mobile-encryption-password))) + (shell-quote-argument (expand-file-name tempfile)) + (shell-quote-argument (expand-file-name outfile)))) + (delete-file tempfile))) (defun org-mobile-decrypt-file (infile outfile) "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." ------------------------------------------------------------------------ Emacs : GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2011-03-29 on CT-SEBOLDCR-T4C Package: Org-mode version 7.5 (release_7.5.125.g70fe) current state: ============== (setq org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars) org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-command-hook) org-agenda-custom-commands '(("z" tags "memorize&daily|odd|thursday|memday31") ("A" "Full Agenda" ((agenda ""))) ("7" "Full Weekly Agenda" ((agenda "" ((org-agenda-span (quote week)))))) ("h" . "HOME + tag/TODO searches") ("ha" "Full Agenda + Next Actions" ((agenda) (todo "INBOX") (todo "NEXTACTION") (todo "TODO"))) ("hn" "Next Actions" ((todo "INBOX") (todo "NEXTACTION") (todo "TODO"))) ("ht" "Non-LCMS Tasks" ((tags-todo "-lcms"))) ("hp" "All Projects" ((todo "PROJECT") (todo "PROJWAITING") (todo "PROJVERIFY"))) ("R" "TeamMania tasks" ((tags-todo "+work+teammania"))) ("w" . "LCMS + tag/TODO searches") ("wo" "LCMS Servicewise Open Tickets" ((tags "+servicewise+ticket-status=\"Closed\""))) ("wt" "LCMS tasks" ((tags-todo "+work+lcms"))) ("wn" "LCMS Next Actions" ((agenda) (todo "INBOX") (todo "NEXTACTION") (tags "+servicewise+ticket-status=\"Closed\"") (todo "TODO")) ((org-agenda-files (quote ("~/org/lcms"))))) ("wp" "LCMS Unfinished Projects" ((todo "PROJECT") (todo "PROJWAITING") (todo "PROJVERIFY")) ((org-agenda-files (quote ("~/org/lcms"))))) ("ws" "SQL tasks" ((tags-todo "+work+sql"))) ("g" agenda "non-LCMS Agenda" ((org-agenda-files (quote ("~/org/gtd.org"))))) ("wd" agenda "LCMS Daily Agenda" ((org-agenda-files (quote ("~/org/lcms"))))) ) org-agenda-files '("~/org" "~/org/fiction" "~/org/reference" "~/org/personal" "~/org/gaming" "~/org/lcms") org-src-fontify-natively t org-babel-load-languages '((R) (clojure . t) (C) (ditaa . t) (dot) (emacs-lisp . t) (gnuplot) (haskell) (latex) (ocaml) (org . t) (perl) (python) (ruby) (screen) (sh) (sql . t) (sqlite)) org-metaup-hook '(org-babel-load-in-session-maybe) org-after-todo-state-change-hook '(org-clock-out-if-current) org-babel-tangle-lang-exts '(("clojure" . "clj") ("emacs-lisp" . "el")) org-export-blocks-postblock-hook '(org-exp-res/src-name-cleanup) org-deadline-warning-days 5 org-export-latex-format-toc-function 'org-export-latex-format-toc-default org-agenda-skip-scheduled-if-done t org-stuck-projects '("+LEVEL=2/-DONE" ("TODO" "NEXT" "NEXTACTION") ("info") "") org-tab-first-hook '(org-hide-block-toggle-maybe org-src-native-tab-command-maybe org-babel-hide-result-toggle-maybe) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-confirm-shell-link-function 'yes-or-no-p org-reveal-start-hook '(org-decrypt-entry) org-export-first-hook '(org-beamer-initialize-open-trackers) org-todo-keywords '((sequence "INBOX(i)" "TICKLER(t!)" "|" "FILE(f@)" "CANCELED(k@)") (sequence "TODO" "NEXTACTION(n)" "WAITING" "VERIFY" "|" "DONE" "REASSIGNED") (sequence "DAILY(d)" "|" "DONEDLY" "UNSCHEDDLY(D)") (sequence "WEEKLY(e)" "|" "DONEWKLY" "UNSCHEDWKLY(E)") (sequence "MONTHLY(m)" "|" "DONEMNTHLY" "UNSCHEDMNTHLY(M)") (sequence "QUARTERLY(q)" "|" "DONEQUARTERLY" "UNSCHEDQUTRLY") (sequence "REQUEST(r!)" "REQWAITING(w@/!)" "REQVERIFY(v)" "|" "REQCLOSED(c!)" "REQREASSIGNED(a@)") (sequence "PROJECT(P!)" "PROJWAITING(W@/!)" "PROJVERIFY(V)" "|" "PROJCLOSED(C!)" "PROJREASSIGNED(A@)") ) org-agenda-before-write-hook '(org-agenda-add-entry-text) org-default-notes-file "~/org//process.org" org-directory "~/org/" org-babel-pre-tangle-hook '(save-buffer) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-export-preprocess-before-normalizing-links-hook '(org-remove-file-link-modifiers) org-agenda-span 'day org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-show-block-all append local] 5] #[nil "\300\301\302\303\304$\207" [org-add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-use-fast-todo-selection 'prefix org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-log-into-drawer t org-agenda-mode-hook '(hl-line-mode) org-export-interblocks '((lob org-babel-exp-lob-one-liners) (src org-babel-exp-inline-src-blocks)) org-agenda-skip-deadline-if-done t org-occur-hook '(org-first-headline-recenter) org-from-is-user-regexp nil org-export-preprocess-before-selecting-backend-code-hook '(org-beamer-select-beamer-code) org-mobile-use-encryption t org-agenda-use-time-grid nil org-mobile-checksum-binary "sha1sum" org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc org-beamer-auto-fragile-frames org-beamer-place-default-actions-for-lists) org-metadown-hook '(org-babel-pop-to-session-maybe) org-export-blocks '((src org-babel-exp-src-block nil) (comment org-export-blocks-format-comment t) (ditaa org-export-blocks-format-ditaa nil) (dot org-export-blocks-format-dot nil)) ) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=orgmobile-eol.diff Content-Description: org-mode patch Changes in master Modified lisp/org-mobile.el diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el index 83462f0..fa1d4f4 100644 --- a/lisp/org-mobile.el +++ b/lisp/org-mobile.el @@ -472,6 +472,12 @@ agenda view showing the flagged items." target-file) (org-mobile-cleanup-encryption-tempfile)))) +(defun org-mobile-copy-file (file newname) + "Copy file, converting to Unix line endings." + (with-temp-file newname + (set-buffer-file-coding-system 'undecided-unix nil) + (insert-file-contents file))) + (defun org-mobile-copy-agenda-files () "Copy all agenda files to the stage or WebDAV directory." (let ((files-alist org-mobile-files-alist) @@ -485,7 +491,7 @@ agenda view showing the flagged items." (make-directory target-dir 'parents)) (if org-mobile-use-encryption (org-mobile-encrypt-and-move file target-path) - (copy-file file target-path 'ok-if-exists)) + (org-mobile-copy-file file target-path)) (setq check (shell-command-to-string (concat org-mobile-checksum-binary " " (shell-quote-argument (expand-file-name file))))) @@ -710,12 +716,15 @@ encryption program does not understand them." (defun org-mobile-encrypt-file (infile outfile) "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." - (shell-command - (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s" - (shell-quote-argument (concat "pass:" - (org-mobile-encryption-password))) - (shell-quote-argument (expand-file-name infile)) - (shell-quote-argument (expand-file-name outfile))))) + (let ((tempfile (make-temp-file "orgmobile"))) + (org-mobile-copy-file infile tempfile) + (shell-command + (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" + (org-mobile-encryption-password))) + (shell-quote-argument (expand-file-name tempfile)) + (shell-quote-argument (expand-file-name outfile)))) + (delete-file tempfile))) (defun org-mobile-decrypt-file (infile outfile) "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." --=-=-=--