tags 12533 patch
quit


"Drew Adams" <drew.adams@oracle.com> writes:

> emacs -Q
>  
> (defcustom foo ()
>   "..."
>   :type '(repeat (cons
>                   string
>                   (choice
>                    (const flimpo)
>                    (const nil)
>                    (other t))))
>   :group 'edit)
>  
> M-x customize-option foo
>  
> Click button INS.
>  
> (Optional: Enter something in field `String'.)
>  
> Choose `Other' in `Value Menu'.
>  
> An INS button pops up inappropriately under `Choice'.  If you click it
> then it shows that it expects another `repeat' cell, at the wrong level.

I can reproduce this.

> This broken behavior happens as long as you choose `Other' in `Value
> Menu'.  If you choose one of the other possibilities then Customize
> behaves correctly.
>  
> To me this is clearly a bug.  But it is so all the way back through
> Emacs 20.  So I wonder - am I right?  I cannot believe that this
> behavior is correct.  What am I missing?
>  

I think you are right.  And it happens with the `Other' option, which
creates a widget of type `other', because that widget was defined with a
format string that contains the %n escape at the end of the string.

That escape add spaces (for indentation), after inserting a newline.
But it's not useful when at the end of the format string, because that
indents unconditionally the contents of the buffer that follow the
widget.  The %n escape is better used in the middle of a format string,
to cause indentation of the contents that belong to the same widget.

Therefore, I think it is a mistake to have that %n in the format string
of the `other' widget, and I propose the attached patch.

Best regards,
Mauro.