- 2009-10-12 (Mon) 22:26
- emacs
I got some reactions about Emacs via Twitter/Facebook.
Gary B at work told me about this command.
(global-set-key "\C-x\C-m" 'execute-extended-command)
It sets up another key stroke (C-x C-m) for “execute-extended-command“, which you can do with M-x as default. I was also originally thinking that “execute-extended-command” is such a frequent command and why Emacs doesn’t assign with Control key instead of Meta. As Gary told me “it’ll grow on you.” For me personally at this moment, I have no problems with doing M-x, but we’ll see. At least now I know how to do it.
Steph told me 3 things at one message.
M-x occur
is absolute useful. My initial reaction was, “Hmm, it looks similar to tag jump?” But I was wrong. Because it takes regex, it can do a lot more flexible, and more over it’s on the fly. Neat!
M-x align-regexp
I haven’t used it yet but looks nice. And I found this page: Emacs wiki — Align commands comes with tons of other useful tricks for aligning.
Also % for finding the matching brace.
I found M-C-f (forward) and M-C-b (backward) in order to do that. How do I do with % sign?
Before I used Emacs on my dev box only very once in a while and I couldn’t like for various reasons. One of the biggest glitch was, lots of my config wasn’t simply working. So, I setup .emacs.el and .emacs.d on my linux dev box today. It was not still working, then I realize “Hmm, maybe I can update Emacs.” Gentoo default was 21. 22 was installed, but not defaultly used. And latest is 23. Why not? Boon, here you go. Emacs 23 works perfectly fine now.
As I explained before (Emacs Again (1): config), I setup all Emacs related config files on Dropbox. I know you can setup Dropbox on Linux but since all dev at work can log into my dev box, I don’t wanna do that. So what I did was setup rsync script on both my work mac and my linux box.
#!/bin/sh
rsync --progress -a --rsh='ssh -p22' $HOME/Dropbox/Config/emacs/ takashi@my.devbox.local:emacs/ --exclude 'auto-save-list' --exclude '.DS_Store' --exclude 'tramp'
then I run this command everyday. Yay.
One last thing is about permission issue. I believe I talked about this with Mauvis before (and I don’t remember what he does, sorry!).
If you start to use Emacs, then you wanna do every text editing in Emacs. But what if you wanna edit something that requires root permission. You can do sudo emacs /something/important Yeah, you can do it but… It’s not efficient at all.
One other way I found was using tramp. But I don’t like the idea because it implicitly requires that you can login as root via ssh on your localhost. I think it’s definitely a nice hack but I don’t like the solution. And I talked to Gary about it, and he said “then I use vi.” Touché, Gary.
- Newer: Update SSL Certificate
- Older: Emacs Again (8): Recent Commands
Comments:3
- stephanie 09-10-13 (Tue) 11:07
-
Put the cursor on top of the brace. And then press: shift-5 (the % sign). It will take you to the matching brace.
- beatak 09-10-13 (Tue) 11:33
-
Shift-5 (% sign) sounds like vi’s key stroke to find a matched brace. It doesn’t work on my Emacs instance… Maybe you have setup something in .emacs.el? We should do .emacs.el show-and-tell! That actually might be a good idea for the next event of my meetup. Come and join us!
- stephanie 09-10-13 (Tue) 12:58
-
aha, it was in my .emacs file:
http://www.gnu.org/software/emacs/emacs-faq.html#Matching-parentheses
;; By an unknown contributor
(global-set-key “%” ‘match-paren)
(defun match-paren (arg)
“Go to the matching paren if on a paren; otherwise insert %.”
(interactive “p”)
(cond ((looking-at “\\s\(”) (forward-list 1) (backward-char 1))
((looking-at “\\s\)”) (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))maybe i’ll come to your next meetup! i def want to learn more!
Trackbacks:0
- Trackback URL for this entry
- http://blog.nydd.org/2009/10/emacs-again-9-some-tips-and-not-to-be-purist/trackback/
- Listed below are links to weblogs that reference
- Emacs Again (9): some tips and not to be purist. from Vantage Point of Queens