changeset 108139:cded9fd7d5d0

ispell.el: Kill ispell process when killing its associated buffer. (ispell-init-process,ispell-kill-ispell,kill-buffer-hook): Kill ispell process when killing its associated buffer.
author Agustin martin <agustin.martin@hispalinux.es>
date Tue, 27 Apr 2010 12:44:44 +0200
parents 0c5ef72c7a9d
children c9a940f35ec6
files lisp/textmodes/ispell.el
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/ispell.el	Tue Apr 27 12:35:00 2010 +0200
+++ b/lisp/textmodes/ispell.el	Tue Apr 27 12:44:44 2010 +0200
@@ -1334,6 +1334,9 @@
 (defvar ispell-process-directory nil
   "The directory where `ispell-process' was started.")
 
+(defvar ispell-process-buffer-name nil
+  "The buffer where `ispell-process' was started.")
+
 (defvar ispell-filter nil
   "Output filter from piped calls to Ispell.")
 
@@ -2630,7 +2633,8 @@
 	  ispell-process-directory default-directory
 	  ispell-process (ispell-start-process)
 	  ispell-filter nil
-	  ispell-filter-continue nil)
+	  ispell-filter-continue nil
+	  ispell-process-buffer-name (buffer-name))
     (if ispell-async-processp
 	(set-process-filter ispell-process 'ispell-filter))
     ;; protect against bogus binding of `enable-multibyte-characters' in XEmacs
@@ -2691,10 +2695,16 @@
       (kill-buffer ispell-session-buffer)
       (setq ispell-output-buffer nil
 	    ispell-session-buffer nil))
+    (setq ispell-process-buffer-name nil)
     (setq ispell-process nil)
     (message "Ispell process killed")
     nil))
 
+;; Kill ispell process when killing its associated buffer
+(add-hook 'kill-buffer-hook
+	  '(lambda ()
+	     (if (equal ispell-process-buffer-name (buffer-name))
+		 (ispell-kill-ispell t))))
 
 ;;; ispell-change-dictionary is set in some people's hooks.  Maybe this should
 ;;;  call ispell-init-process rather than wait for a spell checking command?