The `fill-region` command in org-mode works incorrectly.
Steps to reproduce:
1. Launch emacs `emacs -Q -L path/to/org-mode/lisp`
2. Execute `org-mode`
3. Past this into the scratch buffer:
#+begin_src conf
pid /tmp/nginx.pid;
events {}
# one two three four five six seven eight nine ten eleven twelve thirteen
fourteen
http {
upstream application {
server 127.0.0.1:3000;
}
server {
listen 8080;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/secrets/.htpasswd_automations;
location / {
proxy_set_header Authorization "";
proxy_pass http://application;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /healthz {
auth_basic off;
return 200 "OK";
}
}
}
#+end_src
4. Move the cursor to the comment line "# one two three four...".
5. Exectue this sequence of commands: back-to-indentation ->
-> set-mark-command -> move-end-of-line -> fill-region
6. The line ends up looking like this:
events {}
# one two three four five six seven eight nine ten eleven twelve thirtheen
fourteen
http {
I expect it to look like this:
events {}
# one two three four five six seven eight nine ten eleven twelve thirtheen
# fourteen
http {
Emacs version: GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.49, cairo version 1.18.2) of 2025-10-1
Org version: Org mode version 9.8-pre (release_9.7.34-463-g1afa55 @
/home/wurfkreuz/.source/org-mode/lisp/