From a64a56fbf03d5ece647254c8920fe5af59cdf3cd Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 5 May 2025 14:05:36 -0400 Subject: [PATCH] (comment-setup-function): Make it usable with `add-function` * lisp/newcomment.el (comment-setup-function): Give it a non-nil default. (comment-normalize-vars): Call it unconditionally. --- lisp/newcomment.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index a6a1b7340a6..9593d464cc7 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -344,7 +344,7 @@ terminated by the end of line (i.e., `comment-end' is empty)." "Return the mirror image of string S, without any trailing space." (comment-string-strip (concat (nreverse (string-to-list s))) nil t)) -(defvar comment-setup-function nil +(defvar comment-setup-function #'ignore "Function to set up variables needed by commenting functions.") ;;;###autoload @@ -354,8 +354,7 @@ All the `comment-*' commands call this function to set up various variables, like `comment-start', to ensure that the commenting functions work correctly. Lisp callers of any other `comment-*' function should first call this function explicitly." - (when (functionp comment-setup-function) - (funcall comment-setup-function)) + (funcall comment-setup-function) (unless (and (not comment-start) noerror) (unless comment-start (let ((cs (read-string "No comment syntax is defined. Use: ")))