emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/ispell.el,v


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/ispell.el,v
Date: Tue, 20 Mar 2007 16:23:09 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Richard M. Stallman <rms>       07/03/20 16:23:09

Index: ispell.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/textmodes/ispell.el,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -b -r1.208 -r1.209
--- ispell.el   14 Feb 2007 12:44:58 -0000      1.208
+++ ispell.el   20 Mar 2007 16:23:09 -0000      1.209
@@ -766,9 +766,7 @@
        (if buf (kill-buffer buf)))
       (set-buffer (get-buffer-create " *ispell-tmp*"))
       (erase-buffer)
-      (unless (file-exists-p default-directory)
-       (setq default-directory (expand-file-name "~/")))
-      (setq status (call-process
+      (setq status (ispell-call-process
                    ispell-program-name nil t nil
                    ;; aspell doesn't accept the -vv switch.
                    (let ((case-fold-search
@@ -827,6 +825,22 @@
       (kill-buffer (current-buffer)))
     result))
 
+(defun ispell-call-process (&rest args)
+  "Like `call-process' but defend against bad `default-directory'."
+  (let ((default-directory default-directory))
+    (unless (and (file-directory-p default-directory)
+                (file-readable-p default-directory))
+      (setq default-directory (expand-file-name "~/")))
+    (apply 'call-process args)))
+
+(defun ispell-call-process-region (&rest args)
+  "Like `call-process-region' but defend against bad `default-directory'."
+  (let ((default-directory default-directory))
+    (unless (and (file-directory-p default-directory)
+                (file-readable-p default-directory))
+      (setq default-directory (expand-file-name "~/")))
+    (apply 'call-process-region args)))
+
 
 
 ;;; The preparation of the menu bar menu must be autoloaded
@@ -895,7 +909,7 @@
   (let* ((dictionaries
          (split-string
           (with-temp-buffer
-            (call-process ispell-program-name nil t nil "dicts")
+            (ispell-call-process ispell-program-name nil t nil "dicts")
             (buffer-string))))
         ;; Search for the named dictionaries.
         (found
@@ -928,7 +942,7 @@
   "Return value of Aspell configuration option KEY.
 Assumes that value contains no whitespace."
   (with-temp-buffer
-    (call-process ispell-program-name nil t nil "config" key)
+    (ispell-call-process ispell-program-name nil t nil "config" key)
     (car (split-string (buffer-string)))))
 
 (defun ispell-aspell-find-dictionary (dict-name)
@@ -1500,7 +1514,8 @@
              (erase-buffer)
              (set-buffer session-buf)
              (setq status
-                   (apply 'call-process-region (point-min) (point-max)
+                   (apply 'ispell-call-process-region
+                          (point-min) (point-max)
                           ispell-program-name nil
                           output-buf nil
                           "-a" "-m" ispell-args))
@@ -2197,7 +2212,7 @@
            (while (search-backward "*" nil t) (insert "."))
            (setq word (buffer-string))
            (erase-buffer))
-         (setq status (apply 'call-process prog nil t nil
+         (setq status (apply 'ispell-call-process prog nil t nil
                              (nconc (if (and args (> (length args) 0))
                                         (list args)
                                       (if look-p nil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]