samhuri.net/posts/2007/08/cheat-from-emacs.md
Sami Samhuri 007b1058b6
Migrate from Swift to Ruby (#33)
Replace the Swift site generator with a Ruby and Phlex implementation.
Loads site and projects from TOML, derive site metadata from posts.

Migrate from make to bake and add standardrb and code coverage tasks.

Update CI and docs to match the new workflow, and remove unused
assets/dependencies plus obsolete tooling.
2026-02-07 21:19:03 -08:00

2.8 KiB
Raw Permalink Blame History

Title Author Date Timestamp Tags
Cheat from Emacs Sami Samhuri 9th August, 2007 2007-08-09T18:56:00-07:00 Emacs

Update: I had inadvertently used string-join, a function provided by something in my ~/.emacs.d. The script has been updated to work with a vanilla Emacs (23, but should work with 22 as well).

Update #2 [2007.08.10]: Editing cheats and diffs have been implemented.

Update #3 [2007.08.21]: I added completion to cheat.el. The file linked on this page is still the latest version.

We all know and love cheat. Now you can cheat without leaving Emacs (and without using a shell in Emacs).

Just save cheat.el in ~/.emacs.d and then (require 'cheat) in your ~/.emacs. I also bind C-z C-c to cheat, you may want to do something similar.

You can't do everything you can do with cheat on the command line yet, and for most of the commands the cheat command itself is used. Now you can do everything the command line client does from within Emacs, though you may need to revert to using cheat-command (described below).

Here's the rundown:

Any time you enter a cheat name there are both completion and a cheat-specific history available. Unless you are adding a new cheat. In that case you should use a new, unique name (duh).

  • cheat Lookup a cheat sheet interactively (cheat <name>)
  • cheat-sheets List all cheat sheets (cheat sheets)
  • cheat-recent List recently added cheat sheets (cheat recent)
  • cheat-versions List versions of a cheat sheet interactively (cheat <name> --versions)
  • cheat-clear-cache Clear all cached sheets.
  • cheat-add-current-buffer Add a new cheat using the specified name and the contents of the current buffer as the body. (cheat <name> --add)
  • cheat-edit Retrieve a fresh copy of the named cheat and display the body in a buffer for editing.
  • cheat-save-current-buffer Save the current cheat buffer, which should be named cheat-<name>.
  • cheat-diff Show the diff between the current version and the given version of the named cheat. If the version given is of the form m:n then show the diff between versions m and n. (cheat <name> --diff <version>)
  • cheat-command Pass any arguments you want to cheat interactively.

(Added) I may add support for --diff and --edit in the future.

Please do send me your patches so everyone can benefit from them.