From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#36085: 26.2; find-dired octal escapes instead of Cyrillic text Date: Sun, 13 Mar 2022 11:35:01 +0530 Message-ID: <87ilsigzg2.fsf@gmail.com> References: <83o938nl9j.fsf@gnu.org> 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="27068"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , grindeg@yandex.ru, 36085@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 13 07:06:17 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 1nTHMv-0006qy-AY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Mar 2022 07:06:17 +0100 Original-Received: from localhost ([::1]:49624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTHMt-00034X-Tn for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Mar 2022 01:06:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTHMh-00034K-Hh for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2022 01:06:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTHMg-0002Mo-2b for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2022 01:06:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nTHMf-0008Sm-TO for bug-gnu-emacs@gnu.org; Sun, 13 Mar 2022 01:06:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Mar 2022 06:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36085 X-GNU-PR-Package: emacs Original-Received: via spool by 36085-submit@debbugs.gnu.org id=B36085.164715151232471 (code B ref 36085); Sun, 13 Mar 2022 06:06:01 +0000 Original-Received: (at 36085) by debbugs.gnu.org; 13 Mar 2022 06:05:12 +0000 Original-Received: from localhost ([127.0.0.1]:41463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTHLs-0008Rf-DL for submit@debbugs.gnu.org; Sun, 13 Mar 2022 01:05:12 -0500 Original-Received: from mail-pl1-f195.google.com ([209.85.214.195]:44942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTHLq-0008RO-Fm for 36085@debbugs.gnu.org; Sun, 13 Mar 2022 01:05:10 -0500 Original-Received: by mail-pl1-f195.google.com with SMTP id q11so11007723pln.11 for <36085@debbugs.gnu.org>; Sat, 12 Mar 2022 22:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=GAwoLJDNR7yHRXHxHEpgO2UqjdTuHclyq+LmTFKycOM=; b=BEYSt7tlEGZPsxWcueH63vw3V4HA17CpLPhfEgI3HAYnHVh/EyrLymfekmBHF32Nxd CsNRfXynMYXPkbgIt8z6/JBsgxfzcAGexad9kmvmBJ1qePd2lHyIDAxqO025f1ywAtvE Rs7UH1Lc0AzvfRdjw/QLoBNPkHMPmTxqH9S2P1LxlcbzozM+YjGeQMJNKfJtETkXHJWh 2guK92poGi1QqzTjEQnoSKsYnSEOPStgLK2mMSsijeuCFR/fB8PmsmkPRWVi4+s9QBmD fOQa3Y26VtzThdMB1xWGcgkX3Ga2hcKcEhOjYPMf9L2xPPdbeKTGRazgiBlK+wzmJOP4 4Lvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=GAwoLJDNR7yHRXHxHEpgO2UqjdTuHclyq+LmTFKycOM=; b=pFV7Atg7MNRhRBiX712rF0fl6s06+htdFgMDBzVn1tAMUoruijnk3XV4oaRUdUKKik ilXO6jvNnYeWXyLE/lXMryKu1BEomfsEuZ5g07PytJqFBxEUvVITO3F0FugAVs9UazPO V6VsGapw8PSz5pHGhL3i02dPGEsC2isUSCxLY7zHBweEPwkqE1e95X857yebMreVqDQR htQah2CgRy9ujfirVhtGGKKxRtAVrH/t8oOjI/M+dNM190ZbBclaRDziH/bfNxqs8JIp YU8CImIJgv18LBx1/qlS5cdF2YvdBeKmLobMwXp4QldUACYAVz5O7UuZUAWjYeEl4lMX 9C1w== X-Gm-Message-State: AOAM532L5XVMF/XbGRED+F06iSMe0Al6kWMGL30aKdkrF0ydItO66O/+ EoyUC/c6a/vCd70v+4R0s/U= X-Google-Smtp-Source: ABdhPJwdHDNU3FQ/ypEdoqpkUvN2ztpBl81wtrDUjxVueDa4sQepYZHvAEtv8bzzTgYsfSbofOQBlA== X-Received: by 2002:a17:90a:8581:b0:1b2:7541:af6c with SMTP id m1-20020a17090a858100b001b27541af6cmr19257223pjn.48.1647151504581; Sat, 12 Mar 2022 22:05:04 -0800 (PST) Original-Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id oc3-20020a17090b1c0300b001bf8c88a8c4sm17573207pjb.35.2022.03.12.22.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Mar 2022 22:05:04 -0800 (PST) In-Reply-To: <83o938nl9j.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Jun 2019 18:34:48 +0300") 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:228281 Archived-At: [=E0=AE=9A=E0=AE=A9=E0=AE=BF, =E0=AE=9C=E0=AF=82=E0=AE=A9=E0=AF=8D 08 2019]= Eli Zaretskii wrote: Hi Eli, >> From: Mattias Engdeg=C3=A5rd >> Date: Sat, 8 Jun 2019 17:14:11 +0200 >>=20 >> Eli wrote: >>=20 >> > P.S. Emacs could perhaps go above and beyond the call of duty, and >> > attempt to convert the octal escapes back to readable text. But I >> > don't think we should do it, as it's a clear bug in >> > 'find'. Nonetheless, if someone wants to submit patches to do such >> > a conversion, I won't block them. >>=20 >> The default (BSD) find in macOS does not seem to escape anything; >> files named =D0=9F=D0=BE=D1=80=D1=82=D1=80=D0=B5=D1=82 or APL\360 are pr= inted exactly that way. Thus, >> Emacs would need to know what 'find' it is running. This appears to >> validate your recommendation. > > Indeed, the hard part is to distinguish between \nnn an octal escape > and the literal string "\nnn". That difficulty is one reason why > gdb-mi.el performs a similar decoding only as an opt-in optional > behavior. After being annoyed by the same exact behaviour, and with the helpful hint about gdb-mi.el, I came up with the following function. With a preliminary testing, it does not choke on literal "\nnn" and it does not noticeably slow down find-dired unlike the xargs option. Maybe, we can include something like this, WDYT? (defun vz/find-dired-unescape () "Unescape the C-style octal escape strings." (while (not (eobp)) (when-let ((beg (next-single-property-change (point) 'dired-filenam= e)) (props (text-properties-at beg))) (goto-char beg) (while (and (re-search-forward (rx "\\" (group (any "0-7") (? (an= y "0-7") (? (any "0-7"))))) (line-end-position) 'noerror) (not (eq (char-before (match-beginning 0)) ?\\))) (let ((num (string-to-number (match-string 1) 8))) (replace-match (unibyte-string num) t nil nil 0))) (decode-coding-region beg (line-end-position) buffer-file-coding-= system) (set-text-properties beg (line-end-position) props)) (forward-line))) (custom-set-variables '(find-ls-option (cons "-ls" "-dlis")) '(find-dired-refine-function #'vz/find-dired-unescape))