all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Reuben Thomas <rrt@sc3d.org>
Cc: 19492@debbugs.gnu.org
Subject: bug#19492: How to neatly call interactive commands interactively?
Date: Fri, 02 Aug 2019 22:24:28 +0200	[thread overview]
Message-ID: <87ef23mi2r.fsf@mouse.gnus.org> (raw)
In-Reply-To: <CAOnWdojqW89s2QxWyJZ2QGYJ-FLHFu=RERUwtH_O5EXKDcGN9w@mail.gmail.com> (Reuben Thomas's message of "Fri, 2 Jan 2015 22:09:35 +0000")

Reuben Thomas <rrt@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





  reply	other threads:[~2019-08-02 20:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 22:09 bug#19492: How to neatly call interactive commands interactively? Reuben Thomas
2019-08-02 20:24 ` Lars Ingebrigtsen [this message]
2019-08-03  2:46   ` Noam Postavsky

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ef23mi2r.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=19492@debbugs.gnu.org \
    --cc=rrt@sc3d.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.