From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#56837: 28.1.90; `current-indentation' sometimes returns zero inside invisible text Date: Sat, 30 Jul 2022 17:08:12 +0800 Message-ID: <87v8rfq877.fsf@localhost> References: <875yjfrq2w.fsf@localhost> <83r12356fy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25830"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56837@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 30 11:08:14 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 1oHiSE-0006Zn-Iv for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jul 2022 11:08:14 +0200 Original-Received: from localhost ([::1]:57656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHiSD-0001bP-IC for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jul 2022 05:08:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHiS2-0001ZE-Th for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 05:08:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44285) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHiS2-0006iK-KE for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 05:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oHiS2-0000SJ-Fq for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 05:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Jul 2022 09:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56837 X-GNU-PR-Package: emacs Original-Received: via spool by 56837-submit@debbugs.gnu.org id=B56837.16591720411681 (code B ref 56837); Sat, 30 Jul 2022 09:08:02 +0000 Original-Received: (at 56837) by debbugs.gnu.org; 30 Jul 2022 09:07:21 +0000 Original-Received: from localhost ([127.0.0.1]:34028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHiRN-0000R2-DM for submit@debbugs.gnu.org; Sat, 30 Jul 2022 05:07:21 -0400 Original-Received: from mail-pj1-f51.google.com ([209.85.216.51]:55940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHiRJ-0000Qk-FG for 56837@debbugs.gnu.org; Sat, 30 Jul 2022 05:07:20 -0400 Original-Received: by mail-pj1-f51.google.com with SMTP id b10so6505001pjq.5 for <56837@debbugs.gnu.org>; Sat, 30 Jul 2022 02:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=YCRDEZM0TdTFlBeTPhseiHWNkPYU7cXuYRPtmj5Y8/0=; b=LZbNF2omA6fekXL0TTSKvjXkw77reT46fO/dOQ3DWIhMF5cxugUuC/4dumzG6WK0Pg izYJDz17ZHRWV/qCGRAaHhA6/brA4WdvECZTsrn2BGCT4DnNMt8jWXWC9Ec+9W8OK5OA yXwsoBDpDRbweHzbaKAVVaZKj+k8pVMJiv0ESZ/jRCwgTD1Vxwab5zWz4BC1Y5gNeuAv FVrJqgvRDX/yJnSlAgYJlmGIJOZ3Ox3tgyDcIYD1fdgB59L+d2s+f1+N35ddFeua/WKL 9L9TiCFuPNMXIpeTrecp2HPiTCfdV2RzVQ3rpsAWaql4MD3KsXIhyHesLGG8RsVji2u4 08kQ== 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:in-reply-to:references:date :message-id:mime-version; bh=YCRDEZM0TdTFlBeTPhseiHWNkPYU7cXuYRPtmj5Y8/0=; b=NL5lqwruNUvtXeQKsbxvcc4PH3bDQrAMUJBQ4Xu4g4pUwaZvgGb6vuPXwHk4yZB4r9 mA4Bs67foblEadbWe9ekmAQHtzMkT2prMnBcBoiNEQys16Dy0hRVXQpQNLCBQnu61jhu 0TTX7SiqPsRiu9iw2Q4XuaRtIuzp2j8oXNL44Wyb1lr++qUl34NdYCXFEEFN8hAldUmS f9rCpZTKLthJUDsMLruZv1M2+rKavJJ/9KXuulXUtY1Tqhg69tuR2LheK+o1mLuKWvZr GP0iKLbXzhKry3IsBZxGlPUYSeHjWswRfRnBQsYuWIYQ2uimxJi+u0ujcEUx9wnDVe6g T60g== X-Gm-Message-State: ACgBeo0RrZ1JHG3CeczcmGQTby64Ar6SbP/yrimh44ANGMLR817xTQwy XF64AZiQytXULAUgo7BfAWO8fCDpMGqr1A== X-Google-Smtp-Source: AA6agR6qiSRXnKCiUU+ke4XPui9Kh5VwpEWXBmfaOpkSQcBp9nf/5RbMXmsVNf1Ggn3iBkNtBlgGVA== X-Received: by 2002:a17:90b:390e:b0:1f2:b7b6:9f9 with SMTP id ob14-20020a17090b390e00b001f2b7b609f9mr8727966pjb.64.1659172031468; Sat, 30 Jul 2022 02:07:11 -0700 (PDT) Original-Received: from localhost ([1.83.155.1]) by smtp.gmail.com with ESMTPSA id q17-20020aa78431000000b0052d2b55be32sm297153pfn.171.2022.07.30.02.07.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jul 2022 02:07:10 -0700 (PDT) In-Reply-To: <83r12356fy.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:238245 Archived-At: Eli Zaretskii writes: > I don't understand what is the purpose of asking about indentation of > a line that is completely invisible. current-indentation skips > invisible characters, so if everything is invisible, why do you expect > any useful result? This is needed for parsing. In Org, indentation defines the list level. Similarly, indentation is meaningful in Python. Since parsed text can be hidden inside fold (using org-mode, or outline-mode; the latter may also be used in Python buffers), getting an accurate indentation is important even when text is invisible. > Technically, the difference between the two results is because > current-indentation tries to account for the ellipsis (which is > present in the first case but not in the second). But that's not > relevant to the larger issue at hand here. I do not understand how ellipsis can be meaningfully accounted for with regard to indentation. AFAIU, they are not. Try * something a * else 4. Move point to "* something" 5. to fold the outline 6. M-: (save-excursion (search-forward " a") (current-indentation)) ;; => 10 > Bottom line: I think you are hitting undefined behavior here. Maybe. But then I'd like to be able to get the "hard" indentation information for the underlying text in buffer, accounting for tab-width, and disregarding overlays and other font-lock staff. As I mentioned above, this is required for parsing. Best, Ihor