Support for butterfly editing

View: New views
5 Messages — Rating Filter:   Alert me  

Support for butterfly editing

by Raffael Mancini-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hi *,

In order to maintain the reputation of emacs as being a text shell
capable of accomplishing the most difficult tasks, I've written a
small function that will finally add support for the now famous
butterfly button as described in http://xkcd.com/378/.

(defun butterfly ()
  "This function is designed to be used only be the most\
proficient hackers on earth. If equipped with a butterfly key,
it\ should be bound to C-x M-c M-butterfly (for further
information please refer to http://xkcd.com/378/"
  (interactive)
  (if (yes-or-no-p "Do you really want to unleash the powers of the butterfly? ")
      (progn
        (message "Amazing physics going on...")
        (sit-for (* 5 (/ (abs (random)) (float most-positive-fixnum))))
        (message "Successfully flipped one bit!"))
    (message "Well, then go to www.xkcd.com!")))

I ask the gnu emacs dev team to either add that function to gnu emacs
or if my implementation is not polished enough implement it in
another way.

This would be another great example where an xkcd comic kind of
materializes (http://wetriffs.com/ is the first) and would maybe open
emacs to a broader audience.

Kind regards,
Raffael Mancini

PS: Please don't tear me in pieces for this. If not appropriate just
ignore this mail.



Re: Support for butterfly editing

by Jason Rumney-4 :: Rate this Message:

| View Threaded | Show Only this Message

raffael.mancini@... wrote:
> (message "Amazing physics going on...")
> (sit-for (* 5 (/ (abs (random)) (float most-positive-fixnum))))
>  

It might be more interesting to use animate or zone here, to show the
amazing physics happening.




Re: Support for butterfly editing

by martin rudalics :: Rate this Message:

| View Threaded | Show Only this Message

 >   "This function is designed to be used only be the most\
 > proficient hackers on earth. If equipped with a butterfly key,
 > it\ should be bound to C-x M-c M-butterfly (for further
 > information please refer to http://xkcd.com/378/"

With this doc-string C-h f RET butterfly RET gives on my system


butterfly is an interactive Lisp function.
(butterfly)

This function is designed to be used only be the mostproficient hackers on earth. If equipped with a butterfly key,
itshould be bound to C-x M-c M-butterfly (for further
information please refer to http://xkcd.com/378/


The doc-string violates at least the following four conventions from
appendix D.6 of the Emacs Lisp Reference Manual

      The first line of the documentation string should consist of one
      or two complete sentences that stand on their own as a summary.

      For a function, the first line should briefly answer the question,
      "What does this function do?"

      Finally, to create a hyperlink to URLs, write the URL in single
      quotes, preceded by `URL'.

      Don't write key sequences directly in documentation strings.

has two silly backslashes and misses a right paren and a period.


I think C-h f RET butterfly RET should give something like

butterfly is an interactive Lisp function.
It is bound to <C-x> <M-c> <M-butterfly>.
(butterfly)

Flip desired bit on drive platter.
This function is designed to be used only by the most proficient
hackers on earth.  For further information please refer to
`http://xkcd.com/378/'.




Re: Support for butterfly editing

by Juri Linkov :: Rate this Message:

| View Threaded | Show Only this Message

> Hi *,
>
> In order to maintain the reputation of emacs as being a text shell
> capable of accomplishing the most difficult tasks, I've written a
> small function that will finally add support for the now famous
> butterfly button as described in http://xkcd.com/378/.
>
> (defun butterfly ()
>   "This function is designed to be used only be the most\
> proficient hackers on earth. If equipped with a butterfly key,
> it\ should be bound to C-x M-c M-butterfly (for further
> information please refer to http://xkcd.com/378/"
>   (interactive)
>   (if (yes-or-no-p "Do you really want to unleash the powers of the butterfly? ")
>       (progn
> (message "Amazing physics going on...")
> (sit-for (* 5 (/ (abs (random)) (float most-positive-fixnum))))
> (message "Successfully flipped one bit!"))
>     (message "Well, then go to www.xkcd.com!")))
>
> I ask the gnu emacs dev team to either add that function to gnu emacs
> or if my implementation is not polished enough implement it in
> another way.
>
> This would be another great example where an xkcd comic kind of
> materializes (http://wetriffs.com/ is the first) and would maybe open
> emacs to a broader audience.

What a shame we still don't have this famous command as an easter egg
in Emacs.  I've added it now to misc.el (a file for nonstandard Emacs
commands) taking into account more suggestions from this thread for
using `animate-string' and `browse-url'.

As for the keys to run this command, there is a little secret:
`C-x M-c M-butterfly' is nothing more than a valid key sequence
with a slight permutation.  After the two-step conversion:

      1
   +------+
   !      !
  ==      v
C-x M-c M-butterfly
=======            ^
   !               !
   +---------------+
           2

1. move "x " to the beginning of the word "butterfly";
2. move "C-M-c" to the end of the word "butterfly".

we get a valid Emacs key sequence `M-x butterfly C-M-c'!

--
Juri Linkov
http://www.jurta.org/emacs/



Re: Support for butterfly editing

by Tomas Zerolo :: Rate this Message:

| View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, Dec 29, 2008 at 01:52:18AM +0200, Juri Linkov wrote:
> > Hi *,
> >
> > In order to maintain the reputation of emacs [...]
> > [...] http://xkcd.com/378/.
> >

[...]

> What a shame we still don't have this famous command as an easter egg
> in Emacs. [...]

Christmas is barely over and you are already thinking Easter eggs. How
far are you going to take that ;-)

Seriously: Thanks for making me smile

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJWFGmBcgs9XrR2kYRAtIhAJ9S+W5D08mikwliduwp47VBoCjVDACfTNW2
1maMj81Efg6hifilDf7qRxE=
=xObF
-----END PGP SIGNATURE-----