]> git.eshelyaron.com Git - emacs.git/commitdiff
(comment-setup-function): Make it usable with `add-function`
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 5 May 2025 18:05:36 +0000 (14:05 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:51:10 +0000 (10:51 +0200)
* lisp/newcomment.el (comment-setup-function): Give it a non-nil default.
(comment-normalize-vars): Call it unconditionally.

(cherry picked from commit a64a56fbf03d5ece647254c8920fe5af59cdf3cd)

lisp/newcomment.el

index a6a1b7340a671f4de3c0ee67a3f6ade15cb47ee3..9593d464cc77445ed2c439b02903b768499dc1cf 100644 (file)
@@ -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: ")))