emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smarter M-x that filters on major-mode


From: Juri Linkov
Subject: Re: Smarter M-x that filters on major-mode
Date: Sun, 14 Feb 2021 19:43:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]