[Top][All Lists]

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

moving text from one buffer to another

From: drain
Subject: moving text from one buffer to another
Date: Fri, 18 Jan 2013 00:39:59 -0800 (PST)

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 ()
  (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" "address@hidden")
                    ("Foo2" "address@hidden")
                    ("Foo3" "address@hidden")
                    ("Foo4" "address@hidden")
                    ("Foo5" "address@hidden")
                    ("Foo6" "address@hidden")
                    ("Foo7" "address@hidden")
                    ("Foo8" "address@hidden"))))
                (setq contact (second (assoc contact names))
                      topic (read-from-minibuffer "Topic: "))
                (compose-mail contact topic)
                (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:
Sent from the Emacs - Help mailing list archive at

reply via email to

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