[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el |
Date: |
Mon, 06 Jun 2005 17:06:25 -0400 |
Index: emacs/lisp/textmodes/flyspell.el
diff -c emacs/lisp/textmodes/flyspell.el:1.64
emacs/lisp/textmodes/flyspell.el:1.65
*** emacs/lisp/textmodes/flyspell.el:1.64 Fri Jun 3 15:02:44 2005
--- emacs/lisp/textmodes/flyspell.el Mon Jun 6 21:06:19 2005
***************
*** 268,278 ****
:type 'boolean)
(defcustom flyspell-auto-correct-binding
! (cond
! ((eq flyspell-emacs 'xemacs)
! [(control \;)])
! (t
! [?\C-\;]))
"The key binding for flyspell auto correction."
:group 'flyspell)
--- 268,274 ----
:type 'boolean)
(defcustom flyspell-auto-correct-binding
! [(control ?\;)]
"The key binding for flyspell auto correction."
:group 'flyspell)
***************
*** 425,450 ****
(define-key map [(control \.)] 'flyspell-auto-correct-word)
map))
! ;;;###autoload
! (defvar flyspell-mode-map (make-sparse-keymap))
!
! ;; mouse, keyboard bindings and misc definition
! (when (or (assoc 'flyspell-mode minor-mode-map-alist)
! (setq minor-mode-map-alist
! (cons (cons 'flyspell-mode flyspell-mode-map)
! minor-mode-map-alist)))
! (if flyspell-use-meta-tab
! (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word))
! (cond
! ((eq flyspell-emacs 'xemacs)
! (define-key flyspell-mode-map flyspell-auto-correct-binding
'flyspell-auto-correct-previous-word)
! (define-key flyspell-mode-map [(control \,)] 'flyspell-goto-next-error)
! (define-key flyspell-mode-map [(control \.)] 'flyspell-auto-correct-word))
! (flyspell-use-local-map
! (define-key flyspell-mode-map flyspell-auto-correct-binding
'flyspell-auto-correct-previous-word)
! (define-key flyspell-mode-map [?\C-\,] 'flyspell-goto-next-error)
! (define-key flyspell-mode-map [?\C-\.] 'flyspell-auto-correct-word))))
!
;; the name of the overlay property that defines the keymap
(defvar flyspell-overlay-keymap-property-name 'keymap)
--- 421,438 ----
(define-key map [(control \.)] 'flyspell-auto-correct-word)
map))
! (defvar flyspell-mode-map
! (let ((map (make-sparse-keymap)))
! ;; mouse, keyboard bindings and misc definition
! (if flyspell-use-meta-tab
! (define-key map "\M-\t" 'flyspell-auto-correct-word))
! (cond
! ;; I don't understand this test, so I left it as is. --Stef
! ((or (featurep 'xemacs) flyspell-use-local-map)
! (define-key map flyspell-auto-correct-binding
'flyspell-auto-correct-previous-word)
! (define-key map [(control ?\,)] 'flyspell-goto-next-error)
! (define-key map [(control ?\.)] 'flyspell-auto-correct-word)))
! map))
;; the name of the overlay property that defines the keymap
(defvar flyspell-overlay-keymap-property-name 'keymap)
***************
*** 462,481 ****
;* Highlighting */
;*---------------------------------------------------------------------*/
(defface flyspell-incorrect-face
! (if (eq flyspell-emacs 'xemacs)
! '((((class color)) (:foreground "OrangeRed" :bold t :underline t))
! (t (:bold t)))
! '((((class color)) (:foreground "OrangeRed" :weight bold :underline t))
! (t (:weight bold))))
"Face used for marking a misspelled word in Flyspell."
:group 'flyspell)
(defface flyspell-duplicate-face
! (if (eq flyspell-emacs 'xemacs)
! '((((class color)) (:foreground "Gold3" :bold t :underline t))
! (t (:bold t)))
! '((((class color)) (:foreground "Gold3" :weight bold :underline t))
! (t (:weight bold))))
"Face used for marking a misspelled word that appears twice in the buffer.
See also `flyspell-duplicate-distance'."
:group 'flyspell)
--- 450,463 ----
;* Highlighting */
;*---------------------------------------------------------------------*/
(defface flyspell-incorrect-face
! '((((class color)) (:foreground "OrangeRed" :bold t :underline t))
! (t (:bold t)))
"Face used for marking a misspelled word in Flyspell."
:group 'flyspell)
(defface flyspell-duplicate-face
! '((((class color)) (:foreground "Gold3" :bold t :underline t))
! (t (:bold t)))
"Face used for marking a misspelled word that appears twice in the buffer.
See also `flyspell-duplicate-distance'."
:group 'flyspell)
***************
*** 1057,1064 ****
(cond
((and (or (not (eq ispell-parser 'tex))
(and (> start (point-min))
! (not (eq (char-after (1- start)) ?}))
! (not (eq (char-after (1- start)) ?\\))))
flyspell-mark-duplications-flag
(save-excursion
(goto-char (1- start))
--- 1039,1045 ----
(cond
((and (or (not (eq ispell-parser 'tex))
(and (> start (point-min))
! (not (memq (char-after (1- start)) '(?\} ?\\)))))
flyspell-mark-duplications-flag
(save-excursion
(goto-char (1- start))
***************
*** 1181,1200 ****
;* time that function is called. */
;*---------------------------------------------------------------------*/
(defun flyspell-math-tex-command-p ()
! (cond
! (flyspell-check-tex-math-command
! nil)
! ((eq flyspell-tex-math-initialized t)
! (texmathp))
! ((eq flyspell-tex-math-initialized 'error)
! nil)
! (t
! (setq flyspell-tex-math-initialized t)
! (condition-case nil
! (texmathp)
! (error (progn
! (setq flyspell-tex-math-initialized 'error)
! nil))))))
;*---------------------------------------------------------------------*/
;* flyspell-tex-command-p ... */
--- 1162,1182 ----
;* time that function is called. */
;*---------------------------------------------------------------------*/
(defun flyspell-math-tex-command-p ()
! (when (fboundp 'texmathp)
! (cond
! (flyspell-check-tex-math-command
! nil)
! ((eq flyspell-tex-math-initialized t)
! (texmathp))
! ((eq flyspell-tex-math-initialized 'error)
! nil)
! (t
! (setq flyspell-tex-math-initialized t)
! (condition-case nil
! (texmathp)
! (error (progn
! (setq flyspell-tex-math-initialized 'error)
! nil)))))))
;*---------------------------------------------------------------------*/
;* flyspell-tex-command-p ... */
***************
*** 1381,1389 ****
(let ((buffer flyspell-external-ispell-buffer))
(set-buffer buffer)
(goto-char (point-min))
! (let ((size (- flyspell-large-region-end flyspell-large-region-beg))
! (start flyspell-large-region-beg)
! (pword "")
(pcount 1))
;; now we are done with ispell, we have to find the word in
;; the initial buffer
--- 1363,1369 ----
(let ((buffer flyspell-external-ispell-buffer))
(set-buffer buffer)
(goto-char (point-min))
! (let ((pword "")
(pcount 1))
;; now we are done with ispell, we have to find the word in
;; the initial buffer
***************
*** 1954,1960 ****
(let ((start (car (cdr word)))
(end (car (cdr (cdr word))))
(word (car word))
! poss replace)
;; now check spelling of word.
(process-send-string ispell-process "%\n") ;put in verbose mode
(process-send-string ispell-process (concat "^" word "\n"))
--- 1934,1940 ----
(let ((start (car (cdr word)))
(end (car (cdr (cdr word))))
(word (car word))
! poss)
;; now check spelling of word.
(process-send-string ispell-process "%\n") ;put in verbose mode
(process-send-string ispell-process (concat "^" word "\n"))
***************
*** 1972,2060 ****
((null poss)
;; ispell error
(error "Ispell: error in Ispell process"))
! ((string-match "GNU" (emacs-version))
! ;; the word is incorrect, we have to propose a replacement
! (setq replace (flyspell-emacs-popup event poss word))
! (cond ((eq replace 'ignore)
! (goto-char save)
! nil)
! ((eq replace 'save)
! (goto-char save)
! (process-send-string ispell-process
! (concat "*" word "\n"))
! (flyspell-unhighlight-at cursor-location)
! (setq ispell-pdict-modified-p '(t)))
! ((or (eq replace 'buffer) (eq replace 'session))
! (process-send-string ispell-process
! (concat "@" word "\n"))
! (if (null ispell-pdict-modified-p)
! (setq ispell-pdict-modified-p
! (list ispell-pdict-modified-p)))
! (flyspell-unhighlight-at cursor-location)
! (goto-char save)
! (if (eq replace 'buffer)
! (ispell-add-per-file-word-list word)))
! (replace
! (flyspell-unhighlight-at cursor-location)
! (let ((new-word (if (atom replace)
! replace
! (car replace)))
! (cursor-location
! (+ (- (length word) (- end start))
! cursor-location)))
! (if (not (equal new-word (car poss)))
! (let ((old-max (point-max)))
! (delete-region start end)
! (funcall flyspell-insert-function new-word)
! (if flyspell-abbrev-p
! (flyspell-define-abbrev word new-word))
! (flyspell-ajust-cursor-point save
! cursor-location
! old-max)))))
! (t
! (goto-char save)
! nil)))
! ((eq flyspell-emacs 'xemacs)
(flyspell-xemacs-popup
! event poss word cursor-location start end save)
! (goto-char save)))
(ispell-pdict-save t))))))
;*---------------------------------------------------------------------*/
! ;* flyspell-xemacs-correct ... */
;*---------------------------------------------------------------------*/
! (defun flyspell-xemacs-correct (replace poss word cursor-location start end
save)
! "The xemacs popup menu callback."
(cond ((eq replace 'ignore)
nil)
((eq replace 'save)
! (process-send-string ispell-process (concat "*" word "\n"))
! (process-send-string ispell-process "#\n")
(flyspell-unhighlight-at cursor-location)
(setq ispell-pdict-modified-p '(t)))
((or (eq replace 'buffer) (eq replace 'session))
! (process-send-string ispell-process (concat "@" word "\n"))
(flyspell-unhighlight-at cursor-location)
(if (null ispell-pdict-modified-p)
(setq ispell-pdict-modified-p
(list ispell-pdict-modified-p)))
(if (eq replace 'buffer)
(ispell-add-per-file-word-list word)))
(replace
(let ((old-max (point-max))
(new-word (if (atom replace)
replace
(car replace)))
(cursor-location (+ (- (length word) (- end start))
cursor-location)))
! (if (not (equal new-word (car poss)))
! (progn
! (delete-region start end)
! (goto-char start)
! (funcall flyspell-insert-function new-word)
! (if flyspell-abbrev-p
! (flyspell-define-abbrev word new-word))))
! (flyspell-ajust-cursor-point save cursor-location old-max)))))
;*---------------------------------------------------------------------*/
;* flyspell-ajust-cursor-point ... */
--- 1952,2016 ----
((null poss)
;; ispell error
(error "Ispell: error in Ispell process"))
! ((featurep 'xemacs)
(flyspell-xemacs-popup
! event poss word cursor-location start end save))
! (t
! ;; The word is incorrect, we have to propose a replacement.
! (flyspell-do-correct (flyspell-emacs-popup event poss word)
! poss word cursor-location start end save)))
(ispell-pdict-save t))))))
;*---------------------------------------------------------------------*/
! ;* flyspell-do-correct ... */
;*---------------------------------------------------------------------*/
! (defun flyspell-do-correct (replace poss word cursor-location start end save)
! "The popup menu callback."
! ;; Originally, the XEmacs code didn't do the (goto-char save) here and did
! ;; it instead right after calling the function.
(cond ((eq replace 'ignore)
+ (goto-char save)
nil)
((eq replace 'save)
! (goto-char save)
! (ispell-send-string (concat "*" word "\n"))
! ;; This was added only to the XEmacs side in revision 1.18 of
! ;; flyspell. I assume its absence on the Emacs side was an
! ;; oversight. --Stef
! (ispell-send-string "#\n")
(flyspell-unhighlight-at cursor-location)
(setq ispell-pdict-modified-p '(t)))
((or (eq replace 'buffer) (eq replace 'session))
! (ispell-send-string (concat "@" word "\n"))
(flyspell-unhighlight-at cursor-location)
(if (null ispell-pdict-modified-p)
(setq ispell-pdict-modified-p
(list ispell-pdict-modified-p)))
+ (goto-char save)
(if (eq replace 'buffer)
(ispell-add-per-file-word-list word)))
(replace
+ ;; This was added only to the Emacs side. I assume its absence on
+ ;; the XEmacs side was an oversight. --Stef
+ (flyspell-unhighlight-at cursor-location)
(let ((old-max (point-max))
(new-word (if (atom replace)
replace
(car replace)))
(cursor-location (+ (- (length word) (- end start))
cursor-location)))
! (unless (equal new-word (car poss))
! (delete-region start end)
! (goto-char start)
! (funcall flyspell-insert-function new-word)
! (if flyspell-abbrev-p
! (flyspell-define-abbrev word new-word)))
! ;; In the original Emacs code, this was only called in the body
! ;; of the if. I arbitrarily kept the XEmacs behavior instead.
! (flyspell-ajust-cursor-point save cursor-location old-max)))
! (t
! (goto-char save)
! nil)))
;*---------------------------------------------------------------------*/
;* flyspell-ajust-cursor-point ... */
***************
*** 2123,2129 ****
(cor-menu (if (consp corrects)
(mapcar (lambda (correct)
(vector correct
! (list 'flyspell-xemacs-correct
correct
(list 'quote poss)
word
--- 2079,2085 ----
(cor-menu (if (consp corrects)
(mapcar (lambda (correct)
(vector correct
! (list 'flyspell-do-correct
correct
(list 'quote poss)
word
***************
*** 2138,2144 ****
(menu (let ((save (if (consp affix)
(vector
(concat "Save affix: " (car affix))
! (list 'flyspell-xemacs-correct
''save
(list 'quote poss)
word
--- 2094,2100 ----
(menu (let ((save (if (consp affix)
(vector
(concat "Save affix: " (car affix))
! (list 'flyspell-do-correct
''save
(list 'quote poss)
word
***************
*** 2149,2155 ****
t)
(vector
"Save word"
! (list 'flyspell-xemacs-correct
''save
(list 'quote poss)
word
--- 2105,2111 ----
t)
(vector
"Save word"
! (list 'flyspell-do-correct
''save
(list 'quote poss)
word
***************
*** 2159,2165 ****
save)
t)))
(session (vector "Accept (session)"
! (list 'flyspell-xemacs-correct
''session
(list 'quote poss)
word
--- 2115,2121 ----
save)
t)))
(session (vector "Accept (session)"
! (list 'flyspell-do-correct
''session
(list 'quote poss)
word
***************
*** 2169,2175 ****
save)
t))
(buffer (vector "Accept (buffer)"
! (list 'flyspell-xemacs-correct
''buffer
(list 'quote poss)
word
--- 2125,2131 ----
save)
t))
(buffer (vector "Accept (buffer)"
! (list 'flyspell-do-correct
''buffer
(list 'quote poss)
word
- [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el, Stefan Monnier, 2005/06/03
- [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el,
Stefan Monnier <=
- [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el, Lute Kamstra, 2005/06/08
- [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el, Lute Kamstra, 2005/06/08
- [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el, Miles Bader, 2005/06/10
- [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el, Juanma Barranquero, 2005/06/14
- [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el, Richard M . Stallman, 2005/06/28