Make set-process-buffer also update the process mark

* src/process.c (Fset_process_buffer): Update the process mark
(bug#43573).
This commit is contained in:
Lars Ingebrigtsen 2020-09-24 17:14:25 +02:00
parent 8463687b5d
commit 7b3e94b664
3 changed files with 17 additions and 10 deletions

View file

@ -1576,7 +1576,8 @@ from previous output.
@defun set-process-buffer process buffer
This function sets the buffer associated with @var{process} to
@var{buffer}. If @var{buffer} is @code{nil}, the process becomes
associated with no buffer.
associated with no buffer; if non-@code{nil}, the process mark will be
set to point to the end of @var{buffer}.
@end defun
@defun get-buffer-process buffer-or-name

View file

@ -1277,6 +1277,10 @@ directory instead of the default directory.
* Incompatible Lisp Changes in Emacs 28.1
** 'set-process-buffer' now updates the process mark.
The mark will be set to point to the end of the new buffer.
+++
** Some properties from completion tables are now preserved.
If 'minibuffer-allow-text-properties' is non-nil, doing completion

View file

@ -1205,6 +1205,16 @@ not the name of the pty that Emacs uses to talk with that terminal. */)
return XPROCESS (process)->tty_name;
}
static void
update_process_mark (struct Lisp_Process *p)
{
Lisp_Object buffer = p->buffer;
if (BUFFERP (buffer))
set_marker_both (p->mark, buffer,
BUF_ZV (XBUFFER (buffer)),
BUF_ZV_BYTE (XBUFFER (buffer)));
}
DEFUN ("set-process-buffer", Fset_process_buffer, Sset_process_buffer,
2, 2, 0,
doc: /* Set buffer associated with PROCESS to BUFFER (a buffer, or nil).
@ -1221,6 +1231,7 @@ Return BUFFER. */)
if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p))
pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer));
setup_process_coding_systems (process);
update_process_mark (p);
return buffer;
}
@ -1637,15 +1648,6 @@ DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0,
return Fmapcar (Qcdr, Vprocess_alist);
}
static void
update_process_mark (struct Lisp_Process *p)
{
Lisp_Object buffer = p->buffer;
if (BUFFERP (buffer))
set_marker_both (p->mark, buffer,
BUF_ZV (XBUFFER (buffer)),
BUF_ZV_BYTE (XBUFFER (buffer)));
}
/* Starting asynchronous inferior processes. */