From mboxrd@z Thu Jan 1 00:00:00 1970 From: charles.sebold@lcms.org Subject: Re: Bug: EOL needs to be converted to Unix for MobileOrg files [7.5 (release_7.5.147.g9ddc)] Date: Tue, 03 May 2011 11:57:51 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:34977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHIv4-0008UZ-5j for emacs-orgmode@gnu.org; Tue, 03 May 2011 12:57:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHIv3-0001kR-A2 for emacs-orgmode@gnu.org; Tue, 03 May 2011 12:57:54 -0400 Received: from ctms100.concordiatech.org ([216.88.180.170]:58044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHIv3-0001kD-6x for emacs-orgmode@gnu.org; Tue, 03 May 2011 12:57:53 -0400 In-Reply-To: (Charles Sebold's message of "Thu, 07 Apr 2011 09:06:35 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On 7 Apr 2011, Charles Sebold wrote: > Second attempt to send this patch. > > 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. I'm bumping this. I think the patch attached to the last post could be better, but failing a response for now, I've decided that rather than drag my changes along, I'm just advising the necessary functions. So, to get this to work for Emacs on Windows + MobileOrg, the following is in my .emacs file. Hopefully this will be helpful for somebody: #+BEGIN_SRC emacs-lisp ; bug fix for org-mobile (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))) (eval-and-compile (require 'cl)) ; for flet (defadvice org-mobile-copy-agenda-files (around crs-org-mobile-copy-agenda-files) "Copy agenda files to mobile device with Unix EOLs." (flet ((copy-file (file newname &optional ok-if-already-exists keep-time preserve-uid-gid preserve-selinux-context) (let ((tempfile (make-temp-file "orgmobile"))) (org-mobile-copy-file file tempfile) (copy-file tempfile newname ok-if-already-exists keep-time preserve-uid-gid preserve-selinux-context) (delete-file tempfile)))) ad-do-it)) (defadvice org-mobile-encrypt-file (around crs-org-mobile-encrypt-file) "Encrypt INFILE to OUTFILE with Unix EOLs." (let ((tempfile (make-temp-file "orgmobile"))) (org-mobile-copy-file infile tempfile) (ad-set-arg 0 tempfile) ad-do-it (delete-file tempfile))) (ad-activate 'org-mobile-copy-agenda-files) (ad-activate 'org-mobile-encrypt-file) #+END_SRC -- Charles Sebold 3rd of May, 2011 GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) | No Gnus v0.18 | org-mode 7.5