From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.devel Subject: Re: jinx Date: Sat, 01 Apr 2023 10:29:13 +0200 Message-ID: <877cuwgg4m.fsf@gmail.com> References: <87sfdnyuxc.fsf@posteo.de> <83sfdl2z26.fsf@gnu.org> <86tty0ydnl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10843"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , rms@gnu.org, m.eliachevitch@posteo.de, emacs-devel@gnu.org To: Arash Esbati Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 01 10:30:11 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1piWck-0002fz-V2 for ged-emacs-devel@m.gmane-mx.org; Sat, 01 Apr 2023 10:30:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piWbz-0006nb-1u; Sat, 01 Apr 2023 04:29:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piWbw-0006nN-KZ for emacs-devel@gnu.org; Sat, 01 Apr 2023 04:29:20 -0400 Original-Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1piWbu-0006do-PP; Sat, 01 Apr 2023 04:29:20 -0400 Original-Received: by mail-ed1-x52e.google.com with SMTP id ek18so98771491edb.6; Sat, 01 Apr 2023 01:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680337755; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NTKdkSQDfRP9ne6hhTnujn2sZoqLVZhdxQIFx/vpPUY=; b=dbIchTa3tbJl9GVQlIugiyUO3K0zp11IincfH+Do8vLaPSS5CfWTCXb9GMhkFJYy1u SMaqHhvlZCAvgvx/S5WCH2KBon5CORw0U9OjYL1Wof8greX51cwbEWj+dxpGXODwz0WM jRx37T9NT3gDlfN+4/MGW1GJBZDAPayzX+vhgEpu6DCmf/bAn3hChfnpMsCFsK8wHbsR LSJ0PAhVxc2NywCuCJ8BhiAhx2tawkeEpc7v9oLHjssb60il3oRYyYVjJGhSAR7LiNn4 7GI9xilvCWNNMjiygptMuYfEqIyv7XfM+2QvPNdu6dj3NwQjhfLudD0KybPZTHYY9PYX DZXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680337755; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NTKdkSQDfRP9ne6hhTnujn2sZoqLVZhdxQIFx/vpPUY=; b=uzdf+2aNerhG+ZxaUHo6BcjYLeZk/1J1MJicVgrgvbXuzR+EAsSOfniFUcXhIZoQwQ 4y0Xbp8FtNtjvzp7BQD/Pb7oJXGi5k2jh0OmxuLk/RbPINB5F9kojPVhg4JTDNeffSvM 0lXcSXPhhPFophSzgP0eNBZcHTV1KWpoexWSc6gcOFtpx/OqRvqWlbXYLJZwzuU6SWTM yA5qQgDegpKeKyW+MwqGMgSXKwGHXIjXeMwqHfRB6Wrl1GfL2StJAMoVyIEpYJwg2zjC jn9OSdG2BHsm3hRH6eP0Pnyd1dM+h2iWU7bOGv2XO1AKma5i8mfU36+FfoMXDLaYvDr1 EpUg== X-Gm-Message-State: AAQBX9emzX96UJuiKpJll7K3XYfBOLBuR5HusjHFdz4PmvJK6jbFFWOV W1PjqwSMdFo1dC/AxZYFzg3q+IZiqdBLGQ== X-Google-Smtp-Source: AKy350Yec4p3r3hqGcLY4OYaq5zN7ZSJs734mSYXv9uJ88aKtX+03sW3YbWIQqtryGUlk+vdtViR6g== X-Received: by 2002:a17:906:2606:b0:932:615c:33d4 with SMTP id h6-20020a170906260600b00932615c33d4mr10643821ejc.34.1680337755195; Sat, 01 Apr 2023 01:29:15 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::f39f]) by smtp.gmail.com with ESMTPSA id p16-20020a170906a01000b008cc920469b5sm1884209ejy.18.2023.04.01.01.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Apr 2023 01:29:14 -0700 (PDT) In-Reply-To: <86tty0ydnl.fsf@gnu.org> (Arash Esbati's message of "Fri, 31 Mar 2023 20:33:02 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304980 Archived-At: On Fri, 31 Mar 2023 at 20:33, Arash Esbati wrote: > Somewhat off-topic, but it would be great if ispell and flyspell could > use the same logic for skipping portions of buffer text. Take for > example (La)TeX mode: ispell uses `ispell-tex-skip-alists' and flyspell > uses `flyspell-tex-command-regexp' (which is not very powerful) and then > a function added to `flyspell-generic-check-word-predicate' (AFAIU). I > once wrote an addition for AUCTeX (tex-ispell.el) which extends > `ispell-tex-skip-alists' for many LaTeX packages but had hard times > making it work with flyspell as well, skipping multi-line text portions > was something I couldn't solve for flyspell, e.g.: > > \begin{verbatim} > Please skip the entire text in this environment. > \end{verbatim} > > Best, Arash The logic used by Flyspell could easily be used by ispell.el, but not vice-versa. However, the flyspell-generic-check-word-predicate API also has some issues (e.g., a minor mode can't plug into it easily). Also, it's quite messy in that some modes are supported in flyspell.el, while all other are expected to implement their own predicate (of course, the latter is a better approach). So I'd suggest a generic API on these lines: #+begin_src emacs-lisp (defvar spelling-ignore-functions nil "Hook used to determine if a word should be excluded from spell checking. These functions are called with two arguments, the start and end positions of a word, until a non-nil value is returned. Any result other than nil or `never' indicates that the word should be excluded from spell checking. Modes derived from `prog-mode' should leave it up to the spell checker to decide whether or not to ignore comments, strings or code regions. They may provide more specific rules, if desired, but this typically not needed. MAYBE ALSO: These functions should make no assumptions about the point position, and are free to move it.") (defun spelling-ignored-p (start end) "Return non-nil if the word between START and END should not be spell che= cked. See `spelling-ignore-functions' for information on how this is determined." (save-excursion (memq (run-hook-with-args-until-success spelling-ignore-functions start= end) '(nil never)))) #+end_src The above would go into a =E2=80=9Cneutral=E2=80=9D place like simple.el. = Each mode would be responsible to define its own hooks and each spell-checking package could use it as it sees fit.