unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* RMAIL, summary/message focus switching with `h' button
@ 2003-02-12 21:13 Alexander Pohoyda
  2003-02-13  0:01 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Pohoyda @ 2003-02-12 21:13 UTC (permalink / raw)


Hi,

As a user of Gnus, I'm used to switch the focus (switch-to-buffer)
typing `h'. This is fixed with the following patch.


--- rmailsum.el.orig    Sun Jan  5 23:01:28 2003
+++ rmailsum.el Sun Jan  5 23:40:13 2003
@@ -66,7 +66,13 @@
 (defun rmail-summary ()
   "Display a summary of all messages, one line per message."
   (interactive)
-  (rmail-new-summary "All" '(rmail-summary) nil))
+  (let (was-in-summary)
+    (if (eq major-mode 'rmail-summary-mode)
+       (setq was-in-summary t))
+    (rmail-new-summary "All" '(rmail-summary) nil)
+    ;; Swap the focus.
+    (if was-in-summary
+       (other-window 1))))
 
 ;;;###autoload
 (defun rmail-summary-by-labels (labels)


-- 
Alexander Pohoyda
<alexander.pohoyda@gmx.net>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RMAIL, summary/message focus switching with `h' button
  2003-02-12 21:13 RMAIL, summary/message focus switching with `h' button Alexander Pohoyda
@ 2003-02-13  0:01 ` Thien-Thi Nguyen
  2003-02-13  6:24   ` Alexander Pohoyda
  0 siblings, 1 reply; 7+ messages in thread
From: Thien-Thi Nguyen @ 2003-02-13  0:01 UTC (permalink / raw)
  Cc: bug-gnu-emacs

Alexander Pohoyda <alexander.pohoyda@gmx.net> writes:

   +  (let (was-in-summary)
   +    (if (eq major-mode 'rmail-summary-mode)
   +       (setq was-in-summary t))
   +    (rmail-new-summary "All" '(rmail-summary) nil)
   +    ;; Swap the focus.
   +    (if was-in-summary
   +       (other-window 1))))

a minor style nit, that does not address the suitability of the patch:

you can tighten the binding construct to something like:

   (let ((was-in-summary (eq major-mode 'rmail-summary-mode)))
      ...)

this is because `eq' is a predicate and `was-in-summary' is used as a
predicate var.  also, in the combined form `setq' is unnecessary.

thi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RMAIL, summary/message focus switching with `h' button
  2003-02-13  0:01 ` Thien-Thi Nguyen
@ 2003-02-13  6:24   ` Alexander Pohoyda
  2003-02-13  9:27     ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Pohoyda @ 2003-02-13  6:24 UTC (permalink / raw)
  Cc: bug-gnu-emacs

> you can tighten the binding construct to something like:
> 
>    (let ((was-in-summary (eq major-mode 'rmail-summary-mode)))
>       ...)

Indeed. Thanks a lot! Here comes a new version:

--- rmailsum.el.orig    Sun Jan  5 23:01:28 2003
+++ rmailsum.el Sun Jan  5 23:40:13 2003
@@ -66,7 +66,10 @@
 (defun rmail-summary ()
   "Display a summary of all messages, one line per message."
   (interactive)
-  (rmail-new-summary "All" '(rmail-summary) nil))
+  (let ((was-in-summary) (eq major-mode 'rmail-summary-mode))
+    (rmail-new-summary "All" '(rmail-summary) nil)
+    ;; Swap the focus.
+    (if was-in-summary (other-window 1))))
 
 ;;;###autoload
 (defun rmail-summary-by-labels (labels)
---

-- 
Alexander Pohoyda
<alexander.pohoyda@gmx.net>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RMAIL, summary/message focus switching with `h' button
  2003-02-13  6:24   ` Alexander Pohoyda
@ 2003-02-13  9:27     ` Andreas Schwab
  2003-02-13  9:37       ` Alexander Pohoyda
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2003-02-13  9:27 UTC (permalink / raw)
  Cc: Thien-Thi Nguyen

Alexander Pohoyda <alexander.pohoyda@gmx.net> writes:

|> > you can tighten the binding construct to something like:
|> > 
|> >    (let ((was-in-summary (eq major-mode 'rmail-summary-mode)))
|> >       ...)
|> 
|> Indeed. Thanks a lot! Here comes a new version:
|> 
|> --- rmailsum.el.orig    Sun Jan  5 23:01:28 2003
|> +++ rmailsum.el Sun Jan  5 23:40:13 2003
|> @@ -66,7 +66,10 @@
|>  (defun rmail-summary ()
|>    "Display a summary of all messages, one line per message."
|>    (interactive)
|> -  (rmail-new-summary "All" '(rmail-summary) nil))
|> +  (let ((was-in-summary) (eq major-mode 'rmail-summary-mode))
                           ^

This paren is misplaced, see above.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RMAIL, summary/message focus switching with `h' button
  2003-02-13  9:27     ` Andreas Schwab
@ 2003-02-13  9:37       ` Alexander Pohoyda
  2003-02-13 10:51         ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Pohoyda @ 2003-02-13  9:37 UTC (permalink / raw)
  Cc: ttn

> |> +  (let ((was-in-summary) (eq major-mode 'rmail-summary-mode))
>                            ^
> This paren is misplaced, see above.

Right. My bad. Thanks. Corrected patch:

--- rmailsum.el.orig    Sun Jan  5 23:01:28 2003
+++ rmailsum.el Sun Jan  5 23:40:13 2003
@@ -66,7 +66,10 @@
 (defun rmail-summary ()
   "Display a summary of all messages, one line per message."
   (interactive)
-  (rmail-new-summary "All" '(rmail-summary) nil))
+  (let ((was-in-summary (eq major-mode 'rmail-summary-mode))
+    (rmail-new-summary "All" '(rmail-summary) nil)
+    ;; Swap the focus.
+    (if was-in-summary (other-window 1))))
 
 ;;;###autoload
 (defun rmail-summary-by-labels (labels)

-- 
Alexander Pohoyda
<alexander.pohoyda@gmx.net>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RMAIL, summary/message focus switching with `h' button
  2003-02-13  9:37       ` Alexander Pohoyda
@ 2003-02-13 10:51         ` Andreas Schwab
  2003-02-13 16:13           ` Alexander Pohoyda
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2003-02-13 10:51 UTC (permalink / raw)
  Cc: ttn

Alexander Pohoyda <alexander.pohoyda@gmx.net> writes:

|> > |> +  (let ((was-in-summary) (eq major-mode 'rmail-summary-mode))
|> >                            ^
|> > This paren is misplaced, see above.
|> 
|> Right. My bad. Thanks. Corrected patch:
|> 
|> --- rmailsum.el.orig    Sun Jan  5 23:01:28 2003
|> +++ rmailsum.el Sun Jan  5 23:40:13 2003
|> @@ -66,7 +66,10 @@
|>  (defun rmail-summary ()
|>    "Display a summary of all messages, one line per message."
|>    (interactive)
|> -  (rmail-new-summary "All" '(rmail-summary) nil))
|> +  (let ((was-in-summary (eq major-mode 'rmail-summary-mode))
|> +    (rmail-new-summary "All" '(rmail-summary) nil)
|> +    ;; Swap the focus.
|> +    (if was-in-summary (other-window 1))))
|>  
|>  ;;;###autoload
|>  (defun rmail-summary-by-labels (labels)

You didn't test your change, did you?  There is a paren missing now.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RMAIL, summary/message focus switching with `h' button
  2003-02-13 10:51         ` Andreas Schwab
@ 2003-02-13 16:13           ` Alexander Pohoyda
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Pohoyda @ 2003-02-13 16:13 UTC (permalink / raw)


Sorry, quite busy at work. This should be OK.

--- rmailsum.el.orig    Sun Jan  5 23:01:28 2003
+++ rmailsum.el Sun Jan  5 23:40:13 2003
@@ -66,7 +66,10 @@
 (defun rmail-summary ()
   "Display a summary of all messages, one line per message."
   (interactive)
-  (rmail-new-summary "All" '(rmail-summary) nil))
+  (let ((was-in-summary (eq major-mode 'rmail-summary-mode)))
+    (rmail-new-summary "All" '(rmail-summary) nil)
+    ;; Swap the focus.
+    (if was-in-summary (other-window 1))))
 
 ;;;###autoload
 (defun rmail-summary-by-labels (labels)


-- 
Alexander Pohoyda
<alexander.pohoyda@gmx.net>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-02-13 16:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-12 21:13 RMAIL, summary/message focus switching with `h' button Alexander Pohoyda
2003-02-13  0:01 ` Thien-Thi Nguyen
2003-02-13  6:24   ` Alexander Pohoyda
2003-02-13  9:27     ` Andreas Schwab
2003-02-13  9:37       ` Alexander Pohoyda
2003-02-13 10:51         ` Andreas Schwab
2003-02-13 16:13           ` Alexander Pohoyda

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).