diff options
| author | Chong Yidong | 2011-04-06 17:55:08 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-04-06 17:55:08 -0400 |
| commit | e67a13abd8584d05dbac22496adb3cfb9256d8d8 (patch) | |
| tree | 01df0d85bb9f5ad9b68922280104b426fc80ddc5 /src/process.c | |
| parent | 7d668f2c1873456ec81ae9a481189fd318b3b5d2 (diff) | |
| download | emacs-e67a13abd8584d05dbac22496adb3cfb9256d8d8.tar.gz emacs-e67a13abd8584d05dbac22496adb3cfb9256d8d8.zip | |
Remove list-processes C function; misc fixes to last change.
* src/process.c (Flist_processes): Removed to Lisp.
(list_processes_1): Deleted.
* lisp/emacs-lisp/cconv.el (cconv--analyse-use): Ignore "ignored" when
issuing unused warnings.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print): Use lambda
macro directly.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 239 |
1 files changed, 0 insertions, 239 deletions
diff --git a/src/process.c b/src/process.c index a9a8eb79ede..4476014edfa 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1239,244 +1239,6 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1239 | 1239 | ||
| 1240 | return Qnil; | 1240 | return Qnil; |
| 1241 | } | 1241 | } |
| 1242 | |||
| 1243 | static Lisp_Object | ||
| 1244 | list_processes_1 (Lisp_Object query_only) | ||
| 1245 | { | ||
| 1246 | register Lisp_Object tail; | ||
| 1247 | Lisp_Object proc, minspace; | ||
| 1248 | register struct Lisp_Process *p; | ||
| 1249 | char tembuf[300]; | ||
| 1250 | int w_proc, w_buffer, w_tty; | ||
| 1251 | int exited = 0; | ||
| 1252 | Lisp_Object i_status, i_buffer, i_tty, i_command; | ||
| 1253 | |||
| 1254 | w_proc = 4; /* Proc */ | ||
| 1255 | w_buffer = 6; /* Buffer */ | ||
| 1256 | w_tty = 0; /* Omit if no ttys */ | ||
| 1257 | |||
| 1258 | for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) | ||
| 1259 | { | ||
| 1260 | int i; | ||
| 1261 | |||
| 1262 | proc = Fcdr (XCAR (tail)); | ||
| 1263 | p = XPROCESS (proc); | ||
| 1264 | if (NILP (p->type)) | ||
| 1265 | continue; | ||
| 1266 | if (!NILP (query_only) && p->kill_without_query) | ||
| 1267 | continue; | ||
| 1268 | if (STRINGP (p->name) | ||
| 1269 | && ( i = SCHARS (p->name), (i > w_proc))) | ||
| 1270 | w_proc = i; | ||
| 1271 | if (!NILP (p->buffer)) | ||
| 1272 | { | ||
| 1273 | if (NILP (BVAR (XBUFFER (p->buffer), name))) | ||
| 1274 | { | ||
| 1275 | if (w_buffer < 8) | ||
| 1276 | w_buffer = 8; /* (Killed) */ | ||
| 1277 | } | ||
| 1278 | else if ((i = SCHARS (BVAR (XBUFFER (p->buffer), name)), (i > w_buffer))) | ||
| 1279 | w_buffer = i; | ||
| 1280 | } | ||
| 1281 | if (STRINGP (p->tty_name) | ||
| 1282 | && (i = SCHARS (p->tty_name), (i > w_tty))) | ||
| 1283 | w_tty = i; | ||
| 1284 | } | ||
| 1285 | |||
| 1286 | XSETFASTINT (i_status, w_proc + 1); | ||
| 1287 | XSETFASTINT (i_buffer, XFASTINT (i_status) + 9); | ||
| 1288 | if (w_tty) | ||
| 1289 | { | ||
| 1290 | XSETFASTINT (i_tty, XFASTINT (i_buffer) + w_buffer + 1); | ||
| 1291 | XSETFASTINT (i_command, XFASTINT (i_tty) + w_tty + 1); | ||
| 1292 | } | ||
| 1293 | else | ||
| 1294 | { | ||
| 1295 | i_tty = Qnil; | ||
| 1296 | XSETFASTINT (i_command, XFASTINT (i_buffer) + w_buffer + 1); | ||
| 1297 | } | ||
| 1298 | |||
| 1299 | XSETFASTINT (minspace, 1); | ||
| 1300 | |||
| 1301 | set_buffer_internal (XBUFFER (Vstandard_output)); | ||
| 1302 | BVAR (current_buffer, undo_list) = Qt; | ||
| 1303 | |||
| 1304 | BVAR (current_buffer, truncate_lines) = Qt; | ||
| 1305 | |||
| 1306 | write_string ("Proc", -1); | ||
| 1307 | Findent_to (i_status, minspace); write_string ("Status", -1); | ||
| 1308 | Findent_to (i_buffer, minspace); write_string ("Buffer", -1); | ||
| 1309 | if (!NILP (i_tty)) | ||
| 1310 | { | ||
| 1311 | Findent_to (i_tty, minspace); write_string ("Tty", -1); | ||
| 1312 | } | ||
| 1313 | Findent_to (i_command, minspace); write_string ("Command", -1); | ||
| 1314 | write_string ("\n", -1); | ||
| 1315 | |||
| 1316 | write_string ("----", -1); | ||
| 1317 | Findent_to (i_status, minspace); write_string ("------", -1); | ||
| 1318 | Findent_to (i_buffer, minspace); write_string ("------", -1); | ||
| 1319 | if (!NILP (i_tty)) | ||
| 1320 | { | ||
| 1321 | Findent_to (i_tty, minspace); write_string ("---", -1); | ||
| 1322 | } | ||
| 1323 | Findent_to (i_command, minspace); write_string ("-------", -1); | ||
| 1324 | write_string ("\n", -1); | ||
| 1325 | |||
| 1326 | for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) | ||
| 1327 | { | ||
| 1328 | Lisp_Object symbol; | ||
| 1329 | |||
| 1330 | proc = Fcdr (XCAR (tail)); | ||
| 1331 | p = XPROCESS (proc); | ||
| 1332 | if (NILP (p->type)) | ||
| 1333 | continue; | ||
| 1334 | if (!NILP (query_only) && p->kill_without_query) | ||
| 1335 | continue; | ||
| 1336 | |||
| 1337 | Finsert (1, &p->name); | ||
| 1338 | Findent_to (i_status, minspace); | ||
| 1339 | |||
| 1340 | if (p->raw_status_new) | ||
| 1341 | update_status (p); | ||
| 1342 | symbol = p->status; | ||
| 1343 | if (CONSP (p->status)) | ||
| 1344 | symbol = XCAR (p->status); | ||
| 1345 | |||
| 1346 | if (EQ (symbol, Qsignal)) | ||
| 1347 | Fprinc (symbol, Qnil); | ||
| 1348 | else if (NETCONN1_P (p) || SERIALCONN1_P (p)) | ||
| 1349 | { | ||
| 1350 | if (EQ (symbol, Qexit)) | ||
| 1351 | write_string ("closed", -1); | ||
| 1352 | else if (EQ (p->command, Qt)) | ||
| 1353 | write_string ("stopped", -1); | ||
| 1354 | else if (EQ (symbol, Qrun)) | ||
| 1355 | write_string ("open", -1); | ||
| 1356 | else | ||
| 1357 | Fprinc (symbol, Qnil); | ||
| 1358 | } | ||
| 1359 | else if (SERIALCONN1_P (p)) | ||
| 1360 | { | ||
| 1361 | write_string ("running", -1); | ||
| 1362 | } | ||
| 1363 | else | ||
| 1364 | Fprinc (symbol, Qnil); | ||
| 1365 | |||
| 1366 | if (EQ (symbol, Qexit)) | ||
| 1367 | { | ||
| 1368 | Lisp_Object tem; | ||
| 1369 | tem = Fcar (Fcdr (p->status)); | ||
| 1370 | if (XFASTINT (tem)) | ||
| 1371 | { | ||
| 1372 | sprintf (tembuf, " %d", (int) XFASTINT (tem)); | ||
| 1373 | write_string (tembuf, -1); | ||
| 1374 | } | ||
| 1375 | } | ||
| 1376 | |||
| 1377 | if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) || EQ (symbol, Qclosed)) | ||
| 1378 | exited++; | ||
| 1379 | |||
| 1380 | Findent_to (i_buffer, minspace); | ||
| 1381 | if (NILP (p->buffer)) | ||
| 1382 | insert_string ("(none)"); | ||
| 1383 | else if (NILP (BVAR (XBUFFER (p->buffer), name))) | ||
| 1384 | insert_string ("(Killed)"); | ||
| 1385 | else | ||
| 1386 | Finsert (1, &BVAR (XBUFFER (p->buffer), name)); | ||
| 1387 | |||
| 1388 | if (!NILP (i_tty)) | ||
| 1389 | { | ||
| 1390 | Findent_to (i_tty, minspace); | ||
| 1391 | if (STRINGP (p->tty_name)) | ||
| 1392 | Finsert (1, &p->tty_name); | ||
| 1393 | } | ||
| 1394 | |||
| 1395 | Findent_to (i_command, minspace); | ||
| 1396 | |||
| 1397 | if (EQ (p->status, Qlisten)) | ||
| 1398 | { | ||
| 1399 | Lisp_Object port = Fplist_get (p->childp, QCservice); | ||
| 1400 | if (INTEGERP (port)) | ||
| 1401 | port = Fnumber_to_string (port); | ||
| 1402 | if (NILP (port)) | ||
| 1403 | port = Fformat_network_address (Fplist_get (p->childp, QClocal), Qnil); | ||
| 1404 | sprintf (tembuf, "(network %s server on %s)\n", | ||
| 1405 | (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), | ||
| 1406 | (STRINGP (port) ? SSDATA (port) : "?")); | ||
| 1407 | insert_string (tembuf); | ||
| 1408 | } | ||
| 1409 | else if (NETCONN1_P (p)) | ||
| 1410 | { | ||
| 1411 | /* For a local socket, there is no host name, | ||
| 1412 | so display service instead. */ | ||
| 1413 | Lisp_Object host = Fplist_get (p->childp, QChost); | ||
| 1414 | if (!STRINGP (host)) | ||
| 1415 | { | ||
| 1416 | host = Fplist_get (p->childp, QCservice); | ||
| 1417 | if (INTEGERP (host)) | ||
| 1418 | host = Fnumber_to_string (host); | ||
| 1419 | } | ||
| 1420 | if (NILP (host)) | ||
| 1421 | host = Fformat_network_address (Fplist_get (p->childp, QCremote), Qnil); | ||
| 1422 | sprintf (tembuf, "(network %s connection to %s)\n", | ||
| 1423 | (DATAGRAM_CHAN_P (p->infd) ? "datagram" : "stream"), | ||
| 1424 | (STRINGP (host) ? SSDATA (host) : "?")); | ||
| 1425 | insert_string (tembuf); | ||
| 1426 | } | ||
| 1427 | else if (SERIALCONN1_P (p)) | ||
| 1428 | { | ||
| 1429 | Lisp_Object port = Fplist_get (p->childp, QCport); | ||
| 1430 | Lisp_Object speed = Fplist_get (p->childp, QCspeed); | ||
| 1431 | insert_string ("(serial port "); | ||
| 1432 | if (STRINGP (port)) | ||
| 1433 | insert_string (SSDATA (port)); | ||
| 1434 | else | ||
| 1435 | insert_string ("?"); | ||
| 1436 | if (INTEGERP (speed)) | ||
| 1437 | { | ||
| 1438 | sprintf (tembuf, " at %ld b/s", (long) XINT (speed)); | ||
| 1439 | insert_string (tembuf); | ||
| 1440 | } | ||
| 1441 | insert_string (")\n"); | ||
| 1442 | } | ||
| 1443 | else | ||
| 1444 | { | ||
| 1445 | Lisp_Object tem = p->command; | ||
| 1446 | while (1) | ||
| 1447 | { | ||
| 1448 | Lisp_Object tem1 = Fcar (tem); | ||
| 1449 | if (NILP (tem1)) | ||
| 1450 | break; | ||
| 1451 | Finsert (1, &tem1); | ||
| 1452 | tem = Fcdr (tem); | ||
| 1453 | if (NILP (tem)) | ||
| 1454 | break; | ||
| 1455 | insert_string (" "); | ||
| 1456 | } | ||
| 1457 | insert_string ("\n"); | ||
| 1458 | } | ||
| 1459 | } | ||
| 1460 | if (exited) | ||
| 1461 | { | ||
| 1462 | status_notify (NULL); | ||
| 1463 | redisplay_preserve_echo_area (13); | ||
| 1464 | } | ||
| 1465 | return Qnil; | ||
| 1466 | } | ||
| 1467 | |||
| 1468 | DEFUN ("list-processes", Flist_processes, Slist_processes, 0, 1, "P", | ||
| 1469 | doc: /* Display a list of all processes. | ||
| 1470 | If optional argument QUERY-ONLY is non-nil, only processes with | ||
| 1471 | the query-on-exit flag set will be listed. | ||
| 1472 | Any process listed as exited or signaled is actually eliminated | ||
| 1473 | after the listing is made. */) | ||
| 1474 | (Lisp_Object query_only) | ||
| 1475 | { | ||
| 1476 | internal_with_output_to_temp_buffer ("*Process List*", | ||
| 1477 | list_processes_1, query_only); | ||
| 1478 | return Qnil; | ||
| 1479 | } | ||
| 1480 | 1242 | ||
| 1481 | DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0, | 1243 | DEFUN ("process-list", Fprocess_list, Sprocess_list, 0, 0, 0, |
| 1482 | doc: /* Return a list of all processes. */) | 1244 | doc: /* Return a list of all processes. */) |
| @@ -7668,7 +7430,6 @@ The variable takes effect when `start-process' is called. */); | |||
| 7668 | defsubr (&Sprocess_contact); | 7430 | defsubr (&Sprocess_contact); |
| 7669 | defsubr (&Sprocess_plist); | 7431 | defsubr (&Sprocess_plist); |
| 7670 | defsubr (&Sset_process_plist); | 7432 | defsubr (&Sset_process_plist); |
| 7671 | defsubr (&Slist_processes); | ||
| 7672 | defsubr (&Sprocess_list); | 7433 | defsubr (&Sprocess_list); |
| 7673 | defsubr (&Sstart_process); | 7434 | defsubr (&Sstart_process); |
| 7674 | defsubr (&Sserial_process_configure); | 7435 | defsubr (&Sserial_process_configure); |