all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: drain <aeuster@gmail.com>
To: Help-gnu-emacs@gnu.org
Subject: moving text from one buffer to another
Date: Fri, 18 Jan 2013 00:39:59 -0800 (PST)	[thread overview]
Message-ID: <1358498399542-275785.post@n5.nabble.com> (raw)


I'd like to know how I could structure this function more elegantly. It
was designed to:

(1) insert the e-mail address and topic of a mail recipient.
(2) insert the body of a message written in my org-mode mail archive.

This is what I have thus far:

(defun custom-compose-mail ()
  (interactive)
  (let ((contact (completing-read 
		  "To: "
		  '(("Foo1" 1) ("Foo2" 2) ("Foo3" 3)
		    ("Foo4" 4) ("Foo5" 5) ("Foo6" 6)
		    ("Foo7" 7) ("Foo8" 8))
		  nil t )))
    (let* ((names '(("Foo1" "foo.bar@aol.com")
		    ("Foo2" "foo2@gmail.com")
 		    ("Foo3" "foo3@gmail.com")
		    ("Foo4" "foo4@gmail.com")
		    ("Foo5" "foo5@yahoo.com")
		    ("Foo6" "foo6@gmail.com")
		    ("Foo7" "foo7@yahoo.com")
                    ("Foo8" "foo8@aol.com"))))
		(setq contact (second (assoc contact names))
		      topic (read-from-minibuffer "Topic: "))
		(compose-mail contact topic)
		(end-of-buffer)
		(newline 1)
                (insert (current-kill 2)))))

When I am done writing a message, I copy it with kill-ring-save. Then a
call the above function interactively with a shortcut. It prompts me for
the name and topic, inserts them into the appropriate fields, then pastes
the copied text into the message body.

I'm comfortable with most of the code, but the way I copy text from the org
archive seems somewhat messy. After a bunch of Google searches,
"current-kill" was the first function that helped me reach my functionality
goals. But it was hardly a learned choice.



--
View this message in context: http://emacs.1067599.n5.nabble.com/moving-text-from-one-buffer-to-another-tp275785.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



             reply	other threads:[~2013-01-18  8:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18  8:39 drain [this message]
2013-01-18  9:56 ` moving text from one buffer to another Filipp Gunbin
2013-01-18 12:25   ` drain
2013-01-18 13:11     ` Filipp Gunbin
2013-01-18 13:25       ` drain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358498399542-275785.post@n5.nabble.com \
    --to=aeuster@gmail.com \
    --cc=Help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.