* moving text from one buffer to another
@ 2013-01-18 8:39 drain
2013-01-18 9:56 ` Filipp Gunbin
0 siblings, 1 reply; 5+ messages in thread
From: drain @ 2013-01-18 8:39 UTC (permalink / raw)
To: Help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: moving text from one buffer to another
2013-01-18 8:39 moving text from one buffer to another drain
@ 2013-01-18 9:56 ` Filipp Gunbin
2013-01-18 12:25 ` drain
0 siblings, 1 reply; 5+ messages in thread
From: Filipp Gunbin @ 2013-01-18 9:56 UTC (permalink / raw)
To: drain; +Cc: Help-gnu-emacs
On 18/01/2013 12:39 +0400, drain wrote:
> 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.
>
[snip]
>
> 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.
>
I'd use a kind of address book instead of completing-read. See `(info
"(gnus) FAQ 5-7")' (for Gnus). Then the function would need only to copy
message content to a new mail buffer. I'm not familiar with org, so I
cannot help you on writing such a function, sorry.
--
Filipp Gunbin
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-18 13:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18 8:39 moving text from one buffer to another drain
2013-01-18 9:56 ` Filipp Gunbin
2013-01-18 12:25 ` drain
2013-01-18 13:11 ` Filipp Gunbin
2013-01-18 13:25 ` drain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).