From: No Wayman <iarchivedmywholelife@gmail.com>
To: 61325@debbugs.gnu.org
Subject: bug#61325: 30.0.50; Jokes in GNUS manual
Date: Tue, 07 Mar 2023 15:02:05 -0500 [thread overview]
Message-ID: <87a60otji3.fsf@gmail.com> (raw)
In-Reply-To: <87fsagg05g.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 1925 bytes --]
I feel like this discussion is easily solved by a technical means.
What we need is an embedded document mark-up language in order for
documentation authors to formally indicate where they are joking.
We then define an alist of "harm categories" which users can
register themselves with.
Before documentation is printed, the "harmfulness coefficient" is
determined for a particular user. If it is above their
"harmfulness threshold", we display a less offensive joke (defined
in a separate, localized user option).
See the attached library, joke.el, which solves 99% of the
problem.
An example usage:
#+begin_src emacs-lisp
(defconst joke-test-text
"A closure is a function that also carries a record of the
lexical
environment that existed when the function was defined. When it is
invoked, any
lexical variable references within its definition use the retained
lexical
environment. In all other respects, closures behave much like
ordinary
functions; in particular, they can be called in the same way as
ordinary
functions. Speaking of which:
<joke>Why did the chicken go to Hell? It wasn't braised
right.</joke>")
(cl-loop for (subject . categories) in '((timmy . (agoraphobic
child))
(rachel . (religious
vegan)))
collect (cons subject (apply #'joke-harm-by-category
joke-test-text
categories)))
;;((timmy (agoraphobic . 0.0)
;; (child . 12.043010752688172))
;; (rachel (religious . 12.043010752688172)
;; (vegan . 12.043010752688172)))
#+end_src
Here we can see 12.04% of the above documentation will offend an
agoraphobic child, such as Timmy. However, it will be doubly
offensive to a religious vegan, such as Rachel.
If I don't hear any convincing objections within the next couple
of hours,
I'll merge to emacs-29 branch.
Thanks.
[-- Attachment #2: joke --]
[-- Type: text/plain, Size: 1861 bytes --]
;;; Joke --- Not a joke. ;; -*- lexical-binding: t; -*-
;;; Commentary:
;; yes.
;;; Code:
(require 'cl-lib)
(defconst joke-harm-categories
'((("chicken" "cow" "meat") . vegetarian)
((vegetarian "cheese" "milk" "fish") . vegan)
(("god" "sex" "heaven" "hell") . religious)
((religious "religion") . atheist)
(("marketplace") . agoraphobic)
((".*") . child))
"Lists of categories of people will be offended by jokes on certain topics.")
(defun joke-victims (joke)
"Return victims of JOKE."
(cl-loop for (spec . victim) in joke-harm-categories
for regexps = (flatten-tree
(cl-loop for el in spec collect
(if (symbolp el)
(car (rassoc el joke-harm-categories))
el)))
when (cl-some (lambda (regexp) (string-match-p regexp joke)) regexps)
collect victim))
(defun joke-jokes (text)
"Return list of jokes in TEXT."
(let ((jokes))
(with-temp-buffer
(insert text)
(goto-char (point-min))
(while (re-search-forward "\\(?:<joke>\\([^z-a]*?\\)</joke>\\)" nil 'noerror)
(push (match-string 1) jokes))
(nreverse jokes))))
(defun joke-harm-by-category (text &rest victims)
"Return percentage of JOKES in TEXT which will harm VICTIMS."
(cl-loop with jokes = (joke-jokes text)
for victim in (or victims '(anyone))
for harmful =
(cl-remove-if-not (lambda (joke) (member victim (joke-victims joke)))
jokes)
collect (cons victim (* 100 (/ (cl-reduce #'+ harmful :key #'length)
(float (length text)))))))
(provide 'joke)
;;; joke.el ends here
next prev parent reply other threads:[~2023-03-07 20:02 UTC|newest]
Thread overview: 136+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 16:01 bug#61325: 30.0.50; Jokes in GNUS manual Ihor Radchenko
2023-02-06 16:20 ` dick
2023-02-12 6:11 ` Jean Louis
2023-02-06 16:27 ` Eli Zaretskii
2023-02-06 16:38 ` Ihor Radchenko
2023-02-06 16:42 ` Ihor Radchenko
2023-02-06 16:51 ` Eli Zaretskii
2023-02-06 17:04 ` Ihor Radchenko
2023-02-18 13:59 ` Petteri Hintsanen
2023-02-19 10:43 ` Ihor Radchenko
2023-02-20 5:18 ` Richard Stallman
2023-02-06 17:23 ` Pankaj Jangid
2023-02-06 17:49 ` Ihor Radchenko
2023-02-06 18:37 ` Pankaj Jangid
2023-02-06 18:45 ` Ihor Radchenko
2023-02-07 2:04 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-07 11:24 ` Ihor Radchenko
2023-02-07 12:36 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-07 13:01 ` Ihor Radchenko
2023-02-07 14:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-07 14:43 ` Ihor Radchenko
2023-02-07 15:10 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-07 16:15 ` Ihor Radchenko
2023-02-08 1:28 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-08 11:40 ` Ihor Radchenko
2023-02-08 11:41 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-08 11:59 ` Ihor Radchenko
2023-02-08 12:50 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-15 14:55 ` Ihor Radchenko
2023-02-16 1:29 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-17 12:25 ` Ihor Radchenko
2023-02-18 4:19 ` Richard Stallman
2023-02-18 11:14 ` Ihor Radchenko
2023-02-20 5:19 ` Richard Stallman
2023-02-22 13:43 ` Eli Zaretskii
2023-02-25 4:09 ` Richard Stallman
2023-02-08 12:36 ` Eli Zaretskii
2023-02-12 6:38 ` Jean Louis
2023-02-09 4:28 ` Richard Stallman
2023-02-07 19:45 ` Pankaj Jangid
2023-02-07 19:56 ` Ihor Radchenko
2023-02-09 4:28 ` Richard Stallman
2023-02-07 14:15 ` dick
2023-02-07 15:09 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-07 15:17 ` Eli Zaretskii
2023-02-08 8:11 ` Michael Albinus
2023-02-08 12:31 ` Eli Zaretskii
2023-02-08 12:59 ` Michael Albinus
2023-02-07 15:41 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-09 4:28 ` Richard Stallman
2023-02-09 16:44 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-12 4:03 ` Richard Stallman
2023-02-08 4:31 ` Richard Stallman
2023-02-08 4:46 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-12 6:46 ` Jean Louis
2023-02-15 14:47 ` Ihor Radchenko
2023-02-16 1:27 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-17 12:38 ` Ihor Radchenko
2023-02-17 5:22 ` Jean Louis
2023-02-19 4:50 ` Richard Stallman
2023-02-19 5:04 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-22 4:33 ` Richard Stallman
2023-02-22 6:02 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-26 2:59 ` Richard Stallman
2023-02-08 13:06 ` dick
2023-02-08 15:35 ` Akib Azmain Turja via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-08 16:06 ` dick
2023-02-15 14:37 ` Ihor Radchenko
2023-02-16 1:34 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-17 12:49 ` Ihor Radchenko
2023-02-19 4:50 ` Richard Stallman
2023-02-19 10:36 ` Ihor Radchenko
2023-02-19 11:01 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-19 11:13 ` Eli Zaretskii
2023-02-20 11:50 ` Ihor Radchenko
2023-02-20 12:34 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-07 13:29 ` Ihor Radchenko
2023-03-07 20:02 ` No Wayman [this message]
2023-03-07 20:12 ` Eli Zaretskii
2023-02-19 12:24 ` Stefan Kangas
2023-02-19 13:05 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-19 13:45 ` Stefan Kangas
2023-02-20 18:29 ` Gregory Heytings
2023-02-21 2:30 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-22 4:34 ` Richard Stallman
2023-02-22 4:35 ` Richard Stallman
2023-03-07 13:48 ` Ihor Radchenko
2023-03-08 0:22 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-08 14:05 ` Ihor Radchenko
2023-03-09 1:14 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-10 4:25 ` Richard Stallman
2023-03-10 7:03 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-09 4:28 ` Richard Stallman
2023-03-08 5:34 ` Jean Louis
2023-03-08 14:13 ` Ihor Radchenko
2023-03-09 1:21 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13 14:50 ` Jean Louis
2023-03-09 4:26 ` Richard Stallman
2023-03-10 11:33 ` Ihor Radchenko
2023-03-10 11:34 ` Ihor Radchenko
2023-03-10 12:06 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-10 12:37 ` Eli Zaretskii
2023-03-10 12:41 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13 15:01 ` Jean Louis
2023-02-19 15:56 ` Drew Adams
2023-02-20 12:00 ` Ihor Radchenko
2023-02-20 12:37 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-20 14:28 ` Michael Albinus
2023-02-20 14:34 ` Ihor Radchenko
2023-02-20 17:01 ` Drew Adams
2023-02-20 11:55 ` Ihor Radchenko
2023-02-27 3:26 ` Richard Stallman
2023-02-19 5:07 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-18 4:19 ` Richard Stallman
2023-02-19 10:25 ` Ihor Radchenko
2023-02-15 15:34 ` Stefan Kangas
2023-02-15 16:00 ` Robert Pluim
2023-02-18 4:19 ` Richard Stallman
2023-02-17 5:24 ` Jean Louis
2023-02-19 4:50 ` Richard Stallman
2023-02-08 13:42 ` Visuwesh
2023-02-12 6:56 ` Jean Louis
2023-02-12 6:32 ` Jean Louis
2023-02-14 4:51 ` Richard Stallman
2023-02-14 11:17 ` Jean Louis
2023-03-09 4:05 ` Sam James
2023-03-09 14:10 ` Dmitry Gutov
2023-03-09 14:17 ` Robert Pluim
2023-03-09 16:57 ` Dmitry Gutov
2023-03-09 17:06 ` Robert Pluim
2023-03-09 20:10 ` Jose A. Ortega Ruiz
2023-03-10 10:53 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-13 15:05 ` Jean Louis
2023-09-06 6:53 ` Stefan Kangas
2023-09-06 7:10 ` Ihor Radchenko
2023-09-06 7:30 ` Stefan Kangas
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a60otji3.fsf@gmail.com \
--to=iarchivedmywholelife@gmail.com \
--cc=61325@debbugs.gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).