help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do-you Aspell for French?


From: Sébastien Vauban
Subject: Re: Do-you Aspell for French?
Date: Thu, 31 Aug 2006 21:01:12 GMT
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Hello everybody,

>> Am 30.08.2006 um 22:53 schrieb Michaël Cadilhac:
>>> Peter Dyballa <Peter_Dyballa@Web.DE> writes:
>>>> Am 30.08.2006 um 21:44 schrieb Sébastien Vauban:
>>>>
>>>>>> (defun ispell-get-otherchars ()
>>>>>>   (replace-regexp-in-string "-" "" (ispell-get-decoded-string 3)))
>>>>>
>>>>> I did add your function, but... no, it does not work... I still
>>>>> got the coumpound words underlined...
>>>
>>> Strange... I use CVS Emacs, what version are you running?
>>
>> 21.3.50, 22.0.50, 23.0.0.

GNU Emacs 21.4.1, and other verions... On Ubuntu and on Windows.


>>> Where did you put it?  If it's in your .emacs, did you put a (require
>>> 'ispell) before?

Yes, now I did (I already had autoloads), but no change.


> However, I've made a big mistake so far, you guys were talking about
> ispell, will I had flyspell in mind.

No, figure out I meant flyspell as well... I use it mainly for
my mails...

I even have since long ago the following in my .emacs:

    ;; dash character (`-') is considered as a word delimiter
    (setq flyspell-consider-dash-as-word-delimiter-flag t)

but it does seem not to do anything...

Here interesting parts of my config, if it can help.

,----
| ;;; .emacs --- my Emacs Init File
| 
| (require 'ispell)
| 
| ;; use GNU Aspell instead of (port of) ispell
| (setq ispell-program-name
|       (if running-ms-windows
|           "C:/Program Files/Aspell/bin/aspell.exe"
|         "/usr/bin/aspell"))
| 
| (when (and ispell-program-name
|            (file-executable-p ispell-program-name))
| 
|     ;; aspell extensions should be used
|     (setq ispell-really-aspell t)
| 
|     ;; remove uninstalled dictonaries from the default list
|     (setq ispell-dictionary-alist
|           '((nil                    ; default (English.aff)
|              "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
|             ("american"             ; Yankee English
|              "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
|             ("british"              ; British version
|              "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil 
iso-8859-1)
|             ("english"                      ; make English explicitly 
selectable
|              "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
|             ("francais"                     ; Francais.aff
|              
"[A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
|              
"[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
|              "[-']" t nil "~list" iso-8859-1)))
| 
|     ;; ispell
|     (autoload 'ispell-word "ispell" "Check the spelling of word in buffer." 
't)
|     (autoload 'ispell-region "ispell" "Check the spelling of region." 't)
|     (autoload 'ispell-buffer "ispell" "Check the spelling of buffer." t)
| 
|     ;; save the personal dictionary without confirmation
|     (setq ispell-silently-savep t)
| 
| (defun ispell-get-otherchars ()
|   (replace-regexp-in-string "-" "" (ispell-get-decoded-string 3)))
| 
| 
| ;;     ;; consider using the `ispell-parser' to check your text
| ;;     ;; Warning! Assignment to free variable ispell-parser!!
| ;;     (add-hook 'tex-mode-hook
| ;;               '(lambda ()
| ;;                  (setq ispell-parser 'tex)))
| 
| ;;     ;; TODO Problems in *mail*: checking all the headers!!
| ;;     ;; turn on flyspell for all text modes
| ;;     (add-hook 'text-mode-hook
| ;;               '(lambda ()
| ;;                  (flyspell-mode 1)))
| 
| ;;     ;; start Flyspell when editing LaTeX source files
| ;;     (add-hook 'LaTeX-mode-hook 'flyspell-mode)
| 
| ;;     ;; ignore the \citep and \citet commands of the NatBib bibliography 
style
| ;;     (eval-after-load "ispell"
| ;;       '(let ((list (car ispell-tex-skip-alists)))
| ;;          (add-to-list 'list '("\\\\cite[tp]" ispell-tex-arg-end))
| ;;          (setcar ispell-tex-skip-alists list)))
| 
|     ;; on-the-fly spelling checking
|     (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checking" t)
| 
|     ;; enable the likeness criteria
|     (setq flyspell-sort-corrections nil)
| 
|     ;;
|     (setq flyspell-auto-correct-previous-word t)
| 
|     ;; dash character (`-') is considered as a word delimiter
|     (setq flyspell-consider-dash-as-word-delimiter-flag t)
| 
|     (defun my-turn-on-flyspell-french ()
|       "Unconditionally turn on Flyspell mode (in French)."
|       (interactive)
|       (flyspell-mode 1) ;; extra
|       (ispell-change-dictionary "francais")
|       (flyspell-buffer)) ;; extra
| 
|     (global-set-key [(shift f7)] 'my-turn-on-flyspell-french)
| 
|     (defun my-turn-on-flyspell-english ()
|       "Unconditionally turn on Flyspell mode (in English)."
|       (interactive)
|       (flyspell-mode 1)
|       (ispell-change-dictionary "english")
|       (flyspell-buffer))
| 
|     (global-set-key [(control f7)] 'my-turn-on-flyspell-english)
| 
|     ;; turn flyspell-mode on [instead of just toggling the mode
|     ;; by calling it like: (add-hook 'text-mode-hook 'flyspell-mode)]
|     (add-hook 'message-mode-hook 'my-turn-on-flyspell-french)
| 
| 
| ;;     (defun activate-flyspell ()
| ;;       "Turn on flyspell-mode and call flyspell-buffer."
| ;;       (interactive)
| ;;       ;; This next line REALLY slows buffer switching.
| ;;       (flyspell-mode)
| ;;       (flyspell-buffer))
| 
| ;;     (defvar customised-hooks-alist
| ;;       '(emacs-lisp-mode-hook
| ;;         nxml-mode-hook
| ;;         python-mode-hook
| ;;         sh-mode-hook
| ;;         text-mode-hook)
| ;;       "An alist of hooks that require customisations.")
| 
| ;;     (unless noninteractive
| ;;       ;; Activate flyspell for various major modes.
| ;;       (add-hook-list customised-hooks-alist 'activate-flyspell))
| 
|     ;; turn on flyspell-prog-mode instead, in emacs-lisp-mode, python-mode,
|     ;; and sh-mode?
| 
|     (defun my-turn-off-flyspell ()
|       "Unconditionally turn off Flyspell mode."
|       (interactive)
|       (flyspell-mode -1))
| 
|     ;; from Alex Schroeder
|     (defun my-change-dictionary ()
|       "Change the dictionary."
|       (interactive)
|       (let ((dict (or ispell-local-dictionary ispell-dictionary)))
|         (setq dict (if (string= dict "francais") "american" "francais"))
|         (message "Switched to %S" dict)
|         (sit-for 0.4)
|         (ispell-change-dictionary dict)
|         (when flyspell-mode
|           (flyspell-delete-all-overlays))))
| 
|     ;; key bindings
|     (global-set-key [(meta $)] 'ispell-word)
|     (global-set-key [(f7)] 'ispell-word)
|     (global-set-key [(shift f7)] 'my-change-dictionary)
|     (global-set-key [(control f7)] 'ispell-change-dictionary)
| 
| ;; ;;* flyspell comments and strings in programming modes
| ;; ;; From: "Stefan Monnier <foo @ acm.com>"
| ;; (defun flyspell-generic-progmode-verify ()
| ;;   "Used for `flyspell-generic-check-word-p' in programming modes."
| ;;   (let ((f (get-text-property (point) 'face)))
| ;;     (memq f '(font-lock-comment-face font-lock-string-face))))
| ;; (defun flyspell-prog-mode ()
| ;;   "Turn on `flyspell-mode' for comments and strings."
| ;;   (interactive)
| ;;   (setq flyspell-generic-check-word-p 'flyspell-generic-progmode-verify)
| ;;   (flyspell-mode 1))
| ;; (add-hook 'c-mode-common-hook 'flyspell-prog-mode t)
| ;; (add-hook 'java-mode-common-hook 'flyspell-prog-mode t)
| 
| 
| ;;; ----[ The Syntax Table
| 
| ;; change word constituent syntax for `text-mode-syntax-table'
| (defun my-change-word-constituent ()
|   (map nil
|        (function
|         (lambda (char)
|           (modify-syntax-entry char "w" text-mode-syntax-table)))
|        ;; accented characters
|        "áéíóúàèìòùâêîôûäëïöüñåç"))
| 
| (my-change-word-constituent)
| 
| ;; now '-' is not considered a word-delimiter
| ;; (add-hook 'emacs-lisp-mode-hook
| ;;           '(lambda ()
| ;;              (modify-syntax-entry ?- "w")))
| 
| ;;; .emacs ends here
`----

Thanks for all in advance,
  Seb

-- 
Sébastien Vauban


reply via email to

[Prev in Thread] Current Thread [Next in Thread]