From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Martin Slouf Newsgroups: gmane.emacs.help Subject: Re: Email in emacs Date: Wed, 10 Aug 2005 22:24:50 +0200 Message-ID: <20050810202450.GA12218@barbucha.martin.net> References: <9d8a555a05080916566945c3d6@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1123705764 16429 80.91.229.2 (10 Aug 2005 20:29:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 10 Aug 2005 20:29:24 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 10 22:29:23 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E2xB6-00032E-HX for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Aug 2005 22:27:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E2xEE-0007WI-DW for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Aug 2005 16:31:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E2xBO-0005qb-8g for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 16:28:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E2xBH-0005n1-Jx for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 16:28:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E2xBH-0005X6-5y for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 16:28:07 -0400 Original-Received: from [84.242.95.145] (helo=barbucha.martin.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E2xMK-0004ox-OJ for help-gnu-emacs@gnu.org; Wed, 10 Aug 2005 16:39:33 -0400 Original-Received: from martin by barbucha.martin.net with local (Exim 3.36 #1 (Debian)) id 1E2x86-0003HM-00 for ; Wed, 10 Aug 2005 22:24:50 +0200 Original-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <9d8a555a05080916566945c3d6@mail.gmail.com> User-Agent: Mutt/1.5.9i X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:28631 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:28631 ok, more info on mutt & emacs, as you requested: the model situation is like this -- you turn on the emacs in X (and it stays so for the rest of the day) and whenever you edit your mail message in mutt, new emacs frame is created, you type your message, close the emacs's frame (using 'C-x #') and you are back in mutt. nice side effect can be (if you set it up), that anytime your EDITOR env variable is consulted for your preferable editor, emacs frame is created and you are in your favourite environment :) to achive this, only a little should be done: 1. edit .muttrc (easy) 2. edit .emacs (harder -- im not a elisp specialist) 3. (optional, for better message editing) install mutt-alias.el and post-mode.el (easy) reason you run with emacsclient and you dont launch new emacs process from mutt directly (ie. setting mutt 'set editor = "emacs"') is that emacs' start up is slow, if you turn on plenty of features in your .emacs (which is my case) hope it will be clear. i would also be thankfull for any comments from anyone who has set up a better way to do what i describe below. +-----------------+ | 1. .muttrc part | +-----------------+ set editor = "emacsclient" +-------------------------------------------------------+ | 2. .emacs part (remember, you should be in X session) | +-------------------------------------------------------+ ;; this will start the emacs server ;; if you launch another emacs instance, ie. (run 'emacs &' from your terminal ;; more than once), problems can occure (but there is no need to do that) ;; especially i recommend to set EDITOR env variable to 'emacsclient' ;; EDITOR=emacsclient ;; and also (needed in case no emacs is running and so emacsclient cannot be ;; started) ;; ALTERNATE_EDITOR=emacs -q -u $USER (server-start) ;; this hook is run when emacsclient is launched (ie. buffer is opened using ;; emacsclient) ;; all it does is that it makes a new frame, resizes the frame a bit and raises ;; the frame (i like it this way) (defun emacsclient-custom() "Pouziti v server-visit-hook" (if window-system (progn (set-frame-height (make-frame) 50) (raise-frame)))) (add-hook 'server-visit-hook '(lambda() (emacsclient-custom))) ;; this hook is run when emacsclient is closed (ie. buffer is closed) ;; remember to close the buffer with 'C-x #' (see emacs docs for details) ;; this just closes the opened frame (defun emacsclient-custom2() "Pouziti v server-done-hook" (if window-system (progn (kill-buffer (buffer-name)) (delete-frame)))) (add-hook 'server-done-hook '(lambda() (emacsclient-custom2))) +---------------------------------------------------------+ | 3. optional part -- setting up mutt-alias and post-mode | +---------------------------------------------------------+ download those files (google will help) and place them into your ~/.emacs.d/site-lisp/ for example than place some init lines into your .emacs (one is shown below) (add-to-list 'load-path "~/.emacs.d/site-lisp") (load "post") (defun post-custom() "Pouziti v post-hook" (load "mutt-alias") (local-set-key "\C-ci" 'mutt-alias-insert) (flyspell-mode 0)) (add-hook 'post-mode-hook '(lambda() (post-custom))) (setq auto-mode-alist (cons '("mutt-" . post-mode) auto-mode-alist)) this code will turn on post-mode in any file which name contains 'mutt-' -- this is a name convention mutt uses, when it creates temporary file under your /tmp dir when you edit your message, maybe there is a better way how to identify a mutt buffer; i dont know. +----------+ | problems | +----------+ i do not know how to write good elisp code; such functions are the most complex elisp i ever wrote :). i use several desktops (6) and my mail redaer (mutt) is on another desktop than my main emacs buffers and frames, so i rarely run into this problem, but when several opened emacs' frames are on your desktops and you open the 'emacsclient buffer' on the same desktop, it is not risen up, instead the pre-existing frame is risen (the emacsclient-custom does a wrong job :( ) -- dont know how to handle this. so dont ask me :) +----------------+ | final comments | +----------------+ today, i do not use this set up for email editting :)) preferably, i use: set editor = "emacs -nw -q -l ~/.emacs_muttrc" reason is, that this set up is consistent even in ssh session (which i use a lot), though it is a bit less convenient (no X frame). as one can see i launch separate emacs process with special init file -- the emacs start is very fast, thanks to i turn only several fetaures nescessary for mail edditting. still my EDITOR variable is set up to 'emacsclient', so in other cases I use emacsclient. - - - - .emacs_muttrc start ; ; Time-stamp: < .emacs_muttrc (16:54 5.6.2005) > ; ; specialni .emacs pro mutt ; (add-to-list 'load-path "~/.emacs.d/site-lisp") (display-time-mode 1) (column-number-mode 1) (global-font-lock-mode 1) (transient-mark-mode 1) (show-paren-mode 1) (auto-fill-mode 1) (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(fill-column 79) '(grep-command "grep -n -d recurse -e \"\" *") '(hippie-expand-try-functions-list (quote (try-expand-dabbrev try-expand-dabbrev-visible try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-file-name-partially try-complete-file-name try-expand-whole-kill try-expand-list try-expand-line))) '(hippie-expand-verbose t) '(time-stamp-active t) '(time-stamp-format " %f (%02H:%02M %1d.%1m.%:y) ")) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. ) (load "hippie-exp") (global-unset-key "\M-/") (global-set-key "\M-/" 'hippie-expand) (load "post") (defun post-custom() "Pouziti v post-hook" (load "mutt-alias") (local-set-key "\C-ci" 'mutt-alias-insert) (flyspell-mode 0)) (add-hook 'post-mode-hook '(lambda() (post-custom))) (setq auto-mode-alist (cons '("mutt-" . post-mode) auto-mode-alist)) - - - - .emacs_muttrc end hope it was helpfull. i will be happy for comments and any suggestions. bye, m. On Tue, Aug 09, 2005 at 07:56:51PM -0400, Rajiv Vyas wrote: > I am debating between mutt and a an email tool within emacs. Goal is > eventuall sync it with my gmail account and will be using it to > send/recieve attachments and for user groups. > > Any suggestions? > > > Rajiv > > > _______________________________________________ > Help-gnu-emacs mailing list > Help-gnu-emacs@gnu.org > http://lists.gnu.org/mailman/listinfo/help-gnu-emacs