From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#58493: [PATCH] * lisp/play/zone.el (zone): Allow selecting a program Date: Thu, 13 Oct 2022 13:37:12 +0000 Message-ID: <87sfjr3kvr.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37384"; mail-complaints-to="usenet@ciao.gmane.io" To: 58493@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 13 15:57:07 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiyhu-0009Vh-1u for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 15:57:06 +0200 Original-Received: from localhost ([::1]:56196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiyhs-0005Fj-MI for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 09:57:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiyPS-0006ti-2u for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 09:38:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiyPR-0006dj-Q7 for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 09:38:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oiyPR-0004uY-Lv for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 09:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Oct 2022 13:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58493 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166566824318823 (code B ref -1); Thu, 13 Oct 2022 13:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Oct 2022 13:37:23 +0000 Original-Received: from localhost ([127.0.0.1]:59976 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiyOp-0004tW-9k for submit@debbugs.gnu.org; Thu, 13 Oct 2022 09:37:23 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:60356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oiyOk-0004tL-5j for submit@debbugs.gnu.org; Thu, 13 Oct 2022 09:37:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiyOj-00068U-NG for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 09:37:18 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:47081) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiyOh-0006a3-Ft for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 09:37:17 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 2DC78240026 for ; Thu, 13 Oct 2022 15:37:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665668233; bh=AGKvvd8sv24jvjjmA/2SIKM7qDC92JqawrX3oOF5D9U=; h=From:To:Subject:Autocrypt:Date:From; b=GtGt7DnqiaytcekGhHamjRAmZiCqHk/GNVxWVcSYaDhsTIMrMv2XS/hRWt8fD6CvP XlsNVkuPORTzZ7Miw3FSWhfldm+QcGK0GrC0C6quQnmTuXjYLIgCltA+P+YXGyWs5A M/8tojHFURgEYwkkU7JuZspExo9nuHQT6BrbT+zAzn0gq1sfMrf84uwSXysceXhdBr K00pCMnSfoyQHIcX2TbDhSz2yb3jjaedlI45eqEMOSZR7ad97erUFFxcCD19mn3fl7 mrxyF5+EB4ehu5G9ZkVSA/28jkyGZexKHFcfYtLmyYAzi/MLmOo18m7zgidPaibbdu 8EQ/hOGAUFkWA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Mp9YN4jh8z9rxB for ; Thu, 13 Oct 2022 15:37:12 +0200 (CEST) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245304 Archived-At: --=-=-= Content-Type: text/plain Tags: patch By default zone chooses a random program, but it seems to me that it should be OK to allow choosing a specific effect. In GNU Emacs 29.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-10-13 built on rhea Repository revision: 0b170c6caeeb669df3cf97c54c43da9cf77e6b42 Repository branch: master System Description: Fedora Linux 36 (Workstation Edition) Configured using: 'configure --with-pgtk --with-imagemagick' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-lisp-play-zone.el-zone-Allow-selecting-a-program.patch >From c122c2a921d0b06d7b49fa8231ab685faeb6169f Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 11 Oct 2022 12:28:45 +0200 Subject: [PATCH] * lisp/play/zone.el (zone): Allow selecting a program --- lisp/play/zone.el | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lisp/play/zone.el b/lisp/play/zone.el index b0ce0194cf..47fdbbec0a 100644 --- a/lisp/play/zone.el +++ b/lisp/play/zone.el @@ -103,9 +103,24 @@ zone-call program)))) ;;;###autoload -(defun zone () - "Zone out, completely." - (interactive) +(defun zone (&optional pgm) + "Zone out, completely. +The optional argument PGM should be an element of `zone-programs' +or nil to have a random element chosen. When invoked +interactively with a prefix argument, the user is prompted for a +program." + (interactive + (and current-prefix-arg + (let ((choice (completing-read + "Program: " + (mapcar + (lambda (prog) + (substring (symbol-name prog) 9)) + zone-programs) + nil t))) + (list (intern (concat "zone-pgm-" choice)))))) + (unless pgm + (setq pgm (aref zone-programs (random (length zone-programs))))) (save-window-excursion (let ((f (selected-frame)) (outbuf (get-buffer-create "*zone*")) @@ -125,8 +140,7 @@ zone (set-window-start (selected-window) (point-min)) (set-window-point (selected-window) wp) (sit-for 0 500) - (let ((pgm (elt zone-programs (random (length zone-programs)))) - (ct (and f (frame-parameter f 'cursor-type))) + (let ((ct (and f (frame-parameter f 'cursor-type))) (show-trailing-whitespace nil) restore) (when ct -- 2.37.3 --=-=-=--