From 9bc0ee5ac80fa501ec61c2f04654f451aba466e3 Mon Sep 17 00:00:00 2001 From: morioka Date: Fri, 10 Jul 1998 21:24:40 +0000 Subject: [PATCH] Merge remi-1_8_4. --- ChangeLog | 60 ++++++++++++++++++ Makefile | 5 +- VERSION | 6 +- ftp.in | 4 +- mime-edit.el | 2 +- mime-play.el | 199 +++++++++++++++++++++++++++++++++++++++++++++++----------- mime-view.el | 12 ++-- semi-def.el | 4 +- 8 files changed, 240 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 382171e..30542cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,63 @@ +1998-07-11 MORIOKA Tomohiko + + * REMI: Version 1.8.4 (Takaoka) released. + +1998-07-09 MORIOKA Tomohiko + + * mime-play.el: Reduce `mime-acting-situation-example-list' while + it is bigger than `mime-acting-situation-example-list-max-size'. + +1998-07-08 MORIOKA Tomohiko + + * mime-edit.el (mime-edit-preview-message): Use `mime-view-buffer' + instead of `mime-view-mode'. + + +1998-07-08 MORIOKA Tomohiko + + * REMI: Version 1.8.3 (Ecch-Dþ-Nakagawa)-A released. + + * mime-play.el (mime-delq-null-situation): Add new optional + argument `ignored-value'. + (mime-raw-play-entity): Add new optional argument + `ignored-method'; add `ignore-examples' to acting-situation. + (mime-detect-content): Specify `ignore-examples' of + acting-situation as `ignore-examples' of `mime-raw-play-entity'; + specify `mime-detect-content' as `ignored-method' of + `mime-raw-play-entity'. + +1998-07-08 MORIOKA Tomohiko + + * mime-view.el (mime-preview-extract-current-entity): Change + interface to add `ignore-examples'. + (mime-preview-print-current-entity): Likewise. + + * mime-play.el (mime-acting-situation-example-list-max-size): New + variable. + (mime-reduce-acting-situation-examples): New function. + (mime-preview-play-current-entity): Change interface to add + `ignore-examples'. + (mime-raw-play-entity): Add new optional argument + `ignore-examples'. Reduce `mime-acting-situation-example-list' + when loading example file. + + +1998-07-08 MORIOKA Tomohiko + + * REMI: Version 1.8.2 (N-Dòmachi)-A released. + +1998-07-07 MORIOKA Tomohiko + + * mime-play.el (mime-acting-situation-example-list): New variable; + abolish `mime-acting-situation-examples'. + (mime-save-acting-situation-examples): Modify for + `mime-acting-situation-example-list'. + (mime-compare-situation-with-example): New function. + (mime-raw-play-entity): Change algorithm to compare with + acting-situation-examples. + (mime-store-message/partial-piece): Use `mime-view-buffer' instead + of `mime-view-mode'. + 1998-07-06 MORIOKA Tomohiko * mime-play.el (mime-preview-play-current-entity): Fix problem diff --git a/Makefile b/Makefile index 420634b..7acb70e 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # PACKAGE = semi -VERSION = 1.8.3 +VERSION = 1.8.4 SHELL = /bin/sh MAKE = make @@ -68,4 +68,5 @@ tar: $(RM) /tmp/$(PACKAGE)-$(VERSION)/ftp.in cd /tmp; $(TAR) cvzf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) cd /tmp; $(RM) -r $(PACKAGE)-$(VERSION) - sed "s/VERSION/$(VERSION)/" < ftp.in > ftp + sed "s/VERSION/$(VERSION)/" < ftp.in \ + | sed "s/PACKAGE/$(PACKAGE)/" > ftp diff --git a/VERSION b/VERSION index 7a4b204..5157e53 100644 --- a/VERSION +++ b/VERSION @@ -158,9 +158,9 @@ 1.6.0 Amaharashi $(B1+@2(B 1.8.0 Ecch-Dþ-Kokubu-A $(B1[Cf9qJ,(B 1.8.1 Fushiki $(BIzLZ(B ; <=> $(B%&%i%8%*%9%C%H%C%/9RO)(B -------- Noumachi $(BG=D.(B -------- Ecch-Dþ-Nakagawa-A $(B1[CfCf@n(B - (Takaoka) ($(B9b2,(B) ; = JR $(BKLN&K\@~!">kC<@~(B +1.8.2 N-Dòmachi-A $(BG=D.(B +1.8.3 Ecch-Dþ-Nakagawa-A $(B1[CfCf@n(B +1.8.4 Takaoka $(B9b2,(B ; = JR $(BKLN&K\@~!">kC<@~(B [etc.] diff --git a/ftp.in b/ftp.in index 7cb4860..8408dbb 100644 --- a/ftp.in +++ b/ftp.in @@ -8,10 +8,10 @@ access-type=anon-ftp; site="ftp.jaist.ac.jp"; directory="/pub/GNU/elisp/semi"; - name="semi-VERSION.tar.gz"; + name="PACKAGE-VERSION.tar.gz"; mode=image]] Content-Type: application/octet-stream; - name="semi-VERSION.tar.gz"; + name="PACKAGE-VERSION.tar.gz"; type=tar; conversions=gzip --}-<> diff --git a/mime-edit.el b/mime-edit.el index f911ce2..d3f63f9 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -2485,7 +2485,7 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" (concat "^" (regexp-quote separator) "$")) (replace-match "") ) - (mime-view-mode) + (mime-view-buffer) )) (defun mime-edit-quitting-method () diff --git a/mime-play.el b/mime-play.el index 221920f..bb5870b 100644 --- a/mime-play.el +++ b/mime-play.el @@ -37,7 +37,9 @@ (error (defvar bbdb-buffer-name nil))) ) -(defvar mime-acting-situation-examples nil) +(defvar mime-acting-situation-example-list nil) + +(defvar mime-acting-situation-example-list-max-size 16) (defun mime-save-acting-situation-examples () (let* ((file mime-acting-situation-examples-file) @@ -51,8 +53,8 @@ (insert "\n;; This file is generated automatically by " mime-view-version-string "\n\n") (insert ";;; Code:\n\n") - (pp `(setq mime-acting-situation-examples - ',mime-acting-situation-examples) + (pp `(setq mime-acting-situation-example-list + ',mime-acting-situation-example-list) (current-buffer)) (insert "\n;;; " (file-name-nondirectory file) @@ -62,25 +64,74 @@ (add-hook 'kill-emacs-hook 'mime-save-acting-situation-examples) - +(defun mime-reduce-acting-situation-examples () + (let* ((rest mime-acting-situation-example-list) + (min-example (car rest)) + (min-score (cdr min-example))) + (while rest + (let* ((example (car rest)) + (score (cdr example))) + (cond ((< score min-score) + (setq min-score score + min-example example) + ) + ((= score min-score) + (if (<= (length (car example))(length (car min-example))) + (setq min-example example) + )) + )) + (setq rest (cdr rest))) + (setq mime-acting-situation-example-list + (delq min-example mime-acting-situation-example-list)) + (setq min-example (car min-example)) + (let ((examples mime-acting-situation-example-list) + (max-score 0) + max-examples) + (while examples + (let* ((ret (mime-compare-situation-with-example min-example + (caar examples))) + (ret-score (car ret))) + (cond ((> ret-score max-score) + (setq max-score ret-score + max-examples (list (cdr ret))) + ) + ((= ret-score max-score) + (setq max-examples (cons (cdr ret) max-examples)) + ))) + (setq examples (cdr examples))) + (while max-examples + (let* ((example (car max-examples)) + (cell (assoc example mime-acting-situation-example-list))) + (if cell + (setcdr cell (1+ (cdr cell))) + (setq mime-acting-situation-example-list + (cons (cons example 0) + mime-acting-situation-example-list)) + )) + (setq max-examples (cdr max-examples)) + )))) + + ;;; @ content decoder ;;; (defvar mime-preview-after-decoded-position nil) -(defun mime-preview-play-current-entity (&optional mode) +(defun mime-preview-play-current-entity (&optional ignore-examples mode) "Play current entity. It decodes current entity to call internal or external method. The method is selected from variable `mime-acting-condition'. +If IGNORE-EXAMPLES (C-u prefix) is specified, this function ignores +`mime-acting-situation-example-list'. If MODE is specified, play as it. Default MODE is \"play\"." - (interactive) + (interactive "P") (let ((entity (get-text-property (point) 'mime-view-entity))) (if entity (let ((the-buf (current-buffer)) (raw-buffer (mime-entity-buffer entity))) (setq mime-preview-after-decoded-position (point)) (set-buffer raw-buffer) - (mime-raw-play-entity entity (or mode "play")) + (mime-raw-play-entity entity (or mode "play") nil ignore-examples) (when (eq (current-buffer) raw-buffer) (set-buffer the-buf) (goto-char mime-preview-after-decoded-position) @@ -121,17 +172,39 @@ If MODE is specified, play as it. Default MODE is \"play\"." ))) ) -(defsubst mime-delq-null-situation (situations field) +(defsubst mime-delq-null-situation (situations field + &optional ignored-value) (let (dest) (while situations - (let ((situation (car situations))) - (if (assq field situation) - (setq dest (cons situation dest)) - )) + (let* ((situation (car situations)) + (cell (assq field situation))) + (if cell + (or (eq (cdr cell) ignored-value) + (setq dest (cons situation dest)) + ))) (setq situations (cdr situations))) dest)) -(defun mime-raw-play-entity (entity &optional mode situation) +(defun mime-compare-situation-with-example (situation example) + (let ((example (copy-alist example)) + (match 0)) + (while situation + (let* ((cell (car situation)) + (key (car cell)) + (ecell (assoc key example))) + (when ecell + (if (equal cell ecell) + (setq match (1+ match)) + (setq example (delq ecell example)) + )) + ) + (setq situation (cdr situation)) + ) + (cons match example) + )) + +(defun mime-raw-play-entity (entity &optional mode situation ignore-examples + ignored-method) "Play entity specified by ENTITY. It decodes the entity to call internal or external method. The method is selected from variable `mime-acting-condition'. If MODE is @@ -142,21 +215,66 @@ specified, play as it. Default MODE is \"play\"." (if mode (setq situation (cons (cons 'mode mode) situation)) ) + (if ignore-examples + (or (assq 'ignore-examples situation) + (setq situation + (cons (cons 'ignore-examples ignore-examples) situation))) + ) (setq ret - (or (ctree-match-calist mime-acting-situation-examples situation) - (ctree-match-calist-partially mime-acting-situation-examples - situation) - situation)) - (setq ret - (or (mime-delq-null-situation - (ctree-find-calist mime-acting-condition ret - mime-view-find-every-acting-situation) - 'method) - (mime-delq-null-situation - (ctree-find-calist mime-acting-condition situation - mime-view-find-every-acting-situation) - 'method) - )) + (mime-delq-null-situation + (ctree-find-calist mime-acting-condition situation + mime-view-find-every-acting-situation) + 'method ignored-method)) + (or ignore-examples + (if (cdr ret) + (let ((rest ret) + (max-score 0) + max-escore + max-examples + max-situations) + (while rest + (let ((situation (car rest)) + (examples mime-acting-situation-example-list)) + (while examples + (let* ((ret + (mime-compare-situation-with-example + situation (caar examples))) + (ret-score (car ret))) + (cond ((> ret-score max-score) + (setq max-score ret-score + max-escore (cdar examples) + max-examples (list (cdr ret)) + max-situations (list situation)) + ) + ((= ret-score max-score) + (cond ((> (cdar examples) max-escore) + (setq max-escore (cdar examples) + max-examples (list (cdr ret)) + max-situations (list situation)) + ) + ((= (cdar examples) max-escore) + (setq max-examples + (cons (cdr ret) max-examples)) + (or (member situation max-situations) + (setq max-situations + (cons situation max-situations))) + ))))) + (setq examples (cdr examples)))) + (setq rest (cdr rest))) + (when max-situations + (setq ret max-situations) + (while max-examples + (let* ((example (car max-examples)) + (cell + (assoc example mime-acting-situation-example-list))) + (if cell + (setcdr cell (1+ (cdr cell))) + (setq mime-acting-situation-example-list + (cons (cons example 0) + mime-acting-situation-example-list)) + )) + (setq max-examples (cdr max-examples)) + ))))) (cond ((cdr ret) (setq ret (select-menu-alist "Methods" @@ -168,7 +286,7 @@ specified, play as it. Default MODE is \"play\"." situation))) ret))) (setq ret (mime-sort-situation ret)) - (ctree-set-calist-strictly 'mime-acting-situation-examples ret) + (add-to-list 'mime-acting-situation-example-list (cons ret 0)) ) (t (setq ret (car ret)) @@ -379,10 +497,13 @@ SUBTYPE is symbol to indicate subtype of media-type.") (setq rest (cdr rest)))))) (if type (mime-raw-play-entity - entity "play" + entity nil (put-alist 'type type (put-alist 'subtype subtype - (mime-entity-situation entity)))) + (del-alist 'method + (copy-alist situation)))) + (cdr (assq 'ignore-examples situation)) + 'mime-detect-content) )) ))) @@ -452,7 +573,7 @@ It is registered to variable `mime-preview-quitting-method-alist'." (erase-buffer) (as-binary-input-file (insert-file-contents file)) (setq major-mode 'mime-show-message-mode) - (mime-view-mode mother) + (mime-view-buffer (current-buffer) nil mother) ) (set-window-buffer pwin (save-excursion @@ -522,11 +643,10 @@ It is registered to variable `mime-preview-quitting-method-alist'." )) (save-window-excursion (setq major-mode 'mime-show-message-mode) - (mime-view-mode mother) + (mime-view-buffer (current-buffer) nil mother) ) (let ((pwin (or (get-buffer-window mother) - (get-largest-window) - )) + (get-largest-window))) (pbuf (save-excursion (set-buffer full-buf) mime-preview-buffer))) @@ -611,8 +731,15 @@ It is registered to variable `mime-preview-quitting-method-alist'." (insert-file-contents file) (eval-buffer) ;; format check - (or (eq (car mime-acting-situation-examples) 'type) - (setq mime-acting-situation-examples nil)) + (condition-case nil + (let ((i 0)) + (while (and (> (length mime-acting-situation-example-list) + mime-acting-situation-example-list-max-size) + (< i 16)) + (mime-reduce-acting-situation-examples) + (setq i (1+ i)) + )) + (error (setq mime-acting-situation-example-list nil))) ) (kill-buffer buffer)))) diff --git a/mime-view.el b/mime-view.el index 7e5ab15..93145fb 100644 --- a/mime-view.el +++ b/mime-view.el @@ -980,22 +980,22 @@ button-2 Move to point under the mouse cursor (autoload 'mime-preview-play-current-entity "mime-play" "Play current entity." t) -(defun mime-preview-extract-current-entity () +(defun mime-preview-extract-current-entity (&optional ignore-examples) "Extract current entity into file (maybe). It decodes current entity to call internal or external method as \"extract\" mode. The method is selected from variable `mime-acting-condition'." - (interactive) - (mime-preview-play-current-entity "extract") + (interactive "P") + (mime-preview-play-current-entity ignore-examples "extract") ) -(defun mime-preview-print-current-entity () +(defun mime-preview-print-current-entity (&optional ignore-examples) "Print current entity (maybe). It decodes current entity to call internal or external method as \"print\" mode. The method is selected from variable `mime-acting-condition'." - (interactive) - (mime-preview-play-current-entity "print") + (interactive "P") + (mime-preview-play-current-entity ignore-examples "print") ) diff --git a/semi-def.el b/semi-def.el index e5a33da..0a17b0d 100644 --- a/semi-def.el +++ b/semi-def.el @@ -1,4 +1,4 @@ -;;; semi-def.el --- definition module for REMI +;;; semi-def.el --- definition module for SEMI ;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. @@ -30,7 +30,7 @@ (require 'custom) -(defconst mime-user-interface-version '("SEMI" "Ecch,D~(B-Daimon" 1 8 3) +(defconst mime-user-interface-version '("SEMI" "Takaoka" 1 8 4) "Implementation name, version name and numbers of MIME-kernel package.") (autoload 'mule-caesar-region "mule-caesar" -- 1.7.10.4