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

From: "Sebastien Vauban" <[email-masked]>
Date: Fri, 08 Nov 2013 21:46:26 +0100

Hi Michael,

Michael Heerdegen wrote:
>>> 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).

I have the following minimal Emacs configuration file:

--8<---------------cut here---------------start------------->8---
(setq ispell-dictionary "francais")

;; spelling checker program
(setq ispell-program-name "aspell")

(message "<<< Before add-to-list >>>")
(add-to-list 'mode-line-format
             '(:eval
               (let ((dict (and (featurep 'ispell)
                                (or ispell-local-dictionary
                                    ispell-dictionary))))
                 (and dict
                      (concat " ["
                              (propertize (substring dict 0 2)
                                          'face 'mode-line-highlight)
                              "]"))))
             t)
(message "<<< After add-to-list >>>")

;; enable on-the-fly spell checking
(add-hook 'text-mode-hook
          (lambda ()
            (flyspell-mode 1)))

;; prevent flyspell from finding mistakes in the code
(add-hook 'prog-mode-hook
          (lambda ()
            ;; `ispell-comments-and-strings'
            (flyspell-prog-mode)))
--8<---------------cut here---------------end--------------->8---

And I open the following Org file:

--8<---------------cut here---------------start------------->8---
#+TITLE:     ECM pour Flyspell
#+Time-stamp: <2013-11-08>
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE:  en

* Développement
  :PROPERTIES:
  :CATEGORY: Dev
  :END:

** DONE Engager firme de relations publiques 			       :mail:
   DEADLINE: <2013-02-14 Thu>
   :LOGBOOK:
   CLOCK: [2013-02-05 Tue 09:00]--[2013-02-05 Tue 10:11] =>  1:11
   - State "TODO"        ->  "STRT"       [2013-02-05 Tue 17:48]
   - State "TODO"        ->  "STRT"       [2013-08-19 Mon 15:16]
   :END:

** TODO Appeler Laura pour bug dans le code shell 		      :phone:

Le bout de code suivant a un problème.

#+begin_src sh
wher command
#+end_src
--8<---------------cut here---------------end--------------->8---

I expect to see the language indicator, but it is not displayed in the
mode-line.

Checking the value of `mode-line-format', it seems that the code to support it
has not been added to that variable!?

Though, that code has been executed, as messages before and after it are well
displayed in the *Messages* buffer.

See demo at http://screencast.com/t/86M9ZPl8lUx.

Any idea about the problem?

Best regards,
  Seb

-- 
Sebastien Vauban