From 1f57189ffbe4f039ea213918c97d0a9496b4db7b Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 5 May 2026 09:39:09 -0500 Subject: refactor: clear package-lint warnings for MELPA prep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I worked through the package-lint backlog and got it to zero. Five changes: 1. Renamed six interactive debug commands from the private `chime--debug-*' prefix to the public `chime-debug-*' form. They were always M-x targets, so the private prefix was just wrong. The autoload cookies stay because public commands SHOULD be autoloaded. README, docstring references in chime.el, and the matching tests follow the rename. 2. Dropped `Version', `Package-Requires', and `Keywords' headers from chime-org-contacts.el. Auxiliary files in a multi-file package shouldn't carry their own metadata — package-lint flags it as an error because the headers have no effect outside the main file. The main file (chime.el) already declares the chime package's metadata. 3. Dropped `Keywords' from chime-debug.el for the same reason. 4. Dropped the auto-loader for the optional chime-org-contacts integration from chime.el. The old code used `with-eval-after-load 'org-capture' to pull the file in, which package-lint flags as a configuration pattern that doesn't belong in a package. Users who want the integration now require it themselves; the README shows both the plain `with-eval-after-load' pattern and the `use-package :after' form. chime-org-contacts.el's internal `with-eval-after-load' went away too — by the time the user has required the file, they've already gated it on org-capture being loaded, so the inner check is redundant. 5. Dropped the redundant `with-eval-after-load' from chime-org-contacts.el's activation block. The setup function still guards on `(boundp 'org-capture-templates)' so it's safe to require either order. Behavioral note: this is a small breaking change for anyone whose config relied on the auto-load. The README change spells out the migration path. --- .gitignore | 1 + README.org | 25 ++++++++++++++++++----- chime-debug.el | 28 ++++++++++++++------------ chime-org-contacts.el | 18 +++++++++-------- chime.el | 20 +++++++------------ tests/test-chime-debug-functions.el | 40 ++++++++++++++++++------------------- 6 files changed, 73 insertions(+), 59 deletions(-) diff --git a/.gitignore b/.gitignore index 837a31b..ff0570a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /.coverage/ /makefile-local /tests/makefile-local +.claude/ diff --git a/README.org b/README.org index 0162cc7..6191078 100644 --- a/README.org +++ b/README.org @@ -966,15 +966,30 @@ After conversion, comment out the diary sexp in your schedule file: *Step 2: Set up capture template for new contacts* +The =chime-org-contacts= integration is optional and lives in its own file. Require it after =org-capture= loads so the template registers cleanly: + #+BEGIN_SRC elisp ;; Enable org-contacts integration (setq chime-org-contacts-file "~/org/contacts.org") ;; Optional: customize capture key (default: "C") (setq chime-org-contacts-capture-key "C") + +;; Load the integration once org-capture is available +(with-eval-after-load 'org-capture + (require 'chime-org-contacts)) +#+END_SRC + +Or, with =use-package=: + +#+BEGIN_SRC elisp +(use-package chime-org-contacts + :after org-capture + :init + (setq chime-org-contacts-file "~/org/contacts.org")) #+END_SRC -This adds an org-capture template (=C-c c C=) that prompts for contact details and automatically inserts a yearly repeating timestamp if a birthday is provided. +Either form adds an org-capture template (=C-c c C=) that prompts for contact details and automatically inserts a yearly repeating timestamp if a birthday is provided. Set =chime-org-contacts-file= to =nil= to disable (the default). @@ -995,10 +1010,10 @@ If something isn't working right, enable debug mode for detailed diagnostics in This loads =chime-debug.el= and gives you these commands: -- =M-x chime--debug-dump-events= -- show all stored upcoming events -- =M-x chime--debug-dump-tooltip= -- show tooltip content -- =M-x chime--debug-config= -- dump complete configuration -- =M-x chime--debug-show-async-stats= -- show async process success/failure stats +- =M-x chime-debug-dump-events= -- show all stored upcoming events +- =M-x chime-debug-dump-tooltip= -- show tooltip content +- =M-x chime-debug-config= -- dump complete configuration +- =M-x chime-debug-show-async-stats= -- show async process success/failure stats - =M-x chime-debug-force-check= -- force an immediate check with diagnostics It also monitors event loading timing and async process performance in the background, logging to =*Messages*=. diff --git a/chime-debug.el b/chime-debug.el index bb57887..837c075 100644 --- a/chime-debug.el +++ b/chime-debug.el @@ -3,9 +3,11 @@ ;; Copyright (C) 2024-2026 Craig Jennings ;; Author: Craig Jennings -;; Keywords: notification alert org org-agenda debug ;; URL: https://github.com/cjennings/chime +;; This file is part of the chime package. Keywords live on the main file +;; (chime.el); auxiliary files don't repeat them per package-lint convention. + ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or @@ -29,9 +31,9 @@ ;; (require 'chime) ;; ;; Available debug functions: -;; - `chime--debug-dump-events' - Show all stored upcoming events -;; - `chime--debug-dump-tooltip' - Show tooltip content -;; - `chime--debug-config' - Show complete configuration dump +;; - `chime-debug-dump-events' - Show all stored upcoming events +;; - `chime-debug-dump-tooltip' - Show tooltip content +;; - `chime-debug-config' - Show complete configuration dump ;; - `chime-debug-monitor-event-loading' - Monitor when events are first loaded ;; ;; All functions write to *Messages* buffer without cluttering echo area. @@ -47,7 +49,7 @@ ;; No need for (require 'chime) here ;;;###autoload -(defun chime--debug-dump-events () +(defun chime-debug-dump-events () "Dump all upcoming events to *Messages* buffer for debugging. Shows events stored in `chime--upcoming-events' with their times and titles." (interactive) @@ -74,7 +76,7 @@ Shows events stored in `chime--upcoming-events' with their times and titles." (message "Dumped %d events to *Messages* buffer" (length chime--upcoming-events)))) ;;;###autoload -(defun chime--debug-dump-tooltip () +(defun chime-debug-dump-tooltip () "Dump current tooltip content to *Messages* buffer for debugging. Shows the tooltip text that would appear when hovering over the modeline." (interactive) @@ -89,7 +91,7 @@ Shows the tooltip text that would appear when hovering over the modeline." (message "Dumped tooltip content to *Messages* buffer"))))) ;;;###autoload -(defun chime--debug-config () +(defun chime-debug-config () "Dump chime configuration and status to *Messages* buffer. Shows all relevant settings, agenda files, and current state." (interactive) @@ -259,7 +261,7 @@ ERROR-DATA is the error information from the async process." (setq chime--debug-async-start-time nil)) ;;;###autoload -(defun chime--debug-show-async-stats () +(defun chime-debug-show-async-stats () "Show statistics about async process performance." (interactive) (chime--log-silently "=== Chime Debug: Async Stats ===") @@ -299,7 +301,7 @@ ERROR-DATA is the error information from the async process." :not-loaded (nreverse not-loaded)))) ;;;###autoload -(defun chime--debug-dump-loaded-features () +(defun chime-debug-dump-loaded-features () "Dump which chime-related features are currently loaded. Useful for diagnosing lazy-loading issues." (interactive) @@ -327,7 +329,7 @@ Warns about slow processes and tracks statistics." (chime--debug-log-async-start))) (chime--log-silently "Chime debug: Async process monitoring enabled") - (message "Chime: Async monitoring enabled - use M-x chime--debug-show-async-stats")) + (message "Chime: Async monitoring enabled - use M-x chime-debug-show-async-stats")) ;;;###autoload (defun chime-debug-disable-async-monitoring () @@ -438,7 +440,7 @@ Shows loaded features before the check and logs async process details." (chime--log-silently " - Event not within %d-minute interval" interval))))) ;;;###autoload -(defun chime--debug-notification-filtering (event-time interval) +(defun chime-debug-notification-filtering (event-time interval) "Debug why a notification might not be generated for EVENT-TIME and INTERVAL. EVENT-TIME should be an Emacs time value (from encode-time or current-time). INTERVAL is the number of minutes before the event to notify. @@ -447,12 +449,12 @@ Traces through the notification filtering pipeline step by step, logging results to *Messages*. Example usage: - (chime--debug-notification-filtering + (chime-debug-notification-filtering (time-add (current-time) (seconds-to-time (* 4 24 3600))) ; 4 days from now 5760) ; 4 days in minutes Or for a specific date/time: - (chime--debug-notification-filtering + (chime-debug-notification-filtering (encode-time 0 0 10 22 11 2025) ; Nov 22, 2025 at 10:00 10) ; 10 minutes before" (interactive diff --git a/chime-org-contacts.el b/chime-org-contacts.el index 73904c2..6c9e590 100644 --- a/chime-org-contacts.el +++ b/chime-org-contacts.el @@ -3,11 +3,12 @@ ;; Copyright (C) 2025-2026 Craig Jennings ;; Author: Craig Jennings -;; Version: 1.0.0 -;; Package-Requires: ((emacs "27.1") (org "9.0")) -;; Keywords: calendar, org-mode, contacts ;; URL: https://github.com/cjennings/chime +;; This file is part of the chime package. Version, Package-Requires, and +;; Keywords live on the main file (chime.el); auxiliary files do not repeat +;; them per package-lint convention. + ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or @@ -145,11 +146,12 @@ Added: %U" ;;; Activation -;; Set up the capture template when org-capture is loaded, -;; but only if chime-org-contacts-file is configured -(with-eval-after-load 'org-capture - (when chime-org-contacts-file - (chime-org-contacts--setup-capture-template))) +;; chime.el guards the require of this file behind its own +;; `with-eval-after-load' on `org-capture', so by the time we get here +;; org-capture is loaded. Set up the template directly when the user +;; has configured `chime-org-contacts-file'. +(when chime-org-contacts-file + (chime-org-contacts--setup-capture-template)) (provide 'chime-org-contacts) ;;; chime-org-contacts.el ends here diff --git a/chime.el b/chime.el index 626d580..b76a5fc 100644 --- a/chime.el +++ b/chime.el @@ -541,9 +541,9 @@ Set to 0 to disable failure warnings." (defcustom chime-debug nil "Enable debug functions for troubleshooting chime behavior. When non-nil, loads chime-debug.el which provides: -- `chime--debug-dump-events' - Show all stored upcoming events -- `chime--debug-dump-tooltip' - Show tooltip content -- `chime--debug-config' - Show complete configuration dump +- `chime-debug-dump-events' - Show all stored upcoming events +- `chime-debug-dump-tooltip' - Show tooltip content +- `chime-debug-config' - Show complete configuration dump - `chime-debug-monitor-event-loading' - Monitor event loading timing These functions write detailed information to the *Messages* buffer @@ -567,16 +567,10 @@ Set to t to enable debug functions: (file-name-directory (or load-file-name buffer-file-name))) t)) -;; Load org-contacts integration if configured -;; Note: The actual template setup happens in chime-org-contacts.el -;; when org-capture is loaded, so users can defer org loading -(with-eval-after-load 'org-capture - (when (and (boundp 'chime-org-contacts-file) - chime-org-contacts-file) - (require 'chime-org-contacts - (expand-file-name "chime-org-contacts.el" - (file-name-directory (or load-file-name buffer-file-name))) - t))) +;; The optional org-contacts integration in chime-org-contacts.el is loaded +;; by the user, not by chime itself. See the README for the recommended +;; `(with-eval-after-load 'org-capture (require 'chime-org-contacts))' or +;; `use-package chime-org-contacts :after org-capture' setup. ;;;; Internal State diff --git a/tests/test-chime-debug-functions.el b/tests/test-chime-debug-functions.el index cef9e4c..a01fd5f 100644 --- a/tests/test-chime-debug-functions.el +++ b/tests/test-chime-debug-functions.el @@ -19,8 +19,8 @@ ;;; Commentary: -;; Tests for debug functions: chime--debug-dump-events, chime--debug-dump-tooltip, -;; and chime--debug-config. These tests verify that debug functions work correctly +;; Tests for debug functions: chime-debug-dump-events, chime-debug-dump-tooltip, +;; and chime-debug-config. These tests verify that debug functions work correctly ;; and handle edge cases gracefully. ;;; Code: @@ -46,10 +46,10 @@ (chime-delete-test-base-dir) (setq chime--upcoming-events nil)) -;;; Tests for chime--debug-dump-events +;;; Tests for chime-debug-dump-events (ert-deftest test-chime-debug-dump-events-normal-with-events () - "Test that chime--debug-dump-events dumps events to *Messages* buffer." + "Test that chime-debug-dump-events dumps events to *Messages* buffer." (test-chime-debug-functions-setup) (unwind-protect (let* ((now (test-time-today-at 14 0)) @@ -67,7 +67,7 @@ (let ((inhibit-read-only t)) (erase-buffer))) ;; Call debug function - (chime--debug-dump-events) + (chime-debug-dump-events) ;; Verify output in *Messages* buffer (with-current-buffer "*Messages*" (let ((content (buffer-string))) @@ -77,7 +77,7 @@ (test-chime-debug-functions-teardown))) (ert-deftest test-chime-debug-dump-events-boundary-no-events () - "Test that chime--debug-dump-events handles no events gracefully." + "Test that chime-debug-dump-events handles no events gracefully." (test-chime-debug-functions-setup) (unwind-protect (progn @@ -85,14 +85,14 @@ (setq chime--upcoming-events nil) ;; Should not error (should-not (condition-case nil - (progn (chime--debug-dump-events) nil) + (progn (chime-debug-dump-events) nil) (error t)))) (test-chime-debug-functions-teardown))) -;;; Tests for chime--debug-dump-tooltip +;;; Tests for chime-debug-dump-tooltip (ert-deftest test-chime-debug-dump-tooltip-normal-with-events () - "Test that chime--debug-dump-tooltip dumps tooltip to *Messages* buffer." + "Test that chime-debug-dump-tooltip dumps tooltip to *Messages* buffer." (test-chime-debug-functions-setup) (unwind-protect (let* ((now (test-time-today-at 14 0)) @@ -110,7 +110,7 @@ (let ((inhibit-read-only t)) (erase-buffer))) ;; Call debug function - (chime--debug-dump-tooltip) + (chime-debug-dump-tooltip) ;; Verify output in *Messages* buffer (with-current-buffer "*Messages*" (let ((content (buffer-string))) @@ -120,7 +120,7 @@ (test-chime-debug-functions-teardown))) (ert-deftest test-chime-debug-dump-tooltip-boundary-no-events () - "Test that chime--debug-dump-tooltip handles no events gracefully." + "Test that chime-debug-dump-tooltip handles no events gracefully." (test-chime-debug-functions-setup) (unwind-protect (progn @@ -128,14 +128,14 @@ (setq chime--upcoming-events nil) ;; Should not error (should-not (condition-case nil - (progn (chime--debug-dump-tooltip) nil) + (progn (chime-debug-dump-tooltip) nil) (error t)))) (test-chime-debug-functions-teardown))) -;;; Tests for chime--debug-config +;;; Tests for chime-debug-config (ert-deftest test-chime-debug-config-normal-dumps-config () - "Test that chime--debug-config dumps configuration to *Messages* buffer." + "Test that chime-debug-config dumps configuration to *Messages* buffer." (test-chime-debug-functions-setup) (unwind-protect (let ((chime-enable-modeline t) @@ -147,7 +147,7 @@ (let ((inhibit-read-only t)) (erase-buffer))) ;; Call debug function - (chime--debug-config) + (chime-debug-config) ;; Verify output in *Messages* buffer (with-current-buffer "*Messages*" (let ((content (buffer-string))) @@ -161,7 +161,7 @@ (test-chime-debug-functions-teardown))) (ert-deftest test-chime-debug-config-boundary-no-agenda-files () - "Test that chime--debug-config handles empty org-agenda-files." + "Test that chime-debug-config handles empty org-agenda-files." (test-chime-debug-functions-setup) (unwind-protect (let ((org-agenda-files '())) @@ -171,7 +171,7 @@ (erase-buffer))) ;; Should not error (should-not (condition-case nil - (progn (chime--debug-config) nil) + (progn (chime-debug-config) nil) (error t))) ;; Verify output mentions 0 files (with-current-buffer "*Messages*" @@ -200,9 +200,9 @@ ;; Call all three debug functions - should not error (should-not (condition-case nil (progn - (chime--debug-dump-events) - (chime--debug-dump-tooltip) - (chime--debug-config) + (chime-debug-dump-events) + (chime-debug-dump-tooltip) + (chime-debug-config) nil) (error t)))))) (test-chime-debug-functions-teardown))) -- cgit v1.2.3