comparison lisp/textmodes/ispell.el @ 7890:e6e305453f19

(ispell-command-loop): C-g should be like X, not q. (ispell-dictionary-alist): Add autoload. Split into two subvariables. (ispell-menu-map): Defvar and set up at top level. Split into parts. (ispell-menu-map-needed): New variable.
author Richard M. Stallman <rms@gnu.org>
date Tue, 14 Jun 1994 20:54:44 +0000
parents 31956391d7ea
children 18870eff0f54
comparison
equal deleted inserted replaced
7889:11d254f1f196 7890:e6e305453f19
4 ;;; 4 ;;;
5 ;;; Copyright (C) 1994 Free Software Foundation, Inc. 5 ;;; Copyright (C) 1994 Free Software Foundation, Inc.
6 ;;; 6 ;;;
7 ;;; 7 ;;;
8 ;;; Authors : Ken Stevens et. al. 8 ;;; Authors : Ken Stevens et. al.
9 ;;; Last Modified By: Ken Stevens <k.stevens@ieee.org>
10 ;;; Last Modified On: Fri May 20 15:58:52 MDT 1994
11 ;;; Update Revision : 2.30
12 ;;; Syntax : emacs-lisp 9 ;;; Syntax : emacs-lisp
13 ;;; Status : Release with 3.1.05 ispell. 10 ;;; Status : Release with 3.1.05 ispell.
14 ;;; Version : International Ispell Version 3.1 by Geoff Kuenning. 11 ;;; Version : International Ispell Version 3.1 by Geoff Kuenning.
15 ;;; Bug Reports : ispell-el-bugs@itcorp.com 12 ;;; Bug Reports : ispell-el-bugs@itcorp.com
16 ;;; 13 ;;;
406 "*If non-nil, a list of extra switches to pass to the Ispell program. 403 "*If non-nil, a list of extra switches to pass to the Ispell program.
407 For example, '(\"-W\" \"3\") to cause it to accept all 1-3 character 404 For example, '(\"-W\" \"3\") to cause it to accept all 1-3 character
408 words as correct. See also `ispell-dictionary-alist', which may be used 405 words as correct. See also `ispell-dictionary-alist', which may be used
409 for language-specific arguments.") 406 for language-specific arguments.")
410 407
411 (defvar ispell-dictionary-alist ; sk 9-Aug-1991 18:28 408 ;;;###autoload
409 (defvar ispell-dictionary-alist-1 ; sk 9-Aug-1991 18:28
412 '((nil ; default (english.aff) 410 '((nil ; default (english.aff)
413 "[A-Za-z]" "[^A-Za-z]" "[---']" nil ("-B") nil) 411 "[A-Za-z]" "[^A-Za-z]" "[---']" nil ("-B") nil)
414 ("english" ; make english explicitly selectable 412 ("english" ; make english explicitly selectable
415 "[A-Za-z]" "[^A-Za-z]" "[---']" nil ("-B") nil) 413 "[A-Za-z]" "[^A-Za-z]" "[---']" nil ("-B") nil)
416 ("deutsch" ; deutsch.aff 414 ("deutsch" ; deutsch.aff
420 "[^a-zA-Z\304\326\334\344\366\337\374]" 418 "[^a-zA-Z\304\326\334\344\366\337\374]"
421 "[---']" t ("-C" "-d" "deutsch") "~latin1") 419 "[---']" t ("-C" "-d" "deutsch") "~latin1")
422 ("nederlands8" ; dutch8.aff 420 ("nederlands8" ; dutch8.aff
423 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" 421 "[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
424 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]" 422 "[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
425 "[---']" t ("-C") nil) 423 "[---']" t ("-C") nil)))
426 ("svenska" ;7 bit swedish mode 424
425 ;;;###autoload
426 (defvar ispell-dictionary-alist-2
427 '(("svenska" ;7 bit swedish mode
427 "[A-Za-z}{|\\133\\135\\\\]" "[^A-Za-z}{|\\133\\135\\\\]" 428 "[A-Za-z}{|\\133\\135\\\\]" "[^A-Za-z}{|\\133\\135\\\\]"
428 "[---']" nil ("-C") nil) 429 "[---']" nil ("-C") nil)
429 ("svenska8" ;8 bit swedish mode 430 ("svenska8" ;8 bit swedish mode
430 "[A-Za-z\345\344\366\305\304\366]" "[^A-Za-z\345\344\366\305\304\366]" 431 "[A-Za-z\345\344\366\305\304\366]" "[^A-Za-z\345\344\366\305\304\366]"
431 "[---']" nil ("-C" "-d" "svenska") "~list") ; Add `"-T" "list"' instead? 432 "[---']" nil ("-C" "-d" "svenska") "~list") ; Add `"-T" "list"' instead?
435 "[^A-Za-z\300\302\304\306\307\310\311\312\313\316\317\324\326\331\333\334\340\342\344\346\347\350\351\352\353\356\357\364\366\371\373\374]" "[---']" 436 "[^A-Za-z\300\302\304\306\307\310\311\312\313\316\317\324\326\331\333\334\340\342\344\346\347\350\351\352\353\356\357\364\366\371\373\374]" "[---']"
436 t nil "~list") 437 t nil "~list")
437 ("dansk" ; dansk.aff 438 ("dansk" ; dansk.aff
438 "[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]" 439 "[A-Z\306\330\305a-z\346\370\345]" "[^A-Z\306\330\305a-z\346\370\345]"
439 "[---]" nil ("-C") nil) 440 "[---]" nil ("-C") nil)
440 ) 441 ))
442
443 ;; ispell-dictionary-alist is set up from two subvariables above
444 ;; to avoid having very long lines in loaddefs.el.
445 ;;;###autoload
446 (defvar ispell-dictionary-alist
447 (append ispell-dictionary-alist-1 ispell-dictionary-alist-2)
441 "An alist of dictionaries and their associated parameters. 448 "An alist of dictionaries and their associated parameters.
442 449
443 Each element of this list is also a list: 450 Each element of this list is also a list:
444 451
445 \(DICTIONARY-NAME CASECHARS NOT-CASECHARS OTHERCHARS MANY-OTHERCHARS-P 452 \(DICTIONARY-NAME CASECHARS NOT-CASECHARS OTHERCHARS MANY-OTHERCHARS-P
477 484
478 Note that the CASECHARS and OTHERCHARS slots of the alist should 485 Note that the CASECHARS and OTHERCHARS slots of the alist should
479 contain the same character set as casechars and otherchars in the 486 contain the same character set as casechars and otherchars in the
480 language.aff file \(e.g., english.aff\).") 487 language.aff file \(e.g., english.aff\).")
481 488
482 489 ;;;###autoload
490 (defvar ispell-menu-map nil)
491
492 ;;; Set up the map.
493 ;;;###autoload
494 (defconst ispell-menu-map-needed
495 ;; Verify this is not Lucid Emacs.
496 (and (not ispell-menu-map) (boundp 'system-key-alist)))
497
498 ;;;###autoload
499 (if ispell-menu-map-needed
500 (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist)))
501 name)
502 ;; Can put in defvar when external defines are removed.
503 (setq ispell-menu-map (make-sparse-keymap "Spell"))
504 (while dicts
505 (setq name (car (car dicts))
506 dicts (cdr dicts))
507 (if (stringp name)
508 (define-key ispell-menu-map (vector (intern name))
509 (cons (concat "Select " (capitalize name))
510 (list 'lambda () '(interactive)
511 (list 'ispell-change-dictionary name))))))))
512
513 ;;;###autoload
514 (if ispell-menu-map-needed
515 (progn
516 ;; Define commands in opposite order you want them to appear in menu.
517 (define-key ispell-menu-map [ispell-change-dictionary]
518 '("Change Dictionary" . ispell-change-dictionary))
519 (define-key ispell-menu-map [ispell-kill-ispell]
520 '("Kill Process" . ispell-kill-ispell))
521 (define-key ispell-menu-map [ispell-pdict-save]
522 '("Save Dictionary" . (lambda () (interactive) (ispell-pdict-save t))))
523 (define-key ispell-menu-map [ispell-complete-word]
524 '("Complete Word" . ispell-complete-word))
525 (define-key ispell-menu-map [ispell-complete-word-interior-frag]
526 '("Complete Word Frag" . ispell-complete-word-interior-frag))))
527
528 ;;;###autoload
529 (if ispell-menu-map-needed
530 (progn
531 (define-key ispell-menu-map [ispell-continue]
532 '("Continue Check" . ispell-continue))
533 (define-key ispell-menu-map [ispell-region]
534 '("Check Region" . ispell-region))
535 (define-key ispell-menu-map [ispell-word]
536 '("Check Word" . ispell-word))
537 (define-key ispell-menu-map [ispell-buffer]
538 '("Check Buffer" . ispell-buffer))
539 (define-key ispell-menu-map [ispell-message]
540 '("Check Message" . ispell-message))
541 (define-key ispell-menu-map [ispell-help]
542 '("Help" . (lambda () (interactive) (describe-function 'ispell-help))))
543 (put 'ispell-region 'menu-enable 'mark-active)))
544
545 ;;;###autoload
546 (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))
483 547
484 (cond 548 (cond
485 ((and (string-lessp "19" emacs-version) 549 ((and (string-lessp "19" emacs-version)
486 (string-match "Lucid" emacs-version)) 550 (string-match "Lucid" emacs-version))
487 (let ((dicts (cons (cons "default" nil) ispell-dictionary-alist)) 551 (let ((dicts (cons (cons "default" nil) ispell-dictionary-alist))
512 t)))))) 576 t))))))
513 (defvar ispell-menu-lucid menu "Lucid's spelling menu.") 577 (defvar ispell-menu-lucid menu "Lucid's spelling menu.")
514 (if current-menubar 578 (if current-menubar
515 (progn 579 (progn
516 (delete-menu-item '("Edit" "Spell")) ; in case already defined 580 (delete-menu-item '("Edit" "Spell")) ; in case already defined
517 (add-menu '("Edit") "Spell" ispell-menu-lucid))))) 581 (add-menu '("Edit") "Spell" ispell-menu-lucid))))))
518
519 ;; cond-case:
520 ((and (featurep 'menu-bar)
521 (string-lessp "19" emacs-version))
522 (let ((dicts (reverse (cons (cons "default" nil) ispell-dictionary-alist)))
523 name)
524 (defvar ispell-menu-map nil)
525 ;; Can put in defvar when external defines are removed.
526 (setq ispell-menu-map (make-sparse-keymap "Spell"))
527 (while dicts
528 (setq name (car (car dicts))
529 dicts (cdr dicts))
530 (if (stringp name)
531 (define-key ispell-menu-map (vector (intern name))
532 (cons (concat "Select " (capitalize name))
533 (list 'lambda () '(interactive)
534 (list 'ispell-change-dictionary name))))))
535 ;; Why do we need an alias here?
536 (defalias 'ispell-menu-map ispell-menu-map)
537 ;; Define commands in opposite order you want them to appear in menu.
538 (define-key ispell-menu-map [ispell-change-dictionary]
539 '("Change Dictionary" . ispell-change-dictionary))
540 (define-key ispell-menu-map [ispell-kill-ispell]
541 '("Kill Process" . ispell-kill-ispell))
542 (define-key ispell-menu-map [ispell-pdict-save]
543 '("Save Dictionary" . (lambda () (interactive) (ispell-pdict-save t))))
544 (define-key ispell-menu-map [ispell-complete-word]
545 '("Complete Word" . ispell-complete-word))
546 (define-key ispell-menu-map [ispell-complete-word-interior-frag]
547 '("Complete Word Frag" . ispell-complete-word-interior-frag))
548 (define-key ispell-menu-map [ispell-continue]
549 '("Continue Check" . ispell-continue))
550 (define-key ispell-menu-map [ispell-region]
551 '("Check Region" . ispell-region))
552 (define-key ispell-menu-map [ispell-word]
553 '("Check Word" . ispell-word))
554 (define-key ispell-menu-map [ispell-buffer]
555 '("Check Buffer" . ispell-buffer))
556 (define-key ispell-menu-map [ispell-message]
557 '("Check Message" . ispell-message))
558 (define-key ispell-menu-map [ispell-help]
559 '("Help" . (lambda () (interactive)
560 (describe-function 'ispell-help)
561 ;(x-popup-menu last-nonmenu-event(list "" ispell-help-list))
562 ))))
563 (put 'ispell-region 'menu-enable 'mark-active)))
564 582
565 583
566 ;;; ********************************************************************** 584 ;;; **********************************************************************
567 ;;; The following are used by ispell, and should not be changed. 585 ;;; The following are used by ispell, and should not be changed.
568 ;;; ********************************************************************** 586 ;;; **********************************************************************
955 (let ((inhibit-quit t)) 973 (let ((inhibit-quit t))
956 (setq char (if (fboundp 'read-char-exclusive) 974 (setq char (if (fboundp 'read-char-exclusive)
957 (read-char-exclusive) 975 (read-char-exclusive)
958 (read-char)) 976 (read-char))
959 skipped 0) 977 skipped 0)
960 (if (or quit-flag (= char ?\C-g)) ; C-g is like typing q 978 (if (or quit-flag (= char ?\C-g)) ; C-g is like typing X
961 (setq char ?q 979 (setq char ?X
962 quit-flag nil))) 980 quit-flag nil)))
963 ;; Adjust num to array offset skipping command characters. 981 ;; Adjust num to array offset skipping command characters.
964 (let ((com-chars command-characters)) 982 (let ((com-chars command-characters))
965 (while com-chars 983 (while com-chars
966 (if (and (> (car com-chars) ?0) (< (car com-chars) char)) 984 (if (and (> (car com-chars) ?0) (< (car com-chars) char))