This is an old revision of the document!

on MacOS


 get it from here >
  % tla register-archive 
  % tla get emacs

elisp programming

info & documentation


scheme interface


  C-x r m  mark
  C-x r b  retrieve
  C-x r l  list
  C-x e    annotate 


M-x eshell interactive shell like buffer

  • C-up / C-down to scroll thru history
  • watch out for running shells in subproceses [eg ssh→zsh]
  • see .emacs for connecting ls with dired
  • how to →
    • r-searhc in history? → M-r (match previous regexp)
    • M-x eshell-completion-help
    • info → emacs info command compare; man-bgproc-sentinel


   echo "hello world" > #<buffer *scratch*>
   ps wax > #<buffer *scratch*>
  • shell vars
     $1 -> single arg (eg. for alias)
     $* -> arg list from commands line
     $_ -> 2nd arg of previous command
     $- -> previous directory (pwd) -> 'cd =' or 'cd -'
  • looping
    • for f in *.txt {mv $f (concat (file-name-sans-extension f) “.renamed”)}
    • for f in *.pict {convert $f (concat (file-name-sans-extension f) “.jpeg”)}
    • for f in *.png {convert -format “jpeg” $f (concat “crushed/” (file-name-sans-extension f) “.jpeg”)}
    • for f in * {vorbiscomment -w -t “TITLE=New Title” $f}

search,find, replace

C-s         search forwards
C-r         search backwards
M-%         Replace
  • M-x grep
  • in dired
    • M-x find-grep-dired > places results of a grep into a dired buufer
    • in a dired buffer > 'Q' to query replace marked files
    • M-x dired-do-query-replace on muliptle files, in dired mode
  • in multiple open files
    • M-x ibuffer
    • m mark the files you want to change (or t to mark all)
    • U regexp replace in all marked
    • S save all marked

mulitple file search & replace -


key macros

 C-x (      also F3, begin recording
 C-x )      also F4, end
 F4         M-x kmacro-call-macro
 C-x C-k e  edit a macro base on previous keystrokes
  • increment number at end of line → F3 F3 down F4 C-5 F4
  • M-x replace-regexp RET ^.*$ RET \&\# RET


  • C-x 4 a add an entry to a changelog in the current directory

keybindings ref.


Forward:                    Backward
C-n         1 line          C-p
C-f         1 character     C-b
C-v         1 page          M-v

C-a         line start/end  C-e
M-<         file start end  M->


C-d         clear letter
M-d         clear word
C-k         cut line
M-k         cut sentence
C-y         paste
C-@         set mark
C-spc       set mark
C-w         cut from mark
M-w         copy from mark
C-x C-x     exchange mark and cursor
C-x C-u     Undo!
C-x C-h     select all
M-2 M-z     zap to next (2nd) character

M-| wc -w   word count (shell command on region: 'wc -w')

File manipulation

C-x C-v     new
C-x C-f     open
C-x C-s     save
C-x C-w     save as
C-x C-c     quit


  • C-x C-f (to open file) then something like /


  • M-x re-builder


C-l         redraw screen
C-o         insert line
M-q         reformat current paragraph
C-x o       switch windows
C-x 0       hide current window
C-x 1       maxmize current window
C-x 2       split window horizontally
C-x 3       split window vertically
C-x C-b     list all buffers (files) in memory
C-x C-k     close current buffer (file)
C-g         cancel command
C-h         help (repeat C-h for more detail)

multiuser editing

  • M-x make-frame-on-display


version control


  • M-1 C-x $ (aka. M-x set-selective-display) hide body of functions
  • C-x $ bring them back


  • using epa & epg
    • M-x epa-encrypt-file
    • M-x epa-encrypt-region


using tramp to connect to remote a host using eshell & sudo

  • /
  • cd /sudo::


  • manual sections
    • International
    • Language Environments
    • Specify Coding
    • Defining Fontsets
  • testing
    • C-h h (view-hello-file)
    • C-x <RET> for multibyte characters, coding systems, and input methods
  • C-x RET f - to set coding system for buffer
  • C-x RET c - set coding system for command

remembering and forgetting

random hacks/notes/tips


  • emacs_notes.1300701625.txt.gz
  • Last modified: 2011-03-21 10:00
  • by nik