From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Danjou Subject: Re: [PATCH] Wash output of org-encrypt-entry, take 3 Date: Mon, 21 Mar 2011 14:54:09 +0100 Message-ID: References: <87bp182hiw.fsf@wanadoo.es> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from [140.186.70.92] (port=56490 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1fYl-0006zv-C7 for emacs-orgmode@gnu.org; Mon, 21 Mar 2011 09:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1fYj-0008M1-S9 for emacs-orgmode@gnu.org; Mon, 21 Mar 2011 09:54:15 -0400 Received: from prometheus.naquadah.org ([212.85.154.174]:36761 helo=mx1.naquadah.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1fYj-0008Lr-I4 for emacs-orgmode@gnu.org; Mon, 21 Mar 2011 09:54:13 -0400 In-Reply-To: <87bp182hiw.fsf@wanadoo.es> (=?utf-8?Q?=22=C3=93scar?= Fuentes"'s message of "Fri, 18 Mar 2011 23:25:11 +0100") 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: =?utf-8?Q?=C3=93scar?= Fuentes Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Mar 18 2011, =C3=93scar 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'. =2D-=20 Julien Danjou =E2=9D=B1 http://julien.danjou.info --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJNh1iCAAoJEGEbqVCLeKXCVBoP/2fYLUuTTwZgNam//O39kfDA 3AUHHHV3+eb20PM/CPSbfqDPko/Nlknv/m0RddY/5ySlw4LcgjuOySV4nVo3jE20 2NvTQKU6tVNFkysUp4E58Mk48dgKUry6v/n+Sc69FjOzqIliWKfapD1bL9dwBNMm BStyB5BaxZW2Q+nfH9GK6lWfLHXGMQsSvNSTXI8lSMXO2As4s6wdIQATyAmFsNQV NILDT9nHzEoBhxCHWzmU0iwwHanCfcBp+ZlrdU9uTY9af6zhqrngCDbz0JaQfYlB LNNndcXXB94mV1XA+YqnnoXMXjfBkb11HN1nngEa+xhk9uXRrxFCQCgbPZkla2Fl 90tKFwZJEp4tdRTAfoNqp7NddBfAUOnQGKcvEuvg/VhCCuqFjkaRklD0sFHQeRQo ezo52i+K0Onz4JPFkWmfxSVUzUJatKJz0oK3FEYAQpuG2YcONP4f6NjfVEMNVUuQ XSTIk7gXkRTMem/PgULqzeCQFOMnMMg0t7Oeo6xmZH66++LPX7N4QgoSnP8lpTf5 Ge+ylQfzh4HIQuiaB51VrrJms56+gJj/bialUHzPa774KtdLEaJLYkqTNNhj78tw hZoK/jTgOiWb8ow+mj2fb5stt0J26mr0Wpy9oWZBy8t5Oa9RY2PgOBxkTgnOleiU 1apkmFUFl/sHa2L9Cj9K =5jkn -----END PGP SIGNATURE----- --=-=-=--