What is list-processes ?

list-processes is an emacs-lisp function which displays daemons running as subprocesses under emacs.

The trouble with list-processes

It doesn’t format the command string Commands with multiline arguments are printed verbatim Arguments are not quoted



This means that commands may flow several lines (as many as it takes to print out the full command).

Also, 90% of the time you can’t copy the command and paste in the terminal because individual parameters with spaces are split into separate arguments.

The thing that tipped me over the edge

anaconda-mode takes up the entire process list with one big, paunchy command.

The fix

This code quotes each argument and replaces actual newlines with escape codes

(let* ((fullcmd ( mapconcat 'e/q ( process-command p) " " )) (oneliner (replace-regexp-in-string "

" "\

" fullcmd t t )) ;; This works but instead of trimming i want to turn everything into one line ;; (fullcmdlen (length fullcmd)) ;; (shortcmd (substring fullcmd 0 (min fullcmdlen (window-total-width)))) ) ( concat "{" oneliner "}" ) ; Surround with braces to allow selecting the command easily. Braces are also valid shell. ;; shortcmd )

Place the above fix into the list-processes--refresh function