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 19:27:09 +0800 Message-ID: <87lesargc2.fsf@localhost> References: <875yjfrq2w.fsf@localhost> <83r12356fy.fsf@gnu.org> <87v8rfq877.fsf@localhost> <83o7x66hgt.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="16816"; 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 13:27:13 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 1oHkcj-0004GV-94 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jul 2022 13:27:13 +0200 Original-Received: from localhost ([::1]:43996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHkci-0008Nd-9D for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jul 2022 07:27:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHkcY-0008NU-FU for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 07:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44404) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHkcY-0001K1-7Y for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 07:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oHkcY-0006cy-3I for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 07:27: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 11:27: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.165918037725419 (code B ref 56837); Sat, 30 Jul 2022 11:27:02 +0000 Original-Received: (at 56837) by debbugs.gnu.org; 30 Jul 2022 11:26:17 +0000 Original-Received: from localhost ([127.0.0.1]:34153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHkbp-0006bu-BB for submit@debbugs.gnu.org; Sat, 30 Jul 2022 07:26:17 -0400 Original-Received: from mail-pl1-f179.google.com ([209.85.214.179]:35566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHkbm-0006bg-SH for 56837@debbugs.gnu.org; Sat, 30 Jul 2022 07:26:16 -0400 Original-Received: by mail-pl1-f179.google.com with SMTP id t2so6661420ply.2 for <56837@debbugs.gnu.org>; Sat, 30 Jul 2022 04:26:14 -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=sX79YgWaDV9a0nA+xTL6Y6t+CgG5hoeqVtvNuJ01zXo=; b=kqBwgDS7E6J8d9l/77wBtBfGEydJc4G6pOIafEY5Fv9u1Q0x+sGU55K8Gq4IvRTNXo 1Su3jKpHBXy3r62ubHUUUjrSOGWAfpukYJ96AxaGYuQvNk08GZzh4iRD74CmlMreyR/Y oPRzizAzy+rr1nMl46J8hl+RPmbqGg2alzCW18PNyQ0ttRriQv15wbeAejxvtmX95BF5 DPrLPxJbcaSTXXcqugVXa3AFaqSb3VQLHybFwcuEnV85TVmMMS0VU/qpfom0i8o7D1Cj eHGDPE2xqpUneOrKIs0ECi7KGnpNdelZgpvZ3cltczL56pwHsic7NhCkO/4oyR+PXZxF flfg== 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=sX79YgWaDV9a0nA+xTL6Y6t+CgG5hoeqVtvNuJ01zXo=; b=Qge7cjReAr3sk4SSb+hgp10XdVP9LsPfGoyjF8LoDRNMmtQczHtDfxFAIom4bV4Ddp rnbmMnrMI/UVsvQbtteOJlOlxrMaWOI61i0WXREyl+EcS28r4U7V/fEhgapTtlsjzx2t K/kTrA9e76l79AIe3g2Z9IHZwzUS7nbzWclzin3O2rcfFVpOzd4gwVzdYnLfVXNHyago Tl/ATrt7Nz4yCmfmC1M5aEO8Lq11hemcm4cU/M8mOfz+gg4YDFgPRxBi7ctSPmyxjsel FRfOoVJgxnwQuV4A7R3Ik/sjdBwYsWImmtPzmpyrbZnitvr7uJO9kAa2XCz2GOzimUDE OC9A== X-Gm-Message-State: ACgBeo3k4xBXyI5c7VOqRDZcMaqM6WtL4D03qhTUByMaHo2cImLZ1FyW I2jFeLtEkEMGhSKWkYDn/imbr4b2MmjVmbkb X-Google-Smtp-Source: AA6agR4jGUzCkKCaGJAqi2iezfCmWru3MF1FGDtZqOx8qiklR0WyxXrDIXMAXhbiTVQWa6AJHtyyhA== X-Received: by 2002:a17:903:2347:b0:16d:c671:5d53 with SMTP id c7-20020a170903234700b0016dc6715d53mr7858237plh.47.1659180369016; Sat, 30 Jul 2022 04:26:09 -0700 (PDT) Original-Received: from localhost ([2409:8a70:217:4f80:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id b13-20020a65578d000000b00419fc2c27d8sm4092588pgr.43.2022.07.30.04.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jul 2022 04:26:07 -0700 (PDT) In-Reply-To: <83o7x66hgt.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:238252 Archived-At: Eli Zaretskii writes: > I guess you should temporarily remove the invisible property? Like > this: > > (let ((invis-spec buffer-invisibility-spec) > indent) > (remove-from-invisibility-spec '(outline . t)) > (setq indent > (save-excursion (search-forward " a") (current-indentation))) > (setq buffer-invisibility-spec invis-spec) indent) A simpler version would be let-binding buffer-invisibility-spec. Note that there is similar issue with current-column, though current-column is much less likely to be used without considering display properties. Would it be possible to include the "text" versions of current-indentation and current-column into Emacs? Something like (defmacro org-current-text-indentation () "Like `current-indentation', but ignore display/invisible properties." `(let ((buffer-invisibility-spec nil)) (current-indentation))) (defmacro org-current-text-column () "Like `current-column', but ignore display/invisible properties." `(string-width (buffer-substring-no-properties (line-beginning-position) (point)))) If not, could you at least mention the invisible text issues in `current-indentation' docstring? The current undefined behaviour is very hard to debug. Best, Ihor