Giter VIP home page Giter VIP logo

parrot's Introduction

https://cultofthepartyparrot.com/parrots/parrot.gif Parrot Mode - Viva la parrot revolution!

https://stable.melpa.org/packages/parrot-badge.svg https://melpa.org/packages/parrot-badge.svg https://api.travis-ci.org/dp12/parrot.png?branch=master http://img.shields.io/:license-gpl3-blue.svg

Background

We developers are an entitled bunch. Since the times of the Romans, programmers have demanded amenities such as bread and circuses, water slides, and multiple cursors. In fact, people of my generation seem to have a perverse desire to see poptart-clad kittens in their text editors. Most recently, I have heard loud and angry demands for parrots wearing science goggles.

Unrealistic? Maybe, but it’s 2018, and therefore parrots will now rotate on the screen using smooth circular motions, like those seen in kung fu.

Polly want a word rotated? Now you can! Just use parrot-rotate-next-word-at-point. With the bird, a word. See the screen capture below, because a gif is worth a thousand pngs, or whatever.

parrot_in_action.gif

Install

Parrot is available on MELPA. You can install it with:

M-x package-install parrot

If you use use-package:

(use-package parrot
  :config
  (parrot-mode))

Or the old-fashioned way:

(add-to-list 'load-path "/path/to/parrot-dir/")
(require 'parrot)
;; To see the party parrot in the modeline, turn on parrot mode:
(parrot-mode)

Rotation function keybindings:

;; for vanilla emacs
(global-set-key (kbd "C-c p") 'parrot-rotate-prev-word-at-point)
(global-set-key (kbd "C-c n") 'parrot-rotate-next-word-at-point)

;; for evil users
(define-key evil-normal-state-map (kbd "[r") 'parrot-rotate-prev-word-at-point)
(define-key evil-normal-state-map (kbd "]r") 'parrot-rotate-next-word-at-point)

Spacemacs Installation

To get parrot working with spacemacs, you need to apply a few changes from this fork of spaceline to your ~/.emacs.d/elpa/2x.x/develop/spaceline-xxx/spaceline-(segments|config).el files. Adjust the spaceline directory path accordingly if you are not using the develop branch.

Usage

Use parrot-rotate-next-word-at-point and parrot-rotate-prev-word-at-point to rotate words at point. If a match is not found under the cursor, parrot will hunt for the nearest match in the current whitespace-delimited word and rotate it.

parrot uses a dictionary list that defines word rotations. You can override the default by setting parrot-rotate-dict in your init file. A sample one is provided below:

(setq parrot-rotate-dict
      '(
        (:rot ("alpha" "beta") :caps t :lower nil)
        ;; => rotations are "Alpha" "Beta"

        (:rot ("snek" "snake" "stawp"))
        ;; => rotations are "snek" "snake" "stawp"

        (:rot ("yes" "no") :caps t :upcase t)
        ;; => rotations are "yes" "no", "Yes" "No", "YES" "NO"

        (:rot ("&" "|"))
        ;; => rotations are "&" "|"

        ;; default dictionary starts here ('v')
        (:rot ("begin" "end") :caps t :upcase t)
        (:rot ("enable" "disable") :caps t :upcase t)
        (:rot ("enter" "exit") :caps t :upcase t)
        (:rot ("forward" "backward") :caps t :upcase t)
        (:rot ("front" "rear" "back") :caps t :upcase t)
        (:rot ("get" "set") :caps t :upcase t)
        (:rot ("high" "low") :caps t :upcase t)
        (:rot ("in" "out") :caps t :upcase t)
        (:rot ("left" "right") :caps t :upcase t)
        (:rot ("min" "max") :caps t :upcase t)
        (:rot ("on" "off") :caps t :upcase t)
        (:rot ("prev" "next"))
        (:rot ("start" "stop") :caps t :upcase t)
        (:rot ("true" "false") :caps t :upcase t)
        (:rot ("&&" "||"))
        (:rot ("==" "!="))
        (:rot ("." "->"))
        (:rot ("if" "else" "elif"))
        (:rot ("ifdef" "ifndef"))
        (:rot ("int8_t" "int16_t" "int32_t" "int64_t"))
        (:rot ("uint8_t" "uint16_t" "uint32_t" "uint64_t"))
        (:rot ("1" "2" "3" "4" "5" "6" "7" "8" "9" "10"))
        (:rot ("1st" "2nd" "3rd" "4th" "5th" "6th" "7th" "8th" "9th" "10th"))
        ))

The following labels are provided for defining rotations in a dictionary entry:

  • :upcase t will add UPPER CASE rotations
  • :caps t will add Capitalized rotations
  • :lower nil will exclude lowercase rotations
  • If no labels are provided, the word list will default to lowercase rotations
  • Defining a word list for which there are no rotations will result in an error, e.g. (:rot ("yes" "no") :lower nil).

You can also append to the default dictionary:

(dolist (entry '((:rot ("hakuna" "matata"))
                 (:rot ("peeple" "sheeple"))))
  (add-to-list 'parrot-rotate-dict entry))

Party Parrots

By default, after a rotation is performed, the selected parrot in the modeline will start rotating. You may select your desired parrot interactively with M-x parrot-set-parrot-type or in your init file using:

(parrot-set-parrot-type 'science)

Like the wonders of the ancient world, parrot comes in 7 original flavors:

ParrotName
https://i.imgur.com/53YCmpd.gifdefault
https://i.imgur.com/svleFy1.gifconfused
https://i.imgur.com/DSExpFD.gifemacs
https://i.imgur.com/xpUahDq.gifnyan
https://i.imgur.com/BnSpEwK.gifrotating
https://i.imgur.com/fMf23JR.gifscience
https://i.imgur.com/WmXn4wz.gifthumbsup

Clicking on the parrot will cause it to rotate, but for mouse-less operation, it is recommended that you bind (parrot-start-animation) to a easily reachable hotkey so you can command your parrot to rotate at will.

Customization

Party parrot

  • parrot-animation-frame-interval - seconds between animation frames; can be a decimal number.
  • parrot-minimum-window-width - minimum width of the window, below which party parrot mode will be disabled.
  • parrot-animate-parrot - t to enable parrot animation, nil for a static image.
  • parrot-spaces-before - number of spaces of padding before the parrot.
  • parrot-spaces-after - number of spaces of padding after the parrot.
  • parrot-num-rotations - number of times the parrot will cycle through its gif.

Rotations

  • parrot-rotate-hunt-for-words - t to rotate words that aren’t directly under the cursor.
  • parrot-rotate-jump-to-word-after-hunt - t to jump to the word rotated if it isn’t under the cursor.
  • parrot-rotate-animate-after-rotation - t to animate the party parrot after rotating a word.
  • parrot-rotate-highlight-after-rotation - t to highlight a word after rotating.
  • parrot-rotate-start-char-invalid-regexp - regexp used to determine if parrot shouldn’t start a rotation.
  • parrot-rotate-start-bound-regexp - regexp used to find the start bound to search for rotations.
  • parrot-rotate-end-bound-regexp - regexp used to find the end bound to search for rotations.

Customization

Is parrot not rotating as much as you want it to? To truly become a parrot provocateur, you can make parrot rotate for many divers reasons by adding parrot-start-animation to various hooks.

For example, if you want the parrot to animate whenever you receive mail in mu4e, you can try:

(add-hook 'mu4e-index-updated-hook #'parrot-start-animation)

You can also add functions to parrot-click-hook so they will run whenever you click on the parrot.

(add-hook 'parrot-click-hook 'flyspell-buffer)

NEW! Want parrot to rotate forever? Set parrot-num-rotations to nil to get perfectly perpetual parrot.

(setq parrot-num-rotations nil)

Misc

Parrot is integration-tested with ecukes 🥒 and is licensed under the GPLv3.

This is my first emacs package, and as such, I’m happy to receive comments or suggestions about elisp coding, feature requests, or contributions.

Because of the amount of raw lisp being converted to kinetic energy, using parrot to rotate may sink as much power as the equivalent poptart. dp12 is not responsible for any seizures or bird-like dance moves that may occur due to this package.

Acknowledgements

All parrots including the gifs in this README (with the exception of emacs parrot) were taken from @jmhobbs Cult of the Party Parrot site. Thanks to @mermop (default), @kyprifog (confused), @shiruken (science), @vaicine (nyan), @youngcba3 (rotating), @zeftilldeath (thumbsup parrot) for their respective parrots, and of course @jmhobbs for compiling them.

Thanks to @francoislg for Party Parrot as a Service, with which I created the emacs parrot.

Thanks to Aaron Hawley, from whom I borrowed a good deal of my rotation code. You can see his rotate text implementation on emacswiki.

Thanks to @rejeep for ecukes, an excellent Cucumber-like testing framework.

Thanks to @DamienCassou for his detailed and thoughtful code review comments.

A special thanks to @TeMPOral, without which parrot wouldn’t be possible. I heavily modified the source code of nyan-mode to create parrot spawn. All credit goes to him for paving the way to new heights of mode-line distraction.

Some parrots stand on the shoulders of giant nyan cats.

parrot3cat.png

parrot's People

Contributors

dp12 avatar ssnnoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

parrot's Issues

Support for spaceline?

I use spaceline with the following configuration:

    (use-package spaceline
      :config
      (require 'spaceline-config)
      (spaceline-spacemacs-theme)
      (setq spaceline-buffer-encoding-abbrev-p nil)
                                            ;(setq spaceline-line-column-p nil)
      (setq spaceline-line-p nil)
      (setq powerline-default-separator (quote arrow))
      (line-number-mode 1)
      (column-number-mode 1)
      (display-time-mode 1)
      (setq display-time-24hr-format t)
      ;; (setq display-time-format "%H:%M - %d %B %Y")
      (setq display-time-default-load-average nil)
      (use-package fancy-battery
        :config
        (setq fancy-battery-show-percentage t)
        (setq battery-update-interval 15)
        (if window-system
            (fancy-battery-mode)
          (display-battery-mode)))
      (spaceline-spacemacs-theme)
      )

(parrot-mode) doesn't seem to have any effect here.

Outstanding Fork

Regarding melpa/melpa#8811 (comment)

The changes in https://github.com/positron-solutions/parrot/commits/master/ are available for cherry pick / diff etc. The only changes that don't make sense to bring in via that method are the maintainer and homepage package headers.

Let's just decide what to do. The worst outcome would be to fork the core XPM modeline animation work and maintain two copies.

Because we can use autoloads to defer the inclusion of functions for progress and org todo states, I think we can keep the package lightweight while supporting more than one basic integration. If we go this direction, I should check my autoloads and attempt to make sure parrot-progress.el is not loaded unless its behavior is turned on.

Some packages go the direction of having a main package and then some extras packages. It's probably too heavy in this case.

Not works with smart mode line.

Following is my config which consult nyan-mode. (yes, nyan mode works with smart-mode-line)

(require 'smart-mode-line)
(setq sml/theme 'smart-mode-line-powerline)

(require 'parrot)
(add-to-list 'mode-line-format (list '(:eval (list (parrot-create)))))

(sml/setup)

It not working.

Following is smart-mode-line repo.

https://github.com/Malabarba/smart-mode-line

C-c p

Please don't put stuff in the C-c single letter keymap because user stuff goes there ♥

Support universal argument

Been using this package with great joy so far-- love the concept.

I was a bit surprised when I tried doing an universal argument (C-u -- 4) on parrot-rotate and it didn't work like I intuited it would. Is there a reason for this lack of behavior or can it be added as a feature with a pull request?

Parrot mode for Emacs running in a terminal

Would it be possible to support parrot mode for Emacs inside a terminal (office work restrictions), perhaps using some ascii text like (V) that animates with the * moving up/down.

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.