From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id mL60CBozXWcegQEAqHPOHw:P1 (envelope-from ) for ; Sat, 14 Dec 2024 07:26:18 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id mL60CBozXWcegQEAqHPOHw (envelope-from ) for ; Sat, 14 Dec 2024 08:26:18 +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=fm3 header.b=jrb9eb0e; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b="M ck8JQB"; dmarc=none; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734161170; a=rsa-sha256; cv=none; b=p9MCZF4OYga+Xny5sSNDbdqjZyblmznNGP83WvRN4qUG6J5VdHHybGSxhTE23a0Ymu0edG AYdbiXEwz/7YsF9vnJEwQ0AAloExOdWO9zO2vpL5seoZP6Pcn1AgC5ymqQ++8lZcUq2RW/ DA+FZNLp+0n6ltzr4iB9JcsAT2H7BEu8b3orzAUDkuXCuNcr5BuhffGBHwb8FEcWJEDNy7 JQ4Eg7V0s8UJbXdmNZWIdGpFSlTTAAedInhdFehkN0DRm8Xg3fi9DpOf2lnY0/EGdF+XAg QNCtgnV4QXxKYfjM1HrC+gi9qw++XKaJcYX6dA832XUtx7344xgYWgmgJkE3qg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=purvis.id.au header.s=fm3 header.b=jrb9eb0e; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b="M ck8JQB"; dmarc=none; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734161170; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=hlCrIuFpyNab34Ubz/yQ6h0YUPxDctDjPGnrolEhefg=; b=K3vXSZAagWOiPhBMz+QxLjRjNL0QUcQs8MmzX6jjvYCRdVFrmalVyAwLtCRj48HbtFd5pb G75BJKjfwQHDw2hUyN4JFIisQZKW/ip7K40STFwJBnxoNLONNEBfpYt5O4iyJ8wqkfsTBJ QLY30IrWP4DS/5qhqZJ88wKxIRqkvkd6Slmyd7GUxJ658/8beUbQOb9N9a720B950Bqy7R 7U6PrpzFYHOhEI6/QIhfaxI672YpixsUHBRuXNIhDLO164R8EAajreuHmDiwi24LPFhCEz o0C72E2dW8cAgZHBZ/Gbq0w5nbW9uHUcapAiAG0t8uMZxXEtHh+cBgNtlheBYA== 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 56BB74DAB for ; Sat, 14 Dec 2024 08:26:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMMWe-0008Gb-Ps; Sat, 14 Dec 2024 02:25:20 -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 1tMMWc-0008Fn-9B for emacs-orgmode@gnu.org; Sat, 14 Dec 2024 02:25:18 -0500 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tMMWZ-0004nK-U1 for emacs-orgmode@gnu.org; Sat, 14 Dec 2024 02:25:17 -0500 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id D4121114011C for ; Sat, 14 Dec 2024 02:25:12 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Sat, 14 Dec 2024 02:25:12 -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 :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1734161112; x=1734247512; bh=H3VjkIR7tE420q5a/GE2zwtkcuYhpB/k 6gE8jJuhFHw=; b=jrb9eb0eYpih0H/vH8b/K5pWlIYoNtdYZak9o26eiun2X0Ig RsIxnmovieBZh9uBG2pAcSfZbwwen3AK2ce0o4tL1G1ldkQFxhABTvHvVBY2xNj0 ktUJQRLN9096F459lWLpyhyO2aSrW4B7POVfxWLFz8NEZ2LTomFQPYhvwkff3N0x ePH8GuSBKLneZLXB8U4M/mbVIABP3YmIPrIALuJrAKU8JXDR1yhaXqMf5dnmv6dy DgCSpRvXCVOTt7NKafHavIiRvzyF7uIEZrX+ZD7cSbvr0hshCfvWfJYxkJ2ZibQb e/q0dYjFMufEVbOC7ZiEGL+YbG1bYPOS2mToMg== 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:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1734161112; x= 1734247512; bh=H3VjkIR7tE420q5a/GE2zwtkcuYhpB/k6gE8jJuhFHw=; b=M ck8JQB2W641GqaMavB5L1YORa9+ggtTWpdAV4ZaYOCftY9wzIdXWW2PAnwBkmoAZ y1ajvpkiw2R2+P7Ig9XM5gDCGlHgIhfXtV3+Ccg9QwgwxhSCUba/GcXvhzB0Ikqs P9+gSl+KhsjIed53tojUOx3H79cYMU3chXmnF1X7CBOkBloqP+ZWs2rmkJ8aj0Eb xuHToxifTA/gm9rUS8FAs7KJJh6YJNu5iJStP671etP3Sqsm8eFsgwFbpEhCdU+J jlFBVOqC5GheWD8XCRq+gBS09eeYxfwvmim4/F7JbLyUMYXcQAvCNOtEa+NtWkVe Vrr1kx+9DSpDnKVxA5TFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrkeekgddutdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkfgggtgesthdtredttdertdenucfhrhhomhepofgrlhgtohhlmhcurfhurhhvihhsuceo mhgrlhgtohhlmhesphhurhhvihhsrdhiugdrrghuqeenucggtffrrghtthgvrhhnpeetge eutddvffdutdffhfefleduveffkedtvdfgiedtueehueelgfegteejhfevudenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghltgholhhmse hpuhhrvhhishdrihgurdgruhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepvghmrggtshdqohhrghhmohguvgesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i9199493a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 14 Dec 2024 02:25:11 -0500 (EST) From: Malcolm Purvis To: emacs-orgmode@gnu.org Subject: [PATCH] Add next-error support to org-lint report buffer Date: Sat, 14 Dec 2024 18:25:08 +1100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=202.12.124.145; envelope-from=malcolm@purvis.id.au; helo=fout-b2-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_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_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-Queue-Id: 56BB74DAB X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -2.67 X-Spam-Score: -2.67 X-TUID: MrbcZd4cWLYF Years of muscle memory have made me expect that the output of linter tools can be processed with `next-error' (C-x `). This isn't the case with org-lint. This patch hooks the org linter report into the next-error infrastructure. I should have my copyright assignment on file with the FSF. Malcolm * 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 -- Malcolm Purvis