~ubuntu-branches/ubuntu/intrepid/mew-beta/intrepid

« back to all changes in this revision

Viewing changes to mew-summary4.el

  • Committer: Bazaar Package Importer
  • Author(s): Tatsuya Kinoshita
  • Date: 2007-08-18 19:09:07 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070818190907-t4ygobhu4fml2wj2
Tags: 5.2.51~0.20070817-1
New upstream release. (CVS trunk on 2007-08-17)

Show diffs side-by-side

added added

removed removed

Lines of Context:
842
842
            (goto-char (point-min))
843
843
            (re-search-forward mew-eoh nil t)
844
844
            (setq beg (point))
845
 
            (while (looking-at mew-eoh) (forward-line))
 
845
            (while (looking-at mew-eoh)
 
846
              (forward-line)
 
847
              (if (eobp) (error "invalid message (number 1)")))
846
848
            (delete-region beg (point))
847
849
            ;; Removing unnecessary fields from the encapsulated
848
850
            ;; (inner) header.
870
872
              (goto-char (point-min))
871
873
              (re-search-forward mew-eoh nil t)
872
874
              (forward-line)
 
875
              (if (eobp) (error "invalid message (number %d)" (1+ i)))
873
876
              (delete-region (point-min) (point)))
874
877
            (setq i (1+ i)))
875
878
          (mew-header-delete-lines `(,mew-x-mew-uidl:))
1298
1301
    (setq search-invisible t))
1299
1302
  (message "'search-invisible' is set to '%s'" search-invisible))
1300
1303
 
 
1304
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
1305
;;;
 
1306
;;; Lines
 
1307
;;;
 
1308
 
 
1309
(defun mew-normal-line ()
 
1310
  (setq truncate-lines nil))
 
1311
 
 
1312
(defun mew-summary-line ()
 
1313
  (interactive)
 
1314
  (mew-summary-msg-or-part
 
1315
   (let ((win (selected-window))
 
1316
         (N 3) status)       
 
1317
     (unwind-protect
 
1318
         (progn
 
1319
           (mew-summary-toggle-disp-msg 'on)
 
1320
           (mew-window-configure 'message)
 
1321
           ;; message buffer
 
1322
           (cond
 
1323
            ((not (eq buffer-undo-list t)) (setq status 1))
 
1324
            (truncate-lines (setq status 2))
 
1325
            (t (setq status 0)))
 
1326
           (setq status (% (1+ status) N))
 
1327
           (mew-elet
 
1328
            (cond
 
1329
             ((= status 0)
 
1330
              (setq truncate-lines nil)
 
1331
              (message "Normal lines"))
 
1332
             ((= status 1)
 
1333
              (setq buffer-undo-list nil)
 
1334
              (mew-wrap-lines (if (mew-header-end) (1+ (mew-header-end)) (point-min)) (point-max))
 
1335
              (message "Wrapped lines"))
 
1336
             ((= status 2)
 
1337
              (save-excursion
 
1338
                (primitive-undo (length buffer-undo-list) buffer-undo-list))
 
1339
              (buffer-disable-undo)
 
1340
              (setq truncate-lines t)
 
1341
              (message "Long lines")))))
 
1342
       (select-window win)))))
 
1343
 
 
1344
(defcustom mew-wrap-lines-column fill-column
 
1345
  "*Number of fill column to wrap line."
 
1346
  :group 'mew-message
 
1347
  :type 'integer)
 
1348
 
 
1349
(defun mew-wrap-lines (beg end)
 
1350
  (save-restriction
 
1351
    (narrow-to-region beg end)
 
1352
    (save-excursion
 
1353
      (goto-char (point-min))
 
1354
      (let* ((adaptive-fill-mode nil)
 
1355
             (column (min (window-width) mew-wrap-lines-column))
 
1356
             (fill-column column)
 
1357
             width start fill-prefix)
 
1358
        (while (not (eobp))
 
1359
          (setq start (point))
 
1360
          (setq fill-prefix (fill-match-adaptive-prefix))
 
1361
          (end-of-line)
 
1362
          (setq width (current-column))
 
1363
          (forward-line)
 
1364
          (if fill-prefix
 
1365
              (setq fill-column (+ column (string-width fill-prefix)))
 
1366
            (setq fill-column column))
 
1367
          (when (> width fill-column)
 
1368
            (fill-region-as-paragraph start (1- (point)))))))))
 
1369
 
1301
1370
(provide 'mew-summary4)
1302
1371
 
1303
1372
;;; Copyright Notice: