Coder Social home page Coder Social logo

nyan-mode's Introduction

Nyan Mode - Turn your Emacs into Nyanmacs! :)

https://badge.fury.io/gh/TeMPOraL%2Fnyan-mode.svg https://img.shields.io/badge/nyan-nyan-ff00ff.svg https://stable.melpa.org/packages/nyan-mode-badge.svg https://melpa.org/packages/nyan-mode-badge.svg https://zenodo.org/badge/DOI/10.5281/zenodo.164185.svg

WARNING, MIND DUMBING CONTENT INSIDE.

“Nyan-mode. It’s things like this that make me proud to be an emacs user.” - mitchellh

“Everything that’s wrong (or right) with Emacs.” - wasamasa

Nyanmacs is expanding!! Read the story so far! :).

screenshot.png

Nyan Mode is an analog indicator of your position in the buffer. The Cat should go from left to right in your mode-line, as you move your point from 0% to 100%.

Features

  • NEW! You can scroll the buffer by clicking in the Nyan Cat area!
  • NEW! You can customize the minimum window width below which Nyan Mode will be disabled.
  • Mind dumbing content included,
  • Animation (M-x nyan-start-animation, M-x nyan-stop-animation),
  • Wavy rainbow (M-x nyan-toggle-wavy-trail),
  • Music, mplayer is needed (M-x nyan-start-music, M-x nyan-stop-music) (thanks, George Leontiev!),
  • Customizable properties.

Customizations

  • nyan-animate-nyancat - t to have it animated, nil for a static version.
  • nyan-animation-frame-interval - number of seconds between animation frames. Accepts fractional values.
  • nyan-bar-length - length of nyan-mode bar, in 8px-wide units.
  • nyan-cat-face-number - choose a cat face for the console mode.
  • nyan-wavy-trail - t to make the trail wavy; works even better when animation is enabled!
  • nyan-minimum-window-width - minimum width of the window, below which Nyan Mode will be disabled. This is important because Nyan Mode will otherwise push out more relevant information from the modelilne.

Using Nyan Mode with custom modeline

For those who were asking, or are planning to, Amit Patel shared some tips on how to make nyan-mode work with custom modeline.

He changed his mode-line-format to appear like the following:

(setq mode-line-format
      (list
       '(:eval (list (nyan-create)))
       ))

Known issues

It’s my second attempt to write a minor mode in Emacs, so there will definiely be some bugs.

This version uses XPM images, which should be supported by default by most Emacs 23 installations, Windows included. In case it doesn’t work, try switching to master-png branch. This branch, however, may have it’s own issues:

There was a problem with displaying PNG images, which require libpng to be available for Emacs. The lib is sometimes missing (e.g. some Windows installation). To make it work on Windows, one needs to download a proper DLL and put it into emacs bin/ folder. To see which DLL is needed, do: M-x describe-variable <ret> image-library-alist <ret>.

Customizing nyan-animate-nyancat is broken; don’t do it. I think it works now; please report issues if there are problems with it.

Code is messy and in dire need of cleanup.

It’s been reported to happen that nyan mode gets duplicated when you activate it twice during Emacs initialization. I’m investigating this and will hopefully track it down and fix it soon.

Credits

Thanks to everyone contributing patches, bug repots and ideas! The Emacs world is forever in your debt!

Code and idea inspired by sml-modeline, maintained by Lennart Borgman. See source. sml-modeline is also available on Melpa (https://melpa.org/packages/sml-modeline-badge.svg).

For animated Nyan Cat, I used frames by DryBowser455.

Other editors

For many years only the One True Editor was blessed with the presence of the Nyan Cat. Since its inception, however, daring souls have brought Nyanness to the lands of Lesser Editors.

Here are the examples I’ve tracked down so far:

If you’ve seen others in the wild, please submit.

Related

Check out Aaron Miller’s weatherline.el, partially inspired by Nyan Mode.

Also check out zone-nyan by Vasilij Schneidermann (wasamasa) if you want the Nyan Cat to visit your Emacs when you step away from the keyboard!

Nyanyanyanyanyanyanya! ♬ ♫ ♪ ♩

nyan-mode's People

Contributors

arifer612 avatar bambuchaadm avatar citizen428 avatar edgar-gip avatar folone avatar jasonm23 avatar jgkamat avatar joaotavora avatar kragen avatar kyokenn avatar mshroyer avatar purcell avatar shreve avatar temporal avatar tmurph 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nyan-mode's Issues

wish: clicking the nyan-bar to scroll the file

It would be pretty cool to be able to click the nyan-bar to scroll to that position in the file.

Or to drag nyan to where I want to read.

The next step would then be

(scroll-bar-mode -1) ; nyan wins :)

Getting rid of cl

Hi,

I always use nyan-mode. But I am tired of seeing warnings about cl being depreciated. Could cl be removed from nyan-mode?

As far as I can tell, the only reliance on cl is a lexical-let.
Would there be any issues with turning lexical-binding on for the buffer and getting rid of the lexical-let?
It seems to work for me.

Like this:

-;;; nyan-mode.el --- Nyan Cat shows position in current buffer in mode-line.
+;;; nyan-mode.el --- Nyan Cat shows position in current buffer in mode-line. -*- lexical-binding: t -*-
+
 ;; Nyanyanyanyanyanyanya!
 
 ;; Author: Jacek "TeMPOraL" Zlydach <[email protected]>
@@ -52,8 +53,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defconst +nyan-directory+ (file-name-directory (or load-file-name buffer-file-name)))
 
 (defconst +nyan-cat-size+ 3)
@@ -230,7 +229,7 @@
 
 (defun nyan-add-scroll-handler (string percentage buffer)
   "Propertize `STRING' to scroll `BUFFER' to `PERCENTAGE' on click."
-  (lexical-let ((percentage percentage)
+  (let ((percentage percentage)
                 (buffer buffer))
     (propertize string 'keymap `(keymap (mode-line keymap (down-mouse-1 . ,(lambda () (interactive) (nyan-scroll-buffer percentage buffer))))))))

Thanks,

Invalid image type 'xpm'

This is the error I get when I try to enact nyan mode. I see the note about the .png branch - can you please tell me how I can install it?

[QUESTION] Display graphical nyan cat in emacs terminal mode

I apologize that this question is somewhat outside the scope of the repo, but I figured this is the best place to ask it. Is there a terminal within which nyan-mode will display the graphical nyan cat when Emacs is running in terminal mode?

mplayer and MP3

Hello! Nice project, it's a pleasure to work with it 🌈🍞🐱

I got some trouble with the music: I don't have any decoders for mp3 (this is a bare fedora machine) and no mplayer installed. It's no problem to convert the song to wav, but how about mplayer, could give it a try and replace it with a play command running in a loop?

Thanks in advance

Handle especially small windows

If I have especially small windows in my frame (e.g. a sixteenth of the maximized frame) nyan cat will push all of the extra information out of the lower bar (modes, line number, git info, etc.). Perhaps it would be best to disable nyan cat for those cases, or make a resizable nyan that adapts to the window size?

make package.el compatible

File should end with

;;; nyan-mode.el ends here

to be compatible with package.el. Test by doing (package-buffer-info) within the .el file.

Add possibility to customize nyam faces

Could you add the possibility to customize nyan.xpm and rainbow.xpm?
I have edited these two files with convert from imagemagick.
But, I have to keep replacing the original files when I update or compile Emacs packages.
https://i.imgur.com/WzW9NXb.png

Do you want this two edited files for you to add to nyam and make a way to choose between rainbow and black-white?

Duplicate nyans after reload init file

This is my setting.

    (use-package nyan-mode
      :init
      (setq nyan-animate-nyancat t)
      (setq nyan-wavy-trail t)
      (setq nyan-minimum-window-width 80)
      (setq nyan-bar-length 20)
      (nyan-mode))

This is what happen.
screen shot 2018-06-03 at 13 37 25

Thanks!

Click to scroll buffer to point scrolls wrong window

Click to scroll buffer to point scrolls wrong buffer

Steps:

  1. Open A buffer and split vertically
  2. Put Cursor in left window
  3. Click the trail in the mode-line of the right window
    Left Window is moved, expect the right window to move

Disabling nyan-mode leaves an expensive timer running

I noticed that Emacs was hitting my CPU pretty heavily and traced the problem back to a lingering nyan-animation-timer that was spinning despite my having disabled nyan-mode.

Steps to reproduce

Emacs version 26.3, nyan-mode 1.1.2

  1. Start up top, or your favorite CPU monitor.
  2. Start emacs -Q -l nyan-mode.el
  3. M-x nyan-mode
  4. Watch the emacs process use some CPU but quiet down to minimal usage (basically nothing on my laptop, just a few spikes every now and then).
  5. Evaluate (customize-set-variable 'nyan-animate-nyancat t)
  6. Watch the emacs process start consuming CPU. >3% on my laptop, though up to way more if I enable other heavyweight mode line constructs.
  7. M-x nyan-mode (disable nyan-mode)
  8. Watch the emacs process continue to consume CPU. >2% on my laptop, though still a lot if I enable other mode line constructs.
  9. M-x nyan-stop-animation
  10. Watch the process go back down to minimal CPU usage.

Expected behavior

CPU usage should stop when disabling nyan-mode.

Analysis

After step (9) above, M-x list-timers shows that the nyan-animation-timer is still spinning. This forces an expensive mode-line update every second. The problem is that the timer only gets canceled through customizing nyan-animate-nyancat, not through disabling the actual mode.

animate nyan makes highlight on buttons broke

When animation is enabled, button highlight is broken.
So if I move my cursor (mouse) onto a button, the highlight will show up for like 0.1s,
then it's gone, instead of staying highlighted.

I have reproduced this by starting a vanilla Emacs and load nyan-mode.

To reproduce:

  • start Emacs with emacs -q
  • load nyan-mode
  • (nyam-mode)
  • (nyan-animate-nyancat)
  • M-x customize (there are a lot of buttons in customize homepage)
  • move cursor (mouse) to any button and see highlight blink and disappear.

No longer seems to be breaking powerline

This is part of my .emacs:

(use-package nyan-mode
  :config
  (progn
    (nyan-mode)
    (nyan-start-animation))
  )

(use-package powerline
  :config
  (powerline-default-theme)
  )

Absolutely zero problems. Even without use-package there's no breakages. I've tested it on both emacs 24.5 and 25.3.1.

Proof:
2017-12-15_20 03 51

Link broken(trivial)

Hello!
In readme, these two links are broken.
It's a trivial matter compared to the greatness of this package...
image

please add "*.elc" to .gitignore

Sorry, didn't create a formal pull request for this trivial change.
Please add "*.elc" to the .gitignore file so that pre-compilation of the .el file to .elc doesn't trigger a dirty working directory.
Thanks,
Jeff

May you please create a tag for release?

Good evening,

Tonight I am writing to humbly put in a request for you to tag this project.

The reason is that a lot of users want to rely on a "numbered" release, by
the most broad definition of the term. For me, it is really simple, I am setting
up a "kind of stable" Emacs configuration of my system here https://github.com/grettke/home/blob/master/.emacs.el
and I would like to rely 100% just one tag. Whenever a "kind of stable" version
is ready, another tag would be super, too.

You might already have the most stable version in the mainline; and tagging it
would make it crystal clear to new users. Perhaps you have already released such
a version elsewhere, and if so, my apologies, and where does it live?

Stable is not the best word here. It just means that the project lives on GitHub
and that it has a tag. It doesn't mean that the software is perfect, it just
means that it is tagged. That tag gives users a version to settle on and go on
with their life is all.

I've used your package for a long time, love it, and so do many, many others.
This is a way to get that project out to the other thousands and thousands of
users who also rely upon MELPA stable.

All it takes is for you to create a tag, and within hours, it will show up on
MELPA stable.

Can't wait to hear about what you think and whether or not a tag is in this
project's future!

Kind regards,

Grant Rettke

nyan on ubuntu xenial causes lag on vertical cursor movement

$ emacs  --version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Enabling nyan on my laptop causes a pretty long delay when scrolling vertically by holding down C-n. What can I do to provide you with relevant info?

Trail length is wrong in narrowed buffer

Narrowing the buffer seems to result in the length of the rainbow trail being too short. It seems that the trail length is calculated as something like (position within visible region)/(length of whole buffer), where it should be (position within visible region)/(length of visible region).

Emacs 25.2.1, Trisquel 7.0.

Potential memory leak

I think there is a memory leak if the animation is activated. I opened emacs and just left it inactive while I was watching its memory consumption and it was eating memory gradually. In my office desktop where I only have 8GB of RAM, Linux reached the memory limits and stopped responding.
I disabled the Nyan-mode's animations and emacs stoped eating my RAM like a crazy

Nyan is small on HiDPI screens

I have a high dpi screen running at 3200x1800. Most emacs features respect the font size and the general X scaling but nyan does not, he is tiny!

Is there a way to make him scale based on the font size or system scaling?

image

Nyan only in text mode on Emacs 26.2

After updating my Emacs from 25.x to 26.2, my Nyan cat is in text only, not displaying the xpm graphics.

nyan-mode-1.1.2 from elpa with emacs-version 26.2 from https://github.com/m-parashar/emax64/releases/tag/emax64-26.2-20190417 on latest Windows 10.

I checked the img folder and made sure that my Emacs is able to display the xpm files as graphic which it does.

So maybe there is an issue with the latest Emacs version. Let me know if I should check something.

I noticed, that all of my mode-line icons are replaced with their text counterparts: m-parashar/emax64#23 - maybe it is good to keep this issue open for others who recognize this behavior. I'll close it when the other issue is solved.

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.