all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: rameiko87@posteo.net
Cc: 69738@debbugs.gnu.org
Subject: bug#69738: Followup
Date: Sat, 04 May 2024 12:37:32 +0300	[thread overview]
Message-ID: <86a5l5hq8z.fsf@gnu.org> (raw)
In-Reply-To: <86wmos8f0o.fsf@gnu.org> (message from Eli Zaretskii on Sat, 20 Apr 2024 14:11:51 +0300)

Ping!  Could you please try the patch I propose below?

> Cc: 69738@debbugs.gnu.org
> Date: Sat, 20 Apr 2024 14:11:51 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Date: Mon, 15 Apr 2024 10:15:55 +0000
> > From: rameiko87@posteo.net
> > Cc: 69738@debbugs.gnu.org
> > 
> > > So please show a minimal
> > > recipe for reproducing this, after applying the patch I sent, and
> > > starting from "emacs -Q -nw".  There's probably something I'm missing.
> > 
> > emacs -nw -Q (FRAME 1 IS SCRATCH)
> > C-x 5 2
> > M-x load-file PATCH
> > M-x rmail (FRAME 2 IS RMAIL)
> > M-: (setq rmail-mail-new-frame t)
> > C-x 5 2
> > C-x b *Messages* (FRAME 3 IS MESSAGES)
> > C-x 5 o (BACK TO FRAME 2)
> > m (NEW MAIL OPENS ON FRAME 4)
> > C-u - C-x 5 o (THIS IS WHAT THE PATCH DOES, REVERTING BACK TO FRAME 1 
> > WHICH IS SCRATCH AND NOT RMAIL)
> > 
> > Does it make sense?
> 
> I guess it does, although it evidently breaks the expectations of
> Rmail.  Please try a more thorough patch below.
> 
> > Curiously, replacing the last line by C-c C-k kills the draft but 
> > doesn't change the frame (note that I applied the patch). I deduce that 
> > rmail-mail-return is not called by C-c C-k... Am I doing something 
> > wrong?
> 
> It looks like "C-c C-k" (implemented in message.el) was not intended
> to return to the original buffer.
> 
> diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
> index d422383..437f120 100644
> --- a/lisp/mail/rmail.el
> +++ b/lisp/mail/rmail.el
> @@ -3684,7 +3684,12 @@ rmail-start-mail
>  				   other-headers)
>    (let ((switch-function
>  	 (cond (same-window nil)
> -	       (rmail-mail-new-frame 'switch-to-buffer-other-frame)
> +	       (rmail-mail-new-frame
> +                (progn
> +                  ;; Record the frame from which we invoked this command.
> +                  (modify-frame-parameters (selected-frame)
> +				           '((rmail-orig-frame . t)))
> +                  'switch-to-buffer-other-frame))
>  	       (t 'switch-to-buffer-other-window)))
>  	yank-action)
>      (if replybuffer
> @@ -3714,6 +3719,11 @@ rmail-start-mail
>  	  (modify-frame-parameters (selected-frame)
>  				   '((mail-dedicated-frame . t)))))))
>  
> +(defun rmail--find-orig-rmail-frame ()
> +  (car (filtered-frame-list
> +        (lambda (frame)
> +          (eq (frame-parameter frame 'rmail-orig-frame) t)))))
> +
>  (defun rmail-mail-return (&optional newbuf)
>    "Try to return to Rmail from the mail window.
>  If optional argument NEWBUF is specified, it is the Rmail buffer
> @@ -3755,9 +3765,19 @@ rmail-mail-return
>     ;; probably wants to delete it now.
>     ((display-multi-frame-p)
>      (delete-frame))
> -   ;; The previous frame is where normally they have the Rmail buffer
> -   ;; displayed.
> -   (t (other-frame -1))))
> +   (t
> +    ;; Try to find the original Rmail frame and make it the top frame.
> +    (let ((fr (selected-frame))
> +          (orig-fr (rmail--find-orig-rmail-frame)))
> +      (if orig-fr
> +          (progn
> +            (modify-frame-parameters orig-fr '((rmail-orig-frame . nil)))
> +            (select-frame-set-input-focus orig-fr))
> +        ;; If we cannot find the frame from which we started, punt, and
> +        ;; display the previous frame, which is where they normally have
> +        ;; the Rmail buffer displayed.
> +        (other-frame -1))
> +      (delete-frame fr)))))
>  
>  (defun rmail-mail ()
>    "Send mail in another window.
> 
> 
> 
> 





  reply	other threads:[~2024-05-04  9:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 22:49 bug#69738: [BUG] rmail-mail-new-frame doesn't delete the new frame after composing the message on Emacs 29.2 rameiko87
2024-03-12 13:54 ` Eli Zaretskii
2024-03-21  8:57   ` Eli Zaretskii
2024-04-13 17:44 ` bug#69738: Followup rameiko87
2024-04-14  9:44   ` Eli Zaretskii
2024-04-14 16:14     ` rameiko87
2024-04-14 16:30       ` Eli Zaretskii
2024-04-14 17:47         ` rameiko87
2024-04-14 17:55           ` rameiko87
2024-04-14 18:50             ` Eli Zaretskii
2024-04-14 18:49           ` Eli Zaretskii
2024-04-15 10:15             ` rameiko87
2024-04-20 11:11               ` Eli Zaretskii
2024-05-04  9:37                 ` Eli Zaretskii [this message]
2024-05-06 19:12                   ` rameiko87
2024-05-12 22:42                   ` rameiko87
2024-05-13 10:53                     ` Eli Zaretskii
2024-05-28 13:28                       ` rameiko87
2024-06-20  9:58                         ` Eli Zaretskii

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=86a5l5hq8z.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=69738@debbugs.gnu.org \
    --cc=rameiko87@posteo.net \
    /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.