turn off color
Do not use colors even if the terminal is capable (still allows the buffer mode to do syntax highlighting with bold text, etc):emacs --color=noDisable (all) major-mode syntax highlighting:
(global-font-lock-mode -1)People suggest using the following in a loop over all font faces:
(set-face-attribute face nil :foreground nil :background nil)M-x customize-face can be used over a particular keyword in a buffer to change syntax highlighting properties M-x customize-themes to choose a color theme (includes dark themes). Consider fxn/monochrome-theme.el
installing packages
Install a package from MELPA/ELPA (useful for installing language modes)M-x package-install package-name
eval a lisp expression in the current buffer and print the value in the minibuffer
M-:for example
M-: major-modeto show the current major mode
force a mode on a file, put at end of text
// Local Variables: // mode: c++ // End:
goto an offset in the file
M-x goto-charShort cut:
M-g c
register commands
point-to-register: C-x r SPC register-to-point: C-x j <register id> copy-to-register: C-x r x insert-register: C-x r g view-register: -
highlight or remove useless whitespace
To show trailing whitespace(setq-default trailing-whitespace t)in .emacs file. To remove tailing whitespace in a buffer, type
M-x delete-trailing-whitespace
code folding
use hide/show minor mode (hs-minor-mode) M-x hs-minor-mode add the minor mode to all programming modes (add-hook 'prog-mode-hook #'hs-minor-mode) C-c @ C-M-h hide all (hs-hide-all) C-c @ C-h hide block (hs-hide-block) C-c @ C-s show block (hs-show-block) C-c @ C-e toggle block (some particular about the pos to work) C-c @ C-a show all C-c @ C-l hide all (when pos outside of all blocks in the file)
.emacs file
; this is for shells that set either delete or backspace ; as ctrl h use M-x help to get to help instead (global-set-key "\C-h" 'backward-delete-char) ; set the tab width slightly smaller (setq default-tab-width 4) ;; do not display a splash screen on startup for emacs 22 (setq inhibit-splash-screen t) ;; turn off menu bar in terminal (if (not window-system) (menu-bar-mode -1)) ;; don't use tabs to indent, may or may not want this ;; to insert a tab C-q- to make the elisp debugger window go away hit 'q' in the buffer tramp: allows you to edit files remotely through ssh as well as other methods. you can just open a file using the normal scp path syntax.(setq-default indent-tabs-mode nil) (add-hook 'prog-mode-hook #'hs-minor-mode) ;; show trailing whitespace (setq-default show-trailing-whitespace t)
emacs keybindings
under gnome 3
gsettings set org.gnome.desktop.interface gtk-key-theme "Emacs"
fill-paragraph
M-q is 'fill-paragraph' reflows text to justify it
Desktop Keybindings
under xfce
xfconf-query -c xsettings -p /Gtk/KeyThemeName -s Emacs
may need to add
--create --type string
to above