unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andrea Crotti <andrea.crotti.0@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Print out my key-sequences
Date: Sun, 18 Apr 2010 10:47:48 +0200	[thread overview]
Message-ID: <m1aat1xi2z.fsf@gmail.com> (raw)
In-Reply-To: x2ze01d8a51004171600u609f24f8ge13ab469b522c8f@mail.gmail.com

Lennart Borgman <lennart.borgman@gmail.com> writes:

> On Sun, Apr 18, 2010 at 12:06 AM, Andrea Crotti
> <andrea.crotti.0@gmail.com> wrote:
>> Lennart Borgman <lennart.borgman@gmail.com> 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	other threads:[~2010-04-18  8:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 14:09 Print out my key-sequences Andrea Crotti
2010-04-07 14:23 ` Peter Dyballa
2010-04-07 14:43   ` Andrea Crotti
2010-04-07 15:07     ` suvayu ali
2010-04-08  8:44       ` Andrea Crotti
2010-04-10  5:47         ` Suvayu Ali
2010-04-17 10:11           ` Andrea Crotti
2010-04-17 15:58             ` Kevin Rodgers
2010-04-17 18:59               ` Andrea Crotti
2010-04-17 19:27                 ` Lennart Borgman
2010-04-17 22:06                   ` Andrea Crotti
2010-04-17 22:12                     ` Drew Adams
2010-04-17 22:16                       ` Drew Adams
2010-04-17 23:00                     ` Lennart Borgman
2010-04-18  8:47                       ` Andrea Crotti [this message]
2010-04-18  9:01                         ` Andrea Crotti
2010-04-18 11:13                           ` Lennart Borgman
2010-04-18 14:16                             ` Andrea Crotti
2010-04-18 14:59                               ` Thierry Volpiatto
2010-04-18 16:09                               ` Lennart Borgman
2010-04-21  7:09                               ` Kevin Rodgers
2010-05-24 17:07                                 ` Andrea Crotti
2010-05-24 18:02                                   ` Andrea Crotti
2010-05-25  6:47                                   ` Kevin Rodgers
2010-05-31 22:30                                     ` Andrea Crotti
2010-04-07 15:46     ` Thierry Volpiatto

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=m1aat1xi2z.fsf@gmail.com \
    --to=andrea.crotti.0@gmail.com \
    --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).