unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: help-gnu-emacs@gnu.org
Subject: using (current-message) bound to a key
Date: Thu, 11 Jul 2013 11:56:02 +0200	[thread overview]
Message-ID: <87li5d1kul.fsf@yahoo.fr> (raw)

Hello,

I'm trying to access what's located in the echo area. I failed. Could
someone explain what I'm doing wrong ?

(defun show-current-message ()
  (interactive)
  (insert (format "%s" (current-message))))
(global-set-key (kbd "<f5>") 'show-current-message)

That doesn't work, e.g. if I write "'foo" and then hit the
keys: C-x e <f5>, I get "nil" inserted whereas I expected to have
"foo" inserted.

Perhaps the way C-x e works is getting in the way, so I try this:
(defun say-hi ()
  (interactive)
  (message "hi"))
(global-set-key (kbd "<f6>") 'say-hi)

then hitting succesively f6 and f5 inserts again "nil" instead of the
expected "hi".

On the other hand,
(progn
  (message "hi")
  (call-interactively 'show-current-message))
inserts "hi" as expected.

So there is something wrong with me binding show-current-message to a
key. How to work around this ?

Thanks

-- 
Nico.



             reply	other threads:[~2013-07-11  9:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11  9:56 Nicolas Richard [this message]
2013-07-11 10:35 ` using (current-message) bound to a key Peter Dyballa
2013-07-11 11:06   ` Nicolas Richard

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87li5d1kul.fsf@yahoo.fr \
    --to=theonewiththeevillook@yahoo.fr \
    --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.
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).