[Top][All Lists]

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

using (current-message) bound to a key

From: Nicolas Richard
Subject: using (current-message) bound to a key
Date: Thu, 11 Jul 2013 11:56:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)


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 ()
  (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 ()
  (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,
  (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 ?



reply via email to

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