From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: drain Newsgroups: gmane.emacs.help Subject: moving text from one buffer to another Date: Fri, 18 Jan 2013 00:39:59 -0800 (PST) Message-ID: <1358498399542-275785.post@n5.nabble.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1358498421 27445 80.91.229.3 (18 Jan 2013 08:40:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 18 Jan 2013 08:40:21 +0000 (UTC) To: Help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 18 09:40:39 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tw7V9-0008So-1v for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jan 2013 09:40:39 +0100 Original-Received: from localhost ([::1]:37393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tw7Up-0006rI-Dw for geh-help-gnu-emacs@m.gmane.org; Fri, 18 Jan 2013 03:40:19 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tw7Ue-0006pT-VX for Help-gnu-emacs@gnu.org; Fri, 18 Jan 2013 03:40:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tw7Uc-0006GQ-Os for Help-gnu-emacs@gnu.org; Fri, 18 Jan 2013 03:40:08 -0500 Original-Received: from sam.nabble.com ([216.139.236.26]:43909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tw7Uc-00066c-H1 for Help-gnu-emacs@gnu.org; Fri, 18 Jan 2013 03:40:06 -0500 Original-Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Tw7UV-0006Bl-Iw for Help-gnu-emacs@gnu.org; Fri, 18 Jan 2013 00:39:59 -0800 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 216.139.236.26 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88706 Archived-At: 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.