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 13:39:40 +0200 Message-ID: <87ilef3k77.fsf@gmail.com> References: <87sfdnyuxc.fsf@posteo.de> <83sfdl2z26.fsf@gnu.org> <86tty0ydnl.fsf@gnu.org> <877cuwgg4m.fsf@gmail.com> <83cz4nzw3u.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="21319"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: arash@gnu.org, rms@gnu.org, m.eliachevitch@posteo.de, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 01 13:40:02 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 1piZaU-0005GT-15 for ged-emacs-devel@m.gmane-mx.org; Sat, 01 Apr 2023 13:40:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piZaH-0003CG-W7; Sat, 01 Apr 2023 07:39:50 -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 1piZaG-0003Bb-Do for emacs-devel@gnu.org; Sat, 01 Apr 2023 07:39:48 -0400 Original-Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1piZaE-0006xw-Jq; Sat, 01 Apr 2023 07:39:48 -0400 Original-Received: by mail-ed1-x532.google.com with SMTP id t10so99563760edd.12; Sat, 01 Apr 2023 04:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680349182; 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=leUD/om1NdGqcOtDXm96olZPd+wL5WJerd95dolWnkE=; b=EZYHT243WQ8KpO3vHHanoXarfWOjFKMJ0YQhDXJrJV/goY1pyBQ+h8WKsFZg+SkhR2 f3aF/jR8xcBWOE0bIIU/DIfnpuOyyIrk4tERYnUxiJiQbHHTOtUrTx8MU6vGb066za7z r9kfK37/Xm01nV+50Zg0XQK9i4Q/HQwTDegfzBmrGbfwqckhQWjHuuY+iAg3MZDaUm4y CXlgq1lmFoldZ59RG672nICpxUMtV6y7k/9nayqOpVrEa5gCmTcxQFnmzirqGmnX1VTC 1FITvE/5ze1i7CYxupP5eFz7DhnT5e50tengHxMR/HfX9DIaKNUQnwZHgPNdf9YxgT/e 004A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680349182; 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=leUD/om1NdGqcOtDXm96olZPd+wL5WJerd95dolWnkE=; b=RfteUzHJ+c1+wPWRzA33abh/Hhk5I+hoDuLJd2HOEEgqPXom9GYTkZDIrXdmBdBu7g 6HZSQ8XlOsV76YmYy8ntZnTUr9dGrNT2+OnxhmR8ZGbGtZhFOvthjzIFbJrC6Eq8u+SE 4xQPzUJ8mxhWwhv7ZEIeJUGWaHZQ0mXyWsqS0pYGpcGIsFMUfQDPV5Cm5Tubw0rp5Op3 TKLhG6Ji0zruoBYZR6lPQ6tQP+8OAUdXhsHGHxPL1dkeebqFy+6pyTUt9grJtUFHP6Cb el455WXyyHBVOQ8zgrXSRNR+B/OtFd2H6N/RQzgp4gelMtNR0Efd6XejBkpsQFYLvKkV zr1A== X-Gm-Message-State: AAQBX9dOi9zKLn4AG8oJLaL/O0PQF1JVx+d5FMS7dO1QNPh4pF5R6hCS X9dzDEL9hRNuTm+q3lcQF2HRPww3OIWo7A== X-Google-Smtp-Source: AKy350azbBpbMZDlbcJJQMXhkfOeBo9Z+8AYRaz0a5xpRIZlqugLSWAbE5Gpz8Z7gmzFCK9G7duYOA== X-Received: by 2002:a17:906:408a:b0:933:2dfd:2f50 with SMTP id u10-20020a170906408a00b009332dfd2f50mr13098777ejj.30.1680349182226; Sat, 01 Apr 2023 04:39:42 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8ac0:56d0::f39f]) by smtp.gmail.com with ESMTPSA id j3-20020a170906050300b00947a40ded80sm1826845eja.104.2023.04.01.04.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Apr 2023 04:39:41 -0700 (PDT) In-Reply-To: <83cz4nzw3u.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 01 Apr 2023 14:21:25 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=arstoffel@gmail.com; helo=mail-ed1-x532.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:304990 Archived-At: On Sat, 1 Apr 2023 at 14:21, Eli Zaretskii wrote: >> From: Augusto Stoffel >> Cc: Eli Zaretskii , rms@gnu.org, m.eliachevitch@posteo.d= e, >> emacs-devel@gnu.org >> Date: Sat, 01 Apr 2023 10:29:13 +0200 >>=20 >> So I'd suggest a generic API on these lines: >>=20 >> #+begin_src emacs-lisp >> (defvar spelling-ignore-functions nil >> "Hook used to determine if a word should be excluded from spell checki= ng. >> 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. > > If we pass START and END, why does the region have to be a single > "word"? This is a tricky point. The notion of "word", for spell checking purposes, is outside of the major mode's control. For instance, some languages include the apostrophe or hyphen as a word char, some don't. Passing START and END means that the major mode can use the information of how the spell-checker did the tokenization. Typically, though, I expect most function will look only at START or END. > why not let the caller specify a larger region to be skipped? Then the return value can't be a boolean; it has to be a list of regions, which is too complicated. >> 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. > > Why? I thought the purpose of this is to override what the > spell-checker knows, and that includes comments and strings, if > needed. So I see no reason for such a recommendation. Maybe. But the above is exactly how Flyspell's flyspell-generic-check-word-predicate works, and it makes sense IMO. >> (defun spelling-ignored-p (start end) >> "Return non-nil if the word between START and END should not be spell = checked. >> See `spelling-ignore-functions' for information on how this is >> determined." >> (save-excursion > > Why do we need save-excursion? If we remove it here, then most spelling-ignore-functions will need to call save excursion on their own, which would probably be fine as well. >> The above would go into a =E2=80=9Cneutral=E2=80=9D place like simple.el. > > Why not ispell.el? All the spelling functions use ispell.el anyway. > simple.el is preloaded, so having this there bloats every Emacs > session for no good reason, IMO. jit-spell only uses ispell.el to start a process and jinx doesn't use it at all. To me it makes sense to untangle the spellchecking support API for major modes from any particular implementation. But I guess this is not a major issue.