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: Reuben Thomas
Subject: bug#19492: How to neatly call interactive commands interactively?
Date: Fri, 2 Jan 2015 22:09:35 +0000

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

reply via email to

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