From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: locked narrowing in ELisp Date: Wed, 17 Aug 2022 17:03:46 +0300 Message-ID: <3c4f3c87-39a1-9ee7-1ca7-384315882663@yandex.ru> References: <2d4a8d8f-d17d-6f84-cd45-586db2f9728c@yandex.ru> <79484704-f981-5c12-e000-333b75499520@yandex.ru> <8816ba91-3c71-c04b-32fd-122047795421@yandex.ru> <83pmgzc6ut.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38636"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 17 16:05:50 2022 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 1oOJg5-0009wF-Or for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Aug 2022 16:05:49 +0200 Original-Received: from localhost ([::1]:49028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOJg4-0007EX-L4 for ged-emacs-devel@m.gmane-mx.org; Wed, 17 Aug 2022 10:05:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOJeW-0005vb-Eo for emacs-devel@gnu.org; Wed, 17 Aug 2022 10:04:12 -0400 Original-Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:36784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOJeT-0007QI-94; Wed, 17 Aug 2022 10:04:12 -0400 Original-Received: by mail-wr1-x42e.google.com with SMTP id j7so16351158wrh.3; Wed, 17 Aug 2022 07:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc; bh=IRa9srmJ0Zs5b7ffjSk0/WbaVW5nv5pkvYY4R2Id7xs=; b=ElY9RxatF7SYQhbJASqRO+KsoEwwbkapBMFMyLPgd8Le9/XVFw3Yl/PktwMVmRMhBp opFYZv4amtF44ejZ2R7U7QUEaNnYq2kUtjdIq5iClzb16Z8CnOBfTJF3l9lvWN6VYpws FzqpVgC5uD8OSoVXK7piF98x/a78SoNmDEsE7bm7/I/ycwt9k6oVpSMd10smc1xk5ar6 Ne8QzQKNAatthMn/XJ7F4NjAPOYOnZhQ4iuAF0npFPTHi4gQNXRNhNichHPZVRbWR2vd RZ+2iQ+e9YaIvGsSdyilApJwVQDb1h9VZvAEP6VaukbfDKCvhiJCJ3WTtXBb0XY7rf4W SwPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc; bh=IRa9srmJ0Zs5b7ffjSk0/WbaVW5nv5pkvYY4R2Id7xs=; b=g4AhnM6Q7c+YrTAbPFQNKREOQyMxncwtNKlXzMt+ptMH4arvj7VhuH9i8cQ4pCFGVG CKhnJbKmDBmJZkbM/2AemdZ/OWQrgZhY/9DDDZ8otXN+OxTiU/WRByiUDmP9utcpy+jF OC9nFXBjahDPVsHF1Y09z+mzZNjMl1nSoJfky5RD+1Sggdhsi2LPIgRBkF4ZUMq2o7Vh PCtS4kNgz1C/jLj7DMvVh4bgaiuLDdjUvaapQnT1AouB3Yru6yBBXWPlrU7jYujQSX9z zxlJJJ5Cgsw89qpNkssDKFuw3Pc2baehvQvrF272UUnOZwihfyOGrspdHYv8bKU1QvHF wJhg== X-Gm-Message-State: ACgBeo1I87QRXJ2ggtv372wbLc19wVnNkDiAMvVjXFOUF4NMg/CfL1cw GAswXsTNVE57maiLUv8SbFg6ktayhp8= X-Google-Smtp-Source: AA6agR6eYjXDNiS21UnrwXezLFHxJQ2mdTlS5BqOUK1GJlTToByVsnhIO/8fRQlyrw4MLoWjrGAiWA== X-Received: by 2002:a05:6000:982:b0:220:6e5e:1087 with SMTP id by2-20020a056000098200b002206e5e1087mr14380102wrb.82.1660745029154; Wed, 17 Aug 2022 07:03:49 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id c16-20020a056000105000b0021eb309c97dsm12977108wrx.25.2022.08.17.07.03.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Aug 2022 07:03:48 -0700 (PDT) Content-Language: en-US In-Reply-To: <83pmgzc6ut.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=raaahh@gmail.com; helo=mail-wr1-x42e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" Xref: news.gmane.io gmane.emacs.devel:293559 Archived-At: On 17.08.2022 16:55, Eli Zaretskii wrote: >> Date: Wed, 17 Aug 2022 16:40:01 +0300 >> Cc: emacs-devel@gnu.org >> From: Dmitry Gutov >> >>> Could be, but unless we go through the whole C code looking for checks >>> of BEGV/ZV and updating the code to also check the "soft bounds" this >>> won't work reliably enough to replace existing uses of narrowing. >> >> The point is to avoid doing that. If we can. >> >> For instance, use two overlays in the current buffer with `invisible' >> property rather than have the display engine refer to the new kind of >> narrowing bounds. > > That's a time bomb waiting to go off, because invisible text is > handled at a relatively high level in the display engine, and > otherwise the invisible property is largely ignored in Emacs. User-level features should be implementable in terms of primitives allowed in Lisp userland. > Moreover, it will make redisplay slower. Skipping invisible text is > faster than iterating through it, but it still takes time, whereas not > going beyond BEGV..ZV is instantaneous. Org, as one example, uses invisible text all the time. Other feature too. > And finally, I don't think I see the benefit of this, even if it'd > work: you want to get rid of (save-restriction (widen)), but you are > willing to have to replace that with tests of overlays and invisible > text all over the place? No, I don't think the addition of "tests ... all over the place" will be needed. The display engine handles the 'invisible' property already. A number of features/commands will indeed need to know the bounds of the user-level narrowing (and we'll have a buffer-local variable for that), but that's probably it.