README.org (3123B)
1 Replace yes-or-no with super-duper-yes-or-no. 2 3 * About: 4 5 Copying from [[https://lists.gnu.org/archive/html/help-gnu-emacs/2023-09/msg00129.html][the mailing list post for now]] (random case toggle prompt now works): 6 7 People often alias yes-or-no with y-or-n, which is a less demanding 8 confirmation function. 9 10 I thought, hey, what about aliasing yes-or-no with something even more 11 demanding to avoid confirming stuff accidentally? 12 13 I had a few ideas which I plan on implementing: 14 15 One idea (Google's Gmail's Drunk Mode) is to ask the user to solve a 16 small arithmetic problem, which I haven't yet implemented. 17 18 Another idea given by a friend was to prompt something like this with 19 randomly capitalised letters: 20 21 #+begin_src elisp 22 "If yOU undERstanD what you'rE doing, enter the capitalized letters here:" 23 #+end_src 24 25 What I did do is write a function which asks the user to write a 26 sequence of randomly selected words from a wordlist in order to 27 confirm, and another to decline. [1] Right now it only uses a dummy 28 wordlist, but I have also written another package which provides a 29 selection of publicly known wordlists, which the first package would 30 be dependent on. 31 32 The wordlist package [2] bundles publicly known worslists such as the 33 Diceware wordlists and the EFF wordlists. I took the original files 34 as they are from those projects, and produce vectors of strings, each 35 vector is a wordlist. 36 37 It might just be my horrid code, but it takes a noticeable amount of 38 time to produce the vectors. How should I cache the results of the 39 wordlist producing functions? 40 41 Another concern is that this solution takes a lot of memory? Could I 42 make this dependency optional in the super-duper-yes-or-no package? 43 44 This is partly an exercise in learning Emacs Lisp, but maybe someone 45 would find it useful? 46 47 p.s. I haven't yet created their https://sr.ht/ homes, so they are 48 still only up on https://codeberg.org/ 49 50 [1]: <https://codeberg.org/yuvallangerontheroad/super-duper-yes-or-no> 51 [2]: <https://codeberg.org/yuvallangerontheroad/emacs-wordlists> 52 53 * Installation: 54 55 1. Download super-duper-yes-or-no.el. 56 2. Run src_text{M-x package-install-file <RET> /path/to/superduper-yes-or-no.el <RET>}. 57 3. Add src_elisp{(require 'super-duper-yes-or-no)} to your src_text{~/.config/emacs/init.el}. 58 59 * Usage: 60 61 62 - To replace yes-or-no-p with random sequences of words: 63 64 #+begin_src elisp 65 (defalias 'yes-or-no-p 66 'super-duper-yes-or-no-yes-or-no-words-p) 67 #+end_src 68 69 - To replace yes-or-no-p with uppercase letters hunts: 70 71 #+begin_src elisp 72 (defalias 'yes-or-no-p 73 'super-duper-yes-or-no-yes-or-no-toggle-case-p) 74 #+end_src 75 76 - To replace yes-or-no-p with arithmetic problems: 77 78 #+begin_src elisp 79 (defalias 'yes-or-no-p 80 'super-duper-yes-or-no-yes-or-no-arithmetic-problem-p) 81 #+end_src 82 83 * Support: 84 85 [[https://buymeacoffee.com/kakafarm][Support me 💰 on "buymeacoffee"]]! 86 87 * Todo: 88 ** Add proper wordlists, like Diceware's or EFF's. 89 *** There is one on the [[https://codeberg.org/yuvallangerontheroad/emacs-wordlists][codeberg mirror]] for now, but on its home at [[https://git.sr.ht/~kakafarm/emacs-wordlist/][source hut]] eventually.