Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (add-to-list 'load-path "~/.emacs.d/gnus/lisp/")
- (require 'gnus-load)
- (require 'cl)
- (require 'gnus)
- (setq gnus-save-newsrc-file nil)
- (setq user-full-name "RCV" ;; Установка полного имени пользователя:
- message-send-mail-partially-limit nil
- gnus-always-read-dribble-file t ;; Don't waste my time asking whether I want to get dribble autosave
- gnus-interactive-exit nil ;; Don't waste my time with interactive exit
- gnus-home-directory "~/.emacs.d/Gnus"
- gnus-directory "~/.emacs.d/Gnus/News/"
- message-directory "~/.emacs.d/Gnus/Mail/"
- nnfolder-directory "~/.emacs.d/Gnus/Mail/archive/"
- message-auto-save-directory "~/.emacs.d/Gnus/Mail/drafts"
- gnus-gcc-mark-as-read t ;; Stops sent emails appearing as new
- gnus-inhibit-startup-message t ;; no startup message
- gnus-large-newsgroup 200 ;; do not prompt when accessing large folders
- gnus-read-active-file 'some
- gnus-auto-select-next 'quietly
- gnus-permanently-visible-groups "Work"
- message-kill-buffer-on-exit t) ;;really close the mail window after sending it.
- (setq-default gnus-asynchronous t
- gnus-novice-user nil
- gnus-use-cache t
- )
- (setq gnus-select-method '(nnimap "Gmail"
- (nnimap-address "imap.gmail.com")
- (nnimap-expunge-on-close always)
- (nnimap-authinfo-file "~/.emacs.d/Gnus/.imap-authinfo")
- (nnimap-server-port 993)
- (nnimap-stream ssl)))
- (setq gnus-secondary-select-methods '(
- (nnimap "Work"
- (nnimap-address "mail.work.ru")
- (nnimap-authinfo-file "~/.emacs.d/Gnus/.imap-authinfo")
- (nnimap-stream ssl)
- (nnimap-server-port 993))
- ;; (nntp "aioe"
- ;; (nntp-open-connection-function
- ;; nntp-open-ssl-stream)
- ;; (nntp-port-number "563")
- ;; (nntp-address "news.aioe.org"))
- (nntp "gnu"
- (nntp-address "news.gnus.org"))
- ;; (nntp "neva"
- ;; (nntp-open-connection-function
- ;; nntp-open-ssl-stream)
- ;; (nntp-port-number "563")
- ;; (nntp-address "news2.neva.ru"))
- (nntp "gmane"
- (nntp-open-connection-function
- nntp-open-ssl-stream)
- (nntp-port-number "563")
- (nntp-address "news.gmane.org"))))
- (setq gnus-group-line-format "%M%S%p%P%5y:%B%(%uG%)%l %O\n")
- (defun gnus-user-format-function-G (arg)
- (concat (car (cdr gnus-tmp-method)) ":"
- (or (gnus-group-find-parameter gnus-tmp-group 'display-name)
- (let ((prefix (assq 'remove-prefix (cddr gnus-tmp-method))))
- (if (and prefix
- (string-match (concat "^\\("
- (regexp-quote (cadr prefix))
- "\\)")
- gnus-tmp-qualified-group))
- (substring gnus-tmp-qualified-group (match-end 1))
- gnus-tmp-qualified-group)))))
- ;(setq gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Установка удобного просмотра;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Turn on adaptive scoring
- ;(setq gnus-group-line-format "%M%S%5y:%B%(%G%)\n")
- ;(setq gnus-use-adaptive-scoring '(line))
- (setq-default
- gnus-summary-line-format "%U%R%z %(%&user-date; %-15,15f %* %B%s%)\n"
- gnus-user-date-format-alist '((t . "%d.%m.%Y %H:%M"))
- )
- (setq gnus-show-threads nil
- gnus-article-sort-functions '((not gnus-article-sort-by-date))
- gnus-use-adaptive-scoring nil
- gnus-use-scoring nil)
- (defun hide-modeline ()
- (setq mode-line-format nil))
- (add-hook 'gnus-group-mode-hook 'hide-modeline)
- (add-hook 'gnus-summary-mode-hook 'hide-modeline)
- (gnus-add-configuration
- '(article
- (vertical 0.25
- (horizontal 0.3
- (group 0.3)
- (summary 1.0 point))
- (horizontal 1.0
- (article 1.0)))))
- (gnus-add-configuration
- '(summary
- (horizontal 0.25
- (vertical 0.3
- (group 1.0))
- (vertical 1.0
- (summary 1.0 point)))))
- ;; Adaptive scoring weights
- ;; (setq gnus-default-adaptive-score-alist
- ;; '((gnus-unread-mark)
- ;; (gnus-ticked-mark (from 4))
- ;; (gnus-dormant-mark (from 7))
- ;; (gnus-del-mark (from -4) (subject -15))
- ;; (gnus-read-mark (from 5) (subject 30))
- ;; (gnus-expirable-mark (from -0) (subject -0))
- ;; (gnus-killed-mark (from -4) (subject -20))
- ;; (gnus-kill-file-mark)
- ;; (gnus-ancient-mark (subject -10))
- ;; (gnus-low-score-mark)
- ;; (gnus-catchup-mark (from -1) (subject -10))))
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Установка удобного просмотра;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Don't make email expirable by default
- (remove-hook 'gnus-mark-article-hook
- 'gnus-summary-mark-read-and-unread-as-read)
- (add-hook 'gnus-mark-article-hook 'gnus-summary-mark-unread-as-read)
- (setq nnmail-expiry-wait 1)
- (setq message-send-mail-function 'message-send-mail-with-sendmail
- smtpmail-local-domain "nanoemacs"
- mail-user-agent 'gnus-user-agent
- sendmail-program "/usr/bin/msmtp"
- mail-specify-envelope-from t
- mail-envelope-from 'header)
- ;;need to tell msmtp which account we're using
- (setq gnus-parameters
- '(
- (".*"
- (posting-style
- (address "RCV@gmail.com")
- (organization "Home")
- (body "! \n\n\n\n RCV")
- (eval (setq message-sendmail-extra-arguments '("-a" "gmail")))
- (user-mail-address "RCV@gmail.com")))
- (".Work"
- (posting-style
- (address "RCV@mail.work.ru")
- (organization "Work")
- (body " !\n\n\n\nRCV")
- (eval (setq message-sendmail-extra-arguments '("-a" "RCV")))
- (user-mail-address "RCV@mail.work.ru")))
- ("^nntp.*"
- (mm-inline-text-html-with-images t)
- (mm-w3m-safe-url-regexp nil)
- (mm-w3m-safe-url-regexp . "\\`cid:")
- (auto-expire . t)
- (mm-inline-text-html-with-images . nil)
- (posting-style
- (address "RCV@yandex.ru")
- (name "RCV")
- (organization "RCV")
- (body "! \n\n\n\n RCV")
- (eval (setq message-sendmail-extra-arguments '("-a" "yandex")))
- (user-mail-address "RCV@yandex.ru")))
- (".gwene"
- (gnus-summary-line-format "%O%U%R %S\n"))
- ))
- (setq gnus-ignored-from-addresses
- (regexp-opt
- '("RCV@mail.work.ru"
- )))
- ;;Store in server
- (setq gnus-message-archive-method '(nnimap "Gmail"))
- (setq gnus-message-archive-group
- '((".*Gmail" "Send")
- ("^nntp.*" "Send")
- (".*" "WorkSend")
- ))
- ;I had the same problem a few months ago (annoing ~/Mail/archive). It seems to be related to
- ;a previous method of archiving, may be the default one, which relies
- ;on this archive directory. You probably removed the corresponding code
- ;from your .gnus file at some point, but the server is still there and
- ;regenerates the archive directory at startup. Here is what I did to get rid
- ;of it:
- ;First delete the archive directory.
- ;Then go to the *server* buffer (type ^ in the *group* buffer)
- ;and kill the {nnfolder:archive} (type k in front of the corresponding line)
- ;Restart, the archive folder won't be created.
- (defun gnus-goto-colon ()
- (goto-char (point-at-bol)))
- ;;;;;Forward message C-c C-f
- (setq message-make-forward-subject-function 'message-forward-subject-fwd
- message-forward-as-mime nil
- message-forward-ignored-headers "^.*")
- ;;; Correct number mail
- (defun gnus-user-format-function-t (dummy)
- (case (car gnus-tmp-method)
- (nnimap
- (message gnus-tmp-qualified-group)
- (let ((count (nnimap-request-message-count gnus-tmp-qualified-group gnus-tmp-news-server)))
- (if count
- (format "%d" (car count))
- "?")))
- (t
- gnus-tmp-number-total)))
- (defun gnus-user-format-function-y (dummy)
- (case (car gnus-tmp-method)
- (nnimap
- (let ((count (nnimap-request-message-count gnus-tmp-qualified-group gnus-tmp-news-server)))
- (if count
- (format "%d" (cadr count))
- "?")))
- (t
- gnus-tmp-number-of-unread)))
- (defvar nnimap-message-count-cache-alist nil)
- (defun nnimap-message-count-cache-clear nil
- (setq nnimap-message-count-cache-alist nil))
- (defun nnimap-message-count-cache-get (mbox &optional server)
- (when (nnimap-possibly-change-server server)
- (cadr (assoc (concat nnimap-current-server ":" mbox)
- nnimap-message-count-cache-alist))))
- (defun nnimap-message-count-cache-set (mbox count &optional server)
- (when (nnimap-possibly-change-server server)
- (push (list (concat nnimap-current-server ":" mbox)
- count) nnimap-message-count-cache-alist))
- count)
- (defun nnimap-request-message-count (mbox &optional server)
- (let ((count (or (nnimap-message-count-cache-get mbox server)
- (and (nnimap-possibly-change-server server)
- (progn
- (message "Requesting message count for %s..."
- mbox)
- (prog1
- (imap-mailbox-status
- mbox '(messages unseen) nnimap-server-buffer)
- (message "Requesting message count for %s...done"
- mbox)))))))
- (when count
- (nnimap-message-count-cache-set mbox count server))
- count))
- (add-hook 'gnus-after-getting-new-news-hook 'nnimap-message-count-cache-clear)
- ;;;we want some confirmation before sending a message
- (defvar my-message-attachment-regexp
- "attach\\|\Wfiles?\W\\|enclose\\|\Wdraft\\|\Wversion\\|прикладываю\\|приложение")
- (defun check-mail ()
- "ask for confirmation before sending a mail. Scan for possible attachment"
- (save-excursion
- (message-goto-body)
- (let ((warning ""))
- (when (and (search-forward-regexp my-message-attachment-regexp nil t nil)
- (not (search-forward "<#part" nil t nil)))
- (setq warning "No attachment.\n"))
- (goto-char (point-min))
- (unless (message-y-or-n-p (concat warning "Send the message ? ") nil nil)
- (error "Message not sent")))))
- (add-hook 'message-send-hook 'check-mail)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement