all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: comic-book-insult
Date: Mon, 09 Sep 2019 00:55:27 +0200	[thread overview]
Message-ID: <867e6iiejk.fsf@zoho.eu> (raw)
In-Reply-To: 8736h6mtm7.fsf@mbork.pl

Marcin Borkowski wrote:

> Nice, but a bit wrong. If you try it as an
> interactive function, it won't display the
> result - only return it, but this is of no
> use with M-x.

Right, forgot about that, OK:

(defun scramble-string (str)
  "Randomize the characters of a string."
  (interactive "sscramble me: ")
  (let*((empty-str  "")
        (chars      (delete empty-str (split-string str empty-str)))
        (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
        (rand-str   (mapconcat 'identity rand-chars ""))
        )
    (if (called-interactively-p 'any)
        (message rand-str)
      rand-str) ))

>> (defun comic-book-insult ()
>>   (interactive)
>>   (insert (concat (scramble-string "@#$%&") "!") ))
>>
>> ;; (comic-book-insult) ; %@&$#!
>> ;; (comic-book-insult) ; $%#@&!
>
> And this is rather cute, thanks for sharing!

Anytime :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




  reply	other threads:[~2019-09-08 22:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-08 19:05 comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-08 20:16 ` comic-book-insult Marcin Borkowski
2019-09-08 22:55   ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2019-09-08 22:29 ` comic-book-insult Adam Porter
2019-09-10 23:43   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-08 23:47 ` comic-book-insult Eric Abrahamsen
2019-09-09  3:56   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09  5:09 ` comic-book-insult Yuri Khan
2019-09-09 17:41   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09 18:26     ` comic-book-insult Yuri Khan
2019-09-09 18:33       ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09  8:00 ` comic-book-insult Jean Louis
2019-09-09 17:32   ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09 18:05     ` comic-book-insult Jean Louis
2019-09-09 18:10       ` comic-book-insult Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-09 18:13       ` comic-book-insult Eli Zaretskii
2019-09-11 12:56         ` Anonymous arguments - comic-book-insult Jean Louis
2019-09-11 15:12           ` Emanuel Berg via Users list for the GNU Emacs text editor
2019-09-17  6:19             ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=867e6iiejk.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.