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

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

bug#14957: 24.3.50; Flyspell language visible in mode line


From: Michael Heerdegen
Subject: bug#14957: 24.3.50; Flyspell language visible in mode line
Date: Tue, 17 Sep 2013 18:47:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi Stefan,

some comments:

> > I think it'd be great to see the language next to "Fly" in the mode
> > line.  For example, something such as "Fly[FR]" or "Fly[EN]".
>
> That'd be nice, especially if we make it active so that you can right
> click on it to select another language.
> Patches very welcome.

I think this should not be restricted to flyspell, I also want to know
the current dictionary before doing M-$ (`ispell-word'), for example.
For that purpose, I just add

,----------------------------------------------------------------------
| (:eval
|  (let ((dict (and (featurep 'ispell)
|                 (or ispell-local-dictionary
|                     ispell-dictionary))))
|    (and dict
|       (concat " "
|               (propertize (substring dict 0 2)
|                           'face 'mode-line-shadow)))))
`----------------------------------------------------------------------

to `mode-line-format' (`mode-line-shadow' just shows it in gray).

About right clicking to select another language: I think most people
would want a handy command to toggle between two or three dictionaries
they frequently use.
For example, I'm a native German speaker.  When composing an Email, I
want to be able to switch between German and English dict with one key -
everything else is annoying.  I _never_ need any other dict.  Maybe
that's what most people would want to use?  I use this code for that:

--8<---------------cut here---------------start------------->8---
(setq-default flyspell-default-dictionary "american")

(defun my-ispell-toggle-dictionary ()
  (interactive)
  "Toggle local dictionary between German and American."
  (require 'ispell)
  (pcase (or ispell-local-dictionary ispell-dictionary)
    (`"american" (ispell-change-dictionary "deutsch-alt8"))
    (_           (ispell-change-dictionary "american")))
  (force-mode-line-update))

(defun my-flyspell-toggle-dictionary ()
  "Toggle local dictionary.
Turn on `flyspell-mode' if off."
  (interactive)
  (my-ispell-toggle-dictionary)
  (ignore-errors
    (when flyspell-mode (flyspell-buffer))))
--8<---------------cut here---------------end--------------->8---


Regards,

Michael.





reply via email to

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