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

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

Re: string func to use in .emacs


From: Peter Wu
Subject: Re: string func to use in .emacs
Date: Mon, 26 Jan 2004 09:55:28 -0500
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

On Mon, 26 Jan 2004 04:57:37 +0100, Jesper Harder wrote:

> Peter Wu <peterwu@hotmail.com> 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


reply via email to

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