diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index b649e39..308628e 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -112,6 +112,15 @@ This setting can also be overridden in the CRYPTKEY property." (let ((epg-context (epg-make-context nil t t))) (epg-encrypt-string epg-context str (epg-list-keys epg-context crypt-key))))) +(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))) + (defun org-encrypt-entry () "Encrypt the content of the current headline." (interactive) @@ -132,6 +141,7 @@ This setting can also be overridden in the CRYPTKEY property." (setq end (point) encrypted-text (org-encrypt-string (buffer-substring beg end) crypt-key)) + (setq encrypted-text (org-crypt-wash-encrypted-string encrypted-text)) (delete-region beg end) (insert encrypted-text) (when folded