Advertisement
Guest User

gnus_RCV

a guest
Aug 10th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 10.30 KB | None | 0 0
  1. (add-to-list 'load-path  "~/.emacs.d/gnus/lisp/")
  2. (require 'gnus-load)
  3. (require 'cl)
  4. (require 'gnus)
  5.  
  6. (setq gnus-save-newsrc-file nil)
  7.  
  8. (setq user-full-name "RCV"   ;; Установка полного имени пользователя:
  9.       message-send-mail-partially-limit nil
  10.       gnus-always-read-dribble-file t  ;; Don't waste my time asking whether I want to get dribble autosave
  11.       gnus-interactive-exit nil           ;; Don't waste my time with interactive exit
  12.       gnus-home-directory "~/.emacs.d/Gnus"
  13.       gnus-directory "~/.emacs.d/Gnus/News/"
  14.       message-directory "~/.emacs.d/Gnus/Mail/"
  15.       nnfolder-directory "~/.emacs.d/Gnus/Mail/archive/"
  16.       message-auto-save-directory "~/.emacs.d/Gnus/Mail/drafts"
  17.       gnus-gcc-mark-as-read t ;; Stops sent emails appearing as new
  18.       gnus-inhibit-startup-message      t    ;; no startup message
  19.       gnus-large-newsgroup 200 ;; do not prompt when accessing large folders
  20.       gnus-read-active-file 'some
  21.       gnus-auto-select-next 'quietly
  22.       gnus-permanently-visible-groups "Work"
  23.       message-kill-buffer-on-exit t) ;;really close the mail window after sending it.
  24.  
  25.  
  26. (setq-default gnus-asynchronous t
  27.           gnus-novice-user nil
  28.           gnus-use-cache t
  29.           )
  30.  
  31. (setq gnus-select-method '(nnimap "Gmail"
  32.                   (nnimap-address "imap.gmail.com")
  33.                   (nnimap-expunge-on-close always)
  34.                   (nnimap-authinfo-file "~/.emacs.d/Gnus/.imap-authinfo")
  35.                   (nnimap-server-port 993)
  36.                   (nnimap-stream ssl)))
  37.  
  38. (setq gnus-secondary-select-methods '(
  39.                       (nnimap "Work"
  40.                           (nnimap-address "mail.work.ru")
  41.                           (nnimap-authinfo-file "~/.emacs.d/Gnus/.imap-authinfo")
  42.                           (nnimap-stream ssl)
  43.                           (nnimap-server-port 993))
  44.                       ;; (nntp "aioe"
  45.                       ;;        (nntp-open-connection-function
  46.                       ;;         nntp-open-ssl-stream)
  47.                       ;;        (nntp-port-number "563")
  48.                       ;;        (nntp-address "news.aioe.org"))
  49.                       (nntp "gnu"
  50.                         (nntp-address "news.gnus.org"))
  51.                           ;; (nntp "neva"
  52.                       ;;        (nntp-open-connection-function
  53.                       ;;         nntp-open-ssl-stream)
  54.                       ;;        (nntp-port-number "563")
  55.                       ;;        (nntp-address "news2.neva.ru"))
  56.                           (nntp "gmane"
  57.                         (nntp-open-connection-function
  58.                          nntp-open-ssl-stream)
  59.                         (nntp-port-number "563")
  60.                         (nntp-address "news.gmane.org"))))
  61.  
  62. (setq gnus-group-line-format "%M%S%p%P%5y:%B%(%uG%)%l %O\n")
  63.  
  64. (defun gnus-user-format-function-G (arg)
  65.   (concat (car (cdr gnus-tmp-method)) ":"
  66.           (or (gnus-group-find-parameter gnus-tmp-group 'display-name)
  67.               (let ((prefix (assq 'remove-prefix (cddr gnus-tmp-method))))
  68.                 (if (and prefix
  69.                          (string-match (concat "^\\("
  70.                                                (regexp-quote (cadr prefix))
  71.                                                "\\)")
  72.                                        gnus-tmp-qualified-group))
  73.                     (substring gnus-tmp-qualified-group (match-end 1))
  74.                   gnus-tmp-qualified-group)))))
  75.  
  76.  
  77.  
  78. ;(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
  79.  
  80. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Установка удобного просмотра;;;;;;;;;;;;;;;;;;;;;;;;;;
  81. ;; Turn on adaptive scoring
  82. ;(setq gnus-group-line-format "%M%S%5y:%B%(%G%)\n")
  83. ;(setq gnus-use-adaptive-scoring '(line))
  84.  
  85. (setq-default
  86.      gnus-summary-line-format "%U%R%z %(%&user-date;  %-15,15f %* %B%s%)\n"
  87.      gnus-user-date-format-alist '((t . "%d.%m.%Y %H:%M"))
  88. )
  89.  
  90. (setq gnus-show-threads nil
  91.       gnus-article-sort-functions '((not gnus-article-sort-by-date))
  92.       gnus-use-adaptive-scoring nil
  93.       gnus-use-scoring nil)
  94.  
  95. (defun hide-modeline ()
  96.    (setq mode-line-format nil))
  97. (add-hook 'gnus-group-mode-hook 'hide-modeline)
  98. (add-hook 'gnus-summary-mode-hook 'hide-modeline)
  99.  
  100. (gnus-add-configuration
  101.  '(article
  102.    (vertical 0.25
  103.              (horizontal 0.3
  104.                          (group 0.3)
  105.                          (summary 1.0 point))
  106.              (horizontal 1.0
  107.                          (article 1.0)))))
  108. (gnus-add-configuration
  109.  '(summary
  110.    (horizontal 0.25
  111.              (vertical 0.3
  112.                          (group 1.0))
  113.              (vertical 1.0
  114.                          (summary 1.0 point)))))
  115.  
  116. ;; Adaptive scoring weights
  117. ;; (setq gnus-default-adaptive-score-alist
  118. ;;       '((gnus-unread-mark)
  119. ;;         (gnus-ticked-mark (from 4))
  120. ;;         (gnus-dormant-mark (from 7))
  121. ;;         (gnus-del-mark (from -4) (subject -15))
  122. ;;         (gnus-read-mark (from 5) (subject 30))
  123. ;;         (gnus-expirable-mark (from -0) (subject -0))
  124. ;;         (gnus-killed-mark (from -4) (subject -20))
  125. ;;         (gnus-kill-file-mark)
  126. ;;         (gnus-ancient-mark (subject -10))
  127. ;;         (gnus-low-score-mark)
  128. ;;         (gnus-catchup-mark (from -1) (subject -10))))
  129. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Установка удобного просмотра;;;;;;;;;;;;;;;;;;;;;;;;;;
  130.  
  131.  
  132.  
  133. ;; Don't make email expirable by default
  134. (remove-hook 'gnus-mark-article-hook
  135.              'gnus-summary-mark-read-and-unread-as-read)
  136. (add-hook 'gnus-mark-article-hook 'gnus-summary-mark-unread-as-read)
  137.  
  138.  
  139.  
  140. (setq nnmail-expiry-wait 1)
  141. (setq message-send-mail-function 'message-send-mail-with-sendmail
  142.       smtpmail-local-domain "nanoemacs"
  143.       mail-user-agent 'gnus-user-agent
  144.       sendmail-program "/usr/bin/msmtp"
  145.       mail-specify-envelope-from t
  146.       mail-envelope-from 'header)
  147.  
  148.  
  149.  
  150. ;;need to tell msmtp which account we're using
  151.  
  152. (setq gnus-parameters
  153.   '(
  154.     (".*"
  155.      (posting-style
  156.       (address "RCV@gmail.com")
  157.       (organization "Home")
  158.       (body "! \n\n\n\n RCV")
  159.       (eval (setq message-sendmail-extra-arguments '("-a" "gmail")))
  160.       (user-mail-address "RCV@gmail.com")))
  161.     (".Work"
  162.      (posting-style
  163.       (address "RCV@mail.work.ru")
  164.       (organization "Work")
  165.       (body "  !\n\n\n\nRCV")
  166.       (eval (setq message-sendmail-extra-arguments '("-a" "RCV")))
  167.       (user-mail-address "RCV@mail.work.ru")))
  168.     ("^nntp.*"
  169.      (mm-inline-text-html-with-images t)
  170.      (mm-w3m-safe-url-regexp nil)
  171.      (mm-w3m-safe-url-regexp . "\\`cid:")
  172.      (auto-expire . t)
  173.      (mm-inline-text-html-with-images . nil)
  174.      (posting-style
  175.       (address "RCV@yandex.ru")
  176.      (name "RCV")
  177.       (organization "RCV")
  178.       (body "! \n\n\n\n RCV")
  179.       (eval (setq message-sendmail-extra-arguments '("-a" "yandex")))
  180.       (user-mail-address "RCV@yandex.ru")))
  181.     (".gwene"
  182.      (gnus-summary-line-format "%O%U%R %S\n"))
  183. ))
  184.  
  185.   (setq gnus-ignored-from-addresses
  186.       (regexp-opt
  187.        '("RCV@mail.work.ru"
  188. )))
  189.  
  190.  
  191.  
  192.  
  193.  
  194. ;;Store in server
  195. (setq gnus-message-archive-method '(nnimap "Gmail"))
  196. (setq gnus-message-archive-group
  197.            '((".*Gmail" "Send")
  198.          ("^nntp.*" "Send")
  199.          (".*" "WorkSend")
  200.              ))
  201.  
  202. ;I had the same problem a few months ago (annoing ~/Mail/archive). It seems to be related to
  203. ;a previous method of archiving, may be the default one, which relies
  204. ;on this archive directory. You probably removed the corresponding code
  205. ;from your .gnus file at some point, but the server is still there and
  206. ;regenerates the archive directory at startup. Here is what I did to get rid
  207. ;of it:
  208. ;First delete the archive directory.
  209. ;Then go to  the *server* buffer (type ^ in the *group* buffer)
  210. ;and kill the {nnfolder:archive} (type k in front of the corresponding line)
  211. ;Restart, the archive folder won't be created.
  212.  
  213.  
  214.  
  215.  
  216. (defun gnus-goto-colon ()
  217.   (goto-char (point-at-bol)))
  218.  
  219. ;;;;;Forward message C-c C-f
  220. (setq message-make-forward-subject-function 'message-forward-subject-fwd
  221. message-forward-as-mime nil
  222. message-forward-ignored-headers "^.*")
  223.  
  224.  
  225. ;;; Correct number mail
  226.  
  227.  
  228. (defun gnus-user-format-function-t (dummy)
  229.   (case (car gnus-tmp-method)
  230.     (nnimap
  231.      (message gnus-tmp-qualified-group)
  232.      (let ((count (nnimap-request-message-count gnus-tmp-qualified-group gnus-tmp-news-server)))
  233.        (if count
  234.        (format "%d" (car count))
  235.      "?")))
  236.     (t
  237.      gnus-tmp-number-total)))
  238.  
  239. (defun gnus-user-format-function-y (dummy)
  240.   (case (car gnus-tmp-method)
  241.     (nnimap
  242.      (let ((count (nnimap-request-message-count gnus-tmp-qualified-group gnus-tmp-news-server)))
  243.        (if count
  244.        (format "%d" (cadr count))
  245.      "?")))
  246.     (t
  247.      gnus-tmp-number-of-unread)))
  248.  
  249. (defvar nnimap-message-count-cache-alist nil)
  250.  
  251. (defun nnimap-message-count-cache-clear nil
  252.   (setq nnimap-message-count-cache-alist nil))
  253.  
  254. (defun nnimap-message-count-cache-get (mbox &optional server)
  255.   (when (nnimap-possibly-change-server server)
  256.     (cadr (assoc (concat nnimap-current-server ":" mbox)
  257.          nnimap-message-count-cache-alist))))
  258.  
  259. (defun nnimap-message-count-cache-set (mbox count &optional server)
  260.   (when (nnimap-possibly-change-server server)
  261.     (push (list (concat nnimap-current-server ":" mbox)
  262.         count) nnimap-message-count-cache-alist))
  263.   count)
  264.  
  265. (defun nnimap-request-message-count (mbox &optional server)
  266.   (let ((count (or (nnimap-message-count-cache-get mbox server)
  267.            (and (nnimap-possibly-change-server server)
  268.             (progn
  269.               (message "Requesting message count for %s..."
  270.                    mbox)
  271.               (prog1
  272.                   (imap-mailbox-status
  273.                    mbox '(messages unseen) nnimap-server-buffer)
  274.                 (message "Requesting message count for %s...done"
  275.                      mbox)))))))
  276.     (when count
  277.       (nnimap-message-count-cache-set mbox count server))
  278.     count))
  279.  
  280. (add-hook 'gnus-after-getting-new-news-hook 'nnimap-message-count-cache-clear)
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288. ;;;we want some confirmation before sending a message
  289.   (defvar my-message-attachment-regexp
  290.         "attach\\|\Wfiles?\W\\|enclose\\|\Wdraft\\|\Wversion\\|прикладываю\\|приложение")
  291.   (defun check-mail ()
  292.   "ask for confirmation before sending a mail. Scan for possible attachment"
  293.    (save-excursion
  294.      (message-goto-body)
  295.      (let ((warning ""))
  296.       (when (and (search-forward-regexp my-message-attachment-regexp nil t nil)
  297.                  (not (search-forward "<#part" nil t nil)))
  298.          (setq warning "No attachment.\n"))
  299.       (goto-char (point-min))
  300.       (unless (message-y-or-n-p (concat warning "Send the message ? ") nil nil)
  301.          (error "Message not sent")))))
  302.   (add-hook 'message-send-hook 'check-mail)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement