bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10624: Dired-marking all files in the region


From: Stefan Monnier
Subject: bug#10624: Dired-marking all files in the region
Date: Thu, 22 Nov 2012 10:40:36 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> is to add an `interactive' arg (there were some reasons not to use
> (called-interactively-p 'interactive) but I forgot the exact reasons).

One of the main reasons is reliability.  If you look at the code of
called-interactively-p, you'll see it's pretty hackish, so it's easy to
break it.  For example `called-interactively-p' may fail to work correctly
in the following known cases:
- when the function is advised (this was recently improved, so it will
  now fail sometimes rather than always).
- when inside a condition-case or catch in lexical-binding code.
- when inside a `pcase' branch (because pcase sometimes moves the
  branch to a lambda in order to avoid duplicating the code).

Another reason is that it makes it more flexible for non-interactive
callers, which can control whether to run the function "as if the
arguments had been provided interactively".

`called-interactively-p' is handy when you can't add an argument, but
otherwise it's much better to add an `interactive' argument.


        Stefan





reply via email to

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