nim-lang / nim-mode

An emacs major mode for the Nim programming language
137 stars 46 forks source link

windows 10 nimsuggest failing, a simple fix #238

Open cark opened 2 years ago

cark commented 2 years ago

Problem statement: I couldn't make nim-mode work with nimsuggest. Nimsuggest was timing out. It was unable to find the temporary copy of my source code in the temp directory. In my case this path looks something like this : C:\Users\carkh\AppData\Local\Temp\emacs-nim-mode\00000000056b84a0\f:/home/cara/Nim/capture/src

Looking at nim-suggest.el, in the nimsuggest--get-temp-file-name function, in response to bug 119, we're replacing the colon in this path with U+A789 (a colon looking unicode character).

I changed this replaced character to a simple asscii 's' character, and now it works.

So here is the change :

(defun nimsuggest--get-temp-file-name ()
  "Get temp file name."
  (mapconcat 'directory-file-name
             `(,(nimsuggest--get-dirty-dir)
               ,(cl-case system-type
                  ((ms-dos windows-nt cygwin)
                   ;; For bug #119, convert ":" to "꞉" (U+A789)
                   (concat "/"
                           (replace-regexp-in-string
                            ":" "s";;(char-to-string #xA789) <---- change is on this line
                            buffer-file-name)))
                  (t ; for *nix system
                   buffer-file-name)))
             ""))