comparison lisp/textmodes/ispell.el @ 63139:be61de52f953

(ispell-check-version): Use match-string-no-properties. (ispell-region, ispell-buffer-local-parsing, ispell-buffer-local-dict) (ispell-buffer-local-words): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Wed, 08 Jun 2005 15:45:34 +0000
parents a7e02ef1e3d6
children 5ccb3fdd9847 173dee4e2611
comparison
equal deleted inserted replaced
63138:2a347143dae3 63139:be61de52f953
794 (format "%d" (car ispell-required-version)) 794 (format "%d" (car ispell-required-version))
795 "\\)\\.\\([0-9]*\\)\\.\\([0-9]*\\)\\>") 795 "\\)\\.\\([0-9]*\\)\\.\\([0-9]*\\)\\>")
796 nil t) 796 nil t)
797 case-fold-search case-fold-search-val) 797 case-fold-search case-fold-search-val)
798 (if (or (not status) ; major version mismatch 798 (if (or (not status) ; major version mismatch
799 (< (car (read-from-string (buffer-substring-no-properties 799 (< (car (read-from-string (match-string-no-properties 2)))
800 (match-beginning 2) (match-end 2))))
801 (car (cdr ispell-required-version)))) ; minor version mismatch 800 (car (cdr ispell-required-version)))) ; minor version mismatch
802 (error "%s version 3 release %d.%d.%d or greater is required" 801 (error "%s version 3 release %d.%d.%d or greater is required"
803 ispell-program-name (car ispell-required-version) 802 ispell-program-name (car ispell-required-version)
804 (car (cdr ispell-required-version)) 803 (car (cdr ispell-required-version))
805 (car (cdr (cdr ispell-required-version)))) 804 (car (cdr (cdr ispell-required-version))))
806 ;; check that it is the correct version. 805 ;; check that it is the correct version.
807 (if (and (= (car (read-from-string (buffer-substring-no-properties 806 (if (and (= (car (read-from-string (match-string-no-properties 2)))
808 (match-beginning 2)(match-end 2))))
809 (car (cdr ispell-required-version))) 807 (car (cdr ispell-required-version)))
810 (< (car (read-from-string (buffer-substring-no-properties 808 (< (car (read-from-string (match-string-no-properties 3)))
811 (match-beginning 3)(match-end 3))))
812 (car (cdr (cdr ispell-required-version))))) 809 (car (cdr (cdr ispell-required-version)))))
813 (setq ispell-offset 0)) 810 (setq ispell-offset 0))
814 ;; Check to see if it's really aspell. 811 ;; Check to see if it's really aspell.
815 (goto-char (point-min)) 812 (goto-char (point-min))
816 (let (case-fold-search) 813 (let (case-fold-search)
2565 (if (and (< rstart ispell-region-end) 2562 (if (and (< rstart ispell-region-end)
2566 (re-search-forward 2563 (re-search-forward
2567 (ispell-begin-skip-region-regexp) 2564 (ispell-begin-skip-region-regexp)
2568 ispell-region-end t)) 2565 ispell-region-end t))
2569 (progn 2566 (progn
2570 (setq key (buffer-substring-no-properties 2567 (setq key (match-string-no-properties 0))
2571 (car (match-data))
2572 (car (cdr (match-data)))))
2573 (set-marker skip-region-start 2568 (set-marker skip-region-start
2574 (- (point) (length key))) 2569 (- (point) (length key)))
2575 (goto-char rstart)) 2570 (goto-char rstart))
2576 (set-marker skip-region-start nil)))) 2571 (set-marker skip-region-start nil))))
2577 (setq reg-end (max (point) 2572 (setq reg-end (max (point)
3508 (let ((end (save-excursion (end-of-line) (point))) 3503 (let ((end (save-excursion (end-of-line) (point)))
3509 string) 3504 string)
3510 (search-forward ispell-parsing-keyword) 3505 (search-forward ispell-parsing-keyword)
3511 (while (re-search-forward " *\\([^ \"]+\\)" end t) 3506 (while (re-search-forward " *\\([^ \"]+\\)" end t)
3512 ;; space separated definitions. 3507 ;; space separated definitions.
3513 (setq string (downcase (buffer-substring-no-properties 3508 (setq string (downcase (match-string-no-properties 1)))
3514 (match-beginning 1) (match-end 1))))
3515 (cond ((and (string-match "latex-mode" string) 3509 (cond ((and (string-match "latex-mode" string)
3516 (not (eq 'exclusive ispell-check-comments))) 3510 (not (eq 'exclusive ispell-check-comments)))
3517 (ispell-send-string "+\n~tex\n")) 3511 (ispell-send-string "+\n~tex\n"))
3518 ((string-match "nroff-mode" string) 3512 ((string-match "nroff-mode" string)
3519 (ispell-send-string "-\n~nroff\n")) 3513 (ispell-send-string "-\n~nroff\n"))
3542 (progn 3536 (progn
3543 (search-forward ispell-dictionary-keyword) 3537 (search-forward ispell-dictionary-keyword)
3544 (setq end (save-excursion (end-of-line) (point))) 3538 (setq end (save-excursion (end-of-line) (point)))
3545 (if (re-search-forward " *\\([^ \"]+\\)" end t) 3539 (if (re-search-forward " *\\([^ \"]+\\)" end t)
3546 (setq ispell-local-dictionary 3540 (setq ispell-local-dictionary
3547 (buffer-substring-no-properties (match-beginning 1) 3541 (match-string-no-properties 1))))))
3548 (match-end 1)))))))
3549 (goto-char (point-max)) 3542 (goto-char (point-max))
3550 (if (search-backward ispell-pdict-keyword nil t) 3543 (if (search-backward ispell-pdict-keyword nil t)
3551 (progn 3544 (progn
3552 (search-forward ispell-pdict-keyword) 3545 (search-forward ispell-pdict-keyword)
3553 (setq end (save-excursion (end-of-line) (point))) 3546 (setq end (save-excursion (end-of-line) (point)))
3554 (if (re-search-forward " *\\([^ \"]+\\)" end t) 3547 (if (re-search-forward " *\\([^ \"]+\\)" end t)
3555 (setq ispell-local-pdict 3548 (setq ispell-local-pdict
3556 (buffer-substring-no-properties (match-beginning 1) 3549 (match-string-no-properties 1)))))))
3557 (match-end 1))))))))
3558 ;; Reload if new personal dictionary defined. 3550 ;; Reload if new personal dictionary defined.
3559 (if (and ispell-local-pdict 3551 (if (and ispell-local-pdict
3560 (not (equal ispell-local-pdict ispell-personal-dictionary))) 3552 (not (equal ispell-local-pdict ispell-personal-dictionary)))
3561 (progn 3553 (progn
3562 (ispell-kill-ispell t) 3554 (ispell-kill-ispell t)
3582 (ispell-casechars (ispell-get-casechars)) 3574 (ispell-casechars (ispell-get-casechars))
3583 string) 3575 string)
3584 ;; buffer-local words separated by a space, and can contain 3576 ;; buffer-local words separated by a space, and can contain
3585 ;; any character other than a space. Not rigorous enough. 3577 ;; any character other than a space. Not rigorous enough.
3586 (while (re-search-forward " *\\([^ ]+\\)" end t) 3578 (while (re-search-forward " *\\([^ ]+\\)" end t)
3587 (setq string (buffer-substring-no-properties (match-beginning 1) 3579 (setq string (match-string-no-properties 1))
3588 (match-end 1)))
3589 ;; This can fail when string contains a word with illegal chars. 3580 ;; This can fail when string contains a word with illegal chars.
3590 ;; Error handling needs to be added between ispell and emacs. 3581 ;; Error handling needs to be added between ispell and emacs.
3591 (if (and (< 1 (length string)) 3582 (if (and (< 1 (length string))
3592 (equal 0 (string-match ispell-casechars string))) 3583 (equal 0 (string-match ispell-casechars string)))
3593 (ispell-send-string (concat "@" string "\n")))))))) 3584 (ispell-send-string (concat "@" string "\n"))))))))