I use Emacs for pretty much all of my normal editing. Now, before anyone rips me apart, I admit that I haven't given vi that much of a trial. I've never sat down for the vi tutorial. Maybe it's better, maybe it's not. I don't know. What I DO know is that I love using emacs over any of the other little editors in widows, emacs is faster and easier than UltraEdit. A million times better than notepad or WordPad. My favorite thing is Macros. I use macros like nobody's business. In fact, there's a couple I use all the time and saved in my .emacs file.
;;Index a node of XML
(fset 'indent-xml-1
[?\C-s ?> ?< left return])
;;Index the first 3000 lines of an XML file
(fset 'indent-xml
[C-home ?\C-1 ?\C-0 ?\C-0 ?\C-0 ?\M-x ?i ?n ?d ?e ?n ?t ?- ?x ?m ?l ?- ?1 return ?\C-x ?h ?\C-\M-\\])
I know there's probably a simpler, cleaner way of writing it, but I don't have the time. This is how emacs saved my macro and it's fine.
Here's another awesome function I found to create a new scratch buffer. I can never have enough scratch buffers. Mainly because I hate opening up new windows for emacs. I like having 1 or 2 tops.
(defun create-scratch-buffer nil
"create a new scratch buffer to work in. (could be *scratch* - *scratchX*)"
(interactive)
(let ((n 0)
bufname)
(while (progn
(setq bufname (concat "*scratch"
(if (= n 0) "" (int-to-string n))
"*"))
(setq n (1+ n))
(get-buffer bufname)))
(switch-to-buffer (get-buffer-create bufname))
(if (= n 1) (lisp-interaction-mode)) ; 1, because n was incremented
))
Thursday, October 18, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment