all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: calling similar function
Date: Fri, 7 Jul 2006 21:11:01 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICAELFDHAA.drew.adams@oracle.com> (raw)
In-Reply-To: <1152327294.203987.318550@75g2000cwc.googlegroups.com>

    how I could call an interactive function by another
    interactive function. Here is the function I want to call:

    (defun list (command)
      (interactive "sCommand> ")
        (if (string-match "ls" command)
            (shell-command "ls")))

You don't want to redefine the function `list'; believe me, you do *not*
want to do that ;-). Call it `my-ls' or `je!iov??%moiyp', but not `list'.

    (defun list-foo () (interactive)(list))

That works (after renaming `list') - it calls `my-ls'.

Now, if you want to have list-foo call `my-ls' *interactively*, so that it
reads the command, then you need to use (call-interactively 'my-ls) instead
of just (my-ls).

      parent reply	other threads:[~2006-07-08  4:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-08  2:54 calling similar function scm
2006-07-08  4:07 ` Giorgos Keramidas
2006-07-08  4:11 ` Drew Adams [this message]

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=DNEMKBNJBGPAOPIJOOICAELFDHAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /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.