~ubuntu-branches/ubuntu/lucid/mew-beta/lucid

« back to all changes in this revision

Viewing changes to mew-pick.el

  • Committer: Bazaar Package Importer
  • Author(s): Tatsuya Kinoshita
  • Date: 2006-10-31 22:07:48 UTC
  • mfrom: (1.1.6 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20061031220748-iq1bg528g9nt2l57
Tags: 5.1.52~0.20061031-1
New upstream release. (CVS trunk on 2006-10-31)

Show diffs side-by-side

added added

removed removed

Lines of Context:
439
439
(defmacro mew-pick-lex-cut ()
440
440
  `(when (and start (< start i))
441
441
     (let ((word (substring pattern start i)) key op val)
442
 
       (if (string-match "^\\([-a-z0-9]+\\)\\(!?==?\\)\\(.+\\)$" word)
 
442
       ;; Allowing "to,cc" 
 
443
       (if (string-match "^\\([-a-z0-9,]+\\)\\(!?==?\\)\\(.+\\)$" word)
443
444
           (progn
444
445
             (setq key (mew-match-string 1 word))
445
446
             (setq op  (mew-match-string 2 word))
533
534
     ((eq cur 'close)
534
535
      (error "')' alone"))
535
536
     ((eq cur 'not)
536
 
      (unless mew-inherit-pick-omit-and
 
537
      (unless (or mew-inherit-pick-omit-and2 mew-inherit-pick-omit-and)
537
538
        (setq mew-inherit-pick-ret (cons 'and mew-inherit-pick-ret)))
538
539
      (setq mew-inherit-pick-tokens (cdr mew-inherit-pick-tokens))
539
540
      (mew-pick-parse-not))
540
541
     ((eq cur 'and)
541
542
      (unless mew-inherit-pick-omit-and
542
543
        (setq mew-inherit-pick-ret (cons 'and mew-inherit-pick-ret)))
 
544
 
543
545
      (setq mew-inherit-pick-tokens (cdr mew-inherit-pick-tokens))
544
546
      (mew-pick-parse-elements))
545
547
     ((eq cur 'or)
629
631
 
630
632
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
631
633
;;;
 
634
;;; Hyper Estraier
 
635
;;;
 
636
 
 
637
(defun mew-pick-canonicalize-pattern-est (pattern)
 
638
  (let ((mew-inherit-pick-omit-and2 t))
 
639
    (mapconcat
 
640
     'mew-pick-native-text-est
 
641
     (mew-pick-parse (mew-pick-lex pattern))
 
642
     " ")))
 
643
 
 
644
(defun mew-pick-native-text-est (token)
 
645
  (mew-pick-native-text "mew-pick-pattern-est-" token))
 
646
 
 
647
(defun mew-pick-pattern-est-and   (sym) "AND")
 
648
(defun mew-pick-pattern-est-or    (sym) "OR")
 
649
(defun mew-pick-pattern-est-open  (sym) (error "'(' is not supported"))
 
650
(defun mew-pick-pattern-est-close (sym) (error "')' is not supported"))
 
651
(defun mew-pick-pattern-est-not   (sym) "ANDNOT")
 
652
(defun mew-pick-pattern-est-key   (key) key)
 
653
(defun mew-pick-pattern-est-kyvl  (kyvl)
 
654
  (error "'%s' is not supported" kyvl))
 
655
 
 
656
(defvar mew-pick-filter-est-head-fields "date,subject,from,to,cc,resent-from,resent-to,resent-cc,reply-to,mail-followup-to,x-mail-count,x-ml-count,x-ml-name,x-seqno,x-sequence,mailinglist-id,message-id,in-reply-to,references,newsgroups,followup-to")
 
657
 
 
658
(defun mew-pick-filter-est-kyvl (kyvl)
 
659
  (unless (and (listp kyvl) (= (length kyvl) 3))
 
660
    (error "Filter is invalid" kyvl))
 
661
  (let ((op (nth 0 kyvl))
 
662
        (ky (nth 1 kyvl))
 
663
        (vl (nth 2 kyvl)))
 
664
    (if (string= ky "head")
 
665
        (setq ky mew-pick-filter-est-head-fields))
 
666
    (cond
 
667
     ((string= op "=")
 
668
      (setq op "ISTRINC"))
 
669
     ((string= op "==")
 
670
      (setq op "STRINC"))
 
671
     ((string= op "!=")
 
672
      (setq op "!ISTRINC"))
 
673
     ((string= op "!==")
 
674
      (setq op "!STRINC"))
 
675
     (t
 
676
      (error "'%s' is not supported" op)))
 
677
    (format "%s %s %s" ky op vl)))
 
678
 
 
679
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
680
;;;
632
681
;;; Namazu
633
682
;;;
634
683
 
658
707
;;;
659
708
 
660
709
(defun mew-pick-canonicalize-pattern-google (pattern)
661
 
  (let* ((mew-inherit-pick-omit-and t)
662
 
         (tokens (mew-pick-parse (mew-pick-lex pattern)))
663
 
         tkn ret)
 
710
  (let ((mew-inherit-pick-omit-and t)
 
711
        (tokens (mew-pick-parse (mew-pick-lex pattern)))
 
712
        tkn ret)
664
713
    (while tokens
665
714
      (setq tkn (car tokens))
666
715
      (setq tokens (cdr tokens))
682
731
 
683
732
(defun mew-pick-pattern-google-and   (sym) "and")
684
733
(defun mew-pick-pattern-google-or    (sym) "or")
685
 
(defun mew-pick-pattern-google-open  (sym) "'(' is not supported")
686
 
(defun mew-pick-pattern-google-close (sym) "')' is not supported")
 
734
(defun mew-pick-pattern-google-open  (sym) (error "'(' is not supported"))
 
735
(defun mew-pick-pattern-google-close (sym) (error "')' is not supported"))
687
736
(defun mew-pick-pattern-google-not   (sym) "-")
688
737
(defun mew-pick-pattern-google-key   (key) key)
689
738
(defun mew-pick-pattern-google-kyvl  (kyvl)
690
739
  (let ((op (nth 0 kyvl)))
691
740
    (error "'%s' is not supported" op)))
692
741
 
693
 
 
694
742
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
695
743
;;;
696
744
;;; WDS
697
745
;;;
698
746
 
699
747
(defun mew-pick-canonicalize-pattern-wds (pattern)
700
 
  (let* ((mew-inherit-pick-omit-and t)
701
 
         (tokens (mew-pick-parse (mew-pick-lex pattern)))
702
 
         tkn ret)
 
748
  (let ((mew-inherit-pick-omit-and t)
 
749
        (tokens (mew-pick-parse (mew-pick-lex pattern)))
 
750
        tkn ret)
703
751
    (while tokens
704
752
      (setq tkn (car tokens))
705
753
      (setq tokens (cdr tokens))
721
769
 
722
770
(defun mew-pick-pattern-wds-and   (sym) "and")
723
771
(defun mew-pick-pattern-wds-or    (sym) "or")
724
 
(defun mew-pick-pattern-wds-open  (sym) "'(' is not supported")
725
 
(defun mew-pick-pattern-wds-close (sym) "')' is not supported")
 
772
(defun mew-pick-pattern-wds-open  (sym) (error "'(' is not supported"))
 
773
(defun mew-pick-pattern-wds-close (sym) (error "')' is not supported"))
726
774
(defun mew-pick-pattern-wds-not   (sym) "-")
727
775
(defun mew-pick-pattern-wds-key   (key) key)
728
776
(defun mew-pick-pattern-wds-kyvl  (kyvl)