[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string func to use in .emacs
From: |
Jesper Harder |
Subject: |
Re: string func to use in .emacs |
Date: |
Mon, 26 Jan 2004 01:44:45 +0100 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
Peter Wu <peterwu@hotmail.com> writes:
> On Sun, 25 Jan 2004 18:45:05 +0100, Mario Domgörgen wrote:
>
>> ,----[ C-h f delete-trailing-whitespace RET ]
>
>> Look at this function to start with....
>
> This function seems to trim the trailing whitespaces in a
> buffer. How can I use it to trim a string variable?
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)))
- string func to use in .emacs, Peter Wu, 2004/01/25
- Re: string func to use in .emacs, Eli Zaretskii, 2004/01/25
- Message not available
- Re: string func to use in .emacs, Peter Wu, 2004/01/25
- Re: string func to use in .emacs, Mario Domgörgen, 2004/01/25
- Re: string func to use in .emacs, Peter Wu, 2004/01/25
- Re: string func to use in .emacs,
Jesper Harder <=
- Re: string func to use in .emacs, Peter Wu, 2004/01/25
- Re: string func to use in .emacs, Jesper Harder, 2004/01/25
- Re: string func to use in .emacs, Peter Wu, 2004/01/26
- Re: string func to use in .emacs, Eli Zaretskii, 2004/01/26
- Re: string func to use in .emacs, Eli Zaretskii, 2004/01/25