: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/usieve/stoopidsimple.com/includes/common.inc on line 1782.
: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/usieve/stoopidsimple.com/includes/common.inc on line 1782.
emacs hints | stoopidsimple.com

emacs hints

salem | 2005-08-24 02:06

Ok... so you use emacs but your lisp could use some help. Here are some tips.



Q) Looking for a function? variable? key stroke for setting up a binding?
A) Use the online help! E.g:

emacs keyfunction
C-h vLookup variable by name
C-h fLookup function by name
C-h kLookup what is bound to a key

Note: "C-h v" means hold the control key while hitting the "h" key. Then release both keys and hit the "v" key



Q) I just made a new "defun", but it is not available from M-x?
A) Don't forget to make it (interactive)!
Ex:

(defun function-name ()
  (interactive)
   (do-something-cool)
)



Q) How do I indent a whole buffer?
A) You can do it by marking the whole region, then calling indent-region. Or you could bind a key to the following function:

(defun indent-this-buffer ()
  "Select all, indent region"
  (interactive)
  (mark-whole-buffer)
  (indent-region (region-beginning) (region-end) nil)
)



Q) How do I turn off the dumb menu and toolbars?
A) Put the following in your .emacs file:

;; To turn off the menu:
(menu-bar-mode nil)
;; To turn off the tool bar:
(tool-bar-mode nil)



Q) How do I get syntax color highlighting all the time?
A) Put the following in your .emacs file:

(global-font-lock-mode t)



Q) How do I use function keys in my define-key function calls?
A) Use braces:

(define-key c-mode-base-map [f8] 'compile)

Lfhex

Tonality

User login

Navigation

PHP

Kccmp

Java

Homestar

Slashdot


Advertisement