help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Print out my key-sequences


From: Andrea Crotti
Subject: Re: Print out my key-sequences
Date: Sun, 18 Apr 2010 10:47:48 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.90 (darwin)

Lennart Borgman <address@hidden> writes:

> On Sun, Apr 18, 2010 at 12:06 AM, Andrea Crotti
> <address@hidden> wrote:
>> Lennart Borgman <address@hidden> writes:
>>
>>>
>>> post-command-hook?
>>
>> Great almost there, it's really not so difficult apparently...
>> So given this function
>>
>> --8<---------------cut here---------------start------------->8---
>> (defun growl-popup (msg)
>>  "Show a popup using growl notification or say it, only working on OSX with 
>> growlnotify in the $PATH"
>>  (interactive)
>>  (if (not (null window-system))
>>      (shell-command (concat "growlnotify -a /Applications/Emacs.app/ -m " 
>> msg))
>>    (message msg)))
>> --8<---------------cut here---------------end--------------->8---
>>
>> I only need to pass the last command and add a hook that executes it
>> every time, the only thing missing is how to get a string from the
>> last-command variable.
>>
>> Any help?
>> This doesn't work
>> (growl-popup last-command)
>
> (growl-popup (format "%s" last-command))
>
>> Debugger entered--Lisp error: (wrong-type-argument sequencep 
>> self-insert-command)


Oh great, I did this

--8<---------------cut here---------------start------------->8---
(defun growl-popup (msg)
  "Show a popup using growl notification or say it, only working on OSX with 
growlnotify in the $PATH"
  (interactive)
  (if window-system
      (shell-command (concat "growlnotify -a /Applications/Emacs.app/ -m " msg))
    (message msg)))

(defun popup-last ()
  (interactive)
  (growl-popup (format "%s" last-command)))

(add-hook 'post-command-hook 'popup-last)
--8<---------------cut here---------------end--------------->8---

And now emacs is going crazy, when I try to evaluate something it tries
to execute it in the shell.

I then removed the hook with
(setq post-command-hook (remq 'popup-last post-command-hook))

but it didn't listen, it's continuing to use it indefinitely...

Other problems are:
- the command is shown after (not during)
- I should remove useless stuff like self-insert-command
- I want to see the keyboard combination, not the full name of the
command...






reply via email to

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