(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
(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
(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
"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)
(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))
(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