[mew-dist 27775] Re: "_"
Hideyuki SHIRAI ( 白井秀行 )
shirai at example.com
2007年 8月 6日 (月) 19:01:33 JST
From: Kazu Yamamoto (山本和彦) <kazu at example.com> さん曰く
Subject: [mew-dist 27773] Re: "_"
Message-ID: <20070806.161339.261243083.kazu at example.com>
Date: Mon, 06 Aug 2007 16:13:39 +0900 (JST)
> > となりますよね。こういう場合、その行だけ折り返すことによって、ぼ
> > くは逆に読みにくく感じます。そこで、ぼくのコードの様に全部
> > fill-column でそろえちゃうのが一つの解決策だと思います。
>
> 気持ちは分かりました。:-)
ども。
> 僕は今の実装でいいと思うので、後はユーザのみなさんの意見をお待ちします。
というわけで、いつもの「オプションで逃げる」をやってみました ^^;
(defcustom mew-summary-wrap-all-lines nil
=> non-nil なら、すべてのラインを fill します。
(defcustom mew-summary-wrap-lines-column nil
=> mew-summary-wrap-all-lines の値に関わらず fill-column を設定
できます。nil なら message-mode の fill-column を使いますが、
draft などよりちょっと大きめの値が良いみたいです。
また、C-u_ で mew-summary-wrap-all-lines の値を反転させて折り返
しますので試してみてくださいませ。
ついでに、mew-header-end()のエラー回避も入っています。
--
白井秀行 (mailto:shirai at example.com)
-------------- next part --------------
? .cvsignore
? wrap.diff
Index: mew-summary4.el
===================================================================
RCS file: /cvsmew/mew/mew-summary4.el,v
retrieving revision 1.198
diff -u -r1.198 mew-summary4.el
--- mew-summary4.el 6 Aug 2007 05:00:18 -0000 1.198
+++ mew-summary4.el 6 Aug 2007 09:52:57 -0000
@@ -1309,8 +1309,8 @@
(defun mew-normal-line ()
(setq truncate-lines nil))
-(defun mew-summary-line ()
- (interactive)
+(defun mew-summary-line (&optional arg)
+ (interactive "P")
(mew-summary-msg-or-part
(let ((win (selected-window))
(N 3) status)
@@ -1320,6 +1320,7 @@
(mew-window-configure 'message)
;; message buffer
(cond
+ (arg (setq status 0))
((not (eq buffer-undo-list t)) (setq status 1))
(truncate-lines (setq status 2))
(t (setq status 0)))
@@ -1330,9 +1331,20 @@
(setq truncate-lines nil)
(message "Normal lines"))
((= status 1)
+ (when arg
+ (setq truncate-lines nil)
+ (when (and buffer-undo-list (not (eq buffer-undo-list t)))
+ (primitive-undo (length buffer-undo-list) buffer-undo-list)
+ (buffer-disable-undo)))
(setq buffer-undo-list nil)
- (mew-wrap-lines (1+ (mew-header-end)) (point-max))
- (message "Wrapped lines"))
+ (mew-wrap-lines (if (mew-header-end)
+ (1+ (mew-header-end))
+ (point-min))
+ (point-max) arg)
+ (message "Wrapped %slines"
+ (if (or (and mew-summary-wrap-all-lines (not arg))
+ (and (not mew-summary-wrap-all-lines)arg))
+ "all " "")))
((= status 2)
(primitive-undo (length buffer-undo-list) buffer-undo-list)
(buffer-disable-undo)
@@ -1340,20 +1352,32 @@
(message "Long lines")))))
(select-window win)))))
-(defun mew-wrap-lines (beg end)
+(defun mew-wrap-lines (beg end inv-all)
(save-restriction
(narrow-to-region beg end)
(save-excursion
(goto-char (point-min))
- (let ((adaptive-fill-mode nil)
- (buffer-width (window-width))
- width start fill-prefix)
+ (let* ((adaptive-fill-mode nil)
+ (buffer-width (window-width))
+ (fill-column (or mew-summary-wrap-lines-column fill-column))
+ (column fill-column)
+ (all (if inv-all
+ (not mew-summary-wrap-all-lines)
+ mew-summary-wrap-all-lines))
+ width start fill-prefix)
(while (not (eobp))
(setq start (point))
(setq fill-prefix (fill-match-adaptive-prefix))
(end-of-line)
(setq width (current-column))
(forward-line)
+ (cond
+ ((and all fill-prefix)
+ (setq fill-column (+ column (string-width fill-prefix)))
+ (setq buffer-width fill-column))
+ ((and all (not fill-prefix))
+ (setq fill-column column)
+ (setq buffer-width fill-column)))
(when (> width buffer-width)
(fill-region-as-paragraph start (1- (point)))))))))
Index: mew-vars.el
===================================================================
RCS file: /cvsmew/mew/mew-vars.el,v
retrieving revision 1.301
diff -u -r1.301 mew-vars.el
--- mew-vars.el 20 Apr 2007 05:04:00 -0000 1.301
+++ mew-vars.el 6 Aug 2007 09:52:57 -0000
@@ -1967,6 +1967,17 @@
:group 'mew-message
:type 'integer)
+(defcustom mew-summary-wrap-lines-column nil
+ "*If *non-nil*, this value is used to wrap lines instead of 'fill-column'."
+ :group 'mew-message
+ :type '(choice integer (const nil)))
+
+(defcustom mew-summary-wrap-all-lines nil
+ "*If *non-nil*, wrap all lines."
+ :group 'mew-message
+ :type '(choice (const :tag "Wrap lines only over the window-width" nil)
+ (const :tag "Wrap all lines" t)))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Draft mode
Mew-dist メーリングリストの案内