help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to get the system emails


From: Sharon Kimble
Subject: how to get the system emails
Date: Wed, 08 Mar 2017 18:26:15 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

How can I download the /var/mail/mail system mails into my gnu working please?

This is my complete gnus config -

--8<---------------cut here---------------start------------->8---
** email with gnus
*** start up
#+BEGIN_SRC emacs-lisp
;;switch to gnus group buffer or start gnus
(defun my-switch-to-gnus-group-buffer ()
  "Switch to gnus group buffer if it exists, otherwise start gnus"
  (interactive)
  (if (or (not (fboundp 'gnus-alive-p))
          (not (gnus-alive-p)))
      (gnus)
    (switch-to-buffer "*Group*")))
(global-set-key (kbd "C-c n") 'my-switch-to-gnus-group-buffer)
#+END_SRC
[2014-12-21 Sun 13:24]

*** main config
#+begin_src emacs-lisp
(setq debug-on-error t)
(add-to-list 'load-path "/home/boudiccas/.emacs.d/personal-elisp")
(require 'quark-gnus-auto)

(setq user-full-name "Sharon Kimble"
     user-mail-address "boudiccas@skimble.plus.com")

(require 'smtpmail)
(require 'expiry-hack)

;;; http://codingquark.com/multiple-email-accounts-in-gnus/ 
                   ;; '((file :path "/net/norwich/var/mail/boztu")

(setq mail-sources '((file :path "/var/mail/boudiccas")
                       (pop :server "mail.plus.net" :user "skimble" :password 
"123454321")))

(setq gnus-secondary-select-methods '((nnml "")
                                      (nnimap "sharons"    (nnimap-address 
"mail.gandi.net"))
                                      (nnimap "tgmeds"     (nnimap-address 
"mail.gandi.net"))
                                      (nnimap "gmail"     (nnimap-address 
"imap.gmail.com")))
                                          gnus-select-method '(nnnil ""))

(setq smtpmail-smtp-server "relay.plus.net")
(setq send-mail-function 'smtpmail-send-it)
(setq message-send-mail-function 'smtpmail-send-it)

(setq smtpmail-auth-credentials "/home/boudiccas/.authinfo")

 (require 'gnutls)
 (setq starttls-use-gnutls t
       starttls-gnutls-program "/usr/bin/gnutls-cli")

(add-to-list 'gnus-secondary-select-methods
             '(nntp "news.gmane.org"))
(add-to-list 'gnus-secondary-select-methods
             '(nntp "news.gwene.org"))
(add-to-list 'gnus-secondary-select-methods
             '(nntp "nntp.aioe.org"))
(add-to-list 'gnus-secondary-select-methods
             '(nntp "news.eternal-september.org"
                    (nntp-open-connection-function nntp-open-tls-stream)
                    (nntp-port-number 563)))

(setq gnus-visible-headers 
"^From:\\|^Newsgroup:\\|^Subject:\\|^Date:\\|^Reply-to:\\|^To:")

(setq-default
     gnus-summary-line-format "%U%R%z %(%&user-date;  %-15,15f  %B (%c) %s%)\n"
     ;; gnus-summary-line-format "%U%R%z %(%&user-date;  %-15,15(%f%)  %B (%c) 
%s%)\n"
     ;; gnus-summary-line-format "%*%U%3{%R%} %I%0{%f%} %1{%s%}\n"
     gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M"))
     gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references
     gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date)
     gnus-sum-thread-tree-false-root ""
     gnus-sum-thread-tree-indent " "
     gnus-sum-thread-tree-leaf-with-other "├► "
     gnus-sum-thread-tree-root ""
     gnus-sum-thread-tree-single-leaf "╰► "
     gnus-sum-thread-tree-vertical "│"
     gnus-article-browse-delete-temp t
     gnus-treat-strip-trailing-blank-lines 'last
     gnus-keep-backlog '20)

(setq gnus-thread-sort-functions
      '((not gnus-thread-sort-by-date)))
(setq gnus-article-sort-functions
      '((not gnus-article-sort-by-date)))

(defalias 'yes-or-no-p 'y-or-n-p)

;; auto-sign all mail
(add-hook 'gnus-message-setup-hook 'mml-secure-message-sign)
(add-hook 'message-setup-hook 'mml-secure-message-sign)

; Use fancy splitting:
(setq nnmail-split-methods 'nnmail-split-fancy
nnmail-split-fancy
 '(| (to "help-bash@gnu\\.org" "help-bash")
     (to "help-gnu-emacs@gnu\\.org" "help-gnu-emacs")
     (to "markdown-discuss@six\\.pairlist\\.net" "markdown")
     (to "Markdown-Discuss@six\\.pairlist\\.net" "markdown")
     (to "info-gnus-english@gnu\\.org" "info-gnus-english")
     (to "emacs-orgmode@gnu\\.org" "org-mode")
     (to "TsDoItYourselfHormones@yahoogroups\\.com" "tsDIYhormones")
     (to "kent@mailman\\.lug\\.org\\.uk" "KLUG")
     (to "gllug@mailman\\.lug\\.org\\.uk" "GLLUG")
     (to "obnam-support@obnam\\.org" "obnam")
     (to "obnam-dev@obnam\\.org" "obnam-dev")
     (to "transgendernews-noreply@yahoogroups\\.com" "tgnews")
     (to "transsexual-uk@yahoogroups\\.com" "TSUK")
     (to "transsexual-uk-wg@yahoogroups\\.com" "TSUK-WG")
     (to "comment-reply@wordpress\\.com" "general")
     (any "wordpress@sharons\\.org\\.uk" "lockout")
     (any "wordpress@tgmeds\\.org\\.uk" "lockout")
     (any "admin@wpbeginner\\.com" "wpbeginner")
     (to "tsover40@yahoogroups\\.com" "tsover40")
     (to "gramps-users@lists\\.sourceforge\\.net" "gramps")
     (to "get_iplayer@lists\\.infradead\\.org" "get-iplayer")
     (to "tmux-users@lists\\.sourceforge\\.net" "tmux")
     (to "tmux-users@lists\\.sf\\.net" "tmux")
     (to "wikidPad@yahoogroups\\.com" "wikidpad")
     (to "crone@yahoogroups\\.com" "crone")
     (to "xetex@tug\\.org" "xetex")
     (any "logcheck@london" "system")
     (any "root@localhost.localdomain" "system")
     (any "root@london" "system")
     (any "boudiccas@localhost" "system")
     ("X-Spam-Flag" "YES" "spam")
     "general"))

(setq message-kill-buffer-on-exit t)

(require 'mm-url)
(defadvice mm-url-insert (after DE-convert-atom-to-rss () )
  "Converts atom to RSS by calling xsltproc."
  (when (re-search-forward "xmlns=\"http://www.w3.org/.*/Atom\"";
                           nil t)
    (goto-char (point-min))
    (message "Converting Atom to RSS... ")
    (call-process-region (point-min) (point-max)
                         "xsltproc"
                         t t nil
                         (expand-file-name 
"/home/boudiccas/.emacs.d/atom2rss.xsl") "-")
    (goto-char (point-min))
    (message "Converting Atom to RSS... done")))

(ad-activate 'mm-url-insert)

(require 'w3m)
;;You need install the ClI brower 'w3m' and Emacs plugin 'w3m'
(setq mm-text-html-renderer 'w3m)

;; Inline images?
(setq-default mm-attachment-override-types '("image/.*"))

;; prompt for mail replies to newsgroups!!!!!
(defadvice gnus-summary-reply (around reply-in-news activate)
  (interactive)
  (when (or (not (gnus-news-group-p gnus-newsgroup-name))
            (y-or-n-p "REALLY reply with a personal email? "))
    ad-do-it))

;; from Tassilo Horn, 17/7/14
(setq shr-color-visible-distance-min 10
          shr-color-visible-luminance-min 60)
(setq gnus-treat-fill-article 0)

(add-hook 'kill-emacs-hook
          (lambda ()
            (if (gnus-alive-p)
                (gnus-group-exit))))

(add-hook 'message-mode-hook
(lambda ()
  (setq fill-column 68)
  (turn-on-auto-fill)))

 (add-hook 'gnus-article-mode-hook
           (lambda () (setq-local widget-button-face nil)))

(defun cc-fetch-whole-thread()
  "like `A R' `T o' `A T' in the summary buffer."
  (interactive)
  (gnus-summary-refer-references)
  (gnus-summary-top-thread)
  (gnus-summary-refer-thread))

(require 'gnus-namazu)
(gnus-namazu-insinuate)
(setq gnus-namazu-make-index-command "mknmz")
(setq gnus-namazu-make-index-arguments
     '("--all" "--mailnews" "--deny=^.*[^0-9].*$" "--exclude=(SPAM|ham)"))

(defun xsteve-gnus-namazu-update-all-indices ()
  (interactive)
  (gnus-namazu-update-all-indices t))

(defun xsteve-gnus-update-namazu-index ()
(run-at-time "6:00am" nil 'xsteve-gnus-namazu-update-all-indices))

(require 'midnight)
(add-hook 'midnight-hook 'xsteve-gnus-update-namazu-index)
;;http://www.xsteve.at/prg/gnus/
;;[2015-01-07 Wed 13:06]

;; (setq gnus-message-archive-group "sent.2015")
(setq gnus-message-archive-group "sent.2017")

;;(add-hook 'gnus-started-hook '(lambda ()
;;    (define-key message-mode-map "\C-ca" 'mailrc-mode)))
#+END_SRC

#+results:
: sent.2016

[2015-03-29 Sun 11:27]
"send email 2016 group"
*** auto-tick
#+BEGIN_SRC emacs-lisp
;;# (defun pm/alter-summary-map ()
;;#   (local-set-key "d" [?M ?M ?e ?e down ?g]))

;;# (defun pm/alter-article-map ()
;;#   (local-set-key "d" "MMeen"))

;; to provide an auto-tick without pressing two keys at once
(defun sk/alter-summary-map ()
  (local-set-key "l" [?M ?M ?! ?! down ?g]))
;; FIXME - try removing 'down' in the line above, tangle and then see if it 
works in gnus, and keeps you still on your tagged line.
(add-hook 'gnus-summary-mode-hook       'sk/alter-summary-map)
;;# (add-hook 'gnus-summary-mode-hook       'pm/alter-summary-map)
;;# (add-hook 'gnus-article-mode-hook       'pm/alter-article-map)
#+END_SRC
[2015-03-29 Sun 11:27]
"send email 2016 group"
*** auto-tick
#+BEGIN_SRC emacs-lisp
;;# (defun pm/alter-summary-map ()
;;#   (local-set-key "d" [?M ?M ?e ?e down ?g]))

;;# (defun pm/alter-article-map ()
;;#   (local-set-key "d" "MMeen"))

;; to provide an auto-tick without pressing two keys at once
(defun sk/alter-summary-map ()
  (local-set-key "l" [?M ?M ?! ?! down ?g]))
;; FIXME - try removing 'down' in the line above, tangle and then see if it 
works in gnus, and keeps you still on your tagged line.
(add-hook 'gnus-summary-mode-hook       'sk/alter-summary-map)
;;# (add-hook 'gnus-summary-mode-hook       'pm/alter-summary-map)
;;# (add-hook 'gnus-article-mode-hook       'pm/alter-article-map)
#+END_SRC
[2014-12-11 Thu 03:14]

*** +bbdb+
#+BEGIN_SRC emacs-lisp
;; ;; BBDB: Address list
;; # (require 'bbdb)
;; # (bbdb-initialize 'message 'gnus 'mail)
;; # (setq bbdb-file /home/boudiccas/.emacs.d/bbdb")
;; # (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
;; # (setq bbdb/mail-auto-create-p t
;; # bbdb/news-auto-create-p t)
;; # (defvar bbdb-time-internal-format "%Y-%m-%d"
;; # "The internal date format.")
;; # ;;;###autoload
;; # (defun bbdb-timestamp-hook (record)
;; # "For use as a `bbdb-change-hook'; maintains a notes-field called 
`timestamp'
;; # for the given record which contains the time when it was last modified. If
;; # there is such a field there already, it is changed, otherwise it is added."
;; # (bbdb-record-putprop record 'timestamp (format-time-string
;; # bbdb-time-internal-format
;; # (current-time))))
;; # (add-hook 'message-mode-hook
;; # '(lambda ()
;; # (flyspell-mode t)
;; # (local-set-key "<TAB>" 'bbdb-complete-name)))
#+END_SRC
[2014-12-11 Thu 06:24]

*** misc
#+begin_src emacs-lisp
;;_+ Browse URLs
    (defun gnus-article-browse-urls ()
      "Visit a URL from the `gnus-article-buffer' by prompting via a
    poping up a buffer showing the list of URLs found with the
    `gnus-button-url-regexp'."
      (interactive)
      (gnus-configure-windows 'article)
      (gnus-summary-select-article nil nil 'pseudo)
      (let ((temp-buffer (generate-new-buffer " *Article URLS*"))
            (urls (gnus-article-get-current-urls))
            (this-window (selected-window))
            (browse-window (or (get-buffer-window gnus-article-buffer)
                               ))
            (count 0))
        (save-excursion
          (save-window-excursion
            (set-buffer temp-buffer)
            (mapcar
             (lambda (string)
               (insert (format "\t%d: %s\n" count string))
               (setq count (1+ count))) urls)
            (not-modified)
            (pop-to-buffer temp-buffer)
            (setq count (string-to-number (read-input "Browse which URL: ")))
            (kill-buffer temp-buffer))
          (if browse-window
              (progn (select-window browse-window)
                     (browse-url (nth count urls)))))
        (select-window this-window)))

    (defun gnus-article-get-current-urls ()
      "Return a list of the urls found in the current `gnus-article-buffer'"
      (let (url-list)
        (save-excursion
          (set-buffer gnus-article-buffer)
          (setq url-list (gnus-article-get-urls-region (point-min) 
(point-max))))
        url-list))

    (defun gnus-article-get-urls-region (min max)
      "Return a list of urls found in the region between MIN and MAX"
      (let (url-list)
        (save-excursion
          (save-restriction
            (narrow-to-region min max)
            (goto-char (point-min))
            (while (re-search-forward gnus-button-url-regexp nil t)
              (let ((match-string (match-string-no-properties 0)))
                (if (and (not (equal (substring match-string 0 4) "file"))
                         (not (member match-string url-list)))
                    (setq url-list (cons match-string url-list)))))))
        url-list))
#+end_src
[2015-01-02 Fri 02:17]

*** stats
#+begin_src emacs-lisp
;; Select from summary buffer and run M-x stat RET
(defun stat (beg end)
  (interactive "r")
  (let (header from-list subject-list from subject (n 0) (chars 0))
    (save-excursion
      (goto-char beg)
      (while (< (point) end)
        (setq header (gnus-summary-article-header))
        (incf n)
        (incf chars (mail-header-chars header))
        (setq from (gnus-extract-address-components (mail-header-from header)))
        (setq from (or (car from) (cadr from)))
        (if (assoc from from-list)
            (incf (cdr (assoc from from-list)))
          (push (cons from 1) from-list))
        (setq subject (gnus-simplify-subject (mail-header-subject header)))
        (if (assoc subject subject-list)
            (incf (cdr (assoc subject subject-list)))
          (push (cons subject 1) subject-list))
        (forward-line)))
    (setq from-list (sort from-list (lambda (a b) (> (cdr a) (cdr b)))))
    (setq subject-list (sort subject-list (lambda (a b) (> (cdr a) (cdr b)))))
    (switch-to-buffer-other-window (get-buffer-create "*stat*"))
    (insert (format "Total number of posts: %i\n" n))
    (insert (format "Average bytes/post: %f\n" (/ (float chars) n)))
    (insert (format "Total number of posters: %i\n" (length from-list)))
    (insert (format "Average posts/poster: %f\n\n" (stat-mean from-list)))
    (stat-top from-list 20)
    (insert (format "\nTotal number of subjects: %i\n" (length subject-list)))
    (insert (format "Average posts/subject: %f\n\n" (stat-mean subject-list)))
    (stat-top subject-list 20)))

(defun stat-mean (alist)
  (let ((mean 0))
    (dolist (x alist)
      (incf mean (cdr x)))
    (/ (float mean) (length alist))))

(defun stat-top (alist &optional n)
  (dotimes (i (if (integerp n)
                  (min n (length alist))
                (length alist)))
    (insert (format "%4i %s\n"
                    (cdr (nth i alist))
                    (car (nth i alist))))))
#+end_src
[2015-01-05 Mon 05:34]

*** last seen
#+begin_src emacs-lisp
(add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)

(setq gnus-group-line-format
      "%M\%S\%p\%P\%5y: %(%-40,40g%) %ud\n")
(defun gnus-user-format-function-d (headers)
  (let ((time (gnus-group-timestamp gnus-tmp-group)))
    (if time
        (format-time-string "%b %d  %H:%M" time)
      "")))
#+end_src
[2015-01-07 Wed 10:40]

*** +speed up+
#+begin_src emacs-lisp
;; (setq gc-cons-threshold 3500000)
;; (setq gnus-use-correct-string-widths nil)
#+end_src
[2015-02-27 Fri 18:45]

*** caching
#+begin_src emacs-lisp
(setq gnus-use-cache t)
(setq gnus-cache-directory "/home/boudiccas/Mail/cache/")
(setq gnus-cache-enter-articles '(ticked dormant read unread))
(setq gnus-cache-remove-articles nil)
(setq gnus-cacheable-groups "^nnimap")
#+end_src
[2015-02-27 Fri 18:59]

*** desktop-notify
#+begin_src emacs-lisp
;; (require 'gnus-desktop-notify)
;; (gnus-desktop-notify-mode)
;; (gnus-demon-add-scanmail)
#+end_src
[2015-02-27 Fri 19:11]

*** new 24.4.1 setup
#+begin_src emacs-lisp
(autoload 'mailrc-mode "mailrc" "Load the file \"mailrc.el(c)\" when the 
command mailrc-mode is invoked." t)
#+end_src
[2015-03-29 Sun 11:32]

*** alias
#+begin_src emacs-lisp
 '(gnus-alias-override-user-mail-address t)
 '(gnus-alias-unknown-identity-rule (quote error))
 '(gnus-always-read-dribble-file t)
 '(gnus-article-date-lapsed-new-header t)
 '(gnus-article-update-date-headers nil)
 '(gnus-asynchronous t)
 '(gnus-check-new-newsgroups nil)
 '(message-fill-column 78)
 '(message-cited-text ((((class color)) (:foreground "Blue"))))
 '(message-header-cc ((((class color)) (:bold t :foreground "green2"))))
 '(message-header-name ((((class color)) (:bold nil :foreground "Blue"))))
 '(message-header-other ((((class color)) (:foreground "Firebrick"))))
 '(message-header-subject ((((class color)) (:foreground "black"))))
 '(message-header-xheader ((((class color)) (:foreground "Blue"))))
 '(message-mml ((((class color)) (:foreground "DarkGreen"))))
 '(message-separator ((((class color)) (:foreground "Tan"))))
#+end_src
[2015-02-14 Sat 02:26]
from john wigiely git repo

*** attach file
#+begin_src emacs-lisp
(setq mml-attach-files-at-end t)

(defun mml-attach-file (file &optional type description disposition)
  "Attach a file to the outgoing MIME message.
The file is not inserted or encoded until you send the message with
`\\[message-send-and-exit]' or `\\[message-send]' in Message mode,
or `\\[mail-send-and-exit]' or `\\[mail-send]' in Mail mode.

FILE is the name of the file to attach.  TYPE is its
content-type, a string of the form \"type/subtype\".  DESCRIPTION
is a one-line description of the attachment.  The DISPOSITION
specifies how the attachment is intended to be displayed.  It can
be either \"inline\" (displayed automatically within the message
body) or \"attachment\" (separate from the body)."
  (interactive
   (let* ((file (mml-minibuffer-read-file "Attach file: "))
          (type (mml-minibuffer-read-type file))
          (description (mml-minibuffer-read-description))
          (disposition (mml-minibuffer-read-disposition type nil file)))
     (list file type description disposition)))
  ;; If in the message header, attach at the end and leave point unchanged.
  (let ((head (unless (and (message-in-body-p) (not mml-attach-files-at-end)) 
(point))))
    (if (or head mml-attach-files-at-end) (goto-char (point-max)))
    (mml-insert-empty-tag 'part
                          'type type
                          ;; icicles redefines read-file-name and returns a
                          ;; string w/ text properties :-/
                          'filename (mm-substring-no-properties file)
                          'disposition (or disposition "attachment")
                          'description description)
    ;; When using Mail mode, make sure it does the mime encoding
    ;; when you send the message.
    (or (eq mail-user-agent 'message-user-agent)
        (setq mail-encode-mml t))
    (when (or head mml-attach-files-at-end)
      (unless (pos-visible-in-window-p)
        (message "The file \"%s\" has been attached at the end of the message"
                 (file-name-nondirectory file)))
      (goto-char head))))
#+end_src
[2015-03-27 Fri 16:34]

*** show images
#+begin_src emacs-lisp
(add-hook
    'gnus-article-prepare-hook
    (lambda ()
            (gnus-article-show-images)))
#+end_src
[2015-03-07 Sat 06:49]

*** init
#+begin_src emacs-lisp
;; # (gnus-activate-level 2)
;; # (gnus-agent-expire-all t)
;; # (gnus-agent-expire-days 14)
;; # (gnus-agent-go-online t)
;; # (gnus-agent-mark-unread-after-downloaded nil)
;; # (gnus-agent-synchronize-flags t)
;; # (gnus-always-read-dribble-file t)
;; # (gnus-article-date-lapsed-new-header t)
;; # (gnus-article-update-date-headers nil)
;; # (gnus-asynchronous t)
;; # (gnus-check-new-newsgroups nil)
;; # (gnus-default-article-saver (quote gnus-summary-save-in-mail))
;; # (gnus-gcc-mark-as-read t)
;; # (gnus-generate-tree-function (quote gnus-generate-horizontal-tree))
;; # (gnus-group-default-list-level 2)
#+end_src
[2015-07-10 Fri 12:12]

*** sandbox
**** toggle threads
#+begin_src emacs-lisp
(define-key gnus-summary-mode-map "\C-c\C-t" 'gnus-summary-toggle-threads)
#+end_src
**** delete and read next
#+begin_src emacs-lisp
(defun delete-then-read-next ()
  (interactive)
  (gnus-summary-mark-as-expirable 1)
  (gnus-summary-scroll-up 1)
)
(add-hook 'gnus-summary-mode-hook (lambda ()
    (local-set-key "r" 'delete-then-read-next)
    (local-set-key "d" 'gnus-summary-put-mark-as-expirable-next)
    (local-set-key "u" 'gnus-summary-clear-mark-forward)
    (local-set-key "x" 'gnus-summary-expire-articles)
    (local-set-key "s" 'gnus-summary-move-article)))
#+end_src
[2015-01-21 Wed 05:53]
(defun sk/alter-summary-map ()
  (local-set-key "k" [?M ?M ?! ?! down ?g]))
;; FIXME - try removing 'down' in the line above, tangle and then see if it 
works in gnus, and keeps you still on your tagged line.
(add-hook 'gnus-summary-mode-hook       'sk/alter-summary-map)

**** smtpmail-multi
#+begin_src emacs-lisp
(require 'cl)
(require 'nnir)
(require 'smtpmail-multi)
#+end_src
[2016-02-16 Tue 06:39]
**** quark

#+begin_src emacs-lisp
(defun quark-gnus-auto
(defun quark-gnus-auth-sources ()
  "Return the list of all auth sources from the .authinfo[.gpg]
Temporary wrapper around auth-source-search to avoid bug #22188 - solved in 
emacs25"
  (auth-source-search :port '(25 587 993) :max 999))

(defun quark-gnus-preprocess-email (email)
  "Replaces charaters in email address to prepare
it to be interned as a symbol"
  (replace-regexp-in-string (regexp-quote "@") "." email nil 'literal))

(defun quark-gnus-is-smtp (source)
  "Naive way to determine if the source from .authinfo is an
smtp account"
  (let ((host (plist-get source :host))
        (port (plist-get source :port)))
    (or (and host (string-match "^smtp\\." host))
        (and port
             (or
              (string= port "25")
              (string= port "587"))))))

(defun quark-gnus-is-nntp (source)
  "Naive way to determin if source from .authinfo is an nntp
account"
  (let ((host (plist-get source :host))
        (port (plist-get source :port)))
    (or (and host (or (string-match "^news\\." host)
                      (string-match "^nntp\\." host)))
        (and port (or
                   (string= port "119")
                   (string= port "563"))))))

(defun quark-gnus-is-imap (source)
  "Naive way to determin if source from .authinfo is an imap
account"
  (let ((host (plist-get source :host))
        (port (plist-get source :port)))
    (or (and host (or (string-match "^imap\\." host)
                      (string-match "@gmail" host)))
        (and port
             (or
              (string= port "993")
              (string= port "143"))))))

(defun quark-gnus-create-smtpmail-multi-accounts (smtps)
  "Given the SMTPS - list of smtp accounts from authinfo,
create a variable `smtpmail-multi-accounts' from smtpmail-multi
package, assuming login is the email address.
Best suitable for gmail-like services.

If port is not specified use the 25 port and no encryption.
If port is 587 use starttls encryption."
  (let ((accounts nil))
    (dolist (source smtps)
      (let* ((user (plist-get source :user))
             (host (plist-get source :host))
             (port-from-source (plist-get source :port))
             (port (if port-from-source port-from-source "25")))
        (push
         `(,(intern (quark-gnus-preprocess-email user)).
           (,user
            ,host
            ,(string-to-number port)
            ,user
            ,(if (string= port "587") 'starttls 't)
            nil nil nil))
         accounts)))
    `(setq smtp-multi-accounts (quote ,(reverse accounts)))))

(defun quark-gnus-create-smtpmail-multi-associations (smtps)
  "Given the SMTPS - list of smtp accounts from authinfo, create
a variable `smtpmail-multi-associations' from smtpmail-multi package,
assuming login is the email address."
  (let ((accounts nil))
    (dolist (source smtps)
      (let* ((mail (plist-get source :user))
             (symb (quark-gnus-preprocess-email mail)))
        (push
         `(,mail ,(intern symb))
         accounts)))
    `(setq smtpmail-multi-associations (quote ,(reverse accounts)))))

(defun quark-gnus-create-gnu-posting-styles (smtps)
  "Given the SMTPS - list of smtp accounts from authinfo, create a variable
`gnus-posting-styles' from GNUS package, assuming
login is the email address.
Best suitable for gmail-like services."
  (let ((accounts nil))
    (dolist (source smtps)
      (let ((mail (plist-get source :user)))
        (push
         `((header "to" ,mail)
           (address ,mail))
         accounts)
        (push
         `((header "cc" ,mail)
           (address ,mail))
         accounts)))
    `(setq gnus-posting-styles (quote ,(reverse accounts)))))

(defun quark-gnus-set-gnus-select-method (nntps)
  "Given the NNTPS - list of NNTP accounts from authinfo, create a variable
`gnus-select-method' from GNUS package, taking the first NNTP account
from the list. If the list is empty, the variable is not changed."
  (when nntps
    (let ((nntp (car nntps)))
      `(setq gnus-select-method '(nntp ,(plist-get nntp :host))))))

(defun quark-gnus-imap-add-to-gnus-secondary-select-methods (imaps is-gmail)
  "Given the IMAPS - list of IMAP accounts from authinfo, append the list
`gnus-secondary-select-methods' from GNUS package with the generated
entries for typical gmail-alike IMAP servers."
  (let ((accounts nil))
    (dolist (source imaps)
      (let ((user (plist-get source :user))
            (host (plist-get source :host)))
        (if (funcall is-gmail source)
            (push
             `(add-to-list 'gnus-secondary-select-methods
                           '(nnimap ,host
                                    (nnimap-address "imap.gmail.com")
                                    (nnimap-server-port "imaps")
                                    (nnimap-stream ssl)
                                    (nnir-search-engine imap)))
             accounts)
          (push
           `(add-to-list 'gnus-secondary-select-methods
                         '(nnimap ,user
                                  (nnimap-address ,host)
                                  (nnimap-server-port "imaps")
                                  (nnimap-stream ssl)
                                  (nnir-search-engine imap)))
           accounts))))
    `(progn ,@(reverse accounts))))

(let ((smtps (remove-if-not 'quark-gnus-is-smtp (quark-gnus-auth-sources))))
  (eval (quark-gnus-create-smtpmail-multi-accounts smtps))
  (eval (quark-gnus-create-smtpmail-multi-associations smtps))
  (eval (quark-gnus-create-gnu-posting-styles smtps))
  (setq smtpmail-multi-default-account (caar smtpmail-multi-accounts))
  (setq user-mail-address (second (car smtpmail-multi-accounts))))

(let ((nntps (remove-if-not 'quark-gnus-is-nntp (quark-gnus-auth-sources))))
  (eval (quark-gnus-set-gnus-select-method nntps)))

(let ((imaps (remove-if-not 'quark-gnus-is-imap (quark-gnus-auth-sources))))
  (eval (quark-gnus-imap-add-to-gnus-secondary-select-methods imaps (lambda (h) 
(string-match "gmail" (plist-get h :host)))))))
#+end_src
[2016-02-16 Tue 07:12]
https://github.com/codingquark/emacs.d/blob/master/lisp/quark-gnus-auto.el

*** atom->rss
#+begin_src emacs-lisp
;;; Convert Atom to RSS

;; The code for `utl-convert-atom-to-rss' is taken from a defadvice from
;; <http://www.emacswiki.org/emacs/GnusRss>.  The original
;; "atom2rss.xsl" is taken from <http://atom.geekhood.net/>.

;; Github private feed (with info from <https://github.com>) is an Atom,
;; so we need to convert it to use with gnus.  There is a little
;; problem: "atom2rss.xsl" tries to insert a comment with self link to
;; the resulting rss, but a github private link may contain "--" in it
;; (for me this link is:
;; 
"https://github.com/alezost.private.atom?token=a_lot_of_numbers_and_letters--more_numers_and_letters";)
;; and as it is not allowed in xml comments, xsltproc throws an error.

;; To fix that, I commented the line:
;;
;;   <x:template match="atom:feed/atom:link[@rel='self']"> ...
;;
;; in "atom2rss.xsl" and now I can check github feed in gnus. Hooray!

(defvar utl-atom2rss-file
  (expand-file-name "atom2rss.xsl" user-emacs-directory)
  "Path to \"atom2rss.xsl\" file for converting Atom to RSS.")

(defun utl-convert-atom-to-rss (&rest _)
  "Convert Atom to RSS (if needed) by calling xsltproc.
This function is intendend to be used as an 'after' advice for
`mm-url-insert', i.e.:
  (advice-add 'mm-url-insert :after #'utl-convert-atom-to-rss)"
  (when (re-search-forward "xmlns=\"http://www.w3.org/.*/Atom\"";
                           nil t)
    (goto-char (point-min))
    (message "Converting Atom to RSS... ")
    (call-process-region (point-min) (point-max)
                         "xsltproc"
                         t t nil
                         utl-atom2rss-file "-")
    (goto-char (point-min))
    (message "Converting Atom to RSS... done")))
#+end_src
[2015-11-14 Sat 15:38]
from https://github.com/alezost/emacs-utils/blob/master/utl-gnus.el#L199-L238

#+begin_src emacs-lisp
(setq utl-atom2rss-file "/home/boudiccas/emacs.d/atom2rss.xsl")
(advice-add 'mm-url-insert :after #'utl-convert-atom-to-rss)
#+end_src
[2015-11-14 Sat 15:47]
from email from Alex Kost 14-11-15

*** gnus-summary-search-author
#+begin_src emacs-lisp
(defun gnus-summary-search-author (author)
  "As `gnus-summary-limit-to-author',
only do this on all articles in the group,
not just those displayed."
  (interactive "sFrom: ")
  (gnus-summary-insert-old-articles t) ; ALL
  (gnus-summary-limit-to-author author) )
#+end_src
[2015-12-02 Wed 18:59]
From emmanuel berg

*** +email notifications+
#+begin_src emacs-lisp
;; (gnus-demon-add-handler 'gnus-demon-scan-news 30 t)
#+end_src
[2016-10-11 Tue 13:10]
http://codingquark.com/life/2016/10/06/email-notifications-gnus.html
checks every 1 minute, when its working set it for 30 minutes

#+begin_src emacs-lisp
;; (require 'gnus-notify+)
;; (add-hook 'gnus-summary-exit-hook 'gnus-notify+)
;; (add-hook 'gnus-group-catchup-group-hook 'gnus-notify+)
;; (add-hook 'mail-notify-pre-hook 'gnus-notify+)
#+end_src
[2016-10-11 Tue 13:12]

#+begin_src emacs-lisp
;; (display-time-mode) ;; turn the mode on
;; (setq display-time-format "") ;; Hide the date, we have other clocks
;; (setq display-time-mail-directory "~/Mail/general") ;; important directory
;; (setq read-mail-command 'gnus) ;; when clicked (ewwww), open gnus
;; (add-hook 'gnus-group-mode-hook 'display-time-event-handler) ;; force timer 
update when gnus receives the emails
#+end_src
[2016-10-11 Tue 13:13]

*** gnus-colors
#+begin_src emacs-lisp
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(message-cited-text ((((class color)) (:foreground "lightBlue"))))
 '(message-header-cc ((((class color)) (:bold t :foreground "green2"))))
 '(message-header-name ((((class color)) (:bold nil :foreground "LightBlue"))))
 '(message-header-other ((((class color)) (:foreground "Firebrick"))))
 '(message-header-xheader ((((class color)) (:foreground "LightBlue"))))
 '(message-mml ((((class color)) (:foreground "DarkGreen"))))
 '(message-separator ((((class color)) (:foreground "Tan")))))
#+end_src
[2016-03-11 Fri 18:57]
from John Wiegley's gnus settings file

*** datestamp subject note
#+begin_src emacs-lisp
(require 'message)
(require 'bbdb-gnus)
(defun sacha/gnus-add-subject-to-bbdb-record ()
  "Add datestamped subject note for each person this message has been sent to."
  (let* ((subject (concat (format-time-string "%Y-%m-%d")
                          ": E-mail: " (message-fetch-field "Subject") "\n"))
         (bbdb-message-all-addresses t)
         records)
    (setq records
          (bbdb-update-records (bbdb-get-address-components 'recipients) t))
    (mapc (lambda (rec)
            (bbdb-record-set-field rec
                                   'contact
                                   (concat subject "\n"
                                           (or (bbdb-record-field rec 
'contact)))))
          records)))
(add-hook 'message-send-hook 'sacha/gnus-add-subject-to-bbdb-record)
#+end_src
[2016-03-06 Sun 15:39] 
sachac

--8<---------------cut here---------------end--------------->8---

Currently I'm able to get emails from 'cron daemon' but not the rest of
the system emails. So how can I get them please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = http://www.drugfacts.org.uk  
Debian 8.6, fluxbox 1.3.5-2, emacs 25.1.1.1

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]