From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Custom option to turn Flyspell mode on in prog modes Date: Sat, 09 Aug 2014 02:45:55 +0300 Organization: JURTA Message-ID: <877g2ijxrw.fsf@mail.jurta.org> References: <87ppp6vpjv.fsf@gmail.com> <2643591.vy3k34KHB8@descartes> <87fvpzuge2.fsf@gmail.com> <6936196.xMpHYqAt7Y@descartes> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1407545467 25452 80.91.229.3 (9 Aug 2014 00:51:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Aug 2014 00:51:07 +0000 (UTC) Cc: Matthias Meulien , emacs-devel@gnu.org To: =?iso-8859-1?Q?R=FCdiger?= Sonderfeld Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 09 02:51:00 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XFus7-0008Ns-Jv for ged-emacs-devel@m.gmane.org; Sat, 09 Aug 2014 02:50:59 +0200 Original-Received: from localhost ([::1]:53670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFus7-0005iM-Af for ged-emacs-devel@m.gmane.org; Fri, 08 Aug 2014 20:50:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFurV-0005G6-5k for emacs-devel@gnu.org; Fri, 08 Aug 2014 20:50:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFurJ-00037s-Tb for emacs-devel@gnu.org; Fri, 08 Aug 2014 20:50:21 -0400 Original-Received: from alc-vshost7.dreamhost.com ([69.163.216.107]:33088 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFurJ-00037k-OM for emacs-devel@gnu.org; Fri, 08 Aug 2014 20:50:09 -0400 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 41376376017F98; Fri, 8 Aug 2014 17:50:08 -0700 (PDT) In-Reply-To: <6936196.xMpHYqAt7Y@descartes> (=?iso-8859-1?Q?=22R=FCdiger?= Sonderfeld"'s message of "Fri, 08 Aug 2014 15:59:59 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 69.163.216.107 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:173500 Archived-At: >> > 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))))