comparison lisp/tm/tm-play.el @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents d95e72db5c07
children ec9a17fef872
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
2 2
3 ;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc.
4 4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp> 5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Created: 1995/9/26 (separated from tm-view.el) 6 ;; Created: 1995/9/26 (separated from tm-view.el)
7 ;; Version: $Id: tm-play.el,v 1.3 1997/02/04 02:36:07 steve Exp $ 7 ;; Version: $Id: tm-play.el,v 1.4 1997/02/09 23:51:47 steve Exp $
8 ;; Keywords: mail, news, MIME, multimedia 8 ;; Keywords: mail, news, MIME, multimedia
9 9
10 ;; This file is part of tm (Tools for MIME). 10 ;; This file is part of tm (Tools for MIME).
11 11
12 ;; This program is free software; you can redistribute it and/or 12 ;; This program is free software; you can redistribute it and/or
353 (setq total 353 (setq total
354 (if total 354 (if total
355 (progn 355 (progn
356 (or (file-exists-p total-file) 356 (or (file-exists-p total-file)
357 (save-excursion 357 (save-excursion
358 (set-buffer (find-file-noselect total-file)) 358 (set-buffer
359 (get-buffer-create mime/temp-buffer-name))
359 (erase-buffer) 360 (erase-buffer)
360 (insert total) 361 (insert total)
361 (save-buffer) 362 (write-file total-file)
362 (kill-buffer (current-buffer)) 363 (kill-buffer (current-buffer))
363 )) 364 ))
364 (string-to-number total) 365 (string-to-number total)
365 ) 366 )
366 (and (file-exists-p total-file) 367 (and (file-exists-p total-file)
367 (save-excursion 368 (save-excursion
368 (set-buffer (find-file-noselect total-file)) 369 (set-buffer (find-file-noselect total-file))
369 (and (re-search-forward "[0-9]+" nil t) 370 (prog1
370 (string-to-number 371 (and (re-search-forward "[0-9]+" nil t)
371 (buffer-substring (match-beginning 0) 372 (string-to-number
372 (match-end 0))) 373 (buffer-substring (match-beginning 0)
373 ) 374 (match-end 0)))
374 (kill-buffer (current-buffer)) 375 )
375 )) 376 (kill-buffer (current-buffer))
377 )))
376 ))) 378 )))
377 (if (and total (> total 0)) 379 (if (and total (> total 0))
378 (catch 'tag 380 (catch 'tag
379 (save-excursion 381 (save-excursion
380 (set-buffer (get-buffer-create mime/temp-buffer-name)) 382 (set-buffer (get-buffer-create mime/temp-buffer-name))
381 (let ((full-buf (current-buffer))) 383 (let ((full-buf (current-buffer)))
382 (erase-buffer) 384 (erase-buffer)
383 (let ((i 1)) 385 (let ((i 1))
384 (while (<= i total) 386 (while (<= i total)
385 (setq file (concat root-dir "/" (int-to-string i))) 387 (setq file (concat root-dir "/" (int-to-string i)))
386 (if (not (file-exists-p file)) 388 (or (file-exists-p file)
387 (throw 'tag nil) 389 (throw 'tag nil)
388 ) 390 )
389 (as-binary-input-file (insert-file-contents file)) 391 (as-binary-input-file (insert-file-contents file))
390 (goto-char (point-max)) 392 (goto-char (point-max))
391 (setq i (1+ i)) 393 (setq i (1+ i))
392 )) 394 ))
393 (as-binary-output-file (write-file (concat root-dir "/FULL"))) 395 (as-binary-output-file (write-file (concat root-dir "/FULL")))
420 422
421 423
422 ;;; @ rot13-47 424 ;;; @ rot13-47
423 ;;; 425 ;;;
424 426
427 (require 'view)
428
429 (defconst mime-view-text/plain-mode-map (copy-keymap view-mode-map))
430 (define-key mime-view-text/plain-mode-map
431 "q" (function mime-view-text/plain-exit))
432
433 (defun mime-view-text/plain-mode ()
434 "\\{mime-view-text/plain-mode-map}"
435 (setq buffer-read-only t)
436 (setq major-mode 'mime-view-text/plain-mode)
437 (setq mode-name "MIME-View text/plain")
438 (use-local-map mime-view-text/plain-mode-map)
439 )
440
441 (defun mime-view-text/plain-exit ()
442 (interactive)
443 (kill-buffer (current-buffer))
444 )
445
425 (defun mime-article/decode-caesar (beg end cal) 446 (defun mime-article/decode-caesar (beg end cal)
426 (let* ((cnum (mime-article/point-content-number beg)) 447 (let* ((cnum (mime-article/point-content-number beg))
427 (cur-buf (current-buffer)) 448 (cur-buf (current-buffer))
428 (new-name (format "%s-%s" (buffer-name) cnum)) 449 (new-name (format "%s-%s" (buffer-name) cnum))
429 (mother mime::article/preview-buffer) 450 (mother mime::article/preview-buffer)
430 (charset (cdr (assoc "charset" cal))) 451 (charset (cdr (assoc "charset" cal)))
431 (encoding (cdr (assq 'encoding cal))) 452 (encoding (cdr (assq 'encoding cal)))
432 (mode major-mode) 453 (mode major-mode)
433 str) 454 str)
434 (setq str (buffer-substring beg end)) 455 (setq str (buffer-substring beg end))
435 (switch-to-buffer new-name) 456 (let ((pwin (or (get-buffer-window mother)
457 (get-largest-window)))
458 (buf (get-buffer-create new-name))
459 )
460 (set-window-buffer pwin buf)
461 (set-buffer buf)
462 (select-window pwin)
463 )
436 (setq buffer-read-only nil) 464 (setq buffer-read-only nil)
437 (erase-buffer) 465 (erase-buffer)
438 (insert str) 466 (insert str)
439 (goto-char (point-min)) 467 (goto-char (point-min))
440 (if (re-search-forward "^\n" nil t) 468 (if (re-search-forward "^\n" nil t)
448 (save-excursion 476 (save-excursion
449 (set-mark (point-min)) 477 (set-mark (point-min))
450 (goto-char (point-max)) 478 (goto-char (point-max))
451 (tm:caesar-region) 479 (tm:caesar-region)
452 ) 480 )
453 (view-mode) 481 (set-buffer-modified-p nil)
482 (mime-view-text/plain-mode)
454 )) 483 ))
455 484
456 485
457 ;;; @ end 486 ;;; @ end
458 ;;; 487 ;;;