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: Major modes using `widen' is a good, even essential, programming practice. Date: Sun, 7 Aug 2022 20:57:59 +0300 Message-ID: References: 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="1689"; 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 To: Alan Mackenzie , emacs-devel@gnu.org, Gregory Heytings Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 07 19:59:35 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 1oKkYp-0000H3-C3 for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Aug 2022 19:59:35 +0200 Original-Received: from localhost ([::1]:45234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKkYn-0003QM-NR for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Aug 2022 13:59:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKkXU-0002jg-Tk for emacs-devel@gnu.org; Sun, 07 Aug 2022 13:58:12 -0400 Original-Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:44731) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKkXT-0005Eg-ES for emacs-devel@gnu.org; Sun, 07 Aug 2022 13:58:12 -0400 Original-Received: by mail-wm1-x32c.google.com with SMTP id b21-20020a05600c4e1500b003a32bc8612fso3468578wmq.3 for ; Sun, 07 Aug 2022 10:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=yj3uhLAs7HmFTJssCDsgiA3b1k64QpFxuRMJxH1ZdgM=; b=ayCBUdxgGUs9U0kmPu6hGgKWUFc8HwlBmpVXLQyj4FfMShEAwOh8ZMiy13GQC8KQxu vOZM8kjQ5Rs31Lu5NSD6Tj/iLh3j2nQlkxlvYBJ5cev0mSObm777ABVA05xEW3AD5zcd Z4/RTaZOKeHxbIfYPT++q6sm5oFgObvoo0Rl/0xeT2il2hymWBZOvrkPuDcZE3z0Gycu 81pVwTaQMeu+HEmpIwrW/ayuv6Vy4umULLxXmhLZgaehVLXPf+W9eysignJio3LGjyB8 p4eXpshHl7o/edkqCsdRuRaebWtv815InRL01MI/iVjrCPCBytN06cLRKCnEaoVPNO54 BybQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=yj3uhLAs7HmFTJssCDsgiA3b1k64QpFxuRMJxH1ZdgM=; b=wush9dGG3uIX0tC1eCKpTfGDiKewGL+rRtWF+QiZY7uB5aW5bOzAJRQnEzZs0XfKVD WDSkspLVVKagMAxnVz9mlw4CzCmj6Zd7wPsXig497EbB6DoFNOfSbDKrnKTi58xwu5pg VOIqd7SDTDtDzxesc1PusNQXJ24CiQwOHlDNHSRbpYmKWn72Ubwp+RB0oy741GWD4qdA x349U8nF4PyZQF0Lnxu0DNOkamUCFcQZ3xVOjSgiFdJKXt9sowiEZnZL4qMCfPt1HX3b 27RwsCy8Ed8Trc9n7uYCWYeheOEJZQoEVLcresTLdpcD9gdOWwAULwuEVqRtZqVsa6ZM zMng== X-Gm-Message-State: ACgBeo0FhZg0L9XUyYs2/TxmyFAglhiPlVxwj0Ku6SJN7g1YqvO+Mg9O 3YCKE4QD1JhPfW6hjSwGotk= X-Google-Smtp-Source: AA6agR66yTZzEUpqhSKX7ITfdURuM65BqC3c9xrmRjAro9M78DH/T9sXLeiIkY8TteErjEOUmimXvQ== X-Received: by 2002:a05:600c:2907:b0:3a3:3451:6f96 with SMTP id i7-20020a05600c290700b003a334516f96mr15452828wmd.79.1659895081813; Sun, 07 Aug 2022 10:58:01 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id n11-20020a05600c500b00b003a4fb64efcasm15421039wmr.26.2022.08.07.10.58.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 10:58:01 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=raaahh@gmail.com; helo=mail-wm1-x32c.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:293223 Archived-At: On 06.08.2022 23:13, Alan Mackenzie wrote: > Narrowing is primarily a user feature. Users can arbitrarily narrow a > buffer to ANY contiguous region of text. So when a major mode needs to > examine text even slightly distant from point, it MUST widen, to be sure > that the text to be examined is within the visible region. Now wouldn't it have been nice if user-level narrowing didn't create an *actual* narrowing but only some visual perception of it? IIRC there is a third-party package which implements this approach. From what I've seen of feature requests related to narrowing in my packages, it's always along the lines of "please add (save-restriction (widen) ...) around the whole implementation". Are there actually user-level commands which should not ignore narrowing? If not, it would be better if user-level narrowing was implemented as something else (e.g. two invisible overlays). Then all other code wouldn't have to bother with undoing it.