Thanks,

vhdl-mode is using function 'comment-region' from the ‘newcomment.el’ package. With the default value of 1 for option 'comment-padding' the comment string "-- " is inserted, resulting in

-- -- this is a test comment

-- library ieee;
-- use        ieee.std_logic_1164.all

for which uncommenting works fine.  You might have changed 'comment-padding' to 0, which is when you get

---- this is a test comment

--library ieee;
--use        ieee.std_logic_1164.all

For this, 'comment-region' doesn't work correctly for languages with comment starts that contain 2 of the same characters, like "--" in VHDL or "//" in C++. C++-mode doesn't honor the 'comment-padding' option though and always inserts "// ", so the problem doesn't occur.

Remedies:
  1. Use 1 for 'comment-padding'
  2. File a bug report against 'newcomment.el'
  3. Make vhdl-mode not honor option 'comment-padding'
Regards,
Reto


On 2020-08-18 13:39, Stefan Kangas wrote:
Hi,

Reto Zimmermann <reto@gnu.org> writes:

The file is missing.  Could you please re-attach?
Sorry, it was missing in my reply.

You can find the file here:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22368#8

Best regards,
Stefan Kangas