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

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

Re: Use Emacs to compose emails for Gmail web interface


From: Jorge
Subject: Re: Use Emacs to compose emails for Gmail web interface
Date: Wed, 18 Sep 2013 21:03:48 -0300

On Wed, Sep 18, 2013 at 1:57 PM, Jorge <address@hidden> wrote:
> [...] every time I compose an email, I type `c' in Gmail (to open compose),
> then C-a (to select all), C-c , change focus to Emacs, C-M-y (which I have
> bound to clipboard-yank), M-x delete-trailing-whitespace, edit the email,
> C-x h, C-M-w (which I have bound to clipboard-kill-ring-save), change focus
> to gmail, C-v.

I have eased the problem with some Emacs Lisp.  The following is in my .emacs:

(global-set-key "\C-x\C-g" 'gmail)
(setq gmail-temp-file (make-temp-file "gmail"))
(defun gmail-enter ()
  "Visit gmail-temp-file, delete all text in it, yank the X
clipboard, delete trailing whitespace, go to beginning of
buffer."
(interactive)
(find-file gmail-temp-file)
(delete-region (point-min) (point-max))
(clipboard-yank)
(delete-trailing-whitespace)
(goto-char (point-min)))

(defun gmail-leave ()
"Copy the whole buffer to the X clipboard, kill it."
(interactive)
(clipboard-kill-ring-save (point-min) (point-max))
(save-buffer)
(kill-buffer))

(defun gmail (prefix)
  "Without prefix argument: call gmail-enter.
With prefix argument: call gmail-leave"
  (interactive "P")
  (if prefix
      (gmail-leave)
    (gmail-enter)))

Did I do anything wrong?

Regards



reply via email to

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