From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dieter Wilhelm Newsgroups: gmane.emacs.help Subject: Re: Newbie: Unable to write a custom function Date: Sun, 03 Dec 2006 01:06:39 +0100 Organization: The Church of Emacs Message-ID: <87ac254zcg.fsf@hans.local.net> References: <1165094606.836594.304590@j72g2000cwa.googlegroups.com> <4571F5B5.8050306@gmx.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1165104686 21622 80.91.229.2 (3 Dec 2006 00:11:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 3 Dec 2006 00:11:26 +0000 (UTC) Cc: deech , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 03 01:11:25 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gqewv-0002OZ-As for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Dec 2006 01:11:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gqewu-00042H-7y for geh-help-gnu-emacs@m.gmane.org; Sat, 02 Dec 2006 19:11:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gqewh-00040h-J2 for help-gnu-emacs@gnu.org; Sat, 02 Dec 2006 19:11:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gqewf-0003xP-K7 for help-gnu-emacs@gnu.org; Sat, 02 Dec 2006 19:11:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gqewe-0003x6-T6 for help-gnu-emacs@gnu.org; Sat, 02 Dec 2006 19:11:01 -0500 Original-Received: from [212.227.126.186] (helo=moutng.kundenserver.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gqewe-00050H-Ck for help-gnu-emacs@gnu.org; Sat, 02 Dec 2006 19:11:00 -0500 Original-Received: from [84.167.53.90] (helo=duenenhof-wilhelm.de) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1Gqewc333I-0007V3; Sun, 03 Dec 2006 01:10:58 +0100 Original-Received: by duenenhof-wilhelm.de (Postfix, from userid 1000) id DF95C755D3; Sun, 3 Dec 2006 01:06:43 +0100 (CET) Original-To: Andre Kuehne In-Reply-To: <4571F5B5.8050306@gmx.net> (Andre Kuehne's message of "Sat\, 02 Dec 2006 22\:52\:53 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:d7ab225b98a136e1c2910381f940ecb9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:39219 Archived-At: Andre Kuehne writes: > deech wrote: >> Hi all, >> I am new to Emacs. I have written a new search function into my .emacs >> file but I am unable to invoke it with M-x when I restart Emacs. There >> are no error messages when Emacs starts up. Here is the code: >> >> ;;Search backwards from a point for a string. If found delete >> ;;all characters from that string to the point. >> ;;Eg Given the argument 't', 'alligator' becomes 'alliga' >> (defun isearch-backward-tophrase () >> (set-mark-command ()) >> (isearch-backward ) >> (kill-region ()()) >> ) >> >> Any idea what I am doing wrong? > > You have to use the (interactive) special form to make your > funtion invokable with M-x: > > (defun isearch-backward-tophrase () > (interactive) > ... ... By the way, please try it without the mark, at least in interactive mode isearch-backward sets the mark where it starts the search. -- Best wishes H. Dieter Wilhelm Darmstadt, Germany