GNU bug report logs - #70804
29.3.50; Feature request: Allow setting INITIAL-INPUT in comment-normalize-vars when comment-start is nil

Previous Next

Package: emacs;

Reported by: Daan Ro <daanturo <at> gmail.com>

Date: Mon, 6 May 2024 16:38:01 UTC

Severity: wishlist

Tags: patch

Found in version 29.3.50

Full log


View this message in rfc822 format

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Daan Ro <daanturo <at> gmail.com>
Cc: 70804 <at> debbugs.gnu.org
Subject: bug#70804: 29.3.50; Feature request: Allow setting INITIAL-INPUT in comment-normalize-vars when comment-start is nil
Date: Mon, 3 Mar 2025 19:10:19 +0000
Version: 31.1

Daan Ro <daanturo <at> gmail.com> writes:

> Attached a single sexp change patch =)).

Thanks!  Some comments below:

> From 549ee68d5b6cf3dae5dd69b8f1a99c045f200cbe Mon Sep 17 00:00:00 2001
> From: Daanturo <daanturo <at> gmail.com>
> Date: Mon, 3 Mar 2025 18:46:01 +0000
> Subject: [PATCH] Let "#" be the suggested comment-start when undefined
>  (bug#70804)
>
> * lisp/newcomment.el: add "#" to 'comment-normalize-vars' prompt's
> initial input.
> ---
>  lisp/newcomment.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/newcomment.el b/lisp/newcomment.el
> index 945187e863f..3258735dcea 100644
> --- a/lisp/newcomment.el
> +++ b/lisp/newcomment.el
> @@ -358,7 +358,7 @@ comment-normalize-vars
>  function should first call this function explicitly."
>    (unless (and (not comment-start) noerror)
>      (unless comment-start
> -      (let ((cs (read-string "No comment syntax is defined.  Use: ")))
> +      (let ((cs (read-string "No comment syntax is defined.  Use: " "#")))

I think you should use the DEFAULT-VALUE argument instead of
INITIAL-INPUT.

Also, I recommend using format-prompt, e.g.

    (format-prompt "No comment syntax is defined, use" "#")

>  	(if (zerop (length cs))
>  	    (error "No comment syntax defined")
>            (setq-local comment-start cs)
> --
> 2.48.1




This bug report was last modified 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.