diff --git a/dir-config.el b/dir-config.el index 5f18527..d8c0700 100644 --- a/dir-config.el +++ b/dir-config.el @@ -90,18 +90,6 @@ dir-config loading." :type 'boolean :group 'dir-config) -(defcustom dir-config-debug nil - "Enable debug mode for dir-config operations if non-nil. -When this option is enabled, detailed debug information will be logged for -various dir-config activities, including: -- Loading of directory config files -- Cases where directory config files are not found -- Internal state and processing steps -- No error handling -This option is useful for diagnosing and troubleshooting complex issues." - :type 'boolean - :group 'dir-config) - (defcustom dir-config-allowed-directories '() "List of directory names where dir-config files are allowed. Both the dir-config file (e.g., '.dir-config.el') and the buffer path must be @@ -110,6 +98,16 @@ under these directories, not just the dir-config file." :group 'dir-config) ;; Internal variables +(defvar dir-config--debug nil + "Internal variable that enables debug mode if non-nil. +When this option is enabled, detailed debug information will be logged for +various dir-config activities, including: +- Loading of directory config files +- Cases where directory config files are not found +- Internal state and processing steps +- No error handling +This option is useful for diagnosing and troubleshooting complex issues.") + (defvar dir-config--loaded nil) (defvar dir-config--allowed-p nil) (defvar dir-config--file nil) @@ -187,7 +185,7 @@ The dir-config file is loaded only if the directory is allowed and is sourced from the closest parent directory of the buffer." (if (bound-and-true-p dir-config--loaded) ;; Skip it - (when dir-config-debug + (when dir-config--debug (dir-config--message "[DEBUG] %s: Skipping load as already loaded: %s" (buffer-name) dir-config--file)) @@ -195,7 +193,7 @@ from the closest parent directory of the buffer." (let ((current-dir (dir-config--buffer-cwd))) (if (not current-dir) ;; Buffer not supported - (when dir-config-debug + (when dir-config--debug (dir-config--message (concat "[DEBUG] Ignored because the " "buffer '%s' is not supported" " (major-mode: %s)") @@ -211,7 +209,7 @@ from the closest parent directory of the buffer." (dir-config--find-dominating-file dir-config-file-names current-dir))) (if (not dir-config-file) - (when dir-config-debug + (when dir-config--debug (dir-config--message (concat "[DEBUG] %s: None of the dir-config " "files %s were found for the '%s' " @@ -236,7 +234,7 @@ from the closest parent directory of the buffer." (setq-local dir-config--file dir-config-file) ;; Load - (if dir-config-debug + (if dir-config--debug (progn ;; Do not handle errors when debug is activated (load dir-config-file nil t t)