From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Peter Wu Newsgroups: gmane.emacs.help Subject: Re: string func to use in .emacs Date: Mon, 26 Jan 2004 09:55:28 -0500 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <873ca2n4in.fsf@tulip.whu.ca> References: <87llnwlij0.fsf@tulip.whu.ca> <87ptd8gld8.fsf@tulip.whu.ca> <87fze3orby.fsf@gmx.de> <87brorzhac.fsf@tulip.whu.ca> <877jzfz9fw.fsf@tulip.whu.ca> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1075130719 21090 80.91.224.253 (26 Jan 2004 15:25:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2004 15:25:19 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 26 16:25:12 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Al8bv-00013n-00 for ; Mon, 26 Jan 2004 16:25:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Al8F3-0001Rt-En for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jan 2004 10:01:33 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!cpe00095b30c1ed-cm000039823460.cpe.net.cable.rogers.COM!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-NNTP-Posting-Host: cpe00095b30c1ed-cm000039823460.cpe.net.cable.rogers.com (63.138.206.3) Original-X-Trace: news.uni-berlin.de 1075128926 24227058 63.138.206.3 ([117651]) User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:QzH0bHRyOl/3uKRqtsc7dGI+WWc= Original-Xref: shelby.stanford.edu gnu.emacs.help:120423 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16371 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16371 On Mon, 26 Jan 2004 04:57:37 +0100, Jesper Harder wrote: > Peter Wu writes: >> On Mon, 26 Jan 2004 01:44:45 +0100, Jesper Harder wrote: >> >>> A common idiom when you have a function that works in a buffer and >>> want to apply it to a string is to use a temporary buffer: >> >>> (defun string-trim-right (str) >>> (with-temp-buffer >>> (insert str) >>> (delete-trailing-whitespace) >>> (buffer-string))) >> >> I tried to use the func and got an error: My code: >> >> (string-trim-right("Emacs ")) > That should be: > (string-trim-right "Emacs ") This takes care of the problem. Thanks! -- ,,, (o o) Peter Wu ---ooO-(_)-Ooo--- Powered by GNU/Linux 2.4.22