Function: ispell-start-process

ispell-start-process is a byte-compiled function defined in ispell.el.gz.

Signature

(ispell-start-process)

Documentation

Start the Ispell process, with support for no asynchronous processes.

Keeps argument list for future Ispell invocations for no async support.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/ispell.el.gz
(defun ispell-start-process ()
  "Start the Ispell process, with support for no asynchronous processes.
Keeps argument list for future Ispell invocations for no async support."
  ;; `ispell-current-dictionary' and `ispell-current-personal-dictionary'
  ;; are properly set in `ispell-internal-change-dictionary'.

  ;; Parse hunspell affix file if using hunspell and entry is uninitialized.
  (if ispell-really-hunspell
      (or (cadr (assoc ispell-current-dictionary ispell-dictionary-alist))
	  (ispell-hunspell-fill-dictionary-entry ispell-current-dictionary)))

  (let* ((default-directory
           (if (file-accessible-directory-p default-directory)
               default-directory
             ;; Defend against bad `default-directory'.
             (expand-file-name "~/")))
	 (orig-args (ispell-get-ispell-args))
         (args
          (append
           (if (and ispell-current-dictionary      ; Not for default dict (nil)
                    (not (member "-d" orig-args))) ; Only define if not overridden.
               (list "-d" ispell-current-dictionary))
           orig-args
           (if ispell-current-personal-dictionary ; Use specified pers dict.
               (list "-p" ispell-current-personal-dictionary))
           ;; If we are using recent aspell or hunspell, make sure we use the
           ;; right encoding for communication. ispell or older aspell/hunspell
           ;; does not support this.
           (if ispell-encoding8-command
	       (if ispell-really-hunspell
		   (list ispell-encoding8-command
			 (upcase (symbol-name (ispell-get-coding-system))))
		 (list
		  (concat ispell-encoding8-command
			  (symbol-name (ispell-get-coding-system))))))
           ispell-extra-args)))

    ;; Initially we don't know any buffer's local words.
    (setq ispell-buffer-local-name nil)

    (if ispell-async-processp
	(let ((process-connection-type ispell-use-ptys-p))
	  (apply 'start-process
		 "ispell" nil ispell-program-name
		 "-a"                   ; Accept single input lines.
                 ;; Make root/affix combos not in dict.
                 ;; hunspell -m option means different.
		 (if ispell-really-hunspell "" "-m")
		 args))
      (setq ispell-cmd-args args
	    ispell-output-buffer (generate-new-buffer " *ispell-output*")
	    ispell-session-buffer (generate-new-buffer " *ispell-session*"))
      (ispell-send-string "\032\n")	; so Ispell prints version and exits
      t)))