all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: emacs-devel-mXXj517/zsQ@public.gmane.org
Subject: Re: [PATCH] Custom option to turn Flyspell mode on in prog modes
Date: Thu, 14 Aug 2014 14:46:51 +0200	[thread overview]
Message-ID: <86fvgz8chw.fsf@somewhere.org> (raw)
In-Reply-To: 877g2ijxrw.fsf@mail.jurta.org

Juri Linkov wrote:
>>> > 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))))

Why don't they work well?

Note that an approach that seduced me was to only check the buffer once
it gets modified.

--8<---------------cut here---------------start------------->8---
  (add-hook 'first-change-hook
             #'(lambda ()
                 (when (and (memq major-mode my-flyspell-major-mode-list)
                            (not flyspell-mode))
                   (my-turn-on-flyspell-french))))
--8<---------------cut here---------------end--------------->8---

However, I have dropped that because it had problems as well -- though,
I don't remember which ones exactly (done during Org mode exports or
so?).

Best regards,
  Seb

-- 
Sebastien Vauban




  reply	other threads:[~2014-08-14 12:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09  0:25 [PATCH] Custom option to turn Flyspell mode on in prog modes Matthias Meulien
2013-12-09 13:28 ` Rüdiger Sonderfeld
2013-12-11 23:17   ` Matthias Meulien
2014-01-07 19:23     ` Glenn Morris
2014-01-07 19:30       ` Glenn Morris
2014-08-08 13:59     ` Rüdiger Sonderfeld
2014-08-08 23:45       ` Juri Linkov
2014-08-14 12:46         ` Sebastien Vauban [this message]
2013-12-11 23:17   ` bug#16394: " Matthias Meulien
2014-08-08 14:10     ` Rüdiger Sonderfeld
2014-08-14 20:21   ` Mode line strings for sub- and super- minor modes are counterintuitive Matthias Meulien
2014-08-15  5:45     ` Bozhidar Batsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86fvgz8chw.fsf@somewhere.org \
    --to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
    --cc=emacs-devel-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.