emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH] Wash output of org-encrypt-entry, take 3


From: Julien Danjou
Subject: Re: [O] [PATCH] Wash output of org-encrypt-entry, take 3
Date: Mon, 21 Mar 2011 14:54:09 +0100
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

On Fri, Mar 18 2011, Óscar Fuentes wrote:

> The first line (Version:...) can change from machine to machine and over
> time (as gpg is updated with a new version.) This is problematic when
> the file is stored under version control, because as you decrypt and
> encrypt an entry that line will change and create differences among the
> file on the workspace and the file stored on VC.

This is true only if you modify the content of the entry, so I'm not
sure there's a real harm done here.

> Second, the empty line just wastes space and it is plain ugly once we
> remove the first one with the Version text.

This line is required by the protocol.

> Finally, on some systems (mostly Windows) depending on how your Emacs
> and gpg are configured, ^M characters may appear at the end of every
> line of gpg output once it is inserted on the Emacs buffer. This happens
> when the buffer uses Unix line-endings but gpg uses DOS line-endings.

I do not feel the right place and/or way to fix and encoding bug.

> +(defun org-crypt-wash-encrypted-string (str)
> +  "Remove superfluos and annoying text from the encrypted string."
> +  (with-temp-buffer
> +    (insert str)
> +    (goto-char (point-min))
> +    (while (re-search-forward "^Version:.*$\\|\^M\\|^\n" nil t)
> +      (replace-match ""))
> +    (buffer-string)))
> +

Ultimately, maybe simpler with `string-match'.

-- 
Julien Danjou
❱ http://julien.danjou.info

Attachment: pgpDWjhsimObP.pgp
Description: PGP signature


reply via email to

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