Rb@emacs michelson mode minor improvements
Context
This MR contains a bunch of minor improvements, all due to reading the code to understand the issue below. However, they are somewhat unrelated - I did not feel like making a zillions MR from these small commits.
The main problem is small: the Emacs Michelson mode relies on creating a temporary file from a Michelson buffer to run the typecheck
command on it - I use uniquify
to give unique names to my Emacs buffers and this results in names like foo<master>
. The temporary file is derived from the buffer name so that it can break if the buffer name contains characters that are "weird" for the file system. In my case the '<' or '>' characters. So I changed how the temporary file name is computed from the buffer name.
Manually testing the MR
Use uniquify and open the a smart contract with the same base name in two different directories. This can work for example if you use any of the smart contracts in the attic with 2 different git worktrees.
An easier way to reproduce the problem is:
- open a contract, say
tests_python/contracts/attic/add1.tz
(check that the Michelson mode works correctly ;-) ) - rename the Emacs buffer a la uniquify
(rename-buffer "add1.tz<master>")
- try to get typing information
In my *Michelson*
buffer, I get
Deferred process exited abnormally:
command: /home/richard/devel/tweag/nlabs/tezos-branches/tezos/tezos-client
exit status: exit 1
event: exited abnormally with code 1
buffer contents: "zsh:1: no such file or directory: master