From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Smarter M-x that filters on major-mode Date: Sun, 14 Feb 2021 19:43:24 +0200 Organization: LINKOV.NET Message-ID: <87blcmr1dv.fsf@mail.linkov.net> References: <8ed9b43502ae1480e06b@heytings.org> <87blcrdlqf.fsf@gnus.org> <87v9aydg3f.fsf@gnus.org> <83y2fuheph.fsf@gnu.org> <87im6yd4sz.fsf@gnus.org> <8735y2y44f.fsf@gnus.org> <87mtwajua4.fsf@telefonica.net> <87eehmwfeg.fsf@gnus.org> <87blcqjq45.fsf@telefonica.net> <875z2ywbvm.fsf@gnus.org> <87pn16mehu.fsf@gnus.jao.io> <87o8gpvdfd.fsf@gnus.org> <87a6s9mf87.fsf@gnus.jao.io> <87o8goryuj.fsf@gnus.org> <87y2fqepza.fsf_-_@gnus.org> <87pn12u3x8.fsf@tcd.ie> <87h7meenj0.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20013"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: "Basil L. Contovounesios" , emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Feb 14 18:56:06 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lBLcr-000564-1t for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Feb 2021 18:56:05 +0100 Original-Received: from localhost ([::1]:59050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBLcq-0003q2-3x for ged-emacs-devel@m.gmane-mx.org; Sun, 14 Feb 2021 12:56:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBLaV-0002BT-0t for emacs-devel@gnu.org; Sun, 14 Feb 2021 12:53:39 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:12813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBLaS-0003JT-RH for emacs-devel@gnu.org; Sun, 14 Feb 2021 12:53:38 -0500 X-Originating-IP: 91.129.108.204 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id BC2AB240002; Sun, 14 Feb 2021 17:53:30 +0000 (UTC) In-Reply-To: <87h7meenj0.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 14 Feb 2021 15:23:31 +0100") Received-SPF: pass client-ip=217.70.183.193; envelope-from=juri@linkov.net; helo=relay1-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264745 Archived-At: >> and is equivalent to (declare (modes MODES...)), then why not allow >> only the latter syntax? Or am I missing something? > > Since approx. 97% of commands will eventually have this markup, that > means that 97% of commands will start with > > (declare (modes foo-mode)) > (interactive "p") > > and that seems like too much line noise. We don't have to make Emacs > Lisp into Java. Such changes as below are not less line noise, and not less Java. Instead of this, more Lisp-like solution would be like removing redundant :group args from defcustom when there is a defgroup before them. The same way a package would declare its group, then defuns of all package commands could either add a corresponding 'declare' form, or put a command symbol's property to the defgroup mode name. @@ -274,45 +274,45 @@ bb-insert-board )) (defun bb-right (count) - (interactive "p") + (interactive "p" blackbox-mode) (while (and (> count 0) (< bb-x 8)) (forward-char 2) (setq bb-x (1+ bb-x)) (setq count (1- count)))) (defun bb-left (count) - (interactive "p") + (interactive "p" blackbox-mode) (while (and (> count 0) (> bb-x -1)) (backward-char 2) (setq bb-x (1- bb-x)) (setq count (1- count)))) (defun bb-up (count) - (interactive "p") + (interactive "p" blackbox-mode) (while (and (> count 0) (> bb-y -1)) (with-no-warnings (previous-line)) (setq bb-y (1- bb-y)) (setq count (1- count)))) (defun bb-down (count) - (interactive "p") + (interactive "p" blackbox-mode) (while (and (> count 0) (< bb-y 8)) (with-no-warnings (next-line)) (setq bb-y (1+ bb-y)) (setq count (1- count)))) (defun bb-eol () - (interactive) + (interactive nil blackbox-mode) (setq bb-x 8) (bb-goto (cons bb-x bb-y))) (defun bb-bol () - (interactive) + (interactive nil blackbox-mode) (setq bb-x -1) (bb-goto (cons bb-x bb-y))) (defun bb-romp () - (interactive) + (interactive nil blackbox-mode) (cond ((and (or (= bb-x -1) (= bb-x 8))