Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!helios.ee.lbl.gov!nosc!humu!uhccux!lupton From: lupton@uhccux.uhcc.hawaii.edu (Robert Lupton) Newsgroups: comp.emacs Subject: Re: How to move point to end of buffer? Message-ID: <3705@uhccux.uhcc.hawaii.edu> Date: 9 Apr 89 22:40:54 GMT Organization: University of Hawaii Lines: 38 Here's a solution that works: > From: Julian Cowley > To: lupton@uhccux.uhcc.hawaii.edu > Organization: University of Hawaii at Manoa > > Well, I tried to find a way to do this, but it looks like there > is no "real" way to do it except to write an ugly looking Lisp > function. I hope someone comes up with a more elegent solution! > > (let* ((buf (get-buffer "test")) > (bufwin (get-buffer-window buf))) > (set-buffer buf) > (if (get-buffer-window buf) > (set-window-point bufwin (point-max)) > (goto-char (point-max)))) > > Substitute the string "test" with the buffer variable you are > using. > Here's a piece of code: (defun tst () (set-buffer (get-buffer "hello")) (goto-char (point-max)) (insert-string "Hello World\n") (goto-char (point-max))) (You'll have to create the buffer "hello" first). If you (tst) in buffer hello you'll end up at the end. If you (tst) when buffer hello is NOT displayed, then switch to it, you'll end up at the end. If you have buffer hello displayed in a different window, then (tst), you'll end up with dot unchanged. Robert