From b4f78df9b47bc65a3ff5f78ab13d8003fc064c9f Mon Sep 17 00:00:00 2001 From: cage Date: Thu, 25 Jun 2020 12:29:35 +0200 Subject: [PATCH] - added signature in the correct position when replying. --- src/message-rendering-utils.lisp | 2 +- src/ui-goodies.lisp | 39 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/message-rendering-utils.lisp b/src/message-rendering-utils.lisp index 1634232..b7d4cc4 100644 --- a/src/message-rendering-utils.lisp +++ b/src/message-rendering-utils.lisp @@ -277,4 +277,4 @@ (defun signature () (when-let ((signature-file (swconf:signature-file-path))) - (format nil "-- ~%~a" (fs:slurp-file signature-file)))) + (format nil "~%-- ~%~a" (fs:slurp-file signature-file)))) diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index d308223..71e8758 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -834,27 +834,28 @@ Force the checking for new message in the thread the selected message belong." (format stream "~a~%" (msg-utils:add-mention-prefix reply-username)) (loop for line in quoted-lines do (format stream "~a~%" line)))))) + (add-signature (file) + (when-let ((signature (message-rendering-utils:signature))) + (with-open-file (stream + file + :direction :output + :element-type 'character + :if-exists :append) + (write-sequence signature stream)))) (add-body () - (let ((temp-file (fs:temporary-file)) - (signature (message-rendering-utils:signature))) - (when signature - (with-open-file (stream - temp-file - :direction :output - :element-type 'character - :if-exists :supersede) - (write-sequence signature stream))) - (let ((reference-open-file (get-universal-time))) + (let ((temp-file (fs:temporary-file))) (prepare-reply-body temp-file) - (croatoan:end-screen) - (os-utils:open-with-editor temp-file) - (when (and (> (fs:file-size temp-file) - 0) - (> (fs:get-stat-mtime temp-file) - reference-open-file)) - (let ((body (fs:slurp-file temp-file))) - (setf (sending-message:body *message-to-send*) body) - (add-subject))))))) + (add-signature temp-file) + (let ((reference-open-file (get-universal-time))) + (croatoan:end-screen) + (os-utils:open-with-editor temp-file) + (when (and (> (fs:file-size temp-file) + 0) + (> (fs:get-stat-mtime temp-file) + reference-open-file)) + (let ((body (fs:slurp-file temp-file))) + (setf (sending-message:body *message-to-send*) body) + (add-subject))))))) (add-body))) (defun reply-message ()