From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: Merge haskell-ts-mode in upstream Date: Sat, 28 Dec 2024 16:15:10 +0000 Message-ID: <87msgfzsvl.fsf@posteo.net> References: <87cyhh7t00.fsf@bauherren.ovh> <87msglb89y.fsf@posteo.net> <87ed1s1akm.fsf@bauherren.ovh> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11331"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Pranshu Sharma via "Emacs development discussions." To: Pranshu Sharma Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 28 17:16:13 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tRZU4-0002pg-Vz for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Dec 2024 17:16:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRZTJ-0003bm-P0; Sat, 28 Dec 2024 11:15:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRZTD-0003bF-Q4 for emacs-devel@gnu.org; Sat, 28 Dec 2024 11:15:19 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRZTB-0003XI-1E for emacs-devel@gnu.org; Sat, 28 Dec 2024 11:15:19 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 6A93C240103 for ; Sat, 28 Dec 2024 17:15:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1735402511; bh=cvQDMTZBStMvcAD+SzBbaeEmyGAj0zDTlY23HZlJC1Y=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=i/GB6nT6bX06LUanOSuagbx4D6B3hRyKjavlpftaVogrlAEUXyHk7kWGjBK2EEuOj xZkeq3zSikH4bWGVpICOYED7bq1xE2riI/CTV/mS4/3YL+i7axRqL2Kb2st/A6q0Gx Cd7WebO6MwGY0f5Jv3wFekXnkFbfDE0pXjaDjb9NIRoN1wXeHjUmZXvrL05AJ7Mais NP6gydVl4thoPaRCucTt9297CwEcGfCdUJsX7iOHg+u/LPh2hhEtxA4ZqNPVLjfsWG p54VnnmocluQcrxc7qiX6dFxx7MhA549xjVZb4+0RUIxb/yaPGo8VPeEKJ94XDZY6O ag76Yq89lG/YA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YL6sC025Jz6tm4; Sat, 28 Dec 2024 17:15:10 +0100 (CET) In-Reply-To: <87ed1s1akm.fsf@bauherren.ovh> (Pranshu Sharma's message of "Sat, 28 Dec 2024 18:22:17 +1000") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327274 Archived-At: Pranshu Sharma writes: > Philip Kaludercic writes: > >> I see that you have started a new repository. Do you want us to mirror >> your changes with all the commit history, or are you OK with us just >> copying over the coded periodically whenever you want to update the code? > > Ok, it seems like I'll be sticking to git one anyway, since > git-hg-bridge or something doesn't work. I am fine with using the old > repo. Wait, I am confused. The initial proposal was to add the package to emacs.git, right? >>> :type 'boolean) >>> >>> (defcustom haskell-ts-font-lock-level 4 >>> "Level of font lock, 1 for minimum highlghting and 4 for maximum." >>> :group 'haskell-ts-mode >>> :type 'integer) >> >> It might even make sense to use a choice here, as not all integer values >> are valid. > > From the customize manual, using the :options is only avialiable with > few :types, like hook and plist. I don't think it works for numbers. You could just use something of the form (choice (const :tag "Minimal Highlighting" 1) ...) >> You should clean up the indentation, you seem to have tabs in the code >> made the code intended in a harder to read way on my machine. > > Ok, I changed the tab width and indented whole page. tell me if still a > problem. There still seem to be a few instances. You can use whitespace-mode to highlight them ICYDK. >>> >>> (defun haskell-ts-indent-defun (pos) >>> "Indent the current function." >>> (interactive "d") >>> (let ((node (treesit-node-at pos))) >>> (while (not (string-match >>> "^declarations$\\|haskell" >>> (treesit-node-type (treesit-node-parent node)))) >>> (setq node (treesit-node-parent node))) >>> (indent-region (treesit-node-start node) (treesit-node-end node)))) >> >> Why is this function necessary, if we already have the general commands >> for indenting a defun? If it is, it should probably be explained in the >> docstring. > > Haskell functions are not paren wrapped(opptionally they are), so when I > tested those functions don't work. C-M-h works, but the indentation is a > little different in treesitter based mode, it works differently in > incomplete sentences. Meaning newline-indent would rarley be the final > indentation of any expression. I think the reason is too techical to > include in docstring. So regular C-M-h would just re-indent a single equation, while this matches all equations that constitute a total definition? >>> (defun haskell-ts-compile-region-and-go (start end) >>> "Compile the text from START to END in the haskell proc." >>> (interactive "r") >>> (let ((hs (haskell-ts-haskell-session))) >>> (comint-send-string hs ":{\n") >>> (comint-send-region hs start end) >> >> You should probably do something to ensure that the interval doesn't >> contain ":}"? > > I don't get what you mean. If you select a region in the buffer that would happen to include a --8<---------------cut here---------------start------------->8--- :} --8<---------------cut here---------------end--------------->8--- on one line, could this mess up the state of GHCi? >>> (comint-send-string hs "\n:}\n"))) >>> >>> (defun haskell-ts-run-haskell() >>> (interactive) >>> (pop-to-buffer-same-window >>> (if (comint-check-proc "*haskell*") >>> "*haskell*" >>> (make-comint "haskell" "ghci" nil buffer-file-name)))) >> >> 1. Would it make sense to have a user option that allows customising >> this, in case someone uses Cabal, Stack or whatever else? > > I have a lot to say about this: Haskell's eco system is something that > will have you scratching your head when sleeping. Trying to support > these utilities is soft suacide. This package provides a simple ghci > wrapper, and I don't want it to become too complex, and inturn hard to > maintain(these tools are diddy when it comes to backward compatibity) > and understand. If someone wants to make a complex ghci wrapper which > can do all this, they could(but shouldn't, for the sake of mental > health). This mode attempts ot provide syntax+indentation+imenu+ > someminorstuff *fullstop*, not provide the whole hassle-less haskell > development experiance(even if it existed). The current model is that > people just do `import`in ghc. iirc, no fancy cabal/stakc program exists > to start ghci with all the app loaded. To haskell-ts-mode, haskell goes > as far as ghc, cabal and stack don't exist. I don't have much experience with these tools, all I know is that there are commands like "stack ghci" that might be something some people could be interested in setting. > Wait, now that I read it, you meant an option to specify ghci > path(added). I went on a rant as soon as I saw cabal, oh well... I guess that should be fine as well. >> 2. The regular haskell-mode has a `run-haskell' command that creates the >> same buffer name. Assuming that it is not that unusual for people to >> have both installed, when trying out the one or the other, shouldn't >> you take some precaution to detect that scenario? > > yes, that makes sense, I changed buffer name to *Inferior Haskell*. > Initially I wanted to name the functino run-haskell for consistancy(eg > run-php (in php-ts), run-scheme, etc...), but this is fine. If we move the code into the core, then I think it would be fair to add such a function. We shouldn't have to inconvenience users because of third-party packages on NonGNU ELPA. Also, you seem to have named the buffer "*Inferior haskell*" (lower case) instead of "*Inferior Haskell*" in `haskell-ts-haskell-session'. Perhaps you can pull out the string into a constant. > I attach new file, I have also pushed changes to codebrg repo. I think it would be someone with more Tree Sitter experience could take a look at the code as well. Perhaps we should make this more formal by moving over to the bug tracker?