From 1703b07d91a0f7cb3a990ed28633843deacef6fc Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Sun, 3 Jul 2022 12:24:28 +0200 Subject: [PATCH] [Emacs] Simplification and optimisation of org-msg-signature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s faster to modify text while it is still in a buffer. The code is also much simpler and nicer to look at. --- org/config/emacs.org | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/org/config/emacs.org b/org/config/emacs.org index 0994a7b..962707d 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -2279,13 +2279,11 @@ the export part and write your emails directly in org-mode? org-msg-convert-citation t org-msg-greeting-name-limit 3 org-msg-signature (format "\n--\n#+begin_signature\n%s\n#+end_signature" - (string-trim - (replace-regexp-in-string - (regexp-quote "\n") - "\n\n" - (with-temp-buffer - (insert-file-contents mail-signature-file) - (buffer-string)))))) + (with-temp-buffer + (insert-file-contents mail-signature-file) + (while (re-search-forward "\n" nil t) + (replace-match "\n\n")) + (buffer-string)))) :general (phundrak/major-leader-key :keymaps 'org-msg-edit-mode-map