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

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

bug#19492: How to neatly call interactive commands interactively?


From: Lars Ingebrigtsen
Subject: bug#19492: How to neatly call interactive commands interactively?
Date: Fri, 02 Aug 2019 22:24:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Reuben Thomas <address@hidden> writes:

> I wanted to combine a couple of modes for soft-wrapped text, so I wrote:
>
> (defun soft-wrap-modes ()
>   (interactive)
>   "Turn on minor modes for soft wrap"
>   (if (called-interactively-p) (call-interactively 'adaptive-wrap-prefix-mode)
> (adaptive-wrap-prefix-mode))
>   (if (called-interactively-p) (call-interactively 'window-margin-mode)
> (window-margin-mode)))
>
> The idea is that soft-wrap-modes should toggle when used interactively, just
> like the underlying mode commands. But this is not very nice. It could be
> made a bit nicer using map, but is there no way to transparently pass the
> interactivity of the current command down to the sub-commands? I couldn't
> see a way to do this with the standard methods for testing whether a
> command is called in interactive mode.

(I'm going through old bug reports that unfortunately have not received
any responses yet.)

I don't think there's any way to do what you want.  (Somebody correct me
if I'm wrong.)  And I don't really see how an interface that does this
would work, really.  Something like

(with-everything-interactive-if-this-is-interactive
  (adaptive-wrap-prefix-mode)
  (window-margin-mode))

Well, in this case that would be a pretty trivial macro to write, but I
don't see this as being generally useful.  So I'm closing this as a
"wontfix".

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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