5

In ESS mode, I sometimes send some code to the process buffer and want to cancel it using C-c C-c. Can I do this without actually switching to the process window from the script window?

Arktik
  • 932
  • 4
  • 15

3 Answers3

5

You'll need to write your own function for doing this.

You'll want to read up on the functions get-buffer-process and signal-process to learn about how to send the right signal to the ESS process.

Here is an example: An interactive function that sends a SIGINT to a buffer of your choosing.

You can modify this function to target whatever ESS buffer you want or keep it as is.

(defun interrupt-buffer-process (buffer)
  "Send a SIGINT to BUFFERs process."
  (interactive (list 
                (completing-read 
                 "Buffer: "
                 (mapcar 'buffer-name (remove-if-not 'get-buffer-process (buffer-list))))))
  (signal-process (get-buffer-process buffer) 'sigint))
Jordon Biondo
  • 12,332
  • 2
  • 41
  • 62
3

You can do M-x ess-interrupt.

Alex
  • 1,028
  • 5
  • 20
2

Sorry not sure how to paste this as a comment, this works for ESS:

(defun my-interrupt-ess-buffer-process ()
  "Send a SIGINT to script's iESS process."
  (interactive)
  (signal-process (ess-get-process-buffer) 'sigint))
Jordon Biondo
  • 12,332
  • 2
  • 41
  • 62
Arktik
  • 932
  • 4
  • 15