[mew-int 2905] Re: Wish for mew-use-format-flowed

Christophe TROESTLER Christophe.Troestler at example.com
Tue Aug 24 07:30:12 JST 2010


On Mon, 23 Aug 2010 18:04:57 +0200, Harald Hanche-Olsen wrote:
> 
> + Christophe TROESTLER <Christophe.Troestler at example.com>:
> 
> > I use mew-use-format-flowed set to t ― with (setq word-wrap t) on
> > drafts buffers ― and it works mainly fine.  However, I occasionally
> > have to send mails with long lines that I do not want wrapped
> > (typically, error messages).  Is there a way to disable
> > mew-use-format-flowed for a single message?  A menu entry to perform
> > this would be really great.
> 
> I have these lines in my ~/.mew.el:
> 
> (defun mew-draft-use-format-flowed (arg)
>   (interactive "P")
>   (make-local-variable 'mew-use-format-flowed)
>   (setf mew-use-format-flowed
> 	(if (null arg)
> 	    (not (mew-use-format-flowed))
> 	  (> (prefix-numeric-value arg) 0)))
>   (auto-fill-mode (if mew-use-format-flowed -1 1)))
> (define-key mew-draft-body-map "\C-cl" 'mew-draft-use-format-flowed)
> 
> So C-c l toggles mew-draft-body-map and ses auto-fill accordingly.

Thanks!  Your code was a good basis to push me to investigate further but it does not work.  To make it work, I had to use mew-tinfo-set-use-flowed.  Also running mew-draft-mode-name toggle the "F" in the mode line which is a nice visual feedback.  Since I will seldom use it, I also wanted an entry menu (there is a high risk I forget the shortcut).  So, eventually, here is the code I ended up with:

(defun mew-draft-use-format-flowed (arg)
  (interactive "P")
  (set (make-local-variable 'mew-use-format-flowed)
       (if (null arg)
          (not (mew-use-format-flowed))
        (> (prefix-numeric-value arg) 0)))
  (mew-tinfo-set-use-flowed mew-use-format-flowed)
  (mew-draft-mode-name); Display "F" iff Flowed
  (if mew-use-format-flowed
      (progn
       (auto-fill-mode 0)
       (setq word-wrap t))
    (auto-fill-mode 1))
  )

(define-key mew-draft-header-map [menu-bar Mew flowed]
  '(menu-item "Flowed" mew-draft-use-format-flowed
             :button (:toggle . mew-use-format-flowed)))

(define-key mew-draft-mode-map [menu-bar Mew flowed]
  '(menu-item "Flowed" mew-draft-use-format-flowed
             :button (:toggle . mew-use-format-flowed)))


Hope it is useful to others!

Cheers,
C.


More information about the Mew-int mailing list