From 368931b4c0109f7148c7e350cc6daa082466ad47 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 12 Apr 2018 20:24:30 +0200 Subject: Print a message to the minibuffer when executed Provide some user confirmation of the backup action. Otherwise, you're left in doubt about whether the command actually ran. --- w3m-session-backup.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/w3m-session-backup.el b/w3m-session-backup.el index a0f3cd0..1eecc49 100644 --- a/w3m-session-backup.el +++ b/w3m-session-backup.el @@ -103,7 +103,8 @@ (defun w3m-session-backup () "Save the current w3m crash recovery session to a new YAML file." (interactive) - (w3m-session-backup--save-backup)) + (w3m-session-backup--save-backup) + (minibuffer-message "Session saved")) (provide 'w3m-session-backup) -- cgit v1.2.3 From 11e6924d9f1071bbd938d04a94bc3ac6ac3bf321 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 12 Apr 2018 20:30:20 +0200 Subject: Include the file path in the minibuffer confirmation message Instead of printing a generic success message, include the filename and path of the newly saved backup file. Extract the code that generates the file path from `w3m-session-backup--save-backup` to a new function so it can be reused. --- w3m-session-backup.el | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/w3m-session-backup.el b/w3m-session-backup.el index 1eecc49..b688151 100644 --- a/w3m-session-backup.el +++ b/w3m-session-backup.el @@ -79,9 +79,7 @@ (defun w3m-session-backup--save-backup () "Save the current w3m crash recovery session to a new YAML file." (with-temp-file - (concat - (file-name-as-directory w3m-session-backup-save-directory) - (funcall w3m-session-backup-filename-function)) + (w3m-session-backup--save-to) (insert (string-join (mapcar @@ -98,13 +96,22 @@ (format "w3m-tabs-%s.yml" (format-time-string "%Y%m%d-%Hh%Mm%S"))) +(defun w3m-session-backup--save-to () + "Path to the file that the session YAML will be saved to." + (concat + (file-name-as-directory w3m-session-backup-save-directory) + (funcall w3m-session-backup-filename-function))) + ;;;###autoload (defun w3m-session-backup () "Save the current w3m crash recovery session to a new YAML file." (interactive) (w3m-session-backup--save-backup) - (minibuffer-message "Session saved")) + (minibuffer-message + (concat + "Session saved to " + (w3m-session-backup--save-to)))) (provide 'w3m-session-backup) -- cgit v1.2.3