Giter Club home page Giter Club logo

frowny.el's Introduction

Frowny.el

For alphapapa, so he can insert frownies with electric-pair-mode.

This package ships `frowny-mode’, which enables inserting a single “(” when after a “:” – meaning it’ll insert :( without closing the parentheses for modes like electric-pair-mode, paredit-mode, and others.

Version 0.3

2021-11-07: Add frowny-inhibit-modes, so I can toggle hide-details-mode in dired.

Version 0.2

Version 0.2, now with smileys! Yes, if you’re one of those happy-go-lucky people who just has to smile all the time, frowny.el is now for you as well. Go nuts, ya filthy animal.

Installation

I use straight.el, which looks like this:

(straight-use-package '(frowny
                        :host github
                        :repo "duckwork/frowny.el"))

You might need a different form.

Use

Simple as adding it to whatever modes you don’t want to always insert electric pairs, e.g.

(add-hook 'erc-mode-hook #'frowny-mode)

Or you can enable global-frowny-mode, which enables frowny in every buffer. If you want to enable global-frowny-mode but only for some modes, customize frowny-modes.

Customization

There are a (growing?) number of customization options available for frowny-mode:

frowny-eyes
the regex to look for when seeing if ( is completing a frowny. Default: \\(?::-\\|[:=]\\), which captures frownies like :(, :-(, and ==(. I'd recommend replacing it with an =rx form, like this:
(setq frowny-eyes (rx (or ":" ":-" "=" ":'-")))
    
frowny-eyes-looking-back-limit
frowny uses looking-back to determine whether the ( you type is part of a frowny. Emacs’s manual recommends limiting the number of characters looking-back searches for performance reasons, so I recommend setting this number to the maximum length of the strings you have as options in frowny-eyes. As such, the default is 2.
frowny-modes
When enabling global-frowny-mode, you might not want frowny to apply to every buffer. Add modes to this list to only apply frowny to them. By default, frowny applies to every mode.
frowny-inhibit-modes
A list of modes in which to inhibit frowny mode. By default, only special-mode is inhibited. I also add dired-mode in my configuration.

Of course, you can always customize these options using Emacs’s Customize functionality.

Still to do

  • I should probably make frowny-modes more … complex, and allow specifying modes not to apply frowny to.
  • I could do a frowny-prog-mode that checks whether the point is in a comment or not, and frowny accordingly.

frowny.el's People

Contributors

alphapapa avatar duckwork avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.