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

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

Re: Mail avec emacs24


From: Glyn Millington
Subject: Re: Mail avec emacs24
Date: Thu, 30 Apr 2015 20:17:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Hubert Chathi <address@hidden> writes:

> On Thu, 30 Apr 2015 06:43:54 +0100, Glyn Millington <address@hidden> said:
>
> [...]
>
>> I use Gnus and Notmuch
>
> Do you mean you use Gnus and Notmuch separately, or you use Gnus to
> access Notmuch?  If it's the latter, can you give some information about
> how you have that set up?  I'd be interested in looking into a setup
> like that.

Hi Hubert,

Normally the latter.   I did it something like this.

1. Install notmuch!

2. Run it from the command line, and it will take you through various
configuration options.


3. Set up your init.el to run the emacs notmuch mode (which comes with notmuch)

The code I use is below - mostly pinched from Bastien's init file!
http://bzg.fr/emacs.html.  I use John Wiegley's wonderful
use-package.el, but you can extract the useful stuff easily enough.

Hope this helps


Glyn


8<------8<------8<------8<------8<------8<------8<------8<------8<------

;;;; NOTMUCH
(use-package notmuch
  :defer 3
  :config
  (progn
     ;;;; add here stuff required to be configured *before*
     ;;; notmuch is loaded;
    ;; address completeion - not needed as we use bbdb
    ;; (require 'notmuch-address)
    ;; (setq notmuch-address-command "/usr/local/bin/notmuch-addrlookup")
    ;; (notmuch-address-message-insinuate)
    
    (setq notmuch-wash-wrap-lines-length 73)
    
    ;; set up some useful bindings
    (defun gm-notmuch-shortcut ()
      (define-key gnus-group-mode-map (kbd "<f7>") 'notmuch-search))
      
    (defun gm-notmuch-new-shortcut ()
      (define-key gnus-group-mode-map (kbd "<f6>") (shell-command "notmuch new 
> /dev/null 2>&1")))
    
    ;; hook 'em into gnus-group-mode
    (add-hook 'gnus-group-mode-hook 'gm-notmuch-shortcut)
    (add-hook 'gnus-group-mode-hook 'gm-notmuch-new-shortcut)
    
    ;; getting back into Gnus from notmuch!
    (defun gm-notmuch-file-to-group (file)
      "Calculate the Gnus group name from the given file name."
      (let* ((g0 (directory-file-name (file-name-directory file)))
             (g1 (replace-regexp-in-string "/home/glyn/Mail/" "" g0)))
        (concat "nnml:" (replace-regexp-in-string "/" "." g1))))
    
    (defun gm-notmuch-goto-message-in-gnus ()
      "Open a summary buffer containing the current notmuch
        article."
      (interactive)
      (let ((group (gm-notmuch-file-to-group (notmuch-show-get-filename)))
            (message-id (replace-regexp-in-string
                         "^id:" "" (notmuch-show-get-message-id))))
        (setq message-id (replace-regexp-in-string "\"" "" message-id))
        (if (and group message-id)
            (progn
              (switch-to-buffer "*Group*")
              (org-gnus-follow-link group message-id))
          (message "Couldn't get relevant infos for switching to
      Gnus."))))
      
    (define-key notmuch-show-mode-map (kbd "C-c C-c")
      'gm-notmuch-goto-message-in-gnus)
      
    (define-key notmuch-search-mode-map "S"
      (lambda ()
        "mark message as deleted"
        (interactive)
        (notmuch-search-tag (list "+deleted" "-inbox" "-new")))))
  
  
  :bind ("<f8>" . notmuch))






reply via email to

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