From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56682: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing. Date: Fri, 30 Dec 2022 16:38:34 +0000 Message-ID: <6c9d91cffc1bfd801530@heytings.org> References: <166939872890.18950.12581667269687468681@vcs2.savannah.gnu.org> <20221125175209.51166C004B6@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37801"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 30 17:39:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pBIPX-0009f6-RM for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Dec 2022 17:39:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBIPP-00045f-U8; Fri, 30 Dec 2022 11:39:03 -0500 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 1pBIPO-00045Q-Hi for bug-gnu-emacs@gnu.org; Fri, 30 Dec 2022 11:39:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pBIPO-0006Ad-9g for bug-gnu-emacs@gnu.org; Fri, 30 Dec 2022 11:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pBIPO-0001gm-57 for bug-gnu-emacs@gnu.org; Fri, 30 Dec 2022 11:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Dec 2022 16:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.16724183176455 (code B ref 56682); Fri, 30 Dec 2022 16:39:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 30 Dec 2022 16:38:37 +0000 Original-Received: from localhost ([127.0.0.1]:36005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBIOz-0001g3-B7 for submit@debbugs.gnu.org; Fri, 30 Dec 2022 11:38:37 -0500 Original-Received: from heytings.org ([95.142.160.155]:51976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBIOx-0001ft-Nh for 56682@debbugs.gnu.org; Fri, 30 Dec 2022 11:38:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1672418314; bh=ZSFufi4Opmm0yp3OHVwmMcJgObyGhYQDfCOnEeZvX1c=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=THX/Q00R0QoOG07kEHJrlBg1Hcbt6Mh4HmS5lXEcwJb95GWWqkui6JZKzr9k1QHhD /qAnNeOVHX609OFWrbuazP8ort0ruDioY1zhJWwYXDyld9EYHMsmMcc3l3Y4abFgL7 vUx3j0qs6KInVpsjNxyRTyDiJ2mqy+MfYJy7rL2jXeY8qMhHUyyuckUPXyZz5POznq Trwx3mcJ1NO6zK1n9MomsVvcbgYGrrAARZHIJeIUmufNQcnqq9Wq8hBcUib/6XbIwB hzFv9JiuR4Ux9neDRdrJhFvU6kat7t1uSvKopBKtE740ribimQuc/3DjIl7Lod02cE Z+Rx0XUFyxBzg== In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:252139 Archived-At: [Moved to the bug tracker.] Thanks for your comments, Stefan! > > - I don't see any mention of those new features in etc/NEWS. > Yes, that's something I still need to do. > > - I can't think of a case where a piece of code could/should make use of > `narrowing-unlock`. > I don't understand what you mean by that. 'narrowing-lock' locks a narrowing, and is used e.g. in the 'with-narrowing' macro. 'narrowing-unlock' can be used to unlock a narrowing. > > - In `nlinum--line-number-at-pos`, I want to circumvent the narrowing > lock due to long lines (since its performance is only affected by buffer > size but not by line length), but I can't see how to do that. The only > primitive I see which would let me get out of the locked narrowing is > `narrowing-unlock` but: > > - I don't know which tag(s) to use. > That depends on the place where 'nlinum--line-number-at-pos' is called, or IOW where/by which function the narrowing was locked, or IOW again which tag was used to unlock the narrowing. > > - I don't want to remove the lock, I only want to circumvent it > temporarily, and I can't see how to re-install a lock after removing it > (`narrowing-lock` doesn't fit the bill because I don't know the bounds > of the lock and because that would not preserve the stacking order of > locks). > That's part of the improvements you suggested, and I implemented. Simply do a: (save-restriction (narrowing-unlock 'the-appropriate-tag) (widen) ... your code ...) Upon return from the save-restriction, the narrowing locks are restored.