From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CDyFIqTcrV/fBgAA0tVLHw (envelope-from ) for ; Fri, 13 Nov 2020 01:08:52 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id gG1THqTcrV/VEQAAbx9fmQ (envelope-from ) for ; Fri, 13 Nov 2020 01:08:52 +0000 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 1755C9402B4 for ; Fri, 13 Nov 2020 01:08:51 +0000 (UTC) Received: from localhost ([::1]:44176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdNa6-0007y7-BJ for larch@yhetil.org; Thu, 12 Nov 2020 20:08:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdNZk-0007xy-IG for emacs-orgmode@gnu.org; Thu, 12 Nov 2020 20:08:28 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:37695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kdNZi-0002S9-Rc for emacs-orgmode@gnu.org; Thu, 12 Nov 2020 20:08:28 -0500 Received: by mail-pg1-x529.google.com with SMTP id h6so5737316pgk.4 for ; Thu, 12 Nov 2020 17:08:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:references:user-agent:from:to:subject:in-reply-to:message-id :date:mime-version; bh=UlokiS+p8nDMawjn6hA64wRhhVI8i/1kTibcFmDIclU=; b=Fh2UFKHJmRzJ7b25rkKxie5xPkHV1oa8oKGrbyND7TR9mgeY2ipNNAX04woqfYREiT /7vRR8oRbNlCZrnX0R2N1eD5735x8ZM0x3T+MNqLiIojnvnbr9l2jRzYTcE7CqAP6a4q c6siVPys+g4Z7GTkNMzr0ot/u/MaWTO8euh0t6nKzT3fgDBeU6NpIFQjNT+vps5nc5pH XxZjvPY+YGuhkG2fqDFKs2c22JduFRPDp1fJkQuXaeQyfi69MFClyra2ifpdxBBgLj7O Qoy9zDCCEiRiJ/VegNGtAekdP6QHUIfMJrS7WxLz1MX2MeuvcK4K2bv8wEWofOmFR6ZG lxTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:references:user-agent:from:to:subject :in-reply-to:message-id:date:mime-version; bh=UlokiS+p8nDMawjn6hA64wRhhVI8i/1kTibcFmDIclU=; b=Ec5TyMSZJsCdQz/ut6b3HIuwag1evnBXo5mktGUTXKuucz/NYV8Y8fNCp1ceyg7rxx tX7cvSoryOVJFvS/ZEZHzm+mkYzeST988eAxk6yta7n4b4tsWa8TfkWTSQVaj/Be0HZ3 RZix4s+2deqejVlXO2gzROhbPD1ekGr6+tbfn1a+85yC03g/kEouzvgB/LBB3VzqyvaJ H6GjVptDFfqbOu0T/+0XLzigHynOS3l8QEcCmJnDAGAh/QWK5wkXb0P1H2d10Pot5hTE hVhwZkeY3VDDxCnrLdvB2UMksZVgA0IWtPFCi7Gj5E+ys16ovgPYaPqFLSqiJpc81Ocg 5rnw== X-Gm-Message-State: AOAM531HRmBmniW5k9tC48jiEvBsLXHQfBXmq4iIJUcdwJqSNtId4HzR Exay4cIO9UgZgPwosw3FRrRKuHAb/2ARvw== X-Google-Smtp-Source: ABdhPJx75mN4prFFd1m09ZbZJfIuTPBfbuv6XM/ka6aa56OAnYhWjkrJsc+nYenYko3NkMEjKYDCYg== X-Received: by 2002:a17:90b:f07:: with SMTP id br7mr611494pjb.178.1605229704433; Thu, 12 Nov 2020 17:08:24 -0800 (PST) Received: from gusbrs-laptop ([199.116.118.167]) by smtp.gmail.com with ESMTPSA id d2sm8074472pjj.37.2020.11.12.17.08.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 17:08:23 -0800 (PST) References: <87k0ut7yid.fsf@gmail.com> User-agent: mu4e 1.4.13; emacs 27.1 From: Gustavo Barros To: emacs-orgmode@gnu.org Subject: Re: [FR] Don't hardcode checker functions prefix in org-lint In-reply-to: <87k0ut7yid.fsf@gmail.com> Message-ID: <87blg2rrlp.fsf@gmail.com> Date: Thu, 12 Nov 2020 22:08:18 -0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=gusbrs.2016@gmail.com; helo=mail-pg1-x529.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, 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: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 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" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=gmail.com header.s=20161025 header.b=Fh2UFKHJ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: rSQ8RAa7lo/L Hi All, On Tue, 10 Nov 2020 at 17:22, Gustavo Barros wrote: > This is a small feature request for `org-lint' not to hardcode the > checker > functions' prefix, as it currently does. I've been playing with and testing this further, and I found an uncovered corner in my initial suggestion: the revert-buffer behavior in the report buffer. It is still simple to handle it, but requires a couple of extra steps: set the prefix variable as a buffer local variable in the report buffer in `org-lint--display-reports' and let-bind this value before moving to the linted buffer in `org-lint--generate-reports'. As an extra sugar, but non essential, it would also be nice to be able to set the report buffer's name. In sum, the suggestion/request then entails: #+begin_src emacs-lisp (defvar-local org-lint--checkers-prefix nil) (defvar-local org-lint--report-buffer-name nil) (defun org-lint--generate-reports (buffer checkers) (let ((checkers-prefix (or org-lint--checkers-prefix "org-lint"))) (with-current-buffer buffer ;; [...] (funcall (intern (format "%s-%s" checkers-prefix (org-lint-checker-name c))) ast) ;; [...] ))) (defun org-lint--display-reports (source checkers) ;; changed let-binding <-- (let ((buffer (get-buffer-create (or org-lint--report-buffer-name "*Org Lint*")))) (with-current-buffer buffer (org-lint--report-mode) (setf org-lint--source-buffer source) (setf org-lint--local-checkers checkers) ;; added variable setting <-- (setf org-lint--checkers-prefix org-lint--checkers-prefix) (org-lint--refresh-reports) (tabulated-list-print) (add-hook 'tabulated-list-revert-hook #'org-lint--refresh-reports nil t)) (pop-to-buffer buffer))) #+end_src That's about it. With it, I get a fully functional Lint report for personal lints with something like: #+begin_src emacs-lisp (defun my/org-lint (&optional arg) (interactive "P") (let ((org-lint--checkers my/org-lint-checkers) (org-lint--checkers-prefix "my/org-lint") (org-lint--report-buffer-name "*My Org Lint*")) (funcall-interactively 'org-lint arg))) #+end_src Best regards, Gustavo.