Skip to content

Comment-dwim is commenting properly but uncommenting improperly #25

@mattiasdrp

Description

@mattiasdrp

Area

Other

Expected behavior

It should be noted that I don't mind working on this if you don't have the time, feel free to ask me to do the PR ;-)

(* let () =  *)
(*   let a = 3 in  *)
(*   Format.eprintf "%d@." a  *)

Uncommenting this selection should give

let () =  
  let a = 3 in  
  Format.eprintf "%d@." a  

Actual behavior

let () =  *)
  let a = 3 in  *)
  Format.eprintf "%d@." a  *)

Steps to reproduce

I created a minimal setup:

;;; init.el --- init file                            -*- lexical-binding: t; -*-

;; Copyright (C) 2026  mattias

;; Author: mattias <mattias@mattias-pc>
;; Keywords: lisp

(defvar elpaca-installer-version 0.12)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-sources-directory (expand-file-name "sources/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
                              :ref nil :depth 1 :inherit ignore
                              :files (:defaults "elpaca-test.el" (:exclude "extensions"))
                              :build (:not elpaca-activate)))
(let* ((repo  (expand-file-name "elpaca/" elpaca-sources-directory))
       (build (expand-file-name "elpaca/" elpaca-builds-directory))
       (order (cdr elpaca-order))
       (default-directory repo))
  (add-to-list 'load-path (if (file-exists-p build) build repo))
  (unless (file-exists-p repo)
    (make-directory repo t)
    (when (<= emacs-major-version 28) (require 'subr-x))
    (condition-case-unless-debug err
        (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
                  ((zerop (apply #'call-process `("git" nil ,buffer t "clone"
                                                  ,@(when-let* ((depth (plist-get order :depth)))
                                                      (list (format "--depth=%d" depth) "--no-single-branch"))
                                                  ,(plist-get order :repo) ,repo))))
                  ((zerop (call-process "git" nil buffer t "checkout"
                                        (or (plist-get order :ref) "--"))))
                  (emacs (concat invocation-directory invocation-name))
                  ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
                                        "--eval" "(byte-recompile-directory \".\" 0 'force)")))
                  ((require 'elpaca))
                  ((elpaca-generate-autoloads "elpaca" repo)))
            (progn (message "%s" (buffer-string)) (kill-buffer buffer))
          (error "%s" (with-current-buffer buffer (buffer-string))))
      ((error) (warn "%s" err) (delete-directory repo 'recursive))))
  (unless (require 'elpaca-autoloads nil t)
    (require 'elpaca)
    (elpaca-generate-autoloads "elpaca" repo)
    (let ((load-source-file-function nil)) (load "./elpaca-autoloads"))))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))

;; Install use-package support
(elpaca bind-key)

(elpaca elpaca-use-package
  ;; Enable :ensure use-package keyword.
  (elpaca-use-package-mode)
  ;; Assume :ensure t unless otherwise specified.
  (setopt use-package-always-ensure t))

(elpaca-wait)

(use-package neocaml
  :load-path "~/neocaml/"
  :config (message "`neocaml' loaded"))

(provide 'init)

;;; init.el ends here

Write OCaml code, comment it, uncomment it, the leading *) should appear

Environment

Emacs: 31.0.50
System: gnu/linux
neocaml: 0.4.1
Grammars: ocaml (expected: v0.24.2), ocaml-interface (expected: v0.24.2)
Eglot: inactive

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions