From: Sven Willner <sven.willner@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: Robert Pluim <rpluim@gmail.com>, 32214@debbugs.gnu.org
Subject: bug#32214: [PATCH] 'message-kill-buffer': fix backup delete question
Date: Tue, 24 Jul 2018 16:40:03 +0200 [thread overview]
Message-ID: <877elkbsu4.fsf@gmail.com> (raw)
In-Reply-To: <87va995w0f.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
hmm, having a second look into message-disassociate-draft, I am
still not sure what is supposed to happen there.
anyway, my motivation for the patch was to eliminate a rather
annoying (since unnecessary) question to remove a non-existing
backup/auto save file. here is the minimal patch (without any
further changes to the code) doing so.
I think, it makes sense to also check for the existing file-name
to only remove a backup file if there is a properly saved message,
too.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-message-kill-buffer-fix-backup-delete-question.patch --]
[-- Type: text/x-diff, Size: 2662 bytes --]
From 754d5c02f6b8c47c59fdd88e3c71f1a74761591a Mon Sep 17 00:00:00 2001
From: Sven Willner <sven.willner@gmail.com>
Date: Thu, 19 Jul 2018 13:20:26 +0200
Subject: [PATCH] 'message-kill-buffer': fix backup delete question
Before 'message-kill-buffer' would ask to delete backup file if draft has been
saved regardless if a backup file has actually been created. Now only ask if
a backup file exists.
Copyright-paperwork-exempt: yes
---
etc/NEWS | 3 +++
lisp/gnus/message.el | 42 +++++++++++++++++++++---------------------
2 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index f30ab69823..55997b1bf2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -562,6 +562,9 @@ GnuTLS manual) is recommended instead.
\f
** Message
+---
+*** 'message-kill-buffer' asks to delete backup file only if one actually exists
+
+++
*** Messages can now be systematically encrypted
when the PGP keyring contains a public key for every recipient. To
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index dde9c28656..e830d7f239 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4085,20 +4085,19 @@ Instead, just auto-save the buffer and then bury it."
(modified (buffer-modified-p)))
(setq buffer-file-name nil)
(kill-buffer (current-buffer))
- (when (and (or (and auto-save-file-name
- (file-exists-p auto-save-file-name))
- (and file-name
- (file-exists-p file-name)))
- (progn
- ;; If the message buffer has lived in a dedicated window,
- ;; `kill-buffer' has killed the frame. Thus the
- ;; `yes-or-no-p' may show up in a lowered frame. Make sure
- ;; that the user can see the question by raising the
- ;; current frame:
- (raise-frame)
- (yes-or-no-p (format "Remove the backup file%s? "
- (if modified " too" "")))))
+ (when (and auto-save-file-name
+ (file-exists-p auto-save-file-name)
+ file-name
+ (file-exists-p file-name)
+ (progn
+ ;; If the message buffer has lived in a dedicated window,
+ ;; `kill-buffer' has killed the frame. Thus the
+ ;; `yes-or-no-p' may show up in a lowered frame. Make sure
+ ;; that the user can see the question by raising the
+ ;; current frame:
+ (raise-frame)
+ (yes-or-no-p (format "Remove the backup file%s? "
+ (if modified " too" "")))))
(ignore-errors
(delete-file auto-save-file-name))
(let ((message-draft-article draft-article))
--
2.18.0
[-- Attachment #3: Type: text/plain, Size: 1856 bytes --]
Noam Postavsky <npostavs@gmail.com> writes:
> Sven Willner <sven.willner@gmail.com> writes:
>
>> also, the 'when' part should only include the actual deletion
>> of the
>> backup file
>>> (ignore-errors
>>> (delete-file auto-save-file-name))
>> rather than also draft diassociation
>>> (let ((message-draft-article draft-article))
>>> (message-disassociate-draft)))
>> also fixed in the updated patch.
>
>
>> Subject: [PATCH] 'message-kill-buffer': fix backup delete
>> question
>>
>> Before 'message-kill-buffer' would ask to delete backup file if
>> draft has been
>> saved regardless if a backup file has actually been created.
>> Now only ask if
>> a backup file exists.
>
>> + (when (and auto-save-file-name
>> + (file-exists-p auto-save-file-name)
>> + file-name
>> + (file-exists-p file-name)
>
> Does it still make sense to check for file-name here? If we're
> just
> deleting the auto save file, we should probably check for that
> only (but
> see below, I'm not sure if this is actually correct).
>
>> + (progn
>> + ;; If the message buffer has lived in a dedicated window,
>> + ;; `kill-buffer' has killed the frame. Thus the
>> + ;; `yes-or-no-p' may show up in a lowered frame. Make sure
>> + ;; that the user can see the question by raising the
>> + ;; current frame:
>> + (raise-frame)
>> + (yes-or-no-p (format "Remove the backup file%s? "
>> + (if modified " too" "")))))
>
> I wonder if "backup" is meant to refer to the draft copy (as far
> as I
> can tell (through the many layers of indirection), the draft
> "dissociation" is also some kind of deletion). If so, then I
> think this
> change isn't a "fix" at all.
>
>> + (ignore-errors
>> + (delete-file auto-save-file-name)))
>> + (let ((message-draft-article draft-article))
>> + (message-disassociate-draft))
>> (message-do-actions actions))))
next prev parent reply other threads:[~2018-07-24 14:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-19 11:39 bug#32214: [PATCH] 'message-kill-buffer': fix backup delete question Sven Willner
2018-07-19 11:54 ` Sven Willner
2018-07-19 16:15 ` Robert Pluim
2018-07-19 17:16 ` Sven Willner
2018-07-20 23:26 ` Noam Postavsky
2018-07-24 14:40 ` Sven Willner [this message]
2019-05-13 21:03 ` Lars Ingebrigtsen
2019-06-23 23:00 ` Lars Ingebrigtsen
2018-07-19 15:24 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877elkbsu4.fsf@gmail.com \
--to=sven.willner@gmail.com \
--cc=32214@debbugs.gnu.org \
--cc=npostavs@gmail.com \
--cc=rpluim@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.