help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: calling similar function


From: Drew Adams
Subject: RE: calling similar function
Date: Fri, 7 Jul 2006 21:11:01 -0700

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





reply via email to

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