9

This was a pretty cool question, I learned a lot that I didn't know while trying to figure this out. What I learned was that each window has its own value for point. This is important because it means that the point is not associated with the buffer but instead the actual window. As we've seen this makes a big difference. What we need to do then is set the ...


6

(Jules Tamagnan's answer identifies the problem, I'll expand on it.) Your solutions with save-excursion or save-excursion do in fact work! You can see it by checking the value of (point) in that buffer afterwards, e.g. (progn (with-current-buffer "*whatever*" (goto-char 42)) (with-current-buffer "*whatever*" (point))) always returns 42 (...


5

If your question is what is the use of set-window-point then the answer is that it sets the window-point value for the given window's buffer. See the Elisp manual, node Window Point. It starts by telling you this, which should already answer your question: Each window has its own value of point (*note Point::), independent of the value of point in ...


2

I think the following code will help. It is modified from an example in the emacs-lisp intro at https://www.gnu.org/software/emacs/manual/html_node/eintr/append_002dto_002dbuffer-overview.html. (defun append-string-to-buffer (buffer string) ;; Modified from append-to-buffer, defined in the emacs-lisp intro "Append to specified buffer the specified text. ...


1

The following solves the problem inside my process filter. It sets the window point for every window visiting the process buffer to be the process mark, which I force to be at the end. (mapcar (lambda (w) (set-window-point w (process-mark (get-process "foo-process")))) (get-buffer-window-list "foo-buffer"))


1

This is described in chapter The Window Start and End Positions of the elisp manual. Specifically: -- Function: window-start &optional window This function returns the display-start position of window WINDOW. If WINDOW is ‘nil’, the selected window is used. -- Function: window-end &optional window update This function ...


1

After reading the code in the windmove.el, I found following solution. Thanks for your suggestion, @lawlist (defun windmove-diagonal (&optional arg) (interactive "P") (windmove-jump 'left 'down arg)) (defun windmove-jump (dir dir2 &optional arg window) (let* ((other-window (windmove-find-other-window dir arg window)) (other-window2 (...


1

Emacs says the following about this function: set-window-point is a built-in function in `C source code'. (set-window-point WINDOW POS) Make point value in WINDOW be at position POS in WINDOW's buffer. WINDOW must be a live window and defaults to the selected one. Return POS. To ask Emacs type C-h f and then input the function name.


Only top voted, non community-wiki answers of a minimum length are eligible