* mailcap-viewer-lessp is just plain wrong @ 1999-11-01 19:42 Mark Buda 1999-11-01 21:24 ` Shenghuo ZHU 0 siblings, 1 reply; 6+ messages in thread From: Mark Buda @ 1999-11-01 19:42 UTC (permalink / raw) In pgnus-0.97/lisp/mailcap.el, this seems to be just wrong: (defun mailcap-viewer-lessp (x y) ;; Return t iff viewer X is more desirable than viewer Y (let ((x-wild (string-match "[*?]" (or (cdr-safe (assq 'type x)) ""))) (y-wild (string-match "[*?]" (or (cdr-safe (assq 'type y)) ""))) (x-lisp (not (stringp (or (cdr-safe (assq 'viewer x)) "")))) (y-lisp (not (stringp (or (cdr-safe (assq 'viewer y)) ""))))) (cond ((and x-lisp (not y-lisp)) t) ((and (not y-lisp) x-wild (not y-wild)) t) ((and (not x-wild) y-wild) t) (t nil)))) Shouldn't it be more like: ; blah blah blah (cond ((and x-lisp (not y-wild)) t) ((and y-wild (not x-wild)) t) ((and y-wild (not y-lisp)) t) (t nil)))) ? Even if mine isn't right, the existing function is just wrong. How can X be better if only one is wild, regardless of which one is wild? -- I get my monkeys for nothing and my chimps for free. http://www.clark.net/pub/hermit/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mailcap-viewer-lessp is just plain wrong 1999-11-01 19:42 mailcap-viewer-lessp is just plain wrong Mark Buda @ 1999-11-01 21:24 ` Shenghuo ZHU 1999-11-02 13:55 ` Mark Buda 0 siblings, 1 reply; 6+ messages in thread From: Shenghuo ZHU @ 1999-11-01 21:24 UTC (permalink / raw) >>>>> "Mark" == Mark Buda <hermit@clark.net> writes: Mark> In pgnus-0.97/lisp/mailcap.el, this seems to be just wrong: Mark> (defun mailcap-viewer-lessp (x y) Mark> ;; Return t iff viewer X is more desirable than viewer Y Mark> (let ((x-wild (string-match "[*?]" (or (cdr-safe (assq 'type x)) ""))) Mark> (y-wild (string-match "[*?]" (or (cdr-safe (assq 'type y)) ""))) Mark> (x-lisp (not (stringp (or (cdr-safe (assq 'viewer x)) "")))) Mark> (y-lisp (not (stringp (or (cdr-safe (assq 'viewer y)) ""))))) Mark> (cond Mark> ((and x-lisp (not y-lisp)) Mark> t) Mark> ((and (not y-lisp) x-wild (not y-wild)) Mark> t) Mark> ((and (not x-wild) y-wild) Mark> t) Mark> (t nil)))) Mark> Shouldn't it be more like: Mark> ; blah blah blah Mark> (cond Mark> ((and x-lisp (not y-wild)) Mark> t) Mark> ((and y-wild (not x-wild)) Mark> t) Mark> ((and y-wild (not y-lisp)) Mark> t) Mark> (t nil)))) Mark> ? Mark> Even if mine isn't right, the existing function is just wrong. How can Mark> X be better if only one is wild, regardless of which one is wild? Your argument is right, but I don't think yours function is right. In the case that both X and Y are lisp, X is wild, while Y is not wild, your function returns 't. How can X be better than Y? Another problem is, in the case that X is wild and list, Y is neither wild nor list, both evaluations of (mailcap-viewer-lessp x y) and (mailcap-viewer-lessp y x) return 't for both the functions. -- Shenghuo ZHU ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mailcap-viewer-lessp is just plain wrong 1999-11-01 21:24 ` Shenghuo ZHU @ 1999-11-02 13:55 ` Mark Buda 1999-11-03 20:33 ` Shenghuo ZHU 0 siblings, 1 reply; 6+ messages in thread From: Mark Buda @ 1999-11-02 13:55 UTC (permalink / raw) Cc: ding >>>>> "ZSH" == Shenghuo ZHU <zsh@cs.rochester.edu> writes: Mark> Even if mine isn't right, the existing function is just Mark> wrong. How can X be better if only one is wild, regardless Mark> of which one is wild? ZSH> Your argument is right, but I don't think yours function is right. In ZSH> the case that both X and Y are lisp, X is wild, while Y is not wild, ZSH> your function returns 't. How can X be better than Y? ZSH> Another problem is, in the case that X is wild and list, Y is neither ZSH> wild nor list, both evaluations of (mailcap-viewer-lessp x y) and ZSH> (mailcap-viewer-lessp y x) return 't for both the functions. Well, by better I meant that mine produced the correct value in the case I was concerned about :-) Perhaps I miscopied something from my sheet of paper (which I threw out, so I'll never know). This should be right, though. Better, anyway. (cond ; if only one is wild, the other one is better ((and x-wild (not y-wild)) nil) ((and (not x-wild) y-wild) t) ; otherwise, if only one is lisp, it is better ((and x-lisp (not y-lisp)) t) ((and (not x-lisp) y-lisp) nil) ; otherwise, compare them some other arbitrary way (t (blah blah blah))) -- I get my monkeys for nothing and my chimps for free. http://www.clark.net/pub/hermit/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mailcap-viewer-lessp is just plain wrong 1999-11-02 13:55 ` Mark Buda @ 1999-11-03 20:33 ` Shenghuo ZHU 1999-11-04 11:17 ` Toby Speight 0 siblings, 1 reply; 6+ messages in thread From: Shenghuo ZHU @ 1999-11-03 20:33 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 647 bytes --] >>>>> "Mark" == Mark Buda <hermit@clark.net> writes: [...] Mark> (cond Mark> ; if only one is wild, the other one is better Mark> ((and x-wild (not y-wild)) Mark> nil) Mark> ((and (not x-wild) y-wild) Mark> t) Mark> ; otherwise, if only one is lisp, it is better Mark> ((and x-lisp (not y-lisp)) Mark> t) Mark> ((and (not x-lisp) y-lisp) Mark> nil) This condition is not necessary. Mark> ; otherwise, compare them some other arbitrary way Mark> (t Mark> (blah blah blah))) Done. Committed to CVS. -- Shenghuo ZHU 1999-11-03 15:27:38 Shenghuo ZHU <zsh@cs.rochester.edu> * mailcap.el (mailcap-viewer-lessp): Fix bug. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 97-121.diff --] [-- Type: text/x-patch, Size: 673 bytes --] Index: mailcap.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/mailcap.el,v retrieving revision 5.23 diff -u -r5.23 mailcap.el --- mailcap.el 1999/07/09 19:28:56 5.23 +++ mailcap.el 1999/11/03 20:29:40 @@ -623,11 +623,11 @@ (x-lisp (not (stringp (or (cdr-safe (assq 'viewer x)) "")))) (y-lisp (not (stringp (or (cdr-safe (assq 'viewer y)) ""))))) (cond - ((and x-lisp (not y-lisp)) - t) - ((and (not y-lisp) x-wild (not y-wild)) - t) + ((and x-wild (not y-wild)) + nil) ((and (not x-wild) y-wild) + t) + ((and (not y-lisp) x-lisp) t) (t nil)))) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mailcap-viewer-lessp is just plain wrong 1999-11-03 20:33 ` Shenghuo ZHU @ 1999-11-04 11:17 ` Toby Speight 1999-11-04 15:49 ` Shenghuo ZHU 0 siblings, 1 reply; 6+ messages in thread From: Toby Speight @ 1999-11-04 11:17 UTC (permalink / raw) Mark> Mark Buda <URL:mailto:hermit@clark.net> ZSH> Shenghuo ZHU <URL:mailto:zsh@cs.rochester.edu> 0> In article <871za9ov5p.fsf@pazuzu.eudaemonia.org>, Mark wrote: Mark> (cond Mark> ; if only one is wild, the other one is better Mark> ((and x-wild (not y-wild)) Mark> nil) Mark> ((and (not x-wild) y-wild) Mark> t) Mark> ; otherwise, if only one is lisp, it is better Mark> ((and x-lisp (not y-lisp)) Mark> t) Mark> Mark> ((and (not x-lisp) y-lisp) Mark> nil) 0> In article <5bbt9bfh7k.fsf@brain.cs.rochester.edu>, ZSH wrote: ZSH> This condition is not necessary. I think it is useful if we finish the final test (i.e. the "(blah blah blah)" below - perhaps using Q values, as in HTTP), because without it we can fall through and choose X instead of Y even if Y is lisp and X is external. Mark> ; otherwise, compare them some other arbitrary way Mark> (t Mark> (blah blah blah))) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mailcap-viewer-lessp is just plain wrong 1999-11-04 11:17 ` Toby Speight @ 1999-11-04 15:49 ` Shenghuo ZHU 0 siblings, 0 replies; 6+ messages in thread From: Shenghuo ZHU @ 1999-11-04 15:49 UTC (permalink / raw) >>>>> "Toby" == Toby Speight <Toby.Speight@streapadair.freeserve.co.uk> writes: [...] Toby> I think it is useful if we finish the final test (i.e. the "(blah blah Toby> blah)" below - perhaps using Q values, as in HTTP), because without it Toby> we can fall through and choose X instead of Y even if Y is lisp and X Toby> is external. [...] The final test is (t nil). What I did is building those tests according to a Venn diagram. -- Shenghuo ZHU ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1999-11-04 15:49 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1999-11-01 19:42 mailcap-viewer-lessp is just plain wrong Mark Buda 1999-11-01 21:24 ` Shenghuo ZHU 1999-11-02 13:55 ` Mark Buda 1999-11-03 20:33 ` Shenghuo ZHU 1999-11-04 11:17 ` Toby Speight 1999-11-04 15:49 ` Shenghuo ZHU
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).