2010-11-16

emacs macro, use of keys

2010-11-16

http://xahlee.org/emacs/emacs_macro_example.html
http://groups.google.com/group/comp.emacs/browse_frm/thread/b144ac63476bbd2a#

On Nov 16, 8:20 pm, des...@verizon.net wrote:
> Xah Lee writes:
> > new article on emacs keyboard macro as well as elisp code.
> > Command Name       Key
> > start-kbd-macro     Ctrl+x (
> > end-kbd-macro       Ctrl+x )
> > call-last-kbd-macro         Ctrl+x e
> > apply-macro-to-region-lines        
> > Saving Your Keyboard Macro for Future Use
>
> Nice article.
>
> I use keyboard macros a lot and usually apply them to many lines.
>
> I could never see how the binding C-x e is sufficient.
> It's way too hard to type 5, 10, or 100 times.
>
> I know it can be repeated with a count but still sometimes I want
> to move around and apply it to various lines or words.
>
> So, I use this keybinding:
>
> (define-key global-map [(S-f19)] 'call-last-kbd-macro);; Shifted PgUp Key
>
> This converts the Page Up key in the 6 key group above the arrow keys
> into a repeat macro key.
>
> All my bindings for the PgUp key:
>
> (define-key global-map [(f19)] 'repeat-complex-command)
> (define-key global-map [(S-f19)] 'call-last-kbd-macro)
> (define-key minibuffer-local-map [(f19)] 'previous-history-element)
> (define-key minibuffer-local-map [(shift f19)] 'next-history-element)

nice and interesting.

i didn't know that PageUp key is also f19 in emacs?
A quick search in elisp manual doesn't seem to find it. Any pointer?

i have never used “repeat-complex-command” myself.

for me, the page up/down keys are used more for things related to moving by chunk.

Ctrl+PageUp = previous-user-buffer
Ctrl+PageDn = next-user-buffer

Hyper+PageUp = search-pagebreak-prev
Hyper+PageDn = search-pagebreak-next

(the search-pagebreak-prev is pretty much emacs's backward-page, but backward-page's got a problem in that it doesn't do so if the formfeed char ^L is part of a comment, sometimes required because the lang take ^L as syntax error)

other my combo with Page key are pretty standard:

Shift+PageUp = scroll-down with selection.
Alt+PageUp = scroll-other-window-down

same for Down...

for extra function keys, i use the keys on the number pad, either system-wide or within emacs.

e.g.

+ = switch to last app
- = next song
Shift+- = last song
1 = describe-char
4 = ispell-word
0 = lookup-word-definition
Ctrl+0 = lookup-wikipedia
. = xah-browse-url-at-point

many of these functions are personally defined ones or in ErgoEmacs.

for system-wide, it's either defined in AutoHotkey or IntelliType, and sometimes app dependent.
The f1 to f12 are all used up. They pretty much are one-key press to switch to a particular app. e.g. emacs is f6, Firefox is f7, Google Chrome is f4, IE is f9, PowerShell is f10...

Xah

No comments:

Post a Comment