title: Emacs: Kill running python script
body: <p>I don't know if this is a bug with matplotlib/python but running the following from emacs removes my ability to kill the matplotlib process by clicking [x] on the figure window, it has no effect. Is there a command (I googled, no luck) for terminating a specific process that emacs has launched? I can kill the process by finding the buffer and doing <code>C-x k</code> but that is a bit of a hassle, any way to kill ALL running python processes?</p>
  
  <pre><code>#Simple circular box simulator, part of part_sim
  #Restructure to import into gravity() or coloumb () or wind() or pressure()
  #Or to use all forces: sim_full()
  #Note: Implement crashing as backbone to all forces
  import numpy as np
  import matplotlib.pyplot as plt
  from scipy.spatial.distance import pdist, squareform
  
  N = 100                                             #Number of particles
  R = 10000                                           #Box width
  pR= 5                                               #Particle radius
  
  r = np.random.randint(0, R, (N,2))                  #Position vector
  v = np.random.randint(-R/100,R/100,(N,2))           #velocity vector
  a = np.array([0,-10])                               #Forces
  v_limit = R/2                                       #Speedlimit
  
  
  plt.ion()
  line, = plt.plot([],'o')
  line2, = plt.plot([],'o')                           #Track a particle
  plt.axis([0,R+pR,0,R+pR]
  
  
  while True:
  
      v=v+a                                           #Advance
      r=r+v
  
      #Collision tests
      r_hit_x0 = np.where(r[:,0]&lt;0)                   #Hit floor?
      r_hit_x1 = np.where(r[:,0]&gt;R)                   #Hit roof?
      r_hit_LR = np.where(r[:,1]&lt;0)                   #Left wall?
      r_hit_RR = np.where(r[:,1]&gt;R)                   #Right wall?
  
  
      #Stop at walls
      r[r_hit_x0,0] = 0
      r[r_hit_x1,0] = R
      r[r_hit_LR,1] = 0
      r[r_hit_RR,1] = R
  
      #Reverse velocities
      v[r_hit_x0,0] = -0.9*v[r_hit_x0,0]
      v[r_hit_x1,0] = -v[r_hit_x1,0]
      v[r_hit_LR,1] = -0.95*v[r_hit_LR,1]
      v[r_hit_RR,1] = -0.99*v[r_hit_RR,1]
  
      #Collisions
      D = squareform(pdist(r))
      ind1, ind2 = np.where(D &lt; pR)
      unique = (ind1 &lt; ind2)
      ind1 = ind1[unique]
      ind2 = ind2[unique]
  
      for i1, i2 in zip(ind1, ind2):
          eps = np.random.rand()
          vtot= v[i1,:]+v[i2,:]
          v[i1,:] = -(1-eps)*vtot
          v[i2,:] = -eps*vtot
  
      line.set_ydata(r[:,1])
      line.set_xdata(r[:,0])
      line2.set_ydata(r[:N/5,1])
      line2.set_xdata(r[:N/5,0])
      plt.draw()
  </code></pre>