* bug#45941: 28.0.50; rmail doesn't set modified flag when changing 'unseen' flag
@ 2021-01-17 17:55 Andrea G. Monaco
2021-01-27 15:40 ` bug#45941: [PATCH] add option to mark buffer as modified after reading new message Andrea G. Monaco
2021-01-27 17:47 ` Andrea G. Monaco
0 siblings, 2 replies; 5+ messages in thread
From: Andrea G. Monaco @ 2021-01-17 17:55 UTC (permalink / raw)
To: 45941
Hello,
when I read a message for the first time in rmail, the unseen flag gets
cleared, but this does not set the modified flag of the buffer:
therefore the buffer can't be saved, nor Emacs offers to save it when I
close the program, and information about read messages gets usually
lost.
These are the relevant lines in rmail.el, inside rmail-show-message-1:
;; Mark the message as seen, but preserve buffer modified flag.
(let ((modiff (buffer-modified-p)))
(rmail-set-attribute rmail-unseen-attr-index nil)
(unless modiff
(restore-buffer-modified-p modiff)))
I'd prefer no special treatment of 'unseen' flag modification, so that
it set the modified flag.
I think that some users might prefer the current behavior, so we could
add a variable, maybe named rmail-unseen-change-set-modified, to
customize this.
Warmly,
Andrea Monaco
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
of 2020-12-01 built on agm
Repository revision: 90a543e630012cc58c175d5bf3ffd42bb156c6b6
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)
Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2
Important settings:
value of $LC_MONETARY: it_IT.UTF-8
value of $LC_NUMERIC: it_IT.UTF-8
value of $LC_TIME: it_IT.UTF-8
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: RMAIL Summary
Minor modes in effect:
display-time-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug sendmail shr-color color eieio-opt
cl-extra speedbar ezimage dframe find-func shortdoc help-fns radix-tree
help-mode misearch multi-isearch rmailsum shr kinsoku svg xml dom
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse url-vars mailcap qp rmailmm
message rmc puny dired dired-loaddefs rfc822 mml easymenu mml-sec epa
derived epg epg-config gnus-util text-property-search time-date
mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader mail-parse
rfc2231 rmail rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs cl-loaddefs cl-lib password-cache json subr-x map seq
byte-opt gv bytecomp byte-compile cconv rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 191396 51037)
(symbols 48 8932 2)
(strings 32 128911 15394)
(string-bytes 1 12255982)
(vectors 16 118062)
(vector-slots 8 1212654 84005)
(floats 8 190 282)
(intervals 56 5799 1278)
(buffers 984 16))
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#45941: [PATCH] add option to mark buffer as modified after reading new message
2021-01-17 17:55 bug#45941: 28.0.50; rmail doesn't set modified flag when changing 'unseen' flag Andrea G. Monaco
@ 2021-01-27 15:40 ` Andrea G. Monaco
2021-01-27 15:53 ` Andreas Schwab
2021-01-27 17:47 ` Andrea G. Monaco
1 sibling, 1 reply; 5+ messages in thread
From: Andrea G. Monaco @ 2021-01-27 15:40 UTC (permalink / raw)
To: 45941
Hello,
this patch from current rmail.el adds an option for marking buffer as
modified when a message is read for the first time. The variable defaults
to nil, so it should not change current behavior.
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 29460cc20f..d800dce671 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -686,6 +686,10 @@ rmail-show-mime-function
This function is called when `rmail-enable-mime' is non-nil.
The package providing MIME support should set this.")
+(defvar rmail-read-new-message-trigger-modified nil
+ "If true, reading a message for the first time and thus clearing
+its unseen attribute triggers the modified flag for the RMAIL buffer.")
+
;;;###autoload
(defvar rmail-insert-mime-forwarded-message-function nil
"Function to insert a message in MIME format so it can be forwarded.
@@ -2747,10 +2751,11 @@ rmail-show-message-1
(t (setq rmail-current-message msg)))
(with-current-buffer rmail-buffer
(setq header-style rmail-header-style)
- ;; Mark the message as seen, but preserve buffer modified flag.
- (let ((modiff (buffer-modified-p)))
+ ;; Mark the message as seen, but preserve buffer modified flag,
+ ;; unless rmail-read-new-message-trigger-modified is t
+ (let ((modiff (buffer-modified-p)))
(rmail-set-attribute rmail-unseen-attr-index nil)
- (unless modiff
+ (unless rmail-read-new-message-trigger-modified
(restore-buffer-modified-p modiff)))
;; bracket the message in the mail
;; buffer and determine the coding system the transfer encoding.
--
Andrea G. Monaco
Hacker, mathematician, lgbt+ activist
"Hope will never be silent!", H. Milk
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#45941: [PATCH] add option to mark buffer as modified after reading new message
2021-01-27 15:40 ` bug#45941: [PATCH] add option to mark buffer as modified after reading new message Andrea G. Monaco
@ 2021-01-27 15:53 ` Andreas Schwab
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2021-01-27 15:53 UTC (permalink / raw)
To: Andrea G. Monaco; +Cc: 45941
On Jan 27 2021, Andrea G. Monaco wrote:
> diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
> index 29460cc20f..d800dce671 100644
> --- a/lisp/mail/rmail.el
> +++ b/lisp/mail/rmail.el
> @@ -686,6 +686,10 @@ rmail-show-mime-function
> This function is called when `rmail-enable-mime' is non-nil.
> The package providing MIME support should set this.")
>
> +(defvar rmail-read-new-message-trigger-modified nil
> + "If true, reading a message for the first time and thus clearing
The first line of the docstring should be a complete sentence.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#45941: [PATCH] add option to mark buffer as modified after reading new message
2021-01-17 17:55 bug#45941: 28.0.50; rmail doesn't set modified flag when changing 'unseen' flag Andrea G. Monaco
2021-01-27 15:40 ` bug#45941: [PATCH] add option to mark buffer as modified after reading new message Andrea G. Monaco
@ 2021-01-27 17:47 ` Andrea G. Monaco
2021-01-30 9:28 ` Eli Zaretskii
1 sibling, 1 reply; 5+ messages in thread
From: Andrea G. Monaco @ 2021-01-27 17:47 UTC (permalink / raw)
To: 45941
> The first line of the docstring should be a complete sentence.
> Andreas.
Thanks, I didn't know that. I fixed it and also chose a more fitting
name for the variable.
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 29460cc20f..749cdd5891 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -686,6 +686,9 @@ rmail-show-mime-function
This function is called when `rmail-enable-mime' is non-nil.
The package providing MIME support should set this.")
+(defvar rmail-showing-new-message-sets-modified nil
+ "If non-nil, showing a new message sets the modified flag for the RMAIL buffer.")
+
;;;###autoload
(defvar rmail-insert-mime-forwarded-message-function nil
"Function to insert a message in MIME format so it can be forwarded.
@@ -2747,10 +2750,11 @@ rmail-show-message-1
(t (setq rmail-current-message msg)))
(with-current-buffer rmail-buffer
(setq header-style rmail-header-style)
- ;; Mark the message as seen, but preserve buffer modified flag.
- (let ((modiff (buffer-modified-p)))
+ ;; Mark the message as seen, but preserve buffer modified flag,
+ ;; unless rmail-showing-new-message-sets-modified is non-nil
+ (let ((modiff (buffer-modified-p)))
(rmail-set-attribute rmail-unseen-attr-index nil)
- (unless modiff
+ (unless rmail-showing-new-message-sets-modified
(restore-buffer-modified-p modiff)))
;; bracket the message in the mail
;; buffer and determine the coding system the transfer encoding.
--
Andrea G. Monaco
Hacker, mathematician, lgbt+ activist
"Hope will never be silent!", H. Milk
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#45941: [PATCH] add option to mark buffer as modified after reading new message
2021-01-27 17:47 ` Andrea G. Monaco
@ 2021-01-30 9:28 ` Eli Zaretskii
0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2021-01-30 9:28 UTC (permalink / raw)
To: Andrea G. Monaco; +Cc: 45941-done
> From: "Andrea G. Monaco" <andrea.monaco@autistici.org>
> Date: Wed, 27 Jan 2021 18:47:06 +0100
>
>
> > The first line of the docstring should be a complete sentence.
> > Andreas.
>
> Thanks, I didn't know that. I fixed it and also chose a more fitting
> name for the variable.
Thanks, I installed this with some changes: the variable is now a user
option customizable via Custom, and I also added a NE|W|S entry about
it.
With that, I close the bug report. Thank you for your contribution to
Emacs.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-30 9:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-17 17:55 bug#45941: 28.0.50; rmail doesn't set modified flag when changing 'unseen' flag Andrea G. Monaco
2021-01-27 15:40 ` bug#45941: [PATCH] add option to mark buffer as modified after reading new message Andrea G. Monaco
2021-01-27 15:53 ` Andreas Schwab
2021-01-27 17:47 ` Andrea G. Monaco
2021-01-30 9:28 ` Eli Zaretskii
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.