From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14963 invoked by alias); 2 Sep 2013 18:22:58 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17967 Received: (qmail 17429 invoked from network); 2 Sep 2013 18:22:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130902112239.ZM26330@torch.brasslantern.com> Date: Mon, 02 Sep 2013 11:22:39 -0700 In-reply-to: Comments: In reply to vinurs "Does zsh functions have this feature?" (Sep 2, 9:41am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Does zsh functions have this feature? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 2, 9:41am, vinurs wrote: } } As time goes on, my functions will be more and more. But, I } won't all of them will be treated as shell commands. } In zsh, is there any feature like emacs lisp that when I write a } function if I want it to be call by M-x, I should add } (interactive) } in it; if not, it will only be called by lisp programs. In general, no. Zsh differentiates functions callable by the editor by declaring them to be "widgets" via "zle -N" and related commands, but it does not prevent widget functions from being called directly, any more than emacs prevents a lisp program from invoking a function that contains a call to (interactive). There are various ways to cause functions to be excluded from command correction and completion, and you can test for whether the editor is active by e.g. if zle then zle -R "line editor is active" else print "line editor is not active" fi The closest equivalent to (call-interactively) is to invoke the widget by passing its name as an argument to the "zle" command. There are lots of examples of this in the sample widget functions.