unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: emacs-devel@gnu.org
Subject: Re: how to speed up Lisp devel time
Date: Fri, 09 Aug 2024 23:47:01 +0200	[thread overview]
Message-ID: <87ed6x2wtm.fsf@dataswamp.org> (raw)
In-Reply-To: 864j7tlgzm.fsf@gnu.org

Eli Zaretskii wrote:

>> (interactive (if (numberp current-prefix-arg)
>>                  (list current-prefix-arg)
>>                current-prefix-arg))
>
> If you need to support a numeric optional argument, "p" is
> all you need. Anything else is redundant over-engineering
> at best.

Not here, I want M-x to be the default behavior since the 1 is
implicit. The code you suggested isn't equivalent to mine.

>> That, (interactive "p"), is the same as sending 1 on M-x, but
>> here we want it to be the default behavior. Since nothing is
>> stated explicitely.
>> 
>> M-x should be default, just as (function-name) should
>> be default.
>> 
>> But it should be possible to do C-u 1 M-x to set 'end' to 1.
>
> It makes no sense to have "M-x" do something different from
> "C-u 1 M-x", when the argument says how many times to do
> some job.

The interface is very consistent and easy to understand:

For interactive as well as non-interactive use:

- no explicit data -> use default value;
  explicit data -> use it

- same default values

- same validation checks

> This is why in Emacs we use this convention consistently in
> all the commands.

Emacs has tons of conventions and I don't believe in that
method, to some extent - maybe - instead I believe in
automating stuff and have *the computer* check the soundness
of things rather than to put it as list in the documentation
and expect people to do it ever on.

;; This is a comment. Every comment should look like it

That is another thing, but no, I don't believe in that method.

But that besides the point, this whole thread isn't about
_this_ interface!

> You are free to use other conventions in your code, but
> that's not how Emacs commands work, and we require any
> command to adhere to that convention.

*sigh*

> When you want to allow the user to specify more than
> a single argument to a command, things usually become much
> more complicated, so it is best to avoid such commands.

...

> If you must do that, a separate prompt for each argument is
> better than tricky conventions regarding the value of
> prefix arg.

Tricky conventions that is

        M-x -  (expt 4 0) -  1 (instead, since implicit, use default) 
    C-u M-x -  (expt 4 1) -  4 (same)
C-u C-u M-x -  (expt 4 2) - 16 (same)
  C-u n M-x -                n (same)

Too tricky for you, okay. Whatever, it isn't for me and the
thread was, again, not about this particular interface, but
... ah, forget it.

-- 
underground experts united
https://dataswamp.org/~incal




  parent reply	other threads:[~2024-08-09 21:47 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09  7:16 how to speed up Lisp devel time Emanuel Berg
2024-08-09  7:24 ` Eli Zaretskii
2024-08-09  7:39   ` Emanuel Berg
2024-08-09 10:43     ` Eli Zaretskii
2024-08-09 11:18       ` Emanuel Berg
2024-08-09 12:02         ` Eli Zaretskii
2024-08-09 13:54           ` Emanuel Berg
2024-08-09 14:58             ` Eli Zaretskii
2024-08-09 16:03               ` Emanuel Berg
2024-08-09 16:16                 ` Emanuel Berg
2024-08-09 17:54                   ` Eli Zaretskii
2024-08-09 18:56                     ` Christopher Dimech
2024-08-09 21:57                       ` Emanuel Berg
2024-08-09 21:47                     ` Emanuel Berg [this message]
2024-08-09 17:27                 ` Yuri Khan
2024-08-09 21:21                   ` Emanuel Berg
2024-08-10  2:14                   ` Emanuel Berg
2024-08-10  6:01                     ` Yuri Khan
2024-08-10  6:08                       ` Emanuel Berg
2024-08-10  6:44                         ` Yuri Khan
2024-08-10  7:22                           ` Emanuel Berg
2024-08-10  7:51                             ` Emanuel Berg
2024-08-10  4:32                   ` Emanuel Berg
2024-08-10  5:58                     ` Eli Zaretskii
2024-08-09 14:59             ` Eduardo Ochs
2024-08-09 16:19               ` Emanuel Berg
2024-08-09 18:00                 ` Eli Zaretskii
2024-08-09 18:54                   ` Christopher Dimech
2024-08-09 22:17                     ` Emanuel Berg
2024-08-09 22:00                   ` Emanuel Berg
2024-08-09  8:24   ` Emanuel Berg
2024-08-09 10:36     ` Christopher Dimech

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=87ed6x2wtm.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=emacs-devel@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).