Subject: bug#38383: 26.3; Feature request: set-rmail-inbox-list should work in rmail-summary buffers

From: Ed Sabol <[email-masked]>
Date: Mon, 25 Nov 2019 21:06:34 -0500 (EST)

I use rmail-summary-mode, and I find that I often mistakenly execute `M-x
set-rmail-inbox-list' in the rmail-summary buffer instead of the rmail-mode
buffer. That just gives an error since I'm not in the Rmail buffer. It would
be nice if it just DWIM though.

I'm not an elisp expert, but would adding the following lines (or similar)
near the beginning of `set-rmail-inbox-list' in rmailmsc.el (say after the
"(interactive ...)" and before the "(unless (eq major-mode 'rmail-mode) ..."
do the trick?

  (if (and (derived-mode-p 'rmail-summary-mode)
	   rmail-buffer)
      (set-buffer rmail-buffer))

Or perhaps:

  (if (derived-mode-p 'rmail-summary-mode)
      (progn
	(unless rmail-buffer
	  (error "No associated RMAIL buffer found"))
	(set-buffer rmail-buffer)))

if you feel an error message is warranted if rmail-buffer isn't set. Hope
this helps!

In GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, X toolkit)
 of 2019-11-19 built on heasarcdev
Windowing system distributor 'Scientific Linux', version 11.0.11704000
System Description:	Scientific Linux release 6.10 (Carbon)

Recent messages:
Auto-saving...done
Auto-saving...done
Mark set [3 times]
Region copied to kill buffer.
Mark set
Auto-saving...done
scroll-up-command: End of buffer
Mark set [2 times]
Send this bug report to the Emacs maintainers? (y or n) y
Sending...done

Configured using:
 'configure --prefix=/software/usr/contrib
 --exec-prefix=/software/usr/contrib/linux-6.x --with-x-toolkit=lucid
 --with-xft=yes --with-toolkit-scroll-bars=no --with-gif=no --with-tiff=no
 --with-gnutls=no'

Configured features:
XAW3D XPM JPEG PNG SOUND GSETTINGS GLIB NOTIFY LIBSELINUX LIBXML2 FREETYPE
XFT ZLIB LUCID X11 XDBE XIM THREADS

Important settings:
  value of $LC_ALL: C
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: RMAIL

Minor modes in effect:
  show-paren-mode: t
  diff-auto-refine-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-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:
/Home/lhea2/sabol/.emacs.d/elpa/dockerfile-mode-1.2/dockerfile-mode hides /software/usr/contrib/share/emacs/26.x/site-lisp/dockerfile-mode
/software/usr/contrib/share/emacs/26.x/site-lisp/perlcritic hides /software/usr/contrib/share/emacs/site-lisp/perlcritic
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-region hides /software/usr/contrib/share/emacs/site-lisp/mmm-region
/software/usr/contrib/share/emacs/26.x/site-lisp/tidy hides /software/usr/contrib/share/emacs/site-lisp/tidy
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-vars hides /software/usr/contrib/share/emacs/site-lisp/mmm-vars
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-noweb hides /software/usr/contrib/share/emacs/site-lisp/mmm-noweb
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-utils hides /software/usr/contrib/share/emacs/site-lisp/mmm-utils
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-cweb hides /software/usr/contrib/share/emacs/site-lisp/mmm-cweb
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-univ hides /software/usr/contrib/share/emacs/site-lisp/mmm-univ
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-rpm hides /software/usr/contrib/share/emacs/site-lisp/mmm-rpm
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-mason hides /software/usr/contrib/share/emacs/site-lisp/mmm-mason
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-sample hides /software/usr/contrib/share/emacs/site-lisp/mmm-sample
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-mode hides /software/usr/contrib/share/emacs/site-lisp/mmm-mode
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-cmds hides /software/usr/contrib/share/emacs/site-lisp/mmm-cmds
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-class hides /software/usr/contrib/share/emacs/site-lisp/mmm-class
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-compat hides /software/usr/contrib/share/emacs/site-lisp/mmm-compat
/Home/lhea2/sabol/.emacs.d/elpa/mmm-mode-0.5.7/mmm-auto hides /software/usr/contrib/share/emacs/site-lisp/mmm-auto
/software/usr/contrib/share/emacs/26.x/site-lisp/mode-compile hides /software/usr/contrib/share/emacs/site-lisp/mode-compile
/software/usr/contrib/share/emacs/26.x/site-lisp/heasarc-info-mode hides /software/usr/contrib/share/emacs/site-lisp/heasarc-info-mode
/software/usr/contrib/share/emacs/26.x/site-lisp/simple-vc hides /software/usr/contrib/share/emacs/site-lisp/simple-vc
/software/usr/contrib/share/emacs/site-lisp/css-mode hides /software/usr/contrib/share/emacs/26.3/lisp/textmodes/css-mode
/software/usr/contrib/share/emacs/site-lisp/flymake hides /software/usr/contrib/share/emacs/26.3/lisp/progmodes/flymake

Features:
(mail-extr shadow emacsbug apropos cl-print debug jka-compr eieio-opt
speedbar sb-image ezimage dframe find-func rmail-spam-filter rmailkwd
rmailout rmailsort undigest help-fns shr svg xml dom rmailedit thingatpt
browse-url timezone supercite regi mailalias mail-hist sendmail warnings rx
sh-script smie compile comint ansi-color autoload radix-tree pp cus-edit
cus-start cus-load lisp-mnt help-mode misearch multi-isearch mm-archive
network-stream starttls url-http tls gnutls url-gw nsm url-cache url-auth url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap qp rmailsum rmailmm elec-pair paren psvn wid-edit
cl log-edit message rmc puny format-spec rfc822 mml mml-sec epa derived epg
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader
ring add-log diff-mode executable mmm-auto mmm-vars mmm-utils mmm-compat
imenu mm-util mail-prsvr time advice server restart-session dired
dired-loaddefs pcvs vc-cvs pcvs-parse pcvs-info pcvs-defs easy-mmode
pcvs-util ewoc finder-inf package easymenu epg-config url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
time-date mule-util 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 menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame 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 minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads inotify
dynamic-setting font-render-setting x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 834432 124253)
 (symbols 48 33231 3)
 (miscs 40 6033 14208)
 (strings 32 148373 31799)
 (string-bytes 1 5541179)
 (vectors 16 42514)
 (vector-slots 8 1510558 183928)
 (floats 8 110 580)
 (intervals 56 86426 469)
 (buffers 992 33)
 (heap 1024 82101 15948))