From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tom Gillespie Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Fix hack-local-variables for find-file-literally with dos encoding Date: Sun, 15 Aug 2021 15:21:19 -0700 Message-ID: References: <87o89ygyu8.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12646"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs developers To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 16 00:22:28 2021 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 1mFOWR-00037O-Hp for ged-emacs-devel@m.gmane-mx.org; Mon, 16 Aug 2021 00:22:27 +0200 Original-Received: from localhost ([::1]:37542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFOWQ-0007zI-FH for ged-emacs-devel@m.gmane-mx.org; Sun, 15 Aug 2021 18:22:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFOVa-0006kw-3E for emacs-devel@gnu.org; Sun, 15 Aug 2021 18:21:34 -0400 Original-Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mFOVY-0003i6-Lk for emacs-devel@gnu.org; Sun, 15 Aug 2021 18:21:33 -0400 Original-Received: by mail-wr1-x436.google.com with SMTP id q11so20997887wrr.9 for ; Sun, 15 Aug 2021 15:21:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C4SZ33lllWbC71PhgbzB2lWLDDD78lRKJ4oqfMjwVNs=; b=lAzKd70E78zBZr1EbG8YoouXFtZ6sOrJhYRIIgNsvVrb/VmVjFbaq2P0abeCrg9Gmz wutqorUqvWi3bG1vlZg2J5TlgJ3Yz/FcgTeT9j1PZc28Oz6xVZV4yWPKgorozvuhzujD npor1XtI3ZtrK23DPXKaQXhjYKwtxIp4nPm6tWuvTUbNmk2oiVh+vJO/z6RxQSqwwqnd ainGVk5KwGxZMEt+KAoixH6hn78UbpHtCJGdLjTAd6+oX+uuLZyvvTVS6J1CYERQwTgG p7R7n3R74EyEo1Rk0jmPRs5SvzRoEWe+ZME/eV1+13cc82KmtEEqImnu0Rh8NFcuw3mV jn+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C4SZ33lllWbC71PhgbzB2lWLDDD78lRKJ4oqfMjwVNs=; b=GYVQWhtk2VsszIeELRYQDPvTJS14WGEeXrvZV0VTs7qrPiaKJ9MBIYVkYdq5BPErAJ ZyDOMfwUYhWA7SWilRvew7gIMspGYxObOhBo/xRog5WuOYmhTFgxCH0f64vtN+aej5iH nGH8FdfaMjKf1tOgasNeO0vDpK/X3ej0M2HiCJqcBZkLkBt04xC4wa00DQcgL+edhn+T f1hhDGGoC4S2S0VSx2HVu+V/294jUsZKUblCVkTynkqY0CBs9rPl5To8xnRc/vOpH1Pw n7FtRU3YFbBb8z1cBfH8Kpcd+RIORCWyt9BbNS5fi+fLThlrEC2Jotzwi8hAzRlu7dzW e14A== X-Gm-Message-State: AOAM530NuS+MS3KdnYO541oGogkGam6YC7Mtt59EYEGASgkw8RdL65De umYhFX5yyA2PZOGzCILfguglZSGX6bU3JAJvqaM= X-Google-Smtp-Source: ABdhPJxaLmSbcQsu77jcF53P3+LK3ndbDJZ6xMxAh0Pz/jIrnxkuhsg1348IFIdLpeAsYhDwXBoyywWUZnV/oNdI/x4= X-Received: by 2002:a5d:6108:: with SMTP id v8mr3540212wrt.96.1629066090758; Sun, 15 Aug 2021 15:21:30 -0700 (PDT) In-Reply-To: <87o89ygyu8.fsf@gnus.org> Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=tgbugs@gmail.com; helo=mail-wr1-x436.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.23 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:272415 Archived-At: > There probably won't be a 27.3... Ok, good to know. > > - (subst-char-in-region (point) (point-max) ?\^m ?\n) > > + (unless noconv > > + (subst-char-in-region (point) (point-max) ?\^m ?\n)) > > I don't quite understand the logic here -- shouldn't this be a > > (when noconv No, when we read a file literally we don't want to normalize anything. The issue is that 'when noconv' is set (i.e. we are in find-file-literally) then we don't want to convert ?\^m because the value of suffix contains ?\^m. Does this make sense? I tried other approaches including modifying the suffix but this one was by far the cleanest. > ? That is, if we're visiting the file literally, we want to delete the > carriage returns, but not otherwise? (If we're not visiting the file > literally, the CRLFs will already have been translated into newlines.) > > > + (with-current-buffer (find-file-literally tempfile) > > + (hack-local-variables))) > > Should probably be a `should' in here to make it work as a test, I think. I think that is right, it kind of works at the moment because the previous behavior produces an error.