NOTE: reclaimed from the greyhole in 201103, mostly outdated, needs cleaning up.
on macOS
- CarbonEmacs / aquamacs
source
get it from here > % tla register-archive http://sourcecontrol.net/~miles/miles@gnu.org--gnu-2004 % tla get miles@gnu.org--gnu-2004/emacs--cvs-trunk--0 emacs
elisp programming
info & documentation
- using texi & info > http://www.pchristensen.com/blog/articles/setting-up-and-using-emacs-infomode/
- editing remote wiki pages in emacs see » http://www.emacswiki.org/cgi-bin/wiki/SimpleWikiEditMode
- more notes/tips > http://www.shellarchive.co.uk/Emacs.html
packages
- emacs package archive > http://tromey.com/elpa/install.html
scheme interface
- setting up quack > http://www.cs.huji.ac.il/support/emacs/pllab.html
bookmarks
C-x r m mark C-x r b retrieve C-x r l list C-x e annotate
eshell
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
redirection
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 - http://atomized.org/2009/05/emacs-nerdery-search-replace-across-files/
dired
- mark all 't' to toggle unmarked files
- replace in marked files? 'Q' query replace
- edit/open all marked files
- rename in directory
- mark, and → '% R ^.*$ <RET \&.pict' to suffix all files matching a regexp
- deleting
- 'd' to flag, then to delete the flagged files, type `x' (`dired-do-flagged-delete').
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
changelog
- C-x 4 a add an entry to a changelog in the current directory
keybindings ref.
Movement 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-> Editing 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
Tramp
- C-x C-f (to open file) then something like /ssh:user@machin.ne:/home/user/file.txt
Regexps
- M-x re-builder
Misc
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
paredit
- M-x paredit-mode
- structured edting mode for lisp languages
version control
- overview of vc mode > http://www.credmp.org/index.php/2007/12/08/emacs-hidden-gems-version-control/
- see also autodarcs & darcssum notes
- magit
foiding
- M-1 C-x $ (aka. M-x set-selective-display) hide body of functions
- C-x $ bring them back
PGP/GPG
- using epa & epg
- M-x epa-encrypt-file
- M-x epa-encrypt-region
TRAMP
using tramp to connect to remote a host using eshell & sudo
- /ssh:user@example.com
- cd /sudo::
Internationales
- 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
- remember.el (from the emacswiki character)
random hacks/notes/tips
- tutorial/intro → http://www.lib.uchicago.edu/keith/tcl-course/emacs-tutorial.html
image
- enable with M-x iimage-mode)
- then simply add a url of the image, using the
file://
prefix for local imgs (note: wont work via http)
menus
- see: emacs FAQ nodes 'Modifying pull-down menus' and ' Deleting menus and menu options'
random
- the gnu tour → http://www.gnu.org/software/emacs/tour/
fonts / faces / typographica
fonts and language environment
M-x describe-language-environment C-x RET c utf-8 RET M-x describe-fontset M-x list-character-sets
test ranodm unicode
describe characters at a point with C-u C-x =
utf-8
C-x RET r utf-8
see the FAQ
misc.
- M-x narrow-to-region - Hides everything not in the current region.
- Toggling read-only mode in a buffer C-X C-Q
- Undo within a given region C-U C-_
- Unnarrowing the region M-x widen
- anything
- anything.el & anything-config.el
- ediff & ediff-trees.el
- C-h i m advice RET
- M-/ Auto-complete words in your buffer based on what already exists
- M-x align-regexp
- C-x M-c M-butterfly > http://xkcd.com/378/ (try M-x butterfly in emacs 23)
- C-u M-! ls *.h
- M-x align
- M-x query-replace-regexp-eval
- M-g g is the same as M-x goto-line
- M-x auto-revert-tail-mode is great for tailing log files.