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#46859: 28.0.50; [PATCH]: Add option to truncate long lines in xref.el Date: Thu, 04 Mar 2021 16:47:30 +0000 Message-ID: <9cff0f889435d8d03313@heytings.org> References: <87im69uzlt.fsf@mail.linkov.net> <878s74fv27.fsf@mail.linkov.net> <4119ea3055ef8f306fc0@heytings.org> <4119ea30557ef84ca190@heytings.org> <7eb7ee0f-7dba-c90d-cb58-af42c3828643@yandex.ru> <4119ea30554b406efbbf@heytings.org> <4119ea30558f1e4145b0@heytings.org> <4119ea30555e80bdcf7e@heytings.org> <1c82e582-8b90-f3c5-5391-1e88ca4e7ab2@yandex.ru> <4119ea30553e3f90ab8c@heytings.org> <87y2f42ex5.fsf@mail.linkov.net> <4119ea30552873ab9870@heytings.org> <83eegvk2u0.fsf@gnu.org> <9cff0f8894658f3b50c8@heytings.org> <83y2f3huz2.fsf@gnu.org> <9cff0f88942d4103c685@heytings.org> <83mtvjhrzj.fsf@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="34551"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46859@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 04 17:50:03 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 1lHrAo-0008su-Sb for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Mar 2021 17:50:03 +0100 Original-Received: from localhost ([::1]:50044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHrAn-0003Wr-BI for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Mar 2021 11:50:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHr8s-00023X-RI for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 11:48:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48467) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHr8s-0004TG-IU for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 11:48:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lHr8s-0001Vb-DR for bug-gnu-emacs@gnu.org; Thu, 04 Mar 2021 11:48: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: Thu, 04 Mar 2021 16:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46859 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46859-submit@debbugs.gnu.org id=B46859.16148764545765 (code B ref 46859); Thu, 04 Mar 2021 16:48:02 +0000 Original-Received: (at 46859) by debbugs.gnu.org; 4 Mar 2021 16:47:34 +0000 Original-Received: from localhost ([127.0.0.1]:60013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHr8Q-0001Uu-HW for submit@debbugs.gnu.org; Thu, 04 Mar 2021 11:47:34 -0500 Original-Received: from heytings.org ([95.142.160.155]:43082) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHr8O-0001Um-Jd for 46859@debbugs.gnu.org; Thu, 04 Mar 2021 11:47:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1614876451; bh=v5FFdOTvUizGiu0aNKqUQbkDZKvKIyhlk6Da4xHu+W8=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=rCa3sXzvRqYOpKw8qIurc9Nj+tKDaVrV4Sy305FjEeKILHg1qqOBRDMwiPjP4G5yd NF6dw4UpK+yxr1e2EUqV4r50jdhaKEGr1FJbG+YoSD/bm0cHubXFMjN5uqfoAEuU6T JHx8iOHlY9zr+bM1MqulyAwcHcWY8tUzTm4DVaSCxp6WbIGK14RQE0Bo45BJSBpI48 7fJWAXOwhs1oHkOMgrEQYbI6RAdTAd7lTY/h+S/lYM/t1X46zFCuE7ZFU+RwL/aVqS SPbs8SrnGoyA0Ch0zYE7RPPVKzjAyZ+CLgoqPu2BRCJN+mA9R8QoQKRPteVi6tMDoR nh82b7ULgl5Gg== In-Reply-To: <83mtvjhrzj.fsf@gnu.org> 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:201409 Archived-At: >> But you provide the solution: when an xref is followed, the file is >> opened in a buffer, at which point buffer-file-coding-system is set. >> So it seems that it suffices to do (goto-char (filepos-to-bufferpos >> (get-byte-position))). > > Yes. But it can be slow. > Can it become so slow that it would have an impact on user experience? filepos-to-bufferpos would be called only when the xref link is followed, so I guess that even a 0.1 or 0.2 second delay should be okay. >> I just did a filepos-to-bufferpos for one of the last bytes of a 6 MB >> Latin-1 file, and it took only ~2 ms. > > Which value of QUALITY did you use? > I just tried again on a 25 MB Latin-1 file, on one of the last bytes it took ~13 ms without specifying a quality. I tried with nil, 'approximate and 'best, but do not see any difference, the result with benchmark-run is always ~13 ms. > > Also, what happens with multibyte encodings that are not UTF-8, like > iso-2022, for example? > Well, the Latin-1 file is already different from UTF-8. I don't know anything about ISO-2022, but tried with a 25 MB file, created with iconv, which Emacs recognizes as an iso-2022-7bit-dos one. In that case filepos-to-bufferpos does not work at all, with 'approximate you get a position that is about 2 million characters away from the correct one, and with 'best or nil you get nil...