;; .gnus.el -- Dan Jacobson's personal Gnus startup mess ;; Author : Dan Jacobson http://jidanni.org/ ;; Copyright : http://www.fsf.org/copyleft/gpl.html ;; Created On : 1988? ;; Last Modified On: Sat Jan 7 07:17:36 2012 ;; Update Count : 584 (define-key gnus-article-mode-map [?M] 'browse-url-firefox); same key as w3m-view-url-with-external-browser (put 'gnus-group-check-bogus-groups 'disabled t) (put 'gnus-group-find-new-groups 'disabled t) (put 'gnus-summary-edit-article 'disabled t) (setq gnus-treat-fill-long-lines nil gnus-article-update-date-headers 120 gnus-auto-select-on-ephemeral-exit nil mm-text-html-renderer 'w3m ; gnus-w3m mml-insert-mime-headers-always t ;http://article.gmane.org/gmane.emacs.gnus.general/69893 gnus-agent-expire-days 15 message-confirm-send t nnrss-wash-html-in-text-plain-parts t gnus-backup-startup-file version-control gnus-mark-article-hook nil message-insert-canlock nil gnus-select-method (cond ((string-match "jidanni1" system-name) '(nntp "localhost")) ; ((string-match "jidanni3" system-name) ; '(nntp "news.gmane.org")) (t '(nnnil))) gnus-inhibit-mime-unbuttonizing t gnus-secondary-select-methods '((nnml "")) gnus-check-new-newsgroups 'nil ;ask-server gnus-read-active-file nil;try default 'some' instead --naw gnus-save-killed-list nil gnus-widen-article-window t gnus-default-article-saver 'gnus-summary-save-in-mail gnus-posting-styles '( (".*" (User-Agent nil) (From "jidanni@jidanni.org"))) message-user-path "jidanni.org";vanity plates mail-host-address message-user-path;for message id message-user-fqdn mail-host-address mail-sources `((maildir)) gnus-single-article-buffer nil gnus-kill-summary-on-exit nil mail-source-delete-incoming t ; gnus-thread-sort-functions ; '(gnus-thread-sort-by-number gnus-thread-sort-by-date) message-generate-headers-first t gnus-treat-date-lapsed 'head gnus-article-date-lapsed-new-header t gnus-treat-emphasize nil;else *bla* becomes bla gnus-default-directory "~/" message-shoot-gnksa-feet '(multiple-copies) sc-auto-fill-region-p nil sc-blank-lines-after-headers nil gnus-thread-indent-level 1 ;mm-discouraged-alternatives '("text/html") mm-w3m-safe-url-regexp nil mm-body-charset-encoding-alist '((utf-8 . 8bit)) gnus-activate-level 5;stop big delay at startup message-syntax-checks '((sender . disabled)) gnus-summary-mode-line-format "Gnus: %G [%A] %Z" gnus-pick-display-summary t gnus-pick-elegant-flow nil nntp-record-commands t gnus-agent nil;We use noffle gnus-asynchronous t;We use noffle gnus-use-article-prefetch nil;else wastefully asks noffle gnus-use-cache nil;else "!" caches noffle's "Will download" ;information messages, so we don't see the article when it arrives. gnus-keep-backlog 'nil;else some noffle article fetches not seen gnus-auto-select-next nil;else wastefully asks noffle ;Put X-NOFFLE-Status info into Summary buffer: nntp-nov-is-evil t;Get X-NOFFLE-Status always gnus-extra-headers '(To Newsgroups X-NOFFLE-Status X-Spam-Status) gnus-summary-line-format (concat "%U%R%z%I%(%2t %3{%~(cut-left 2)" "~(max-right 6)~(pad 6)o%}%3L|%6us|%-14,14f%)%3{%un%}:%s\n") ) (setq gnus-group-line-format "%B%-2T%S%p%P%3U|%3y: %(%-61,61G%) %d %L\n") (add-hook 'message-sent-hook 'gnus-score-followup-thread) (add-hook 'gnus-display-article-hook 'gnus-article-date-lapsed) ;; (setq ;; gnus-article-prepare-hook ;; (function ;; (lambda () ;; (if(string-match-p ;; "tw-blog-sys@yahoo-inc\\.com" ;; (gnus-with-article-headers ;; (cadr (mail-extract-address-components ;; (mail-fetch-field "From"))))) ;; ; (progn ;; ; (set ;; ; (make-local-variable 'mm-w3m-safe-url-regexp) ;; ; "http://tw.blog.yahoo.com/photo/photo.php") ;; ;;; I only want them set to that value for this message please ;; (w3m-toggle-inline-images t))))) (global-set-key "\C-xm" (quote gnus-summary-mail-other-window)) ;hmmmm (defun my-save-buffers-kill-emacs (&optional arg) "Like `save-buffers-kill-emacs'." (interactive) (jidanni-gnus-draft-reminder) (save-buffers-kill-emacs arg)) (define-key global-map "\C-x\C-c" 'my-save-buffers-kill-emacs) (add-hook 'gnus-exit-gnus-hook 'jidanni-gnus-draft-reminder) ;(require 'cl) (defun jidanni-gnus-draft-reminder () "Remind user if there are unsent drafts." (interactive) (if (gnus-alive-p) (let (active) (catch 'continue (dolist (group '("nndraft:drafts" "nndraft:queue")) (setq active (gnus-activate-group group)) (if (and active (>= (cdr active) (car active))) (if (y-or-n-p "There are unsent drafts, really quit? ") (throw 'continue t) (error "Stop!")))))))) (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp) (defun gnus-user-format-function-n (header) ;Steib (let ((case-fold-search t) (val (or (cdr (assq 'X-NOFFLE-Status (mail-header-extra header)))""))) (gnus-replace-in-string val "\\(\\S-\\)\\S-+ ?" "\\1")));first chars (setq nnmail-extra-headers gnus-extra-headers) ;(I Didn't use debian's /usr/share/emacs/site-lisp/gnus/noffle.el) ;remove User-Agent, as it is wasteful ;Want better control of References but don't know how (setq message-required-news-headers '(From Newsgroups Subject Date Message-ID)) (setq message-required-mail-headers '(From Subject Date Message-ID)) (eval-after-load 'message ;for *Drafts* '(add-to-list 'message-required-headers 'Date)) (setq gnus-ignored-from-addresses "jidanni" sc-preferred-attribution-list '("sc-lastchoice" "x-attribution" "sc-consult" "initials" "firstname" "lastname") sc-attrib-selection-list '(("sc-from-address" ((".*" . (bbdb/sc-consult-attr (sc-mail-field "sc-from-address")))))) sc-mail-glom-frame '((begin (setq sc-mail-headers-start (point))) ("^x-attribution:[ \t]+.*$" (sc-mail-fetch-field t) nil t) ("^\\S +:.*$" (sc-mail-fetch-field) nil t) ("^$" (progn (bbdb/sc-default) (list 'abort '(step . 0)))) ("^[ \t]+" (sc-mail-append-field)) (sc-mail-warn-if-non-rfc822-p (sc-mail-error-in-mail-field)) (end (setq sc-mail-headers-end (point)))) mail-user-agent 'gnus-user-agent;m wont work in bbdb before ;sending other mail ;;hmmm, should make sure gnus is running before sending mail. gnus-summary-goto-unread 'never gnus-auto-center-summary nil gnus-confirm-mail-reply-to-news t nnmail-split-methods '(("mail.debianbugs" "@bugs\\.debian\\.org") ("mail.misc" "")) message-from-style nil message-hidden-headers nil gnus-mime-display-multipart-related-as-mixed t;else miss stuff url-automatic-caching t;for when I try news feeds again in 2007 ;(setq gnus-message-archive-group "nnfolder+archive:sent") gnus-message-archive-group (concat "nnml:archive." (format-time-string "%Y" (current-time)))) (add-hook 'gnus-summary-mode-hook (function (lambda () (define-key gnus-summary-mode-map "k" 'gnus-summary-kill-thread) (defun message-shorten-references (header references) "Trim REFERENCES to be (jidanni:)1 Message-ID long or less, and fold them. When sending via news, also check that the REFERENCES are less than 988 characters long, and if they are not, trim them until they are." (let ((maxcount 1);jidanni (count 0) (cut 2) refs) (with-temp-buffer (insert references) (goto-char (point-min)) ;; Cons a list of valid references. GNKSA says we must not include MIDs ;; with whitespace or missing brackets (7.a "Does not propagate broken ;; Message-IDs in original References"). (while (re-search-forward "<[^ <]+@[^ <]+>" nil t) (push (match-string 0) refs)) (setq ;refs (nreverse refs);jidanni off count (length refs))) ;; If the list has more than MAXCOUNT elements, trim it by ;; removing the CUTth element and the required number of ;; elements that follow. (when (> count maxcount) (let ((surplus (- count maxcount))) (message-shorten-1 refs cut surplus) (decf count surplus))) ;; When sending via news, make sure the total folded length will ;; be less than 998 characters. This is to cater to broken INN ;; 2.3 which counts the total number of characters in a header ;; rather than the physical line length of each line, as it should. ;; ;; This hack should be removed when it's believed than INN 2.3 is ;; no longer widely used. ;; ;; At this point the headers have not been generated, thus we use ;; message-this-is-news directly. (when message-this-is-news (while (< 998 (with-temp-buffer (message-insert-header header (mapconcat #'identity refs " ")) (buffer-size))) (message-shorten-1 refs cut 1))) ;; Finally, collect the references back into a string and insert ;; it into the buffer. (message-insert-header header (mapconcat #'identity refs " "))))))) ;; ;;after (setq gnus-extra-headers '(To Newsgroups X-Spam-Status)) (defun gnus-user-format-function-s (header) (gnus-replace-in-string (gnus-extra-header 'X-Spam-Status header) ".*\\(score\\|hits\\)=\\([-0-9.]+\\).*" "\\2")) ;; (defun gnus-article-sort-by-spam-status (h1 h2) ;; "Sort articles by score from the X-Spam-Status: header." ;; (< (string-to-number (gnus-user-format-function-s h1)) ;; (string-to-number (gnus-user-format-function-s h2)))) ;; (defun gnus-thread-sort-by-spam-status (h1 h2) ;; "Sort threads by spam status" ;; (gnus-article-sort-by-spam-status ;; (gnus-thread-header h1) (gnus-thread-header h2))) (setq gnus-parameters '(("^nndoc:" ;; (gnus-thread-sort-functions 'gnus-thread-sort-by-spam-status) (gnus-summary-line-format "%U%R%z%I%(%2t %~(cut-left 2)~(max-right 6)~(pad 6)o|%1{%us%}|%-14,14f%):%s\n")) (":mail\\." (gnus-show-threads nil)) )) ;; (defun gnus-summary-sort-by-spam-status (&optional reverse) ;; "Sort the summary buffer by X-Spam-Status. ;; Argument REVERSE means reverse order." ;; (interactive "P") ;; (gnus-summary-sort 'spam-status reverse)) ;; (gnus-define-keys gnus-summary-mode-map ;; "\C-c\C-s\C-p" gnus-summary-sort-by-spam-status) ;(setq message-from-style 'angles) (setq gnus-save-newsrc-file nil);gets trampled by other readers anyway (setq rs-gnus-auto-digest-subjects "^spamdealer report\\|^Risks Digest") (defun rs-gnus-maybe-enter-digest-mode () "Jidanni auto digest enterer" ;;(when ;(or ;(and (stringp rs-gnus-auto-digest-groups) ;; (string-match rs-gnus-auto-digest-groups gnus-newsgroup-name) ;; (not (string-match "nndoc:.*-[0-9]+" gnus-newsgroup-name))) (and (stringp rs-gnus-auto-digest-subjects) (let ((subject (gnus-with-article-buffer (gnus-fetch-field "Subject")))) (and (stringp subject) (string-match rs-gnus-auto-digest-subjects subject))) (gnus-message 9 ;"Entering digest group automatically.") (documentation 'rs-gnus-maybe-enter-digest-mode));how to say ;current function? ;;(sit-for 1) (gnus-summary-enter-digest-group))) ;(gnus-summary-show-article) ;(add-hook 'gnus-select-article-hook 'rs-gnus-maybe-enter-digest-mode) (setq gnus-large-ephemeral-newsgroup 2222) ;;Be sure we are very aware of Disposition-Notification requests ;;though we can only respond manually at present. (add-hook 'gnus-startup-hook '(lambda () (require 'gnus-art) (setq gnus-visible-headers (concat "^Disposition-Notification-To:\\|";^X-Spam-Status:\\|" gnus-visible-headers)) (setq gnus-header-face-alist (cons '("Disposition-Notification-To:" gnus-summary-cancelled ;vivid gnus-summary-cancelled) gnus-header-face-alist)))) (defun jidanni-message-alter-recipients-discard-all-names (addrcell) "Discard all names in mail addresses, because it looks neater!" (cons (car addrcell) (car addrcell))) (setq message-alter-recipients-function 'jidanni-message-alter-recipients-discard-all-names) ;(setq gnus-msg-keep-gcc-header t) ;will be in Debian sid gnus-msg.el 2008 hopefully (setq message-archive-note nil) (setq rs-bbdb-ignored-from-list '("@public.gmane.org" "post@gwene.org")) (setq bbdb/news-auto-create-p nil) (setq bbdb/news-auto-create-hook 'bbdb-ignore-some-messages-hook) (setq bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook) (setq bbdb-ignore-some-messages-alist `(("From" . , (regexp-opt rs-bbdb-ignored-from-list)))) (custom-set-faces'(gnus-header-subject((t(:foreground "yellow" :bold t))))) (custom-set-faces'(message-header-subject((t(:foreground "yellow" :bold t))))) (defun jidanni-gnus-group-get-new-rss-news() "Sorry attempt to seperate out painful RSS fetching." (let ((gnus-activate-foreign-newsgroups 5)) (gnus-group-get-new-news))) (define-key gnus-group-mode-map "v" (lambda () (interactive) (jidanni-gnus-group-get-new-rss-news))) (define-key gnus-group-mode-map "x" 'gnus-group-list-groups);like gnus-summary-limit-to-unread ;(setq mail-default-dont-reply-to-names nil) (add-hook 'gnus-article-mode-hook (lambda () ;; Gnus sets it to nil in the article buffer locally. (setq nobreak-char-display t))) ;; ;; http://mid.gmane.org/87hbfgta34.fsf.rednorrock@ifi.uio.no ;; ;; Set point on latest (possibly old) article, if entering summary ;; ;; buffer and there are no new unseen/unread articles, otherwise goto ;; ;; first unseen or unread. [For hints, see gnus-sum.el.] ;; (setq gnus-auto-select-subject ;; (lambda() ;; (if (and (not gnus-newsgroup-unreads) ;; (not (null gnus-newsgroup-data))) ;; (progn ;; (goto-char (gnus-data-pos (car (last gnus-newsgroup-data)))) ;; (gnus-summary-position-point)) ;; (gnus-summary-first-unseen-or-unread-subject)))) (add-hook 'gnus-started-hook (lambda () (when (buffer-live-p gnus-dribble-buffer) (with-current-buffer gnus-dribble-buffer (setq buffer-save-without-query nil))))) (defun jidanni-gnus-summary-first-unseen-or-last-subject () "Place the point on the subject line of the first unseen article. If all article have been seen, on the subject line of the last article." (interactive) (prog1 (unless (when (gnus-summary-first-subject nil nil t) (gnus-summary-show-thread) (gnus-summary-first-subject nil nil t)) (goto-char (point-max)) (forward-line -1)) (gnus-summary-position-point))) (setq gnus-auto-select-subject 'jidanni-gnus-summary-first-unseen-or-last-subject) (eval-after-load "gnus-art" '(progn (put 'gnus-summary-save-in-pipe :decode nil) (put 'gnus-summary-save-in-pipe :headers nil))) (setq ad-redefinition-action 'accept);can't just wrap with let() (defadvice gnus-summary-select-article-buffer (after jump-to-html-part activate) "Jump to an html part that emacs-w3m rendered, if any." (unless (get-text-property (point) 'mm-inline-text-html-with-w3m) (let ((pos (text-property-any (point-min) (point-max) 'mm-inline-text-html-with-w3m t))) (gnus-goto-char pos))))