tag:blogger.com,1999:blog-3992530807750384868.post176862637301615408..comments2022-03-28T08:42:20.497+03:00Comments on emacs-fu: some handy key bindingsUnknownnoreply@blogger.comBlogger23125tag:blogger.com,1999:blog-3992530807750384868.post-52738584166818980532011-03-27T07:09:48.862+03:002011-03-27T07:09:48.862+03:00I bind C-x j to bury-buffer.
M-: to evaluate an e...I bind C-x j to bury-buffer.<br /><br />M-: to evaluate an expression in the minibufferAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-64118702721785779352010-09-29T11:08:22.610+03:002010-09-29T11:08:22.610+03:00C-M-l display the current function as much as poss...C-M-l display the current function as much as possible. There are times when a function is too big to fit in a window.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-85616062348727896162010-09-01T18:58:33.439+03:002010-09-01T18:58:33.439+03:00M-m -- I love you, I love you, I love you!
I'...M-m -- I love you, I love you, I love you!<br /><br />I've been using C-a ...Travis Briggshttps://www.blogger.com/profile/04531343562580857609noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-26934488787842358892010-08-12T16:45:29.040+03:002010-08-12T16:45:29.040+03:00On a Mac, I like this in my .emacs:
;; Font size ...On a Mac, I like this in my .emacs:<br /><br />;; Font size up and down<br />(global-set-key [(super =)] 'text-scale-increase)<br />(global-set-key [(super -)] 'text-scale-decrease)<br /><br />which allows me to scale text up & down using Cmd-plus and Cmd-minus.<br /><br />(You could instead use, eg, mac-key-mode.el to get "Mac-like" bindings like this for free, and to use Cmd as meta instead of super, but that's way more modification than I want, and I like having super available.)Andy Gimbletthttp://gimbo.org.uk/noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-43064190482140810132010-08-04T05:33:44.503+03:002010-08-04T05:33:44.503+03:00I use a million of'em. It's awesome that ...I use a million of'em. It's awesome that emacs does so much useful stuff right out of the box.<br /><br />M-% is query-replace. Like replace-string, but it prompts you to confirm each replacement.<br /><br />C-M-% is query-replace-regexp. It's the same thing, but with regular expressions. It's also the only default command I know of that requires four fingers. Impress your vi-using friends!<br /><br />C-x n n "narrows" the buffer to the region (the text you've selected). Useful for doing global replacements on a limited part of the buffer. Get back to the whole buffer with C-x n w ("widen").<br /><br />C-x ESC ESC repeats the last "complex" command (for example, a rectangle command).<br /><br />C-x C-x exchanges point and mark; that is, moves to the other end of the text selection.<br /><br />C-x = tells you about the character under the cursor.<br /><br />M-u, M-l, and M-c uppercase, lowercase, or capitalize the word under the cursor -- but here's a little-known neat trick: Type M-- (meta-minus) first, and it'll do the same thing to the word *before* the cursor, *without* moving the cursor. Handy.Sue D. Nymmenoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-24017645079514391692010-08-02T13:43:45.882+03:002010-08-02T13:43:45.882+03:00C-m
It always kind of annoyed me not beign able t...C-m<br /><br />It always kind of annoyed me not beign able to get to the first character of a line (but not enough to bind some key to it). Thank you for these tips!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-14605363245040749662010-08-02T12:13:19.996+03:002010-08-02T12:13:19.996+03:00Andy: This should also work if you don't happe...Andy: This should also work if you don't happen to remember the other binding: C-a enter C-p C-x C-o<br /><br />(That is, make sure that there actually is more than one line there...)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-63379918456363324852010-08-02T01:14:07.319+03:002010-08-02T01:14:07.319+03:00Eoin: As well as the indent-region solution, remem...Eoin: As well as the indent-region solution, remember that any time you find yourself repeating the same action on every line (or many lines) in a buffer, you can probably speed things up by using macros. Especially in conjunction with apply-macro-to-region-lines, in which case you would only need to type: F3 TAB F4, then mark the region (or C-x h to mark the whole buffer) and use M-x apply-macro-to-region-lines to indent every line.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-45336891683894070522010-08-02T01:06:45.817+03:002010-08-02T01:06:45.817+03:00The completion on C-x 8 RET appears to be more ver...The completion on C-x 8 RET appears to be more versatile even than Moritz U indicates. It seems to me that pressing TAB will attempt the following in sequence: (1) Find completions for the text such that the strings before and after the cursor remain intact. (2) Otherwise, find completions for the text based only on the string before the cursor.<br /><br />So "alpha" TAB will find nothing, but "alpha" C-a TAB will find everything ending in "alpha", and "alpha" C-a C-f TAB will find only "APL FUNCTIONAL SYMBOL ALPHA", because that is the only name starting with "A" and ending with "LPHA".Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-77579648311013614052010-07-31T21:34:44.683+03:002010-07-31T21:34:44.683+03:00Works like a dream. Thank you djcb! :-)Works like a dream. Thank you djcb! :-)Eoinhttps://www.blogger.com/profile/13303172160735513077noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-64690545199275838932010-07-31T15:47:44.895+03:002010-07-31T15:47:44.895+03:00Eouin: try C-x h C-M-\
ie. mark-whole-buffer and ...Eouin: try C-x h C-M-\<br /><br />ie. mark-whole-buffer and then indent-regiondjcbhttps://www.blogger.com/profile/15938154009846040711noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-75890803422647841562010-07-31T15:17:28.679+03:002010-07-31T15:17:28.679+03:00Is there a command to correct all of the indentati...Is there a command to correct all of the indentation in a file? <br /><br />When I get a horribly indented java code file from a student, I have to manually go to each line and hit TAB just so I can read it!Eoinhttps://www.blogger.com/profile/13303172160735513077noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-73463964261781705362010-07-31T06:42:53.748+03:002010-07-31T06:42:53.748+03:00I use the "repeat" one quite a bit:
C-u...I use the "repeat" one quite a bit:<br /><br />C-u C-u C-u : -- creates a row of 64 colons to separate seconds of code. (64 = 4*4 *4)<br /><br />C-u 50 : -- same, but 50 chars, to leave room for a label<br /><br />On some versions the ":" is absorbed, so quote it: C-u 50 C-q :John Tells Allhttps://www.blogger.com/profile/10134085861618082210noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-26623683355219943902010-07-31T02:27:23.677+03:002010-07-31T02:27:23.677+03:00A few more nice shortcuts:
C-M-f, C-M-b: forward-...A few more nice shortcuts:<br /><br />C-M-f, C-M-b: forward-sexp, backward-sexp<br />M-SPC: just-one-space<br />C-c : winner-undo (use winner-mode)Laurenthttp://laurent.le-brun.eunoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-65820234630721745502010-07-31T02:25:25.111+03:002010-07-31T02:25:25.111+03:00@Andy Chilton: try M-\ (delete-horizontal-space).@Andy Chilton: try M-\ (delete-horizontal-space).Nicnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-9413737169815889832010-07-31T01:52:44.694+03:002010-07-31T01:52:44.694+03:00My favorite is M-x viper-mode ;)My favorite is M-x viper-mode ;)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-12400865389204777002010-07-31T01:28:15.632+03:002010-07-31T01:28:15.632+03:00C-h b for showing all keybindings is also for inte...C-h b for showing all keybindings is also for interest.<br />C-down-mouse-3 to access the menubar as context menu.<br />C-down-mouse-1 to acces the buffer-menu.<br />C-M-SPC to mark symbols (sexp)<br />M-TAB complete-symbol (usefull for lisping)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-54809656341056699032010-07-31T01:13:01.492+03:002010-07-31T01:13:01.492+03:00Cool, a few good ones there I didn't know abou...Cool, a few good ones there I didn't know about. Thanks.<br /><br />I tried C-x C-o and it is one I'll now remember. When I press it in amongst 5 white lines it does the right thing, but I expected that if I pressed it on a single white line it wouldn't actually do anything. Instead it removes it.<br /><br />Do you know of a command such that if I press it on a single white line (e.g. that line has just whitepace on it) it won't compress the line but instead just remove the whitespace?Andy Chiltonhttp://www.chilts.org/blog/noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-23085359829895867392010-07-30T22:31:58.250+03:002010-07-30T22:31:58.250+03:00@Moritz U: ah, didn't know that, thanks! corre...@Moritz U: ah, didn't know that, thanks! corrected.<br />@BFW: thanks, correcteddjcbhttps://www.blogger.com/profile/15938154009846040711noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-3051915912550490302010-07-30T21:52:50.052+03:002010-07-30T21:52:50.052+03:00And M-/ (bound to hippie-expand) has to be my favo...And <i>M-/</i> (bound to hippie-expand) has to be my favorite binding.ahttps://www.blogger.com/profile/03202031495623868181noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-8930665197503408182010-07-30T21:51:49.169+03:002010-07-30T21:51:49.169+03:00Note: C-u M-^ mimic's vi's join.
M-q fill...Note: <i>C-u M-^</i> mimic's vi's join.<br /><br /><i>M-q</i> fills the current paragraph, not the region.ahttps://www.blogger.com/profile/03202031495623868181noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-51168701202263314012010-07-30T21:46:43.770+03:002010-07-30T21:46:43.770+03:00I have a small correction regarding the C-x 8 RET ...I have a small correction regarding the C-x 8 RET completion:<br /><br />It is also possible to use * as wildcard. C-x 8 RET HEX*GRE*POW will get you the HEXAGRAM OF GREAT POWERand thusly great power!Anonymoushttps://www.blogger.com/profile/16107710174941373063noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-70800760264077381902010-07-30T21:42:35.441+03:002010-07-30T21:42:35.441+03:00My favourites are the rectangle commands: C-x r k ...My favourites are the rectangle commands: C-x r k to kill the rectangle and C-x r t to add text.Anonymousnoreply@blogger.com