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

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

Re: And while we're at it...


From: Pascal J. Bourguignon
Subject: Re: And while we're at it...
Date: Wed, 01 Dec 2010 15:19:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Gary <help-gnu-emacs@garydjones.name> writes:

> Tassilo Horn wrote:
>> Gary writes:
>>
>>> 'insert' and friends insert their arguments at the current point. If
>>> I'm at a different point in the file to where I want to actually
>>> insert the text?
> ...
>> something like:
>>
>>   (let ((text (compute-text-to-be-inserted)))
>>     (save-excursion
>>       (goto-buffer-position-where-text-should-be-inserted)
>>       (insert text)))
>>
>> The `save-excursion' will restore the current position after its body
>> has been executed.
>
> Yeah, I'd read and mentally noted that. What I'm missing is how to
> goto-buffer-position-where-text-should-be-inserted, as you put it. I
> found backward-line which might help, but I don't know what position in
> that line the "point" would then be. End? Beginning? Somewhere in the
> middle?

There are a lot of way of moving around in a buffer.

goto-char
goto-line
forward-<whatever>
backward-<whatever>
beginning-of-<whatever>
end-of-<whatever>
search-forward
search-backward

etc...


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


reply via email to

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