[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to automate a code
From: |
Alex Kost |
Subject: |
Re: how to automate a code |
Date: |
Mon, 15 Sep 2014 18:50:05 +0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Renato Pontefice (2014-09-15 14:50 +0400) wrote:
> Hi,
> it's still me... with same question:
>
> How can I automate this elisp code, that works, if I paste on emacs
> ___________________________________________________________________
> (while (and (not (eobp))
> (search-forward "[-" nil 'move))
> (skip-chars-forward "A-Z")
> (unless (looking-at "-]")
> (message "Problem found, please fix and hit C-M-c to continue")
> (recursive-edit)))
> ________________________________________________________________
>
> I'm sorry, but I lost my self on the previous thread :-( (my english is not
> so good :-( )
>
> All I need, is to run this code when I press a button (or better a key,
> keybind...)
>
> Can someone tell me how to do that?
1. You can define an interactive function:
(defun my-working-code ()
"Some really useful thing."
(interactive)
(while (and (not (eobp))
(search-forward "[-" nil 'move))
(skip-chars-forward "A-Z")
(unless (looking-at "-]")
(message "Problem found, please fix and hit C-M-c to continue")
(recursive-edit))))
2. And bind it to any key you want:
(global-set-key (kbd "C-S-z") 'my-working-code)
Hint: string in the (kbd ...) is the same as you see after pressing
"C-h c ..."
- how to automate a code, Renato Pontefice, 2014/09/15
- Re: how to automate a code,
Alex Kost <=
- Message not available