diff options
author | Richard M. Stallman <rms@gnu.org> | 2007-03-20 16:23:09 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2007-03-20 16:23:09 +0000 |
commit | bc4c663309d53cfeafb17f596fc8f47f7fb483c6 (patch) | |
tree | c9c2e3426f184af619f2768a995681dcbc39bacb /lisp | |
parent | a8b145e3578d467150ab11113f4ca0ec753c2cb7 (diff) | |
download | emacs-bc4c663309d53cfeafb17f596fc8f47f7fb483c6.tar.gz |
(ispell-call-process): New function.
Defends against bad `default-directory.'
(ispell-check-version, ispell-find-aspell-dictionaries)
(ispell-get-aspell-config-value, lookup-words): Call it.
(ispell-call-process-region): New function.
(ispell-send-string): Call it.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/textmodes/ispell.el | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 73faea4e9c2..a3c9575d90c 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -766,9 +766,7 @@ Otherwise returns the library directory name, if that is defined." (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 @@ Otherwise returns the library directory name, if that is defined." (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 @@ and added as a submenu of the \"Edit\" menu.") (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 @@ and added as a submenu of the \"Edit\" menu.") "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 @@ This allows it to improve the suggestion list based on actual mispellings." (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 @@ Optional second argument contains the dictionary to use; the default is (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 |