From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.bugs Subject: bug#50646: 28.0.50; narrow-to-defun sometimes narrows to wrong defun Date: Sun, 19 Sep 2021 21:57:27 +0200 Message-ID: References: <3a6fa91859db00e5c382752ddedfbdd0@webmail.orcon.net.nz> 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="33391"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 50646@debbugs.gnu.org To: Phil Sainty Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 19 21:58:17 2021 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 1mS2x5-0008TF-Oe for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Sep 2021 21:58:16 +0200 Original-Received: from localhost ([::1]:44906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mS2x4-0005V7-9r for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Sep 2021 15:58:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mS2ws-0005Ut-I6 for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 15:58:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mS2ws-0002LG-5m for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 15:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mS2ws-00040J-5g for bug-gnu-emacs@gnu.org; Sun, 19 Sep 2021 15:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arthur Miller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Sep 2021 19:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50646 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 50646-submit@debbugs.gnu.org id=B50646.163208145715360 (code B ref 50646); Sun, 19 Sep 2021 19:58:02 +0000 Original-Received: (at 50646) by debbugs.gnu.org; 19 Sep 2021 19:57:37 +0000 Original-Received: from localhost ([127.0.0.1]:40028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mS2wT-0003zf-Br for submit@debbugs.gnu.org; Sun, 19 Sep 2021 15:57:37 -0400 Original-Received: from mail-db8eur05olkn2013.outbound.protection.outlook.com ([40.92.89.13]:60161 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mS2wQ-0003zR-Ht for 50646@debbugs.gnu.org; Sun, 19 Sep 2021 15:57:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EZICykoCeMt/HExlPU2/3dsgnXhpIK1B1soC4c+TXDmRaY4BqKGtDn4i5fP7hdXqQCTr+vUYF/Nn3MdP412vzk5HVs87yR1etg2V41UkJqpcjuCR1/Hk65/hLn7PR9jokWQlUuWd+F1hEclfKXN1/PHRswr8f6lp9r215Th4Ed/cb3IHAS/9w5+1ryEB+j56rrF+SWrT57oebesukIoKUoUdNbt2uXQlQtSwQWSM0wtu+IWiGeP2kSWLCV6kcAgU4vXHM0hPQrM/1+6HdtEWFj5XpAQjdla+fF0jvm/l4PK5/E/rqA/PygYApFVC4wrlQj3ngp7IvwwwySqN7BZDbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nYzZd9y+Dm9mNZUI8/voc9+Jiqfu1iFDl7nznFDxIxw=; b=KU88dvfQQOLyR1cyK3gUPaunAHQ6VU3WwyAR/LaGKAIFs2Xj8ylQOUNcqdwdKY0jm3HOBUyzTMeVw77GaAlaOk/hkNdqBehnbyI5CK8CKXVj+kNN1/Q90WVqhg0O0QZUGJ4/vr3eANLqKndKC2w3ya23UdBZewyx7JI1anBQjQ+47OhGskVvZJ+OOcVVg4QAetbQvx7zO217tkT3kWRU9xLL9NZ9fkzih5TfVHXk980YnOQvW8TbIFTEMwF07Y+tTbrN4kZyZu2Xuw/c20fBDRshM00BFQ3s72+kGh4POLmqKOY3n6aexm4sXv/PGiP6uX3VWf/evHv3huHIz4tPEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nYzZd9y+Dm9mNZUI8/voc9+Jiqfu1iFDl7nznFDxIxw=; b=sy+u4p8ParcS5hKuySw7HxzK227qBgREJeWbgYBXD28F8w5HXX0fCeRHWU3CdysGaLiWYPzLoXWQcmvyPDIrhA4BbBNp5p2ufxmVIwL68tluXfv7hACXZZEXIfDe3KWhw7rLcBMWgPxJSYyJV5jkGJbWr76k8Ek2fNG8VCF+57xy6o6LnkOCwxT//wTsf+QaJeOdnS3WIbc9Vqr3gTew44geEI9k4QsdWCSd0Cdg9I9VtIYQ5jwl5cwYrszSNELkCap+zuGAcap55uoDJfycktgcidWcDq3LVqAC/vkkNna1M1S9AOP931MAHtNfXq7AlA1wBQbqosYRK1Nzf5WiJg== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM9PR09MB4771.eurprd09.prod.outlook.com (2603:10a6:20b:284::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Sun, 19 Sep 2021 19:57:27 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%9]) with mapi id 15.20.4523.018; Sun, 19 Sep 2021 19:57:27 +0000 In-Reply-To: (Phil Sainty's message of "Sun, 19 Sep 2021 22:04:13 +1200") X-TMN: [A5QlSHPPnguirD52VGE97Hv/Iq04HRft] X-ClientProxiedBy: AM6P192CA0072.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::49) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <871r5ke3tk.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6P192CA0072.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:82::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Sun, 19 Sep 2021 19:57:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c59693ff-f54e-4e36-7a1f-08d97ba7b4e8 X-MS-TrafficTypeDiagnostic: AM9PR09MB4771: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9/GJzgLy3O70dSfz11wX8jduZCfK7EM3HKRF83/dE6PNg0SGZRRNe6goAbBHOrOQ8N8HpNUghOpxPnC/Hld0dcB4i8rh3KAAnrxSomp2DMP1scQ4SHnTdAr6+8pG6oOgJKm6ctrczQufGrbMiMcw1yA9BAN8LhVQt+I5Cmg4NfhyW7u1dDG1w1s6Q2febeqw3DJPTKQxybFxdElt1qtoS0Uk0wOF9nzinuJGDljUMA9mnUmik19gMDPxPhx7jBrbRmN8Kpqj4qlWxtBhugAjfsfoQ3R3j73y6jjqD9i16GYlJ8PKU743ySEOHZRq1HCBku2cHrd+aTkUEDnJ+H6UF2YoHCuL4WnAKo1SPJnoA8+yhDsbJri6mJV42+owcbAf0QF31e8B/zjja4L2gxJbFd6WppGAPxld0qNsgzG9+pG5PzNYBp/iJHub//BKgMkQ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EVLaos/dS7HPLxLhx2A8ZahyJi1uJCQ93DIzeU1GGK+LxnyCqQ8G1b/ZXQuMzzNMPgFSW64ut8hDWxUUObvr5HROoX5r6UP+R69O0WsV3Zp4K8yenJgo5ymc6bG0BXUUQLhrxsTQh5Pcb5B/HdDbzQ== X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: c59693ff-f54e-4e36-7a1f-08d97ba7b4e8 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2021 19:57:27.7641 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR09MB4771 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" Xref: news.gmane.io gmane.emacs.bugs:214783 Archived-At: Phil Sainty writes: > On 2021-09-19 20:33, Arthur Miller wrote: >> (with-temp-buffer >> (insert-file-contents-literally (expand-file-name file source-director= y)) >> It is the utf-8. When I use `insert-file-contents' instead, it works as >> intended. >> I guess insert-file-contents-literally does not preserve same coding as = what I >> have in the temp-buffer by deafault, so things get messed-up. I don't kn= ow if >> I >> explain it well, but that seems to be the problem. > > Yes, all of the following things from `insert-file-contents' are NOT done > by `insert-file-contents-literally': > > "This function does code conversion according to the value of > =E2=80=98coding-system-for-read=E2=80=99 or =E2=80=98file-coding-system= -alist=E2=80=99, and sets the > variable =E2=80=98last-coding-system-used=E2=80=99 to the coding system= actually used. > > In addition, this function decodes the inserted text from known formats > by calling =E2=80=98format-decode=E2=80=99, which see. > > I don't believe you would typically use *-literally unless you specifical= ly > wanted to avoid all of those things (or some of the things, and were happ= y > to take care of the others in your own code). > > I do also think that the docstring for `insert-file-contents-literally' c= an > be made clearer, firstly just with a newline so that the context for the > final sentence does not begin in the middle of a paragraph, and secondly > so that when users are reading this for the first time it's more obvious > (before reaching that final sentence) that the list of "modifications" ar= e > things which do NOT happen if you use this function. > > How does this look? > > (defun insert-file-contents-literally (filename &optional visit beg end > replace) > "Like `insert-file-contents', but only reads in the file literally. > See `insert-file-contents' for an explanation of the parameters. > -A buffer may be modified in several ways after reading into the buffer, > -due to Emacs features such as format decoding, character code > -conversion, `find-file-hook', automatic uncompression, etc. > + > +In other circumstances a buffer may be modified in several ways after > +reading into the buffer, due to Emacs features such as format decoding, > +character code conversion, `find-file-hook', automatic uncompression, et= c. > > This function ensures that none of these modifications will take place." > (let ((format-alist nil) Yes I am quite aware of the difference contents-literally and not. That is why I use it. Actually today when I opened the file to continue the work on my patch, I saw I used literally and it struck me immidiately what = is going on :). I don't know why I didn't see it the other day. I worked with = the C sources, and there I wanted "literal" version (I still have it in the submi= tted patch). I didn't have time to look through the subr.el today, and I am real= ly not familiar with it so it is really good if you took the time to look thro= ugh offending characters and fixed the bug! Thank you for your kind advices and work, it was very nice that you look th= rough the bug and tried to help me and fixed it.