From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Howard Melman Newsgroups: gmane.emacs.bugs Subject: bug#46878: 27.1; lisp-outline-level returns imprecise level number Date: Tue, 2 Mar 2021 11:35:01 -0500 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23773"; mail-complaints-to="usenet@ciao.gmane.io" To: 46878@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 02 17:36:13 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 1lH80J-0005wv-FL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Mar 2021 17:36:11 +0100 Original-Received: from localhost ([::1]:54658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH80I-0001Bt-EO for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Mar 2021 11:36:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH80A-0001B9-4d for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 11:36:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lH809-0002an-Tu for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 11:36:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lH809-0005Eo-RR for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 11:36:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Howard Melman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Mar 2021 16:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46878 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161470292020068 (code B ref -1); Tue, 02 Mar 2021 16:36:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Mar 2021 16:35:20 +0000 Original-Received: from localhost ([127.0.0.1]:54078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lH7zO-0005DV-Ks for submit@debbugs.gnu.org; Tue, 02 Mar 2021 11:35:20 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lH7zN-0005DO-LO for submit@debbugs.gnu.org; Tue, 02 Mar 2021 11:35:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH7zK-0000c5-No for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 11:35:12 -0500 Original-Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:34946) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lH7zG-0002OI-OW for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2021 11:35:10 -0500 Original-Received: by mail-qv1-xf2d.google.com with SMTP id h7so3232925qvm.2 for ; Tue, 02 Mar 2021 08:35:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=yxlza6AW3viSYNOK25vVDO84H/7Nfz+ynGk2zWpx2po=; b=rH+rudW3J6c9I4db5doM61SOdgk3Z9x2REmXqrD3ftK9/tq1xw3gwtJ7fk8KSk6Z6/ ljKNAB2CTehRHrRh0fclCk3qkAYtofE9OS+Yws0VMyQhtFUAuyRmHPBvgtL0KJncfrNS /xNDe5pZPZdVwJC2ZC/K6/0K2cG7Rbaz1GTW0p9uLbq9vP9utMbNI7xeTd/oK5J8yjP4 N3pnvA6GEilEXdgkr2mi8evzYcdRpHbIITOtHSFNLu8pK7r5LdPoLJtbVAsFvOJGe68S teOx5U20WQKHNd2ZXH/9S6F24v6TIOh9OUZho6P8R4lBMQjhXRJeivAVgFlvVwjOb4bE ueBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=yxlza6AW3viSYNOK25vVDO84H/7Nfz+ynGk2zWpx2po=; b=YYxE5xWQd67DvClN4aMtUPsauFNPNrC1DxRGkf1jdtlC8ZvSuZWjqLmYc2CKdm+p6Q JZklXSDIvqmM1igOwY7EVn/arEpcWU4474FopBjPNz/+PmsPNMP4S6POuN957MmY4YFo yi12Au95MAWEJqY92ERkF/ug4Ly2rEpw3UPYb+6LXkQAy/ST5YjkOrpDfPoxHqbZmihe bxXgQlbXThHh8jGUMQA2G/lwzP/BkpA0VqhjdW7+nIVkBrTVZ37Rwv3MmYKQL3Nyp6OQ TWueixaGRqz7mkpzhGE9CYShJrqFYBkoFfJ4NJL4nzshDI+r5HfIl5YWOQd9sCjez+cz JKSg== X-Gm-Message-State: AOAM530so3vAeCHFh8idX/WwwHPnh9pOJPpnYuGe52ZFP6ohMZJRkGoo euBIKntGCPHzn7dL5ZMQhDoTIOBaQiU4aw== X-Google-Smtp-Source: ABdhPJx5Sy33tk3biAQt3xXnLy/CGPbadVSAB/Y/rjFnI5r0ChTRazXoXJQPRjDpaytySNLpHuO0rg== X-Received: by 2002:a0c:b59f:: with SMTP id g31mr20390203qve.28.1614702903548; Tue, 02 Mar 2021 08:35:03 -0800 (PST) Original-Received: from lumet2.home (pool-108-26-232-211.bstnma.fios.verizon.net. [108.26.232.211]) by smtp.gmail.com with ESMTPSA id l3sm9120315qtd.38.2021.03.02.08.35.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Mar 2021 08:35:03 -0800 (PST) X-Mailer: Apple Mail (2.3608.120.23.2.4) Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=hmelman@gmail.com; helo=mail-qv1-xf2d.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: 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:201227 Archived-At: lisp-outline-level returns a functional but incorrect level number. Comments beginning with ";;; " should be at level 1 but it returns 5 because they match ";;; [^ \t\n]" and the current code just returns that length. The following version returns the right level following the convention that ;;; are top level comments and each lower level adds a ;. As in the existing code, lines that match an autoload tag or begin with ( return level 1000. This fix would be helpful for code that wants to deal with headings by level number generically (e.g., display the top 3 heading levels). Other modes like outline, org, texinfo, and html-mode return a level rooted at 1. Programming modes are more mixed, but this seems like an easy improvement for lisp modes. (defun lisp-outline-level () "Lisp mode `outline-level' function." ;; expects outline-regexp is ";;;\\(;* [^ = \t\n]\\|###autoload\\)\\|(" ;; and point is at the beginning of a matching line (let ((len (- (match-end 0) (match-beginning 0)))) (cond ((looking-at "(\\|;;;###autoload") 1000) ((looking-at ";;\\(;+\\) ") (- (match-end 1) (match-beginning 1))) ;; above should match everything but just in case (t len)))) In GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 = Version 10.14.6 (Build 18G95)) of 2020-08-12 built on builder10-14.porkrind.org Windowing system distributor 'Apple', version 10.3.1894 System Description: Mac OS X 10.15.7 Configured using: 'configure --with-ns '--enable-locallisppath=3D/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' --=20 Howard