Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Google’s still struggling to crack PC gaming

    Xbox unveils first tech details of its next generation console, codenamed Project Helix

    Developer sues publisher after leaving Kickstarter backers waiting over two years for promised physical editions

    Facebook X (Twitter) Instagram
    • Artificial Intelligence
    • Business Technology
    • Cryptocurrency
    • Gadgets
    • Gaming
    • Health
    • Software and Apps
    • Technology
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Tech AI Verse
    • Home
    • Artificial Intelligence

      What the polls say about how Americans are using AI

      February 27, 2026

      Tensions between the Pentagon and AI giant Anthropic reach a boiling point

      February 21, 2026

      Read the extended transcript: President Donald Trump interviewed by ‘NBC Nightly News’ anchor Tom Llamas

      February 6, 2026

      Stocks and bitcoin sink as investors dump software company shares

      February 4, 2026

      AI, crypto and Trump super PACs stash millions to spend on the midterms

      February 2, 2026
    • Business

      Met Office ‘supercomputing as a service’ one year old

      March 12, 2026

      Tech hiring evolves as candidates ask for AI compute alongside pay and perks

      March 11, 2026

      Oracle is spending billions on AI data centers as cash flow turns negative

      March 11, 2026

      Google: Cloud attacks exploit flaws more than weak credentials

      March 10, 2026

      Could this be the key to eternal storage? Experts claim new DNA HDD can be ‘erased and overwritten repeatedly’

      March 9, 2026
    • Crypto

      Banks Respond to Kraken’s Federal Reserve Access as Trump Sides with Crypto

      March 4, 2026

      Hyperliquid and DEXs Break the Top 10 — Is the CEX Era Ending?

      March 4, 2026

      Consensus Hong Kong 2026: The Institutional Turn 

      March 4, 2026

      New Crypto Mutuum Finance (MUTM) Reports V1 Protocol Progress as Roadmap Enters Phase 3

      March 4, 2026

      Bitcoin Short Sellers Caught Off Guard in New White House Move

      March 4, 2026
    • Technology

      Google’s still struggling to crack PC gaming

      March 12, 2026

      Media Briefing: In the AI era, subscribers are the real prize — and the Telegraph proves it

      March 12, 2026

      Furniture.com was built for SEO. Now it’s trying to crack AI search

      March 12, 2026

      How medical creator Nick Norwitz grew his Substack paid subscribers from 900 to 5,200 within 8 months

      March 12, 2026

      Inside Amazon’s effort to shape the AI narrative on sustainability and ethics

      March 12, 2026
    • Others
      • Gadgets
      • Gaming
      • Health
      • Software and Apps
    Check BMI
    Tech AI Verse
    You are at:Home»Technology»ShannonMax: A Library to Optimize Emacs Keybindings with Information Theory
    Technology

    ShannonMax: A Library to Optimize Emacs Keybindings with Information Theory

    TechAiVerseBy TechAiVerseFebruary 19, 2026No Comments5 Mins Read4 Views
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    ShannonMax: A Library to Optimize Emacs Keybindings with Information Theory
    Share
    Facebook Twitter LinkedIn Pinterest WhatsApp Email

    ShannonMax: A Library to Optimize Emacs Keybindings with Information Theory

    ShannonMax

    ShannonMax uses information theory to analyze your emacs usage and suggest better keybindings.

    In particular, it helps you find commands where changing the keybinding can significantly reduce the amount you type.

    WARNING: When using a keylogger, be careful not to log any sensitive information!

    Cite This:
    Straus, S. (2024). Better Keybindings with Information Theory [Computer software]. https://github.com/sstraust/shannonmax

    Original Talk: https://www.youtube.com/watch?v=MytPttbIUOY

    How to Use

    1. Download the files shannon-max.el, and target/emacskeys-0.1.0-SNAPSHOT-standalone.jar. Put them in the same directory, somewhere in your emacs path. So the structure should look like:

      ~/.emacs.d/custom/shannon-max.el
      ~/.emacs.d/custom/target/emacskeys-0.1.0-SNAPSHOT-standalone.jar
      

      And you should have something in your .emacs that looks like this:

      (add-to-list 'load-path "~/.emacs.d/custom")
      (require 'shannon-max)
      (setq shannon-max-jar-file
        (expand-file-name "~/.emacs.d/custom/target/emacskeys-0.1.0-SNAPSHOT-standalone.jar"))
      
      

      You’ll also need to have java/the jvm available on your machine and chmod +x the jar file to make it executable.

    2. Start collecting data.

      Add
      (shannon-max-start-logger) to your .emacs configuration file.

      After a few minutes, check the contents of ~/emacs-logged-keys to verify the logger is working correctly.

    3. Once you have enough data, call M-x shannon-max-analyze to see the results!

    Viewing the Output

    At any time, you can call M-x shannon-max-analyze to see the results.

    In the results buffer:
    C-c C-n to scroll down a page of results
    C-c C-p to scroll up a page of results
    C-c C-e to call keymap-global-set to globally bind a keysequence (emacs version 29 only)

    Interpreting the Results

    Shannonmax compares the actual length of your keybinding (e.g. “x e” has length 2), to the theoretical length of your keybinding (how long it should be, given how much you actually use it). We use information theory on the logged data to determine a keybinding’s theoretical length.

    Commands you use more often should have shorter keybindings, so in general, the strategy is to rebind “Keybindings that are too long” to something that’s shorter and more convenient. If you run out of keys on your keyboard, you can free up space by unbinding infrequently used “Keybindings that are too short”.

    You can learn more about it by watching the video here: https://www.youtube.com/watch?v=MytPttbIUOY

    Customizing the Behavior

    shannon-max-custom-keypress-cost

    By default, shannon-max assumes every keypress costs 1. Sequences with control characters are given an additional cost of 1 per control character.

    So for example:

    • “a” Has a cost of 1
    • “a b” Has a cost of 2
    • “C-a” Has a cost of 2
    • “C-M-a” Has a cost of 3
    • “C-x C-s” Has a cost of 4

    If you have a different view of the world, you can write your own cost function.

    If you create your own cost function, you’ll also need to modify alphabet-size to the corresponding value.

    shannon-max-alphabet-size

    This represents “How much can I type with a single keypress?”. It’s used to compute the theoretical length of a given key command.

    For example, if you only have two keys on your keyboard, then in theory your keybindings must be very long, if you are to represent every possible command with just 2 keys. But if you have 100 keys on your keyboard, your keybindings can be very short.

    By default, we assume you have 52 keys on your keyboard, and every keypress costs 1.

    If you change your cost function, you need to calculate the correct alphabet size for your new cost-weighted “keyboard”. The right way to do this is by solving the characteristic function as described here: https://people.math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf (page 3). I want to make this calculation more automatic, and it’s planned for future work.

    If you’re too lazy to calculate it out you can fiddle with the value until it seems right, and you should still get somewhat useful/actionable results.

    shannon-max-filtered-commands

    A list of emacs commands to ignore from the output. By default we also filter all commands matching “lambda”, “(“, or “[“. This is particularly useful for removing things like the self insert command.

    shannon-max-filter-commands-fn

    Basically does the same thing as shannon-max-filtered-commands, but as a function.

    Known Limitations

    Keylogger Limitations

    Certain packages mess with the keylogger’s ability to correctly log commands. In particular, shannonmax uses real-last-command and this-command-keys-vector inside of post-command-hook in order to determine what keys/commands to log. Certain packages (like ido-mode) interfere with our ability to correctly set these values. We use post(rather than pre)-command-hook so that logged keys are correctly set in god-mode.

    If you have feedback on how to get around this, I’d love your thoughts and advice!

    Better Support For Major Modes

    Certain keybindings are only active in major/minor modes. Ideally we’d compute separate keymaps for every major minor mode, but it’s tricky/takes a lot of thought and care to handle this correctly in a way that’s relevant and useful.

    Support for Multi-Command Codings/Arithmetic Codings

    To get really optimal output, we’d like to understand how pairs or sequences of commonly used emacs commands can be folded into a single keybinding

    More Things to Work On

    • Easier Installation on MELPA
    • Better Custom UI menus for rebinding keys (rather than keymap-global-set)
    • Better support for capitalized letters

    Any other thoughts? Feel free to open an issue on this Repo 😀

    Share. Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Telegram Email
    Previous ArticleBridging Elixir and Python with Oban
    Next Article Show HN: An encrypted, local, cross-platform journaling app
    TechAiVerse
    • Website

    Jonathan is a tech enthusiast and the mind behind Tech AI Verse. With a passion for artificial intelligence, consumer tech, and emerging innovations, he deliver clear, insightful content to keep readers informed. From cutting-edge gadgets to AI advancements and cryptocurrency trends, Jonathan breaks down complex topics to make technology accessible to all.

    Related Posts

    Google’s still struggling to crack PC gaming

    March 12, 2026

    Media Briefing: In the AI era, subscribers are the real prize — and the Telegraph proves it

    March 12, 2026

    Furniture.com was built for SEO. Now it’s trying to crack AI search

    March 12, 2026
    Leave A Reply Cancel Reply

    Top Posts

    Ping, You’ve Got Whale: AI detection system alerts ships of whales in their path

    April 22, 2025714 Views

    Lumo vs. Duck AI: Which AI is Better for Your Privacy?

    July 31, 2025299 Views

    Wired Headphones Are Making A Comeback, And We Have Gen Z To Thank

    July 22, 2025209 Views

    6.7 Cummins Lifter Failure: What Years Are Affected (And Possible Fixes)

    April 14, 2025168 Views
    Don't Miss
    Technology March 12, 2026

    Google’s still struggling to crack PC gaming

    Google’s still struggling to crack PC gaming Image: Razer Summary created by Smart Answers AIIn…

    Xbox unveils first tech details of its next generation console, codenamed Project Helix

    Developer sues publisher after leaving Kickstarter backers waiting over two years for promised physical editions

    Valve responds to NY Attorney General lawsuit: “We have serious concerns with the alterations the NYAG claims are necessary to make to our games”

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    About Us
    About Us

    Welcome to Tech AI Verse, your go-to destination for everything technology! We bring you the latest news, trends, and insights from the ever-evolving world of tech. Our coverage spans across global technology industry updates, artificial intelligence advancements, machine learning ethics, and automation innovations. Stay connected with us as we explore the limitless possibilities of technology!

    Facebook X (Twitter) Pinterest YouTube WhatsApp
    Our Picks

    Google’s still struggling to crack PC gaming

    March 12, 20260 Views

    Xbox unveils first tech details of its next generation console, codenamed Project Helix

    March 12, 20262 Views

    Developer sues publisher after leaving Kickstarter backers waiting over two years for promised physical editions

    March 12, 20261 Views
    Most Popular

    The Players Championship 2025: TV Schedule Today, How to Watch, Stream All the PGA Tour Golf From Anywhere

    March 13, 20250 Views

    Over half of American adults have used an AI chatbot, survey finds

    March 14, 20250 Views

    UMass disbands its entering biomed graduate class over Trump funding chaos

    March 14, 20250 Views
    © 2026 TechAiVerse. Designed by Divya Tech.
    • Home
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions

    Type above and press Enter to search. Press Esc to cancel.