Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!MITRE-BEDFORD.ARPA!sdl From: sdl@MITRE-BEDFORD.ARPA ("Steven D. Litvintchouk") Newsgroups: net.emacs Subject: (error-occurred) and (interactive) Message-ID: <8605241659.AA07159@mitre-bedford.ARPA> Date: Sat, 24-May-86 12:59:36 EDT Article-I.D.: mitre-be.8605241659.AA07159 Posted: Sat May 24 12:59:36 1986 Date-Received: Mon, 26-May-86 01:31:27 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The MITRE Corp., Bedford, MA Lines: 58 > Can anybody tell me if there is a function in GNU Emacs similar to the > Gosling predicate (error-occurred)? I use "condition-case". "condition-case" is actually more general than Gosling's "error-occurred", because "condition-case" can handle different kinds of errors. Here is the definition: condition-case: Regain control when an error is signaled. (condition-case VAR BODYFORM HANDLERS...) executes BODYFORM and returns its value if no error happens. Each element of HANDLERS looks like (CONDITION-NAME BODY...) where the BODY is made of Lisp expressions. The handler is applicable to an error if CONDITION-NAME is one of the error's condition names. When a handler handles an error, control returns to the condition-case and the handler BODY... is executed with VAR bound to (SIGNALED-CONDITIONS . SIGNAL-DATA). The value of the last BODY form is returned from the condition-case. See SIGNAL for more info. And, (courtesy of GNU emacs Mocklisp support package mlsupport.el), here is the way "error-occurred" can be implemented using "condition-case": (defmacro error-occurred (&rest body) (list 'condition-case nil (cons 'progn (append body '(nil))) '(error t))) > I would also appreciate any explanation about the difference in GNU Emacs > between a "function" and a "command". As far as I can tell, it has to do > with the use of the (interactive) function. What is the real meaning of > this function when used with no arguments? Placing an (interactive) declaration just after the documentation string of a function, declares the surrounding function to be interactively callable as a command. That is, it can be invoked via M-x (Meta-x) followed by its name. Otherwise, the only way you can call the function is as a Lisp function; e.g. via M-ESC, eval-expression, or in Lisp interaction mode. I guess the reason for this is to avoid cluttering up the name space of interactive commands with Emacs Lisp functions which are never expected to be invoked interactively by an end user; this cuts down on the number of displayed command completions, etc. If the function expects arguments, then the arguments of (interactive) enable you to specify how arguments are to be passed interactively to the function. Steven Litvintchouk MITRE Corporation ARPA: sdl@mitre-bedford UUCP: ...{allegra,decvax,genrad,ihnp4,philabs,security,utzoo}!linus!sdl