[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: message buffer



Rodrigo Amestica wrote:
> 
> Hi,
> 
> in my configuration (I'm not sure this is always like this) the message buffer
> is reported as a Mime-View. Is there any way to popup the current message in the
> buffer to its own frame? I could not find the option within wl. Then I thought
> that emacs should already provide a function to move a given buffer to its own
> frame (e.g. C-x 52), however the message buffer is not listed as a buffer (C-x
> C-b) and here I realized that I'm at lost.
> 
> Is there any way to pop up a copy of the message buffer to its own frame?

Try this out:

  ;; Message Zoom

  ; Press z on the summary line or in a mime-view buffer to see the
  ; message in its own frame

  (defun unzoom-message ()
    (interactive)
    (really-local-set-key "q" 'mime-preview-quit)
    (let ((return-to-summary zoom-return-to-summary))
      (if (frame-live-p zoom-frame)
          (progn
            (focus-frame zoom-prev-frame)
            (delete-frame zoom-frame)
            (if return-to-summary
                (mime-preview-quit)))
        (mime-preview-quit))))

  (defun zoom-message (&optional return-to-summary)
    (interactive)
    (let ((b (buffer-name))
          (p (selected-frame))
          (f (make-frame)))
      (focus-frame f)
      (switch-to-buffer b)

      (make-local-variable 'zoom-frame)
      (setq zoom-frame f)

      (make-local-variable 'zoom-prev-frame)
      (setq zoom-prev-frame p)

      (make-local-variable 'zoom-return-to-summary)
      (setq zoom-return-to-summary return-to-summary)

      (really-local-set-key "q" 'unzoom-message)))

  (add-hook 'mime-view-mode-hook
            '(lambda ()
               (local-set-key "z" 'zoom-message)))

  (defun wl-summary-zoom-message ()
    (interactive)
    (if (not (wl-summary-message-number))
        (message "No message to zoom")
      (wl-summary-jump-to-current-message)
      (zoom-message t)))

  (define-key wl-summary-mode-map "z" 'wl-summary-zoom-message)

This relies on really-local-set-key, an invention which does what I
think local-set-key *should* do -- set a key binding in the current
buffer only:

  (defun use-really-local-map ()
    (let* ((old-keymap (current-local-map))
           (new-keymap (if old-keymap
                           (copy-keymap old-keymap)
                         (make-sparse-keymap))))
      (use-local-map new-keymap)))

  (defun really-local-set-key (key command)
    (use-really-local-map)
    (local-set-key key command))

  (defun really-local-unset-key (key)
    (use-really-local-map)
    (local-unset-key key))

--
Ron Isaacson
Morgan Stanley
ron.isaacson@morganstanley.com / (212) 276-1349