Mercurial > hg > xemacs
annotate my-news.el @ 85:2a83bb36896f default tip
merge
| author | Henry S Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Thu, 02 Jul 2026 10:12:17 +0100 |
| parents | 8e82ac8512d2 |
| children |
| 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) |
| 72 | 3 (setq ; see ~/.xemacs/gnus.el for local settings |
|
32
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-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
|
5 ) |
| 21 | 6 |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
7 (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
|
8 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
|
9 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
|
10 '(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
|
11 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
|
12 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
|
13 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
|
14 gnus-simplify-subject-regexp "^\\(re[:;.]\\| \\|fwd:\\)*") |
| 21 | 15 |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
16 (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
|
17 (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
|
18 (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
|
19 text)) |
| 21 | 20 |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
21 (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
|
22 "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
|
23 ; (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
|
24 (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
|
25 (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
|
26 (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
|
27 (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
|
28 (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
|
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 h2))))))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
31 ; (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
|
32 result))) |
| 21 | 33 |
| 34 | |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
35 (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
|
36 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
|
37 gnus-secondary-select-methods |
| 21 | 38 '((nnml "ht" |
| 39 (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
|
40 (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
|
41 (gnus-article-sort-by-subject gnus-article-sort-by-date)) |
| 21 | 42 ))) |
| 43 ;;; fixup clarinews | |
| 44 ;(autoload 'gnus-clarinews-fun "clari-clean" "Clean ClariNews articles" t) | |
| 45 ;(add-hook 'gnus-article-prepare-hook 'gnus-clarinews-fun) | |
| 46 | |
| 47 | |
| 48 (defun gnus-Subject-sort-by-subject-and-date (reverse) | |
| 49 "Sort subject display buffer by subject alphabetically. `Re:'s are ignored. | |
| 50 If case-fold-search is non-nil, case of letters is ignored. Date is used | |
| 51 if subjects are equal | |
| 52 Argument REVERSE means reverse order." | |
| 53 (interactive "P") | |
| 54 (gnus-summary-sort-summary | |
| 55 (function | |
| 56 (lambda (a b) | |
| 57 (let ((s-a (gnus-trim-simplify-subject (nntp-header-subject a))) | |
| 58 (s-b (gnus-trim-simplify-subject (nntp-header-subject b))) | |
| 59 ) | |
| 60 (or (gnus-string-lessp s-a s-b) | |
| 61 (and (gnus-string-equal s-a s-b) | |
| 62 (gnus-date-lessp (nntp-header-date a) | |
| 63 (nntp-header-date b))))))) | |
| 64 reverse | |
| 65 )) | |
| 66 | |
| 67 ;(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
|
68 |
| 21 | 69 |
| 70 (defun gnus-string-equal (a b) | |
| 71 "Return T if first arg string is equal than second in lexicographic order. | |
| 72 If case-fold-search is non-nil, case of letters is ignored." | |
| 73 (if case-fold-search | |
| 74 (string-equal (downcase a) (downcase b)) (string-equal a b))) | |
| 75 | |
| 76 (defun gnus-Group-update-and-vanish () | |
| 77 "update newsrc and restore config pre-group selection" | |
| 78 (interactive) | |
| 79 (gnus-group-force-update) | |
| 80 (if gnus-pre-config | |
| 81 (set-window-configuration gnus-pre-config)) | |
| 82 ; (setq gnus-pre-config nil) | |
| 83 ) | |
| 84 | |
| 85 ;; Database stuff | |
| 86 (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
|
87 (setq whitelist-db (open-database (concat my-mail-dir "/white") 'berkeley-db))) |
| 21 | 88 (defun save-white () |
| 89 (close-database whitelist-db) | |
| 90 (open-white)) | |
| 91 | |
| 92 (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
|
93 (setq adlist-db (open-database (concat my-mail-dir "/ad") 'berkeley-db))) |
| 21 | 94 |
| 95 (defun save-ad () | |
| 96 (close-database adlist-db) | |
| 97 (open-ad)) | |
| 98 | |
| 99 (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
|
100 (setq quaker-db (open-database (concat my-mail-dir "/quaker") 'berkeley-db))) |
| 21 | 101 (defun save-quaker () |
| 102 (close-database quaker-db) | |
| 103 (open-quaker)) | |
| 104 | |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
105 (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
|
106 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
107 (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
|
108 "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
|
109 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
110 (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
|
111 (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
|
112 (progn |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
113 (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
|
114 (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
|
115 res) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
116 (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
|
117 (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
|
118 (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
|
119 (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
|
120 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 (message "%s" res)))) |
| 21 | 122 |
| 63 | 123 (defun add-white (&optional dontAddToBBDB) |
| 124 "While reading an article, add to whitelist" | |
| 21 | 125 (interactive "P") |
| 126 (gnus-summary-goto-article (gnus-summary-article-number)) | |
| 63 | 127 (do-add-white (gnus-fetch-original-field "From") dontAddToBBDB)) |
| 128 | |
| 129 (defun do-add-white (addr &optional dontAddToBBDB) | |
| 130 (let* ((components (gnus-extract-address-components addr)) | |
| 21 | 131 (addr (get-canonical-from-addr components))) |
| 63 | 132 (if (not dontAddToBBDB) |
| 133 (let ((bbdb-no-duplicates-p t)) | |
| 134 (condition-case nil | |
| 135 (bbdb-create-internal (car components) nil | |
| 136 (cadr components) nil nil nil) | |
| 137 (error | |
| 138 ;; OK, just means already present | |
| 139 )))) | |
| 21 | 140 (if (new-white addr) |
| 63 | 141 (save-white)))) |
| 21 | 142 |
| 143 (defun add-ad () | |
| 144 (interactive) | |
| 145 (gnus-summary-goto-article (gnus-summary-article-number)) | |
| 146 (let ((addr (get-current-from-addr))) | |
| 147 (if (or (not (get-database addr whitelist-db)) | |
| 148 (yes-or-no-p "Already white, really convert to ad?")) | |
| 149 (if (new-ad addr) | |
| 150 (save-ad))))) | |
| 151 | |
| 152 (defun add-quaker() | |
| 153 (interactive) | |
| 154 (let ((addr (get-addr-before-point))) | |
| 155 (when (new-quaker addr) | |
| 156 (save-quaker)) | |
| 157 (quaker-sig-maybe))) | |
| 158 | |
| 63 | 159 ; not needed anymore because of gnus-posting-styles (q.v. in mail-from-*) |
| 21 | 160 (defun quaker-sig-if-to-quaker () |
| 161 (let ((message-options)) | |
| 162 (save-excursion (message-options-set-recipient)) | |
| 163 (let* ((recipStr (message-options-get 'message-recipients)) | |
| 164 (recips (split-string (downcase recipStr) | |
| 165 ",[ \f\t\n\r\v]+" t))) | |
| 166 (while (and recips | |
| 167 (not (quaker-sig-if-quaker-1 (car recips)))) | |
| 168 (setq recips (cdr recips)))))) | |
| 169 | |
| 170 (defun to-quaker-p () | |
| 171 (let ((message-options)) | |
| 172 (save-excursion (message-options-set-recipient)) | |
| 173 (let* ((recipStr (message-options-get 'message-recipients)) | |
| 174 (recips (split-string (downcase recipStr) | |
| 175 ",[ \f\t\n\r\v]+" t))) | |
| 176 (while (and recips | |
| 177 (not (get-database (car recips) quaker-db))) | |
| 178 (setq recips (cdr recips))) | |
| 179 (not (null recips))))) | |
| 180 | |
| 181 (defun quaker-sig-if-quaker () | |
| 182 (quaker-sig-if-quaker-1 (get-addr-before-point))) | |
| 183 | |
| 184 (defun quaker-sig-if-quaker-1 (addr) | |
| 185 (if (get-database addr quaker-db) | |
| 186 (progn (quaker-sig-maybe) | |
| 187 t))) | |
| 188 | |
| 189 (defun kill-white () | |
| 190 (interactive) | |
| 191 (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
|
192 (let ((addr (downcase (get-current-from-addr)))) |
| 21 | 193 (rem-white addr))) |
| 194 | |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
195 (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
|
196 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
197 (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
|
198 (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
|
199 (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
|
200 |
| 21 | 201 (defun get-from-gnus-addr () |
| 202 (get-from-addr (gnus-fetch-field "From"))) | |
| 203 | |
| 204 (defun get-from-addr (addr) | |
| 205 (get-canonical-from-addr (gnus-extract-address-components addr))) | |
| 206 | |
| 207 (defun get-canonical-from-addr (components) | |
| 208 (downcase (cadr components))) | |
| 209 | |
| 210 (defun get-current-from-addr () | |
| 211 (with-current-buffer gnus-article-buffer | |
| 212 (get-from-gnus-addr))) | |
| 213 | |
| 214 (defun get-current-from-components () | |
| 215 (with-current-buffer gnus-article-buffer | |
| 216 (gnus-extract-address-components (gnus-fetch-field "From")))) | |
| 217 | |
| 218 (defun get-addr-before-point () | |
| 219 (let ((cur (point))) | |
| 220 (save-excursion | |
| 221 (get-from-addr (buffer-substring (+ (search-backward " ") 1) cur))) | |
| 222 )) | |
| 223 | |
| 224 (defun blacken-and-delete (group) | |
| 225 ;; mis-named now | |
| 226 ;; this is part of the expiry processing for xxxSPAM groups, and | |
| 227 ;; actually whitens the from addresses of #-marked articles | |
| 228 ;; The return value is crucial (and crucially outside of the scope of the if) | |
| 229 (if (memq number | |
| 230 (with-current-buffer gnus-summary-buffer | |
| 231 gnus-newsgroup-processable)) | |
| 232 (let ((addr (get-from-gnus-addr))) | |
| 233 (new-white addr))) | |
| 234 'delete) | |
| 235 | |
| 236 (defun unwhiten-and-delete (group) | |
| 237 ;; unused except in stale groups -- usable as an expiry | |
| 238 (if (memq number | |
| 239 (with-current-buffer gnus-summary-buffer | |
| 240 gnus-newsgroup-processable)) | |
| 241 (let ((addr (get-from-gnus-addr))) | |
| 242 (remove-database addr whitelist-db))) | |
| 243 'delete) | |
| 244 | |
| 245 (defun known-black (list) | |
| 246 (if (get-database (get-from-gnus-addr) blacklist-db) | |
| 247 list)) | |
| 248 | |
| 249 (defun white-spam (list) | |
| 85 | 250 (if |
| 251 (let ((from (get-from-gnus-addr))) | |
| 252 (and (or (equal (get-database (get-from-gnus-addr) whitelist-db) "t") | |
| 253 (let ((case-fold-search t) | |
| 254 (subj (gnus-fetch-field "Subject"))) | |
| 255 (or | |
| 256 (and subj (string-match white-subjects subj)) | |
| 257 (and from | |
| 258 (let ((fromDom (substring from (+ 1 (search "@" from))))) | |
| 259 (and fromDom (member fromDom white-domains))))))) | |
| 260 (not (spoofed from)) | |
| 261 )) | |
| 21 | 262 list)) |
| 263 | |
| 264 (defun ad-spam (list) | |
| 265 (if (let ((from (get-from-gnus-addr))) | |
| 266 (or | |
| 267 (equal (get-database from adlist-db) "t") | |
| 268 (and from | |
| 269 (let ((fromDom (substring from (+ 1 (search "@" from))))) | |
| 270 (and fromDom (member fromDom ad-domains)))) | |
| 271 )) | |
| 272 list)) | |
| 273 | |
| 85 | 274 (defvar spoof-targets (list |
| 275 (cons "ht" | |
| 276 (mapcar (lambda (d) (concat d "$")) | |
| 277 '("hst.name" "ed.ac.uk" "markup.co.uk"))) | |
| 278 )) | |
| 279 | |
| 280 (defun spoofed (from) | |
| 281 (let ((spoofee (substring from 0 (search "@" from))) | |
| 282 (spoofDom (substring from (+ 1 (search "@" from))))) | |
| 283 (let ((target (assoc spoofee spoof-targets))) | |
| 284 (if target | |
| 285 (let ((tdom (loop for d in (cdr target) thereis | |
| 286 (and (string-match d spoofDom) | |
| 287 d)))) | |
| 288 (if tdom | |
| 289 (let* ((received (save-excursion | |
| 290 (save-restriction | |
| 291 (let ((case-fold-search t) | |
| 292 (inhibit-point-motion-hooks t)) | |
| 293 (nnheader-narrow-to-headers) | |
| 294 (mail-fetch-field "Received" nil nil t))))) | |
| 295 (bogon (loop for r in received thereis | |
| 296 (and (not (string-match tdom r)) | |
| 297 r)))) | |
| 298 (cond (bogon | |
| 299 (message "Found a spoof sender %s in %s" bogon received) | |
| 300 t)) | |
| 301 ))))))) | |
| 302 | |
| 21 | 303 (defun bogoNote (group) |
| 304 (if (memq number | |
| 305 (with-current-buffer gnus-summary-buffer | |
| 306 gnus-newsgroup-processable)) | |
| 307 (let ((addr (get-from-gnus-addr))) | |
| 308 (new-white addr))) | |
| 309 (shell-command-on-region (point-min) (point-max) | |
| 85 | 310 "/home/ht/bin/makeBogo") |
| 21 | 311 'delete) |
| 312 | |
| 313 (defun whiten-recip () | |
| 314 ;;; a hook for outgoing mail | |
| 63 | 315 (let* ((to (message-fetch-field "To")) |
| 316 (cc (message-fetch-field "cc")) | |
| 317 (msg-recipients (concat to (and to cc ", ") cc)) | |
| 318 (recips (message-tokenize-header msg-recipients)) | |
| 319 (res (mapcar (function do-add-white) recips))) | |
| 21 | 320 (while (and res (not (car res))) |
| 321 (setq res (cdr res))) | |
| 322 (if res (save-white)))) | |
| 323 | |
| 324 | |
| 325 (defun new-white (addr) | |
| 326 (if (get-database addr whitelist-db) | |
| 327 nil | |
| 328 (put-database addr "t" whitelist-db) | |
|
75
0508101db40f
get new-white working (on maritain only??
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
72
diff
changeset
|
329 (comint-exec (get-buffer-create "*new-white*") |
|
0508101db40f
get new-white working (on maritain only??
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
72
diff
changeset
|
330 "new-white" shell-file-name |
|
0508101db40f
get new-white working (on maritain only??
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
72
diff
changeset
|
331 nil (list shell-command-switch |
|
0508101db40f
get new-white working (on maritain only??
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
72
diff
changeset
|
332 (format "echo '%s' >> %s/new-white.txt" addr my-mail-dir))) t)) |
| 21 | 333 |
| 334 (defun new-ad (addr) | |
|
67
a9b2a2335782
make setting advert whiten as well if needed,
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
63
diff
changeset
|
335 (new-white addr) |
| 21 | 336 (if (get-database addr adlist-db) |
| 337 nil | |
| 338 (put-database addr "t" adlist-db) | |
| 339 t)) | |
| 340 | |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
341 (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
|
342 (remove-database addr adlist-db) |
| 21 | 343 (save-ad)) |
| 344 | |
| 345 (defun new-quaker (addr) | |
| 346 (if (get-database addr quaker-db) | |
| 347 nil | |
| 348 (put-database addr "t" quaker-db) | |
| 349 t)) | |
| 350 | |
| 351 (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
|
352 (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
|
353 (save-white)) |
| 21 | 354 |
| 355 (defun bogoOK (group) | |
| 356 (shell-command-on-region (point-min) (point-max) | |
| 357 "/afs/inf.ed.ac.uk/user/h/ht/share/bin/local/makeNonBogo") | |
| 358 'delete) | |
| 359 | |
| 360 (defun del-dups () | |
| 361 (interactive) | |
| 362 (gnus-summary-sort-by-subject) | |
| 363 (gnus-summary-clear-mark-forward 1) | |
| 364 (goto-char (point-min)) | |
| 365 (let ((pos)) | |
| 366 (while (setq pos (search-forward "] " nil t)) | |
| 367 (end-of-line) | |
| 368 (let ((subj (buffer-substring pos (point)))) | |
| 369 (unless (equal subj "") | |
| 370 (let ((target (if (< (length subj) 26) | |
| 371 (concat "] " subj "\n") | |
| 372 (concat "] " (substring subj 0 25)))) | |
| 373 (done 0) | |
| 374 (case-fold-search nil)) | |
| 375 (while (and (= done 0) | |
| 376 (search-forward target nil t)) | |
| 377 (forward-char -3) | |
| 378 (setq done (gnus-summary-mark-as-read-forward 1)))))))) | |
| 379 (gnus-summary-limit-to-unread) | |
| 380 (gnus-summary-sort-by-original)) | |
| 381 | |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
382 (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
|
383 (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
|
384 (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
|
385 (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
|
386 (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
|
387 (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
|
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 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
|
390 (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
|
391 (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
|
392 rpat) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
393 (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
|
394 (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
|
395 (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
|
396 (concat "^" |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
397 field |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
398 ":\\s-*" |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
399 (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
|
400 pat |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
401 (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
|
402 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
|
403 "$")) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
404 (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
|
405 (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
|
406 list))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
407 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
408 (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
|
409 "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
|
410 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
411 (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
|
412 (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
|
413 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
414 ;; 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
|
415 (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
|
416 "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
|
417 (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
|
418 (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
|
419 (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
|
420 (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
|
421 (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
|
422 (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
|
423 (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
|
424 ;(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
|
425 (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
|
426 (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
|
427 (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
|
428 (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
|
429 (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
|
430 (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
|
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 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
|
433 (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
|
434 (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
|
435 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
436 (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
|
437 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
438 (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
|
439 (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
|
440 (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
|
441 (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
|
442 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
443 (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
|
444 (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
|
445 (cond |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
446 ((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
|
447 (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
|
448 (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
|
449 (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
|
450 (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
|
451 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
452 (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
|
453 (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
|
454 (let ((gn (concat "nnml+ht:pers-" |
|
45
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
455 (format-time-string "%Y-%m" (current-time)))) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
456 (jr ht-gnus-just-read)) |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
457 (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
|
458 (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
|
459 (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
|
460 (cond |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
461 ((> 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
|
462 (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
|
463 ((> 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
|
464 (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
|
465 (lambda () |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
466 (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
|
467 (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
|
468 (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
|
469 (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
|
470 (ht-next-with-unseen 1)))) |
|
45
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
471 (message "read: %s" ht-gnus-just-read) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
472 )) |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
473 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
474 (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
|
475 (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
|
476 (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
|
477 (setq gnus-auto-select-first nil)))) |
| 21 | 478 |
| 479 (defun showMPAhtml () | |
| 480 "Show the text/html parts of an multipart/alternative message using lynx" | |
| 481 (interactive) | |
| 482 (gnus-summary-select-article) | |
| 483 (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
|
484 (shell-command-on-region (point-min) (point-max) |
|
43
eee08de75336
try to do better at where news/mail/init stuff is handled,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
34
diff
changeset
|
485 ;(expand-file-name |
|
55
95ba4cc6ffe4
better pattern for to-quaker-p
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
45
diff
changeset
|
486 "/home/ht/bin/showMPA.sh" |
|
43
eee08de75336
try to do better at where news/mail/init stuff is handled,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
34
diff
changeset
|
487 ;) |
|
eee08de75336
try to do better at where news/mail/init stuff is handled,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
34
diff
changeset
|
488 )) |
| 21 | 489 ) |
| 490 | |
|
32
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
491 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
492 ;; 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
|
493 (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
|
494 "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
|
495 (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
|
496 (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
|
497 (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
|
498 (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
|
499 (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
|
500 (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
|
501 (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
|
502 (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
|
503 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
504 (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
|
505 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
506 (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
|
507 "] \\(\\(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
|
508 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
|
509 (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
|
510 (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
|
511 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
512 (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
|
513 "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
|
514 (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
|
515 (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
|
516 (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
|
517 (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
|
518 (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
|
519 (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
|
520 (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
|
521 (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
|
522 (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
|
523 (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
|
524 (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
|
525 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
526 (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
|
527 "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
|
528 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
529 (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
|
530 (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
|
531 (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
|
532 (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
|
533 ) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
534 (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
|
535 (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
|
536 (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
|
537 (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
|
538 (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
|
539 (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
|
540 (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
|
541 (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
|
542 (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
|
543 (and |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
544 (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
|
545 (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
|
546 (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
|
547 (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
|
548 (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
|
549 (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
|
550 (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
|
551 )) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
552 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
553 ;;; Why??? |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
554 (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
|
555 (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
|
556 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
557 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
558 (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
|
559 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
560 (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
|
561 (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
|
562 (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
|
563 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
564 (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
|
565 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
566 (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
|
567 (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
|
568 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
|
569 (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
|
570 (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
|
571 (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
|
572 (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
|
573 (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
|
574 (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
|
575 (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
|
576 (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
|
577 (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
|
578 (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
|
579 (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
|
580 (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
|
581 (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
|
582 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
583 ; (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
|
584 ; (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
|
585 ; (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
|
586 ; (cond |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
587 ; ((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
|
588 ; ((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
|
589 ; (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
|
590 ; t)))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
591 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
592 ;;; 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
|
593 (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
|
594 (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
|
595 (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
|
596 (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
|
597 (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
|
598 (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
|
599 (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
|
600 (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
|
601 (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
|
602 (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
|
603 (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
|
604 (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
|
605 (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
|
606 (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
|
607 (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
|
608 ((= 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
|
609 (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
|
610 (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
|
611 (+ 64 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
612 (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
|
613 (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
|
614 (t |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
615 (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
|
616 (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
|
617 (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
|
618 (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
|
619 str) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
620 str)) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
621 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
622 (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
|
623 ;; 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
|
624 (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
|
625 (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
|
626 (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
|
627 ;; 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
|
628 (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
|
629 (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
|
630 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
|
631 (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
|
632 (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
|
633 (> (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
|
634 (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
|
635 t))))))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
636 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
637 (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
|
638 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
639 ;;; 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
|
640 ;;; 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
|
641 (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
|
642 "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
|
643 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
|
644 `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
|
645 (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
|
646 (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
|
647 (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
|
648 (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
|
649 (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
|
650 (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
|
651 (eolp)) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
652 (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
|
653 (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
|
654 (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
|
655 (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
|
656 (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
|
657 (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
|
658 (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
|
659 (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
|
660 (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
|
661 ;; 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
|
662 ;; 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
|
663 (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
|
664 (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
|
665 (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
|
666 (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
|
667 (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
|
668 (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
|
669 url)))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
670 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
671 (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
|
672 (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
|
673 (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
|
674 ?*) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
675 ((> (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
|
676 ?.) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
677 (t ? )))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
678 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
679 (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
|
680 (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
|
681 (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
|
682 (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
|
683 (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
|
684 (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
|
685 (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
|
686 (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
|
687 (> (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
|
688 "\\." |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
689 ":\\."))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
690 (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
|
691 (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
|
692 (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
|
693 (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
|
694 (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
|
695 (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
|
696 (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
|
697 (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
|
698 (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
|
699 (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
|
700 winning))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
701 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
702 (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
|
703 (interactive) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
704 (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
|
705 (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
|
706 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
707 (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
|
708 (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
|
709 (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
|
710 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
711 (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
|
712 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
713 (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
|
714 (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
|
715 (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
|
716 (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
|
717 (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
|
718 (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
|
719 (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
|
720 (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
|
721 (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
|
722 (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
|
723 (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
|
724 (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
|
725 (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
|
726 (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
|
727 (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
|
728 ("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
|
729 (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
|
730 (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
|
731 (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
|
732 (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
|
733 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
|
734 (nconc |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
735 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
|
736 (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
|
737 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
|
738 (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
|
739 ((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
|
740 (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
|
741 "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
|
742 "calendar")))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
743 (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
|
744 (t |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
745 (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
|
746 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
747 (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
|
748 (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
|
749 (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
|
750 (concat |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
751 "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
|
752 (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
|
753 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
754 (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
|
755 "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
|
756 (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
|
757 (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
|
758 frame) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
759 (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
|
760 ;; 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
|
761 ;; `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
|
762 (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
|
763 (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
|
764 (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
|
765 (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
|
766 (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
|
767 (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
|
768 (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
|
769 (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
|
770 (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
|
771 (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
|
772 (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
|
773 (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
|
774 ))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
775 (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
|
776 ) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
777 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
778 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
779 (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
|
780 (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
|
781 frame) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
782 (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
|
783 ;; 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
|
784 ;; `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
|
785 (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
|
786 (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
|
787 (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
|
788 (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
|
789 (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
|
790 (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
|
791 (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
|
792 (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
|
793 (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
|
794 (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
|
795 (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
|
796 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
797 (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
|
798 (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
|
799 (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
|
800 (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
|
801 (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
|
802 (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
|
803 (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
|
804 (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
|
805 (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
|
806 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
|
807 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
|
808 (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
|
809 (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
|
810 )))) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
811 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
812 (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
|
813 (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
|
814 (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
|
815 (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
|
816 (mapcar |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
817 (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
|
818 (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
|
819 (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
|
820 x)) |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
821 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
|
822 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
|
823 (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
|
824 |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
825 (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
|
826 (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
|
827 (progn |
|
cb9b76219c55
attempt to merge mail read and send from all over
Henry S Thompson <ht@inf.ed.ac.uk>
parents:
24
diff
changeset
|
828 (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
|
829 (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
|
830 |
|
45
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
831 ;; see message-citation-line-function in message.el |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
832 (defun safe-citation () |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
833 (use-text-not-html) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
834 (when message-reply-headers |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
835 (let ((from (mail-header-from message-reply-headers))) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
836 (cond ((string-match "^\"?\\([^\"]*\\)\"? <.*>$" from) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
837 (insert (match-string 1 from) " writes:\n\n")) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
838 ((string-match "^\\([^<@]*\\)@" from) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
839 (insert (match-string 1 from) " writes:\n\n")) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
840 (t |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
841 (insert "[anon] writes:\n\n")))))) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
842 |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
843 (defun use-text-not-html (&optional clear) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
844 (when (and (if clear (looking-at "<html") |
| 83 | 845 (looking-at "> <\\(!doctype\\|html\\|div\\)")) |
|
45
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
846 (bufferp (get-buffer "*Shell Command Output*"))) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
847 ;; replace HTML only with result of my HTML filter |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
848 (delete-region (point)(mark t)) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
849 (insert-buffer "*Shell Command Output*") |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
850 (when (looking-at "piping") |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
851 (kill-entire-line) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
852 (indent-rigidly (point) (mark t) -3) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
853 (if (not clear) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
854 (submerge-region (point) (mark t))))) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
855 ) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
856 |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
857 (setq message-citation-line-function (function safe-citation)) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
858 |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
859 |
| 61 | 860 (defvar safelink_pat "https://[a-z0-9.]*safelinks.protection.outlook.com/\\?url=\\(\\(ftp\\|https?\\)%3A%2F%2F[^&<>\"]*\\)[^\"<> \n]*") |
|
45
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
861 |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
862 (require 'url) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
863 |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
864 (defvar url-ok-chars (nconc |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
865 '(?/ ?& ?% ?+ ?? ?= ?: ?; |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
866 ?# |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
867 ) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
868 url-unreserved-chars)) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
869 |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
870 (defun unsafelink () |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
871 ;; Thanks to Iain Murray for |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
872 ;; /public/homepages/imurray2/web/code/hacks/unsafelink |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
873 (let ((url-unreserved-chars url-ok-chars)) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
874 (while (re-search-forward safelink_pat nil t) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
875 (let ((res (match-string 1))) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
876 (replace-match "") |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
877 ;; unhexify uses regex, so trashes match-string :-( |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
878 (insert (url-hexify-string (url-unhex-string res))) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
879 )) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
880 )) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
881 |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
882 (add-hook 'gnus-article-prepare-hook 'unsafelink) |
|
65ea96008fe0
hacked up some stuff to get rid of useless safelinks.outlook... link wrappers,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
43
diff
changeset
|
883 |
| 21 | 884 (provide 'my-news) |
