GNU bug report logs - #19492
How to neatly call interactive commands interactively?

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Fri, 2 Jan 2015 22:10:01 UTC

Severity: wishlist

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19492 in the body.
You can then email your comments to 19492 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#19492; Package emacs. (Fri, 02 Jan 2015 22:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Reuben Thomas <rrt <at> sc3d.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 02 Jan 2015 22:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Reuben Thomas <rrt <at> sc3d.org>
To: bug-emacs <bug-emacs <at> gnu.org>
Subject: How to neatly call interactive commands interactively?
Date: Fri, 2 Jan 2015 22:09:35 +0000
[Message part 1 (text/plain, inline)]
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.

-- 
http://rrt.sc3d.org
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19492; Package emacs. (Fri, 02 Aug 2019 20:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 19492 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Reuben Thomas <rrt <at> sc3d.org>
Cc: 19492 <at> debbugs.gnu.org
Subject: Re: bug#19492: How to neatly call interactive commands interactively?
Date: Fri, 02 Aug 2019 22:24:28 +0200
Reuben Thomas <rrt <at> sc3d.org> 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




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 02 Aug 2019 20:25:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 19492 <at> debbugs.gnu.org and Reuben Thomas <rrt <at> sc3d.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 02 Aug 2019 20:25:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19492; Package emacs. (Sat, 03 Aug 2019 02:47:02 GMT) Full text and rfc822 format available.

Message #15 received at 19492 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 19492 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: bug#19492: How to neatly call interactive commands interactively?
Date: Fri, 02 Aug 2019 22:46:24 -0400
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

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

I think it would be more like

    (funcall-preserving-interactiveness 'adaptive-wrap-prefix-mode)
    (funcall-preserving-interactiveness 'window-margin-mode)

The main implementation of this would really be called-interactively-p,
when it examines the call stack.

> 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".

That said, while I don't think it's impossible, I don't know if it's
really worth the trouble.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 31 Aug 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.