Skip to content

Instantly share code, notes, and snippets.

@seanhagen
Created November 27, 2013 19:50
Show Gist options
  • Save seanhagen/7682099 to your computer and use it in GitHub Desktop.
Save seanhagen/7682099 to your computer and use it in GitHub Desktop.
Emacs Reference

git-commit-mode

A major mode for editing Git commit messages.

Formatting

Highlight the formatting of git commit messages and indicate errors according to the guidelines for commit messages (see http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).

Highlight the first line (aka "summary") specially if it exceeds 54 characters.

Enable auto-fill-mode' and set the fill-column' to 72 according to the aforementioned guidelines.

Headers

Provide commands to insert standard headers into commit messages.

  • C-c C-x s or C-c C-s inserts Signed-off-by (`git-commit-signoff').
  • C-C C-x a inserts Acked-by (`git-commit-ack').
  • C-c C-x t inserts Tested-by (`git-commit-test').
  • C-c C-x r inserts Reviewed-by (`git-commit-review').
  • C-c C-x o inserts Cc (`git-commit-cc').
  • C-c C-x p inserts Reported-by (`git-commit-reported').

Committing

C-c C-c finishes a commit. By default this means to save and kill the buffer. Customize `git-commit-commit-function' to change this behaviour.

Check a buffer for stylistic errors before committing, and ask for confirmation before committing with style errors.

wtf.el

Use:

To use this, move to an unknown acronym in a buffer and type the following:

M-x wtf-is RET

The `wtf-is' function may also be called noninteractively, and it will return a string (or nil) rather than displaying a message.

To add a custom acronym definition, either customize `wtf-custom-alist' or do:

M-x wtf-add RET RET RET

To remove a custom acronym definition, or mark a pre-defined acronym as "removed" in the case that no custom acronym definition exists in `wtf-custom-alist' for that acronym, do:

M-x wtf-remove RET RET

To mark a pre-defined acronym as "removed", without checking first to see whether it is in wtf-custom-alist', customize the wtf-removed-acronyms' option.

If you add a custom acronym definition, and feel it to be worth sharing, you are encouraged to contact mwolson@gnu.org via email, providing the acronym and its definition. This increases the chance that it will appear in future versions of wtf.el.

wget.el

~/.emacs.d/elpa/wget*/USAGE

skewer-mode

Commentary

  1. Place dependencies in your `load-path' or load them directly
  2. Load skewer-mode.el
  3. M-x `run-skewer' to attach a browser to Emacs
  4. From a `js2-mode' buffer, send forms to the browser to evaluate

The keybindings for evaluating expressions in the browser are just like the Lisp modes. These are provided by the minor mode `skewer-mode'.

  • C-x C-e -- `skewer-eval-last-expression'
  • C-M-x -- `skewer-eval-defun'
  • C-c C-k -- `skewer-load-buffer'

The result of the expression is echoed in the minibuffer.

Additionally, `css-mode' gets a similar set of bindings for modifying the CSS rules on the current page. They operate on declarations and rules.

Note: run-skewer' uses browse-url' to launch the browser. This may require further setup depending on your operating system and personal preferences.

Multiple browsers and browser tabs can be attached to Emacs at once. JavaScript forms are sent to all attached clients simultaneously, and each will echo back the result individually. Use `list-skewer-clients' to see a list of all currently attached clients.

Sometimes Skewer's long polls from the browser will timeout after a number of hours of inactivity. If you find the browser disconnected from Emacs for any reason, use the browser's console to call skewer() to reconnect. This avoids a page reload, which would lose any fragile browser state you might care about.

Manual version

To skewer your own document rather than the provided blank one,

  1. Load the dependencies
  2. Load skewer-mode.el
  3. Start the HTTP server (`httpd-start')
  4. Include "http://localhost:8080/skewer" as a script (see example.html' and check your httpd-port')
  5. Visit the document from your browser

Skewer fully supports CORS so the document need not be hosted by Emacs itself. A Greasemonkey userscript is provided for injecting Skewer into any arbitrary page you're visiting without needing to modify the page on the host.

With skewer-repl.el loaded, a REPL into the browser can be created with M-x skewer-repl', or C-c C-z. This should work just like a console within the browser. Messages can be logged to this REPL with skewer.log()(just likeconsole.log()`).

js2-refactor

Installation

Start by installing the dependencies:

It is also recommended to get expand-region to more easily mark vars, method calls and functions for refactorings.

Then add this to your emacs settings:

(require 'js2-refactor)

Note: I am working on a smoother installation path through package.el, but I haven't had the time to whip this project into that sort of structure - yet.

Usage

All refactorings start with C-c C-m and then a two-letter mnemonic shortcut.

  • ef is extract-function: Extracts the marked expressions out into a new named function.
  • em is extract-method: Extracts the marked expressions out into a new named method in an object literal.
  • ip is introduce-parameter: Changes the marked expression to a parameter in a local function.
  • lp is localize-parameter: Changes a parameter to a local var in a local function.
  • eo is expand-object: Converts a one line object literal to multiline.
  • co is contract-object: Converts a multiline object literal to one line.
  • wi is wrap-buffer-in-iife: Wraps the entire buffer in an immediately invoked function expression
  • ig is inject-global-in-iife: Creates a shortcut for a marked global by injecting it in the wrapping immediately invoked function expression
  • ag is add-to-globals-annotation: Creates a /*global */ annotation if it is missing, and adds the var at point to it.
  • ev is extract-var: Takes a marked expression and replaces it with a var.
  • iv is inline-var: Replaces all instances of a variable with its initial value.
  • rv is rename-var: Renames the variable on point and all occurrences in its lexical scope.
  • vt is var-to-this: Changes local var a to be this.a instead.
  • ao is arguments-to-object: Replaces arguments to a function call with an object literal of named arguments. Requires yasnippets.
  • 3i is ternary-to-if: Converts ternary operator to if-statement.
  • sv is split-var-declaration: Splits a var with multiple vars declared, into several var statements.
  • uw is unwrap: Replaces the parent statement with the selected region.

There are also some minor conveniences bundled:

  • C-S-down and C-S-up moves the current line up or down. If the line is an element in an object or array literal, it makes sure that the commas are still correctly placed.

js2-comint

Commentary

js-comint.el let's you run an inferior javascript process in emacs, and defines a few functions for sending javascript input to it quickly.

Usage:

Put js-comint.el in your load path Add (require 'js-comint) to your .emacs Set inferior-js-program-command to the execution command for running your javascript REPL (setq inferior-js-program-command "/path/to/executable ") Do: M-x run-js Away you go.

I've added the following couple of lines to my .emacs to take advantage of cool keybindings for sending things to the javascript interpreter inside of Steve Yegge's most excellent js2-mode.

(add-hook 'js2-mode-hook '(lambda () (local-set-key "\C-x\C-e" 'js-send-last-sexp) (local-set-key "\C-\M-x" 'js-send-last-sexp-and-go) (local-set-key "\C-cb" 'js-send-buffer) (local-set-key "\C-c\C-b" 'js-send-buffer-and-go) (local-set-key "\C-cl" 'js-load-file-and-go) ))

inflections.el

YEAH.

highlight

learn it

hideshow

more learning

highline

see if it's useful

eshell manual

look into

epresent.el

look into

dired

learn how to use ( plus all the plugins i've downloaded )

ctable

look into it ( ie, what is it )

circe ( or irc in general )

figure it out ( plus plugins )

auto-highlight-symbol

what what ( ....is it )

anything

figure out how to use it, and all the plugins i've got

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment