aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-09-24 17:08:30 +0200
committerLars Ingebrigtsen2020-09-24 17:08:30 +0200
commit8463687b5d245a667ba2ad5803a1c900476aec39 (patch)
treeba5df61f51d1fddfc6ab4c730be5b66ad43ecf3e /src/process.c
parent5df652d6144c82e1a0321d0feaf93e20467f635b (diff)
downloademacs-8463687b5d245a667ba2ad5803a1c900476aec39.tar.gz
emacs-8463687b5d245a667ba2ad5803a1c900476aec39.zip
Refactor process mark setting
* src/process.c (update_process_mark): Make into its own function. (Fmake_process, Fmake_pipe_process, Fmake_serial_process) (connect_network_socket): Use it.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/process.c b/src/process.c
index 53f4a1d8530..948d1336468 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1637,6 +1637,16 @@ DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0,
1637 return Fmapcar (Qcdr, Vprocess_alist); 1637 return Fmapcar (Qcdr, Vprocess_alist);
1638} 1638}
1639 1639
1640static void
1641update_process_mark (struct Lisp_Process *p)
1642{
1643 Lisp_Object buffer = p->buffer;
1644 if (BUFFERP (buffer))
1645 set_marker_both (p->mark, buffer,
1646 BUF_ZV (XBUFFER (buffer)),
1647 BUF_ZV_BYTE (XBUFFER (buffer)));
1648}
1649
1640/* Starting asynchronous inferior processes. */ 1650/* Starting asynchronous inferior processes. */
1641 1651
1642DEFUN ("make-process", Fmake_process, Smake_process, 0, MANY, 0, 1652DEFUN ("make-process", Fmake_process, Smake_process, 0, MANY, 0,
@@ -1805,10 +1815,7 @@ usage: (make-process &rest ARGS) */)
1805 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2); 1815 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2);
1806 1816
1807 /* Make the process marker point into the process buffer (if any). */ 1817 /* Make the process marker point into the process buffer (if any). */
1808 if (BUFFERP (buffer)) 1818 update_process_mark (XPROCESS (proc));
1809 set_marker_both (XPROCESS (proc)->mark, buffer,
1810 BUF_ZV (XBUFFER (buffer)),
1811 BUF_ZV_BYTE (XBUFFER (buffer)));
1812 1819
1813 USE_SAFE_ALLOCA; 1820 USE_SAFE_ALLOCA;
1814 1821
@@ -2453,10 +2460,7 @@ usage: (make-pipe-process &rest ARGS) */)
2453 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2); 2460 : EQ (Vprocess_adaptive_read_buffering, Qt) ? 1 : 2);
2454 2461
2455 /* Make the process marker point into the process buffer (if any). */ 2462 /* Make the process marker point into the process buffer (if any). */
2456 if (BUFFERP (buffer)) 2463 update_process_mark (p);
2457 set_marker_both (p->mark, buffer,
2458 BUF_ZV (XBUFFER (buffer)),
2459 BUF_ZV_BYTE (XBUFFER (buffer)));
2460 2464
2461 { 2465 {
2462 /* Setup coding systems for communicating with the network stream. */ 2466 /* Setup coding systems for communicating with the network stream. */
@@ -3182,12 +3186,7 @@ usage: (make-serial-process &rest ARGS) */)
3182 if (!EQ (p->command, Qt)) 3186 if (!EQ (p->command, Qt))
3183 add_process_read_fd (fd); 3187 add_process_read_fd (fd);
3184 3188
3185 if (BUFFERP (buffer)) 3189 update_process_mark (p);
3186 {
3187 set_marker_both (p->mark, buffer,
3188 BUF_ZV (XBUFFER (buffer)),
3189 BUF_ZV_BYTE (XBUFFER (buffer)));
3190 }
3191 3190
3192 tem = Fplist_get (contact, QCcoding); 3191 tem = Fplist_get (contact, QCcoding);
3193 3192
@@ -3664,10 +3663,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
3664 pset_status (p, Qlisten); 3663 pset_status (p, Qlisten);
3665 3664
3666 /* Make the process marker point into the process buffer (if any). */ 3665 /* Make the process marker point into the process buffer (if any). */
3667 if (BUFFERP (p->buffer)) 3666 update_process_mark (p);
3668 set_marker_both (p->mark, p->buffer,
3669 BUF_ZV (XBUFFER (p->buffer)),
3670 BUF_ZV_BYTE (XBUFFER (p->buffer)));
3671 3667
3672 if (p->is_non_blocking_client) 3668 if (p->is_non_blocking_client)
3673 { 3669 {