unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
Cc: Matthias Meulien <orontee@gmail.com>, emacs-devel@gnu.org
Subject: Re: [PATCH] Custom option to turn Flyspell mode on in prog modes
Date: Sat, 09 Aug 2014 02:45:55 +0300	[thread overview]
Message-ID: <877g2ijxrw.fsf@mail.jurta.org> (raw)
In-Reply-To: <6936196.xMpHYqAt7Y@descartes> ("Rüdiger Sonderfeld"'s message of "Fri, 08 Aug 2014 15:59:59 +0200")

>> > 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	other threads:[~2014-08-08 23:45 UTC|newest]

Thread overview: 10+ 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 [this message]
2014-08-14 12:46         ` Sebastien Vauban
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=877g2ijxrw.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=orontee@gmail.com \
    --cc=ruediger@c-plusplus.de \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).