From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id eJhOCstydmeQaQEA62LTzQ:P1 (envelope-from ) for ; Thu, 02 Jan 2025 11:04:58 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id eJhOCstydmeQaQEA62LTzQ (envelope-from ) for ; Thu, 02 Jan 2025 12:04:43 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=purvis.id.au header.s=fm1 header.b=Yd4rd0Xe; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm2 header.b=C9e5EaQ2; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735815883; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=suWpHu2gXQqLg2CqnAYC7P8zSDaOufEv8rw3JUW9axc=; b=Z/LnRKwtpZCRVUFOIsghU4GvsI/wOLOETv/dWCupaaDdozUaT9I+tjDppXVvERxLeQyBaY GdwOBBH1eLPWQ3dtaiO/8tB4Etu+OXXHywEGQDJhM/eZZrFBBw/FMg6oy6DKwewPyDDU0Z SAooFKAaAENdSqBqaUq5ok4VSah6hAhKRyEGtTEJodgpHh741NsV0+12yao4kjFXWVCMsE MLeZbMaS3alnXWPsi0UaS/PodRkIe/CQ6JNTJJMOqyU7fbIl53b3EtomuyiRaNFXNsxldy rT3k17BCg3qtBls1FPETmO6QeQCmQ7fdkMziTaIAG1QeX0eDQDzawHkCleB+MQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=purvis.id.au header.s=fm1 header.b=Yd4rd0Xe; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm2 header.b=C9e5EaQ2; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735815883; a=rsa-sha256; cv=none; b=RdyTYF+WXSlvz4hA7C5VXPsrpOtB6gBpCGOeNJ/WK1T1prAl+JpkewlvivXeBc/nlN6vT7 AJFbdsowiwGUc4DKlh1BvVrhwzfst7C+TbB3Ah3d8H+D+MhTW+py3bzg3yF3Zkh7AbD3dz G0qcxoL0az/OFuQL+dGH65GBYAavoDgVM67snCsUy1SFb5sEYlR4GfKlFVPlBsyOjG0ChO DoI/ZNmXAmI6cFRYfWZ5KltcoNzeFimebteWGaqOFA9F297Ts8WeRw5p4hYDTmpe4XcYYH XBrjwRj7YRcdfmY2by6bX9qFkrZK+iESmvgv4lFIYc+/Lm0RSsVPJtQ5PF0vrw== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E132624B0F for ; Thu, 02 Jan 2025 12:04:42 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTIzM-0000Vi-1l; Thu, 02 Jan 2025 06:03:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTIzK-0000VQ-0T for emacs-orgmode@gnu.org; Thu, 02 Jan 2025 06:03:38 -0500 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTIzH-0000tl-D6 for emacs-orgmode@gnu.org; Thu, 02 Jan 2025 06:03:37 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 7E3701380176 for ; Thu, 2 Jan 2025 06:03:32 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 02 Jan 2025 06:03:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purvis.id.au; h= cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1735815812; x=1735902212; bh=kyjEBNZyTP a+YzRdxHLH8B87c0jkxyVlclbCg86/4wI=; b=Yd4rd0XeptTSeLz5QDoN++lxvb qDpkQ1I4WeRPZy1fYAc4EE/dRZpGFWwTFSw5AsR3qP5KWXfKsqsGRNhLZmRAPKCY Yf5DbTW5eXy5opJOGtQHmJdnTQeXF/glZm6mBKD5SB1mHNf/1+SvuvdpvEEC1puy maIaebven/35rMjsk3B+FoKnjDv5tf7lfrzfDLmeFlJFXxYdyTNi69McylHRTSDx OSJVdaVvUVPPKf1SwUgLsFtul7+qEngQfvmcfR1S1Q88n1bCs0NIJr4ZV1PJRvEm cSYC+9VwKTi7P/Ahja6WXyVDTDg7AM1Tadf3xMsT0h1nyRDeFFvuPhMbgIuQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1735815812; x=1735902212; bh=kyjEBNZyTPa+YzRdxHLH8B87c0jkxyVlclb Cg86/4wI=; b=C9e5EaQ2dahzY0oYWfAIxdkYKBE93ay0Ont4/Kj/r5Vul21DCGM w1hRbF9Uvq5rLozcP4dxNfwiNiIyOtu1HOY4D73Fg7akiLPwNYUMJJR/rRjJdckJ 7vxqjAv0SnuSYOSN8mlfY0M+lHKtnSoqFDiCU6qNRZWLLFkbWS46ZV5KVPH7ST1N F0ODUcXx7ilHvVDNcfcFn3NdQPXeAQKBCWuK8416ObhfyZD3wKxe5ToDwttL1xiA jTiSsYBkiosFeAFgLVCL1GyYkFro/DPBn7ofVCzSfqYEIIn2tPYpIuoim7zitVIj KBIaE7l5PMK9C1uVpD8fcYqvCIfVQFwc90Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudefvddgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffujg hffffkfgggtgesmhdtreertdertdenucfhrhhomhepofgrlhgtohhlmhcurfhurhhvihhs uceomhgrlhgtohhlmhesphhurhhvihhsrdhiugdrrghuqeenucggtffrrghtthgvrhhnpe eiudfhueeigfevteevgedutdevleejgedvgfduleeuvdeiueevudeukeefieelvdenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghltgholh hmsehpuhhrvhhishdrihgurdgruhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhht phhouhhtpdhrtghpthhtohepvghmrggtshdqohhrghhmohguvgesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i9199493a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 2 Jan 2025 06:03:30 -0500 (EST) From: Malcolm Purvis To: emacs-orgmode@gnu.org Subject: Re: [PATCH] Add next-error support to org-lint report buffer In-Reply-To: <87cyhb970e.fsf@localhost> (Ihor Radchenko's message of "Sat, 28 Dec 2024 15:12:01 +0000") References: <874j2tibsn.fsf@localhost> <87cyhb970e.fsf@localhost> Date: Thu, 02 Jan 2025 22:03:26 +1100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.145; envelope-from=malcolm@purvis.id.au; helo=fout-a2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: 3.50 X-Spam-Score: 3.50 X-Migadu-Queue-Id: E132624B0F X-TUID: t+e3kYJxbIVl --=-=-= Content-Type: text/plain; format=flowed Thanks for the review and happy new year.. >> -| {{{kbd(S)}}} | Sort reports by the column at point | > Looks like you deleted this line by accident. I've restored this in the patch below. > I just tried your patch on an Org file with 2 warnings and tried > to press C-x ` repeatedly. Upon moving to the last line in *Org > lint* buffer, I got This is a bug in the original org-lint code, where this error was raised it you pressed on the line after the list in the report. The next error code just did the same thing. I've included a fix for that to ignore requests to just to the source when not in the list of errors. Malcolm -- Malcolm Purvis --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-next-error-support-to-org-lint-report-buffer.patch >From 72a4e81238a78af1a58c49c1418cffb4032f3bfd Mon Sep 17 00:00:00 2001 From: Malcolm Purvis Date: Sat, 14 Dec 2024 17:18:09 +1100 Subject: [PATCH 1/3] Add next-error support to org-lint report buffer * doc/org-manual.org (Org Syntax): Add next-error keybinding * etc/ORG-NEWS: * lisp/org-lint.el: Register org-lint report buffer with next-error infra. Add callback function to display error. --- doc/org-manual.org | 12 ++++++------ etc/ORG-NEWS | 5 +++++ lisp/org-lint.el | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index d95a9350e..7f6683428 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -20874,12 +20874,12 @@ a "trust level", since false-positive are possible. From there, you can operate on the reports with the following keys: #+attr_texinfo: :columns 0.22 0.78 -| {{{kbd(C-j)}}}, {{{kbd(TAB)}}} | Display the offending line | -| {{{kbd(RET)}}} | Move point to the offending line | -| {{{kbd(g)}}} | Check the document again | -| {{{kbd(h)}}} | Hide all reports from the same checker | -| {{{kbd(i)}}} | Also remove them from all subsequent checks | -| {{{kbd(S)}}} | Sort reports by the column at point | +| {{{kbd(C-j)}}}, {{{kbd(TAB)}}} | Display the offending line | +| {{{kbd(RET)}}} | Move point to the offending line | +| {{{kbd(C-x `)}}} | Move to the next report and display the offending line | +| {{{kbd(g)}}} | Check the document again | +| {{{kbd(h)}}} | Hide all reports from the same checker | +| {{{kbd(i)}}} | Also remove them from all subsequent checks | ** Context Dependent Documentation :PROPERTIES: diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 08857962b..a38b761ad 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -355,6 +355,11 @@ The Texinfo exporter no longer removes links from headings. This applies to all headings, below and above the =H= and =toc= export =#+OPTIONS:=. +*** next-error supports =org-lint= reports + +The command =next-error= can now be used to jump to the next +=org-lint= error. + * Version 9.7 ** Important announcements and breaking changes diff --git a/lisp/org-lint.el b/lisp/org-lint.el index c85d839bc..040934235 100644 --- a/lisp/org-lint.el +++ b/lisp/org-lint.el @@ -172,6 +172,35 @@ are additional check identifiers to be removed." ;;; Reports UI +;; next-error support +(defvar org-lint--next-error-top-of-buffer t + "Is the next error the one at the first line of the buffer? + +Unlike compilation and grep buffers the first line of the org lint +report refers to an error. This needs special handling.") + +(defun org-lint--next-error-function (n &optional reset) + "Find and display the next line error in the report. +N is an integer specifying by how many errors to move. +RESET is a boolean which, if non-nil, says to go back to the beginning +of the errors before moving. + +This function is the local support for the next-error machinery." + (when reset + (setq org-lint--next-error-top-of-buffer t) + (goto-char (point-min))) + (when org-lint--next-error-top-of-buffer + (setq + org-lint--next-error-top-of-buffer nil + n (1- n))) ; In compilation buffers, point starts before the + ; first error, so stepping forward one brings you to + ; the first error. Here the first error is on the + ; first line so adjust the count accordingly. + (forward-line n) + (org-lint--show-source)) + +;; Report mode + (defvar org-lint--report-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map tabulated-list-mode-map) @@ -186,6 +215,12 @@ are additional check identifiers to be removed." (define-derived-mode org-lint--report-mode tabulated-list-mode "OrgLint" "Major mode used to display reports emitted during linting. \\{org-lint--report-mode-map}" + ;; next-error support. + (make-local-variable 'org-lint--next-error-top-of-buffer) + (setq + next-error-function 'org-lint--next-error-function + next-error-last-buffer (current-buffer)) + (setf tabulated-list-format `[("Line" 6 (lambda (a b) -- 2.47.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-Restore-missing-keybinding-documentation.patch >From 863afe940e5778ef813f34629caf3d5a4449959f Mon Sep 17 00:00:00 2001 From: Malcolm Purvis Date: Thu, 2 Jan 2025 21:35:36 +1100 Subject: [PATCH 2/3] Restore missing keybinding documentation --- doc/org-manual.org | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index 7f6683428..89ce86a46 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -20880,6 +20880,7 @@ can operate on the reports with the following keys: | {{{kbd(g)}}} | Check the document again | | {{{kbd(h)}}} | Hide all reports from the same checker | | {{{kbd(i)}}} | Also remove them from all subsequent checks | +| {{{kbd(S)}}} | Sort reports by the column at point | ** Context Dependent Documentation :PROPERTIES: -- 2.47.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-Ignore-attempts-to-jump-to-an-error-off-the-end-of-t.patch >From 5e8a0df5de4bcfa1fd07f21960b7771a2389c5e4 Mon Sep 17 00:00:00 2001 From: Malcolm Purvis Date: Thu, 2 Jan 2025 21:36:18 +1100 Subject: [PATCH 3/3] Ignore attempts to jump to an error off the end of the org-lint report. --- lisp/org-lint.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org-lint.el b/lisp/org-lint.el index 040934235..8d5dce401 100644 --- a/lisp/org-lint.el +++ b/lisp/org-lint.el @@ -295,7 +295,8 @@ for `tabulated-list-printer'." (defun org-lint--current-marker () "Return current report marker." - (get-text-property 0 'org-lint-marker (aref (tabulated-list-get-entry) 0))) + (when-let* ((entry (tabulated-list-get-entry))) + (get-text-property 0 'org-lint-marker (aref entry 0)))) (defun org-lint--current-checker (&optional entry) "Return current report checker. @@ -318,7 +319,7 @@ CHECKERS is the list of checkers used." (defun org-lint--jump-to-source () "Move to source line that generated the report at point." (interactive) - (let ((mk (org-lint--current-marker))) + (when-let* ((mk (org-lint--current-marker))) (switch-to-buffer-other-window org-lint--source-buffer) (unless (<= (point-min) mk (point-max)) (widen)) (goto-char mk) -- 2.47.1 --=-=-=--