annotate my-news.el @ 32:cb9b76219c55

attempt to merge mail read and send from all over
author Henry S Thompson <ht@inf.ed.ac.uk>
date Sun, 08 Oct 2023 16:36:27 +0100
parents 0e5b39d2f8bb
children 034ed479179e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
1 (message "my-news")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
2 ; (debug-on-entry 'gnus-start-news-server)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
3 (setq
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
4 gnus-select-method '(nntp "hebe.uk.clara.net")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
5 gnus-post-method '(nntp "usenet.inf.ed.ac.uk")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
6 gnus-nntp-server nil ; override local default
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
7 )
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
8
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
9 (setq gnus-use-scoring nil ; not used yet
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
10 gnus-summary-gather-subject-limit nil
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
11 gnus-thread-sort-functions
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
12 '(gnus-thread-sort-by-number gnus-thread-sort-by-simpl-subject)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
13 gnus-summary-line-format "%U%R%5N%I%(%[%4L: %-12,12A%]%) %s\n"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
14 gnus-summary-make-false-root 'none
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
15 gnus-mime-display-multipart-related-as-mixed t
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
16 gnus-simplify-subject-regexp "^\\(re[:;.]\\| \\|fwd:\\)*")
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
17
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
18 (defsubst gnus-trim-simplify-subject (text)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
19 (if (string-match gnus-simplify-subject-regexp text)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
20 (substring text (match-end 0))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
21 text))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
22
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
23 (defun gnus-thread-sort-by-simpl-subject (h1 h2)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
24 "sort by slightly simplified subject"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
25 ; (message (format "%s:%s %s:%s" (mail-header-number (gnus-thread-header h1))(mail-header-subject (gnus-thread-header h1))(mail-header-number (gnus-thread-header h2))(mail-header-subject (gnus-thread-header h2))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
26 (let ((case-fold-search t))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
27 (let ((result
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
28 (string-lessp
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
29 (downcase (gnus-trim-simplify-subject (mail-header-subject
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
30 (gnus-thread-header h1))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
31 (downcase (gnus-trim-simplify-subject (mail-header-subject
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
32 (gnus-thread-header h2)))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
33 ; (message (format " %s\n" result))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
34 result)))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
35
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
36
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
37 (setq nnfolder-get-new-mail nil
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
38 nnfolder-inhibit-expiry t
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
39 gnus-secondary-select-methods
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
40 '((nnml "ht"
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
41 (gnus-show-threads nil)
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
42 (gnus-article-sort-functions
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
43 (gnus-article-sort-by-subject gnus-article-sort-by-date))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
44 )))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
45 ;;; fixup clarinews
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
46 ;(autoload 'gnus-clarinews-fun "clari-clean" "Clean ClariNews articles" t)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
47 ;(add-hook 'gnus-article-prepare-hook 'gnus-clarinews-fun)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
48
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
49
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
50 (defun gnus-Subject-sort-by-subject-and-date (reverse)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
51 "Sort subject display buffer by subject alphabetically. `Re:'s are ignored.
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
52 If case-fold-search is non-nil, case of letters is ignored. Date is used
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
53 if subjects are equal
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
54 Argument REVERSE means reverse order."
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
55 (interactive "P")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
56 (gnus-summary-sort-summary
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
57 (function
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
58 (lambda (a b)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
59 (let ((s-a (gnus-trim-simplify-subject (nntp-header-subject a)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
60 (s-b (gnus-trim-simplify-subject (nntp-header-subject b)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
61 )
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
62 (or (gnus-string-lessp s-a s-b)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
63 (and (gnus-string-equal s-a s-b)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
64 (gnus-date-lessp (nntp-header-date a)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
65 (nntp-header-date b)))))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
66 reverse
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
67 ))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
68
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
69 ;(require 'util-mde) ; for string-replace-regexp-2
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
70
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
71
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
72 (defun gnus-string-equal (a b)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
73 "Return T if first arg string is equal than second in lexicographic order.
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
74 If case-fold-search is non-nil, case of letters is ignored."
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
75 (if case-fold-search
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
76 (string-equal (downcase a) (downcase b)) (string-equal a b)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
77
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
78 (defun gnus-Group-update-and-vanish ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
79 "update newsrc and restore config pre-group selection"
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
80 (interactive)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
81 (gnus-group-force-update)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
82 (if gnus-pre-config
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
83 (set-window-configuration gnus-pre-config))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
84 ; (setq gnus-pre-config nil)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
85 )
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
86
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
87 ;; Database stuff
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
88 (defun open-white ()
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
89 (setq whitelist-db (open-database (concat my-mail-dir "/white") 'berkeley-db)))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
90 (defun save-white ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
91 (close-database whitelist-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
92 (open-white))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
93
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
94 (defun open-ad ()
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
95 (setq adlist-db (open-database (concat my-mail-dir "/ad") 'berkeley-db)))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
96
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
97 (defun save-ad ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
98 (close-database adlist-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
99 (open-ad))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
100
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
101 (defun open-quaker ()
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
102 (setq quaker-db (open-database (concat my-mail-dir "/quaker") 'berkeley-db)))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
103 (defun save-quaker ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
104 (close-database quaker-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
105 (open-quaker))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
106
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
107 (defvar database-names '(whitelist-db adlist-db quaker-db) "sic")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
108
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
109 (defun db-status (&optional name)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
110 "Check on the whereabouts of a name"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
111 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
112 (let ((addr
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
113 (or name
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
114 (progn
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
115 (gnus-summary-goto-article (gnus-summary-article-number))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
116 (get-canonical-from-addr (get-current-from-components)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
117 res)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
118 (dolist (dbn database-names)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
119 (if (get-database addr (eval dbn))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
120 (setq res (cons dbn res))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
121 (if name
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
122 res
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
123 (message "%s" res))))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
124
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
125 (defun add-white (&optional addToBBDB)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
126 (interactive "P")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
127 (gnus-summary-goto-article (gnus-summary-article-number))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
128 (let* ((components (get-current-from-components))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
129 (addr (get-canonical-from-addr components)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
130 (if (new-white addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
131 (save-white))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
132 (if addToBBDB
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
133 (let ((bbdb-no-duplicates-p t))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
134 (bbdb-create-internal (car components) nil (cadr components)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
135 nil nil nil)))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
136
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
137 (defun add-ad ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
138 (interactive)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
139 (gnus-summary-goto-article (gnus-summary-article-number))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
140 (let ((addr (get-current-from-addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
141 (if (or (not (get-database addr whitelist-db))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
142 (yes-or-no-p "Already white, really convert to ad?"))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
143 (if (new-ad addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
144 (save-ad)))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
145
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
146 (defun add-quaker()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
147 (interactive)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
148 (let ((addr (get-addr-before-point)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
149 (when (new-quaker addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
150 (save-quaker))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
151 (quaker-sig-maybe)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
152
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
153 ; not needed anymore because of gnus-posting-styles (q.v. in gnus-init)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
154 (defun quaker-sig-if-to-quaker ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
155 (let ((message-options))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
156 (save-excursion (message-options-set-recipient))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
157 (let* ((recipStr (message-options-get 'message-recipients))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
158 (recips (split-string (downcase recipStr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
159 ",[ \f\t\n\r\v]+" t)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
160 (while (and recips
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
161 (not (quaker-sig-if-quaker-1 (car recips))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
162 (setq recips (cdr recips))))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
163
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
164 (defun to-quaker-p ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
165 (let ((message-options))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
166 (save-excursion (message-options-set-recipient))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
167 (let* ((recipStr (message-options-get 'message-recipients))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
168 (recips (split-string (downcase recipStr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
169 ",[ \f\t\n\r\v]+" t)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
170 (while (and recips
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
171 (not (get-database (car recips) quaker-db)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
172 (setq recips (cdr recips)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
173 (not (null recips)))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
174
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
175 (defun quaker-sig-if-quaker ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
176 (quaker-sig-if-quaker-1 (get-addr-before-point)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
177
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
178 (defun quaker-sig-if-quaker-1 (addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
179 (if (get-database addr quaker-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
180 (progn (quaker-sig-maybe)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
181 t)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
182
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
183 (defun kill-white ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
184 (interactive)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
185 (gnus-summary-goto-article (gnus-summary-article-number))
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
186 (let ((addr (downcase (get-current-from-addr))))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
187 (rem-white addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
188
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
189 (defun kill-ad ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
190 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
191 (gnus-summary-goto-article (gnus-summary-article-number))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
192 (let ((addr (downcase (get-current-from-addr))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
193 (rem-ad addr)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
194
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
195 (defun get-from-gnus-addr ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
196 (get-from-addr (gnus-fetch-field "From")))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
197
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
198 (defun get-from-addr (addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
199 (get-canonical-from-addr (gnus-extract-address-components addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
200
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
201 (defun get-canonical-from-addr (components)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
202 (downcase (cadr components)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
203
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
204 (defun get-current-from-addr ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
205 (with-current-buffer gnus-article-buffer
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
206 (get-from-gnus-addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
207
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
208 (defun get-current-from-components ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
209 (with-current-buffer gnus-article-buffer
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
210 (gnus-extract-address-components (gnus-fetch-field "From"))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
211
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
212 (defun get-addr-before-point ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
213 (let ((cur (point)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
214 (save-excursion
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
215 (get-from-addr (buffer-substring (+ (search-backward " ") 1) cur)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
216 ))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
217
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
218 (defun blacken-and-delete (group)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
219 ;; mis-named now
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
220 ;; this is part of the expiry processing for xxxSPAM groups, and
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
221 ;; actually whitens the from addresses of #-marked articles
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
222 ;; The return value is crucial (and crucially outside of the scope of the if)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
223 (if (memq number
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
224 (with-current-buffer gnus-summary-buffer
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
225 gnus-newsgroup-processable))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
226 (let ((addr (get-from-gnus-addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
227 (new-white addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
228 'delete)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
229
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
230 (defun unwhiten-and-delete (group)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
231 ;; unused except in stale groups -- usable as an expiry
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
232 (if (memq number
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
233 (with-current-buffer gnus-summary-buffer
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
234 gnus-newsgroup-processable))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
235 (let ((addr (get-from-gnus-addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
236 (remove-database addr whitelist-db)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
237 'delete)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
238
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
239 (defun known-black (list)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
240 (if (get-database (get-from-gnus-addr) blacklist-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
241 list))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
242
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
243 (defun white-spam (list)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
244 (if (or (equal (get-database (get-from-gnus-addr) whitelist-db) "t")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
245 (let ((case-fold-search t)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
246 (subj (gnus-fetch-field "Subject"))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
247 (from (get-from-gnus-addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
248 (or
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
249 (and subj (string-match white-subjects subj))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
250 (and from
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
251 (let ((fromDom (substring from (+ 1 (search "@" from)))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
252 (and fromDom (member fromDom white-domains)))))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
253 list))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
254
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
255 (defun ad-spam (list)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
256 (if (let ((from (get-from-gnus-addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
257 (or
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
258 (equal (get-database from adlist-db) "t")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
259 (and from
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
260 (let ((fromDom (substring from (+ 1 (search "@" from)))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
261 (and fromDom (member fromDom ad-domains))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
262 ))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
263 list))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
264
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
265 (defun bogoNote (group)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
266 (if (memq number
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
267 (with-current-buffer gnus-summary-buffer
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
268 gnus-newsgroup-processable))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
269 (let ((addr (get-from-gnus-addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
270 (new-white addr)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
271 (shell-command-on-region (point-min) (point-max)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
272 "/afs/inf.ed.ac.uk/user/h/ht/share/bin/local/makeBogo")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
273 'delete)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
274
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
275 (defun whiten-recip ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
276 ;;; a hook for outgoing mail
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
277 (let* ((recips (message-options-get 'message-recipients))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
278 (res (mapcar (function new-white)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
279 (split-string (downcase recips)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
280 ",[ \f\t\n\r\v]*" t))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
281 (while (and res (not (car res)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
282 (setq res (cdr res)))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
283 (if res (save-white))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
284
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
285
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
286 (defun new-white (addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
287 (if (get-database addr whitelist-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
288 nil
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
289 (put-database addr "t" whitelist-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
290 t))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
291
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
292 (defun new-ad (addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
293 (if (get-database addr adlist-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
294 nil
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
295 (put-database addr "t" adlist-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
296 t))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
297
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
298 (defun rem-ad (addr)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
299 (remove-database addr adlist-db)
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
300 (save-ad))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
301
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
302 (defun new-quaker (addr)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
303 (if (get-database addr quaker-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
304 nil
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
305 (put-database addr "t" quaker-db)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
306 t))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
307
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
308 (defun rem-white (addr)
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
309 (remove-database (downcase addr) whitelist-db)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
310 (save-white))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
311
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
312 (defun bogoOK (group)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
313 (shell-command-on-region (point-min) (point-max)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
314 "/afs/inf.ed.ac.uk/user/h/ht/share/bin/local/makeNonBogo")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
315 'delete)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
316
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
317 (defun del-dups ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
318 (interactive)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
319 (gnus-summary-sort-by-subject)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
320 (gnus-summary-clear-mark-forward 1)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
321 (goto-char (point-min))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
322 (let ((pos))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
323 (while (setq pos (search-forward "] " nil t))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
324 (end-of-line)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
325 (let ((subj (buffer-substring pos (point))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
326 (unless (equal subj "")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
327 (let ((target (if (< (length subj) 26)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
328 (concat "] " subj "\n")
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
329 (concat "] " (substring subj 0 25))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
330 (done 0)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
331 (case-fold-search nil))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
332 (while (and (= done 0)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
333 (search-forward target nil t))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
334 (forward-char -3)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
335 (setq done (gnus-summary-mark-as-read-forward 1))))))))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
336 (gnus-summary-limit-to-unread)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
337 (gnus-summary-sort-by-original))
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
338
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
339 (defun mark-and-mark (n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
340 (interactive "p")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
341 (while (>= n 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
342 (gnus-summary-mark-as-read)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
343 (gnus-summary-mark-as-processable 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
344 (setq n (- n 1))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
345
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
346 (defun split-on-whole-field (field pat list)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
347 (goto-char (point-max))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
348 (let ((hit (assq pat wsp-cache))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
349 rpat)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
350 (if hit
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
351 (setq rpat (cdr hit))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
352 (setq rpat
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
353 (concat "^"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
354 field
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
355 ":\\s-*"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
356 (if (stringp pat)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
357 pat
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
358 (cdr (assq pat
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
359 nnmail-split-abbrev-alist)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
360 "$"))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
361 (setq wsp-cache (cons (cons pat rpat) wsp-cache)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
362 (if (re-search-backward rpat nil t)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
363 list)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
364
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
365 (defun ht-gnus-summary-delete-forward ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
366 "REAL delete for nnmail gnus"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
367 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
368 (gnus-summary-delete-article)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
369 (gnus-summary-next-unread-article))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
370
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
371 ;; run the first time we make a summary window
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
372 (defun gnus-summary-mode-fun1 ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
373 "install ht's mods"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
374 (define-key gnus-summary-mode-map "D" 'ht-gnus-summary-delete-forward)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
375 (define-key gnus-summary-mode-map "~" 'mark-and-mark)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
376 (define-key gnus-summary-mode-map "\M-d" 'gnus-edit-and-move-to-diary)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
377 (define-key gnus-summary-mode-map "\M-e" 'gnus-extract-attachment)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
378 (define-key gnus-summary-mode-map "\M-w" 'add-white)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
379 (define-key gnus-summary-mode-map [(control meta w)] 'copy-region-to-kill)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
380 (define-key gnus-summary-mode-map "\M-h" 'showMPAhtml)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
381 ;(define-key gnus-summary-mode-map [(control meta w)] 'kill-white)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
382 (define-key gnus-summary-mode-map "\M-a" 'add-ad)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
383 (define-key gnus-summary-mode-map "\M-n" 'ht-next-unseen-maybe)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
384 (define-key gnus-summary-mode-map "\M-c" 'ht-catchup-and-next-unseen)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
385 (define-key gnus-summary-mime-map "O" 'ht-article-save-parts)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
386 (define-key gnus-summary-backend-map "M" 'ht-move-to-pers)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
387 (remove-hook 'gnus-summary-mode-hook 'gnus-summary-mode-fun1))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
388
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
389 (defun message-mode-fun1 ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
390 (define-key message-mode-map [(control meta q)] 'add-quaker)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
391 (remove-hook 'message-mode-hook 'message-mode-fun1))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
392
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
393 (defvar ht-gnus-just-read nil)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
394
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
395 (defun ht-catchup-and-next-unseen ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
396 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
397 (when (gnus-summary-catchup nil t nil 'fast)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
398 (gnus-summary-exit)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
399 (previous-line 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
400 (ht-next-with-unseen 1)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
401
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
402 (defun ht-next-unseen-maybe (n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
403 (interactive "p")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
404 (cond
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
405 ((eq (gnus-summary-next-unread-subject n) n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
406 (gnus-summary-exit)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
407 (previous-line 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
408 (if (ht-next-with-unseen n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
409 (ht-read-group-unseen-only)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
410
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
411 (defun ht-gnus-pers-refresh (n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
412 (interactive "p")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
413 (let ((gn (concat "nnml+ht:pers-"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
414 (format-time-string "%Y-%m" (current-time)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
415 (gnus-group-get-new-news)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
416 (let ((nn (gnus-number-of-unseen-articles-in-group gn)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
417 (gnus-group-goto-group gn)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
418 (cond
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
419 ((> nn 0)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
420 (gnus-group-read-group nn))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
421 ((> n 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
422 (let ((gnus-auto-select-subject
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
423 (lambda ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
424 (goto-char (point-max))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
425 (previous-line 1))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
426 (gnus-group-read-group nil t)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
427 (t (goto-char (point-min))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
428 (ht-next-with-unseen 1))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
429 (message "%s" ht-gnus-just-read))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
430 )
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
431
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
432 (defun no-select ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
433 (if (member gnus-newsgroup-name no-select-groups)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
434 (progn (make-variable-buffer-local 'gnus-auto-select-first)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
435 (setq gnus-auto-select-first nil))))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
436
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
437 (defun showMPAhtml ()
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
438 "Show the text/html parts of an multipart/alternative message using lynx"
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
439 (interactive)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
440 (gnus-summary-select-article)
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
441 (with-current-buffer gnus-original-article-buffer
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
442 (shell-command-on-region (point-min) (point-max)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
443 (expand-file-name "~/bin/showMPA.sh"))
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
444 )
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
445 )
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
446
32
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
447
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
448 ;; run the first time we make a group window
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
449 (defun gnus-group-mode-fun1 ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
450 "install ht's mods"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
451 (require 'gnus-msg)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
452 (define-key gnus-group-mode-map "\M-\C-g" 'ht-gnus-pers-refresh)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
453 (define-key gnus-group-mode-map "\M-n" 'ht-next-with-unseen)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
454 (define-key gnus-group-mode-map "\M-p" 'ht-previous-with-unseen)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
455 (define-key gnus-group-mode-map "\M- " 'ht-read-group-unseen-only)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
456 (define-key gnus-send-bounce-map "R" 'resend-to-schemadev)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
457 (define-key gnus-send-bounce-map "x" 'flush-all-nogoods)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
458 (remove-hook 'gnus-group-mode-hook 'gnus-group-mode-fun1))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
459
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
460 (defun flush-all-nogoods ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
461 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
462 (while (re-search-forward
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
463 "] \\(\\(Returned\\|\\([Uu]n\\|[Nn]on-?\\)deliver\\(able\\|ed\\)\\)\\( [Mm]ail\\|:?\\)\\|DELIVERY FAILURE\\|Delivery \\(Notification: Delivery has failed\\|Status Notification .\\(Failure\\|Delay\\).\\)\\|failure \\(notice\\|delivery\\)\\)"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
464 nil t)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
465 (gnus-summary-mark-as-read)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
466 (end-of-line)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
467
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
468 (defun gnus-user-format-function-t (header)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
469 "display the to field (for archive messages)"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
470 (let ((n (mail-header-number header)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
471 (with-current-buffer nntp-server-buffer
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
472 (save-excursion
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
473 (save-restriction
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
474 (let ((inhibit-point-motion-hooks t))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
475 (goto-char (point-min))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
476 (let ((beg (search-forward (format " %d Article retrieved." n)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
477 (end (search-forward "\n.\n")))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
478 (narrow-to-region beg end)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
479 (goto-char beg)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
480 (message-fetch-field "To"))))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
481
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
482 (defun gnus-extract-attachment ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
483 "extract attachments from a multi-part mime message"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
484 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
485 (let ((sm gnus-show-mime))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
486 (if sm
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
487 (progn (setq gnus-show-mime nil)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
488 (gnus-summary-select-article t 'force))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
489 )
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
490 (gnus-summary-show-all-headers)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
491 (with-current-buffer gnus-article-buffer
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
492 (save-excursion
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
493 (save-restriction
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
494 (mime/viewer-mode)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
495 (delete-other-windows)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
496 (let ((pt 0))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
497 (while (progn
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
498 (mime-viewer/next-content)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
499 (and
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
500 (equal "*Preview-*Article**" (buffer-name (current-buffer)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
501 (not (= pt (point)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
502 (setq pt (point))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
503 (if (looking-at "^\\[[0-9]* \\([^ ]+ \\)+<")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
504 (mime-viewer/extract-content)))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
505 (kill-buffer "*Preview-*Article**")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
506 (setq gnus-show-mime sm)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
507 ))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
508
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
509 ;;; Why???
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
510 (make-variable-buffer-local 'gnus-extra-headers)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
511 (make-variable-buffer-local 'nnmail-extra-headers)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
512
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
513
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
514 (defun resend-to-schemadev ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
515 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
516 (message "forwarding to xmlschema-dev")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
517 (gnus-summary-resend-message "xmlschema-dev@w3.org" 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
518 (gnus-summary-next-unread-article))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
519
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
520 (defun brutal-resend ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
521 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
522 (message "editing for resend. . .")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
523 (unless (eq (gnus-summary-article-number)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
524 gnus-current-article)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
525 (gnus-summary-select-article t))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
526 (gnus-summary-toggle-header 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
527 (with-current-buffer gnus-article-buffer
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
528 (toggle-read-only)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
529 (gnus-article-date-original)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
530 (goto-char (point-min))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
531 (replace-regexp "^\\(X-Diagnostic\\|X-Envelope-To\\|X-Original-To\\|Delivered-To\\):.*\n" "")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
532 (goto-char (point-min))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
533 (gnus-summary-edit-article-done
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
534 (or (mail-header-references gnus-current-headers) "")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
535 (gnus-group-read-only-p) gnus-summary-buffer nil))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
536 (call-interactively (function gnus-summary-resend-message))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
537 (gnus-summary-next-unread-article))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
538
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
539 ; (unless (fboundp 'builtin-coding-system-p)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
540 ; (fset 'builtin-coding-system-p (symbol-function 'coding-system-p))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
541 ; (defun coding-system-p (obj)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
542 ; (cond
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
543 ; ((builtin-coding-system-p obj) t)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
544 ; ((memq obj '(utf-8 gb2312 koi8-r iso-8859-1))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
545 ; (message (format "Coding system: %s" obj))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
546 ; t))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
547
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
548 ;;; dangerous hack to improve display of names and subjects in mail/news
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
549 (if nil (progn
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
550 (require 'mm-util)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
551 (defun mm-decode-coding-string (str cs)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
552 (if (and str (eq cs 'utf-8))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
553 (if (or (string-match "Â" str)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
554 (string-match "Ã" str))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
555 (let* ((r 0) ; read pointer
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
556 (w 0) ; write pointer
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
557 (l (length str)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
558 (while (< r l)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
559 (let* ((c (aref str r))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
560 (i (char-int c)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
561 (cond ((= i 194)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
562 (aset str w (aref str (+ r 1)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
563 (setq r (+ r 2)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
564 ((= i 195)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
565 (aset str w
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
566 (int-char
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
567 (+ 64
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
568 (char-int (aref str (+ r 1))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
569 (setq r (+ r 2)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
570 (t
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
571 (aset str w c)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
572 (setq r (+ r 1)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
573 (setq w (+ w 1)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
574 (substring str 0 w))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
575 str)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
576 str))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
577
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
578 (defun mm-sort-coding-systems-predicate (a b)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
579 ;; from mm-util, abort if no priorities
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
580 (or (not mm-coding-system-priorities)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
581 (let ((priorities
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
582 (mapcar (lambda (cs)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
583 ;; Note: invalid entries are dropped silently
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
584 (and (setq cs (mm-coding-system-p cs))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
585 (coding-system-base cs)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
586 mm-coding-system-priorities)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
587 (and (setq a (mm-coding-system-p a))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
588 (if (setq b (mm-coding-system-p b))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
589 (> (length (memq (coding-system-base a) priorities))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
590 (length (memq (coding-system-base b) priorities)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
591 t)))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
592
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
593 (require 'browse-url)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
594
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
595 ;;; This version collects extra lines if you use right-button
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
596 ;;; to click on a URL
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
597 (defun browse-url (url &rest args)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
598 "Ask a WWW browser to load URL.
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
599 Prompts for a URL, defaulting to the URL at or before point. Variable
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
600 `browse-url-browser-function' says which browser to use."
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
601 (interactive (browse-url-interactive-arg "URL: "))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
602 (unless (interactive-p)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
603 (setq args (or args (list browse-url-new-window-flag))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
604 (if (and (boundp 'event)(= 3 (event-button event)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
605 (let ((thisLine url))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
606 (while (and (progn (forward-char (length thisLine))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
607 (eolp))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
608 (progn (forward-line 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
609 (beginning-of-line)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
610 (not (looking-at "\\s-"))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
611 (looking-at "\\S-*")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
612 (setq thisLine (buffer-substring (match-beginning 0)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
613 (match-end 0)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
614 (setq url (concat url thisLine)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
615 (if (functionp browse-url-browser-function)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
616 (apply browse-url-browser-function url args)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
617 ;; The `function' can be an alist; look down it for first match
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
618 ;; and apply the function (which might be a lambda).
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
619 (catch 'done
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
620 (dolist (bf browse-url-browser-function)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
621 (when (string-match (car bf) url)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
622 (apply (cdr bf) url args)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
623 (throw 'done t)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
624 (error "No browse-url-browser-function matching URL %s"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
625 url))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
626
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
627 (defun gnus-user-format-function-H (dummy)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
628 (format "%c"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
629 (cond ((eq gnus-tmp-summary-live ?*)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
630 ?*)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
631 ((> (gnus-number-of-unseen-articles-in-group gnus-tmp-group) 0)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
632 ?.)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
633 (t ? ))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
634
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
635 (defun ht-next-with-unseen (n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
636 (interactive "p")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
637 (let* ((gvl (mapcar (function string-to-number)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
638 (split-string gnus-version-number "\\.")))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
639 (pattern (if (or (> (car gvl) 5)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
640 (and (eq (car gvl) 5)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
641 (or (> (cadr gvl) 10)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
642 (and (eq (cadr gvl) 10)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
643 (> (caddr gvl) 7)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
644 "\\."
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
645 ":\\.")))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
646 (if (looking-at pattern)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
647 (if (< n 0)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
648 (backward-char 1)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
649 (forward-char 1)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
650 (let ((missing 0)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
651 (winning (looking-at pattern)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
652 (while (and (zerop missing)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
653 (not winning))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
654 (setq missing (gnus-group-next-unread-group n))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
655 (setq winning (looking-at pattern)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
656 winning)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
657
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
658 (defun ht-read-group-unseen-only ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
659 (interactive)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
660 (gnus-group-read-group
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
661 (gnus-number-of-unseen-articles-in-group (gnus-group-group-name))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
662
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
663 (defun ht-previous-with-unseen (n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
664 (interactive "p")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
665 (ht-next-with-unseen (- n)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
666
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
667 (defun ht-gnus-note-save-to-group ()
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
668 (let ((g (caar group-art)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
669 (if (not (member g ht-gnus-just-read))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
670 (setq ht-gnus-just-read (cons g ht-gnus-just-read)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
671
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
672 (defvar ht-stash-directory (concat my-mail-dir "/stash/"))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
673
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
674 (defun ht-save-part (handle n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
675 (let ((sup-type (mm-handle-media-supertype handle))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
676 (sub-type (mm-handle-media-subtype handle)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
677 (message (format "%s %s/%s" n sup-type sub-type))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
678 (cond ((and (equal sup-type "multipart")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
679 (or (equal sub-type "alternative")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
680 (equal sub-type "related")))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
681 (let ((alts (cddr handle))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
682 (j 0))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
683 (while alts
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
684 (let* ((alt (pop alts))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
685 (handle-type (mm-handle-type alt)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
686 (let* ((sub (mm-handle-media-subtype alt))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
687 (ext (cdr
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
688 (assoc sub '(("calendar" . "vcs")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
689 ("v-calendar" . "vcs"))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
690 (setq j (+ j 1))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
691 (if (not (or (mail-content-type-get
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
692 (mm-handle-disposition alt) 'filename)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
693 (mail-content-type-get
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
694 handle-type 'name)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
695 (nconc
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
696 handle-type
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
697 (list (cons 'name (format "%s.%s.%s"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
698 n j (or ext sub))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
699 (ht-save-part alt (format "%s.%s" n j)))))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
700 ((and (equal sup-type "text")(not
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
701 (member sub-type '("html"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
702 "v-calendar"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
703 "calendar"))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
704 (message "Skipping text part: %s" (mm-handle-disposition handle)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
705 (t
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
706 (mm-save-part handle)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
707
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
708 (defun ht-move-to-pers (n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
709 (interactive "p")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
710 (gnus-summary-move-article n
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
711 (concat
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
712 "nnml+ht:pers-"
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
713 (format-time-string "%Y-%m" (current-time)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
714
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
715 (defun ht-article-save-parts (n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
716 "Save non t/p MIME parts starting at N, which is the numerical prefix."
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
717 (interactive "p2")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
718 (let ((window (get-buffer-window gnus-article-buffer 'visible))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
719 frame)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
720 (when window
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
721 ;; It is necessary to select the article window so that
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
722 ;; `gnus-article-goto-part' may really move the point.
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
723 (setq frame (selected-frame))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
724 (gnus-select-frame-set-input-focus (window-frame window))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
725 (unwind-protect
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
726 (save-window-excursion
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
727 (select-window window)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
728 (let ((len (length gnus-article-mime-handle-alist)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
729 (setq mm-default-directory ht-stash-directory)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
730 (while (<= n len)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
731 (gnus-article-goto-part n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
732 (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
733 (ht-save-part handle n))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
734 (setq n (+ n 1))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
735 )))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
736 (gnus-select-frame-set-input-focus frame))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
737 )
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
738
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
739
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
740 (defun gnus-article-part-wrapper (n function)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
741 (let ((window (get-buffer-window gnus-article-buffer 'visible))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
742 frame)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
743 (when window
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
744 ;; It is necessary to select the article window so that
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
745 ;; `gnus-article-goto-part' may really move the point.
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
746 (setq frame (selected-frame))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
747 (gnus-select-frame-set-input-focus (window-frame window))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
748 (unwind-protect
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
749 (save-window-excursion
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
750 (select-window window)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
751 (when (> n (length gnus-article-mime-handle-alist))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
752 (error "No such part"))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
753 (gnus-article-goto-part n)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
754 (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
755 (funcall function handle)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
756 (gnus-select-frame-set-input-focus frame)))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
757
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
758 (defun mhstore-me (dir)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
759 (interactive (list (read-directory-name "Save parts to " "/tmp" "/tmp" t)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
760 (let ((art (gnus-summary-article-number)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
761 (let* ((grp-parts (split-string gnus-newsgroup-name ":"))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
762 (meth (car grp-parts))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
763 (grp (cadr grp-parts)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
764 (if (string= meth "nnml+ht")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
765 (let ((doit
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
766 (format (concat "cd %s && mhstore -f "
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
767 my-mail-dir "/Mail/%s/%s) -auto")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
768 dir grp art)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
769 (message doit)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
770 (shell-command doit))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
771 ))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
772
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
773 (defun my-message-send-and-exit (&optional arg)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
774 (interactive "P")
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
775 (let ((message-required-mail-headers
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
776 (if arg
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
777 (mapcar
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
778 (lambda(x)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
779 (if(and(consp x)(eq(cdr x)'In-Reply-To))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
780 (cons 'optional 'xyzzy)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
781 x))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
782 message-required-mail-headers)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
783 message-required-mail-headers)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
784 (orig-message-send-and-exit)))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
785
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
786 (require 'message)
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
787 (if (not (fboundp 'orig-message-send-and-exit))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
788 (progn
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
789 (fset 'orig-message-send-and-exit (symbol-function 'message-send-and-exit))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
790 (fset 'message-send-and-exit (symbol-function 'my-message-send-and-exit))))
cb9b76219c55 attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents: 24
diff changeset
791
21
7b2c4ed36302 for new maritain
ht
parents: 7
diff changeset
792 (provide 'my-news)