Giter Site home page Giter Site logo

Comments (4)

chrisdone avatar chrisdone commented on May 18, 2024

Can you contribute a patch that works and checks for Windows? I don't have Windows.

The whole thing is sent to the GHCi process. : is how you give commands to GHCi. :! is one of the commands, it's for running shell commands. :!ls gives a list of the current dir.

from haskell-mode.

josh-j avatar josh-j commented on May 18, 2024

I have haskell-process-generate-tags working on Windows, but not with haskell-process-send-string. I have to use shell-command, start-process, or call-process (btw, which is the best in this case?)*. For some reason haskell-process-send-string simply does nothing when I use it with the powershell command.

Symptom with haskell-process-send-string: :!dir works correctly in the Haskell-mode REPL, but :!powershell ls freezes the REPL after it's done printing out the directory. Something similar happens with winghci, but I'm able to press enter after :!powershell ls finished its output, and then I get back to the REPL prompt. This doesn't happen if I open ghci from cmd.exe.

I'm assuming this means powershell is expecting input after it finishes its command (the -NonInteractive flag doesn't help).

* I was mistaken.

from haskell-mode.

josh-j avatar josh-j commented on May 18, 2024
(defun haskell-process-generate-tags (&optional and-then-find-this-tag)
  "Regenerate the TAGS table."
  (interactive)
  (let ((process (haskell-process)))
    (haskell-process-queue-command
     process
     (haskell-command-make
      (cons process and-then-find-this-tag)
      (lambda (state)
        (if (eq system-type 'windows-nt)
            (shell-command
              (format "powershell -Command \"& { cd %s ; hasktags -e -x (ls -fi *.hs -exclude \\\"#*#\\\" -name -r) }\""
                      (haskell-session-cabal-dir (haskell-process-session (car state)))))
          (haskell-process-send-string
            (car state)
            (format ":!cd %s && %s | %s | %s"
              (haskell-session-cabal-dir (haskell-process-session (car state)))
              "find . -name '*.hs*'"
              "grep -v '#'" ; To avoid Emacs back-up files. Yeah.
              "xargs hasktags -e -x"))))
         nil
         (lambda (state response)
           (when (cdr state)
             (let ((tags-file-name
                    (haskell-session-tags-filename (haskell-process-session (car state)))))
               (find-tag (cdr state))))
           (haskell-mode-message-line "Tags generated."))))))

Is what the code looks like using shell-command, if anyone is interested. Maybe someone else can figure out how to get it working with haskell-process-send-string (or I'll try if I get around to learning elisp).

from haskell-mode.

chrisdone avatar chrisdone commented on May 18, 2024

Will merge a pull request if one is made.

from haskell-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.