emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Custom option to turn Flyspell mode on in prog modes


From: Juri Linkov
Subject: Re: [PATCH] Custom option to turn Flyspell mode on in prog modes
Date: Sat, 09 Aug 2014 02:45:55 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

>> > Looks good.  But I don't think `turn-on-flyspell-prog' is needed
>> > because  `flyspell-prog-mode' already turns the mode on
>> > unconditionally.  (Although  maybe the latter should be
>> > reconsidered.)
>>
>> You are right. The following works well.
>
> Sorry for the long delay.  I have applied the patch (r117667) and also added
> `prettify-symbols-mode' to the list.

BTW, could someone suggest how to turn Flyspell mode only on typing
new text, but not on moving point over the existing text?  Would it be
good to have a new custom option as well?  I've tried such ugly hacks,
but they don't work well:

  ;; Flyspell only on typing, not on moving point
  (add-hook 'flyspell-mode-hook
            (lambda ()
              (remove-hook 'post-command-hook (function 
flyspell-post-command-hook) t)
              (add-hook 'after-change-functions
                        (lambda (start stop len)
                          (flyspell-post-command-hook)) t t)))

  ;; Alternative solution for Flyspell only on typing, not on moving point
  (add-hook 'flyspell-mode-hook
            (lambda ()
              (advice-add 'flyspell-check-pre-word-p :override (lambda () nil))
              ;; After evaluating the next, flyspell doesn't check the last word
              ;; in `auto-fill-mode' when typing SPC moves to the next line,
              ;; because the order of calls in `internal_self_insert' is:
              ;; 1. insert_and_inherit ();
              ;; 2. Frun_hook_with_args (Qafter_change_functions);
              ;; 3. auto_fill_result = call0 (BVAR (current_buffer, 
auto_fill_function));
              ;; 4. Frun_hooks (1, &Qpost_self_insert_hook);
              (advice-add 'flyspell-check-word-p     :override (lambda () 
nil))))



reply via email to

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