Johan Josefsson <[EMAIL PROTECTED]> writes:

> I am currently using two keys (f2 and C-f2) and two functions for
> maximizing and restoring the frame in win32:

> [...]

> It works as intended, but I wonder, is there any simple way to
> replace these two keys with a function that use only one key (f2) to
> toggle between these two states?
>

This is a bit ugly (one should really check the "real" state of the
frame), but works:

(defvar my-frame-toggle-state nil
  "Just a dummy variable too keep track of things")

(defun my-frame-toggle ()
  (interactive)
  (if my-frame-toggle-state
      (my-frame-restore)
    (my-frame-maximize))
  (setq my-frame-toggle-state (not my-frame-toggle-state)))

(defun my-frame-maximize () 
  "Maximize Emacs window in win32" 
  (interactive) 
  (w32-send-sys-command ?\xf030))

(defun my-frame-restore () 
  "Restore Emacs window in win32" 
  (interactive) 
  (w32-send-sys-command ?\xF120))

/Mathias
_______________________________________________
Help-gnu-emacs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to