ThibautVerron / magma-mode

An emacs major-mode for editing magma files
5 stars 1 forks source link

Current path is lost when magma is restarted #12

Closed mjrodgers closed 9 years ago

mjrodgers commented 9 years ago

I have noticed that when I restart magma using C-c C-a, the current path is lost. I have to quit magma and relaunch with C-c C-o to have the proper path.

ThibautVerron commented 9 years ago

Hello,

Which path do you mean? Magma's working directory (where load will look for files), or emacs' working directory (where C-x C-f would start, for example)? Or something else entirely?

C-c C-a should be nothing more than what you describe, kill and relaunch, so if there is inconsistent behavior between the two methods, it's most likely a bug.

mjrodgers commented 9 years ago

The working directory for using 'load'. It seems like a bug where the cwd is not set properly when using C-c C-a.

ThibautVerron commented 9 years ago

Thanks for bringing this to my attention. The magma mode was not attempting to change this cwd at all, so unspecified behavior were to be expected.

I have pushed a new version which should try to maintain a consistent value for the directory:

The new version should reach melpa in a couple hours.

It has been tested for basic functionality (i.e. it shouldn't break anything, though you can't ever be sure), but I probably have skipped some situations in terms of the new feature. If you see some cases where it does not work as described above, or where what's described above does not make any sense, please let me know.

mjrodgers commented 9 years ago

Hmm, it's still not working as expected. When I launch with C-c C-o, the current directory from magma GetCurrentDirectory() is the directory of the file active when launching magma. But when I reset with C-c C-a, it changes to my home directory.

ThibautVerron commented 9 years ago

Where is the cursor when you reset with C-c C-a?

mjrodgers commented 9 years ago

It is in the active file with the code.

ThibautVerron commented 9 years ago

So what you do is:

  1. Open a file in a given directory (not your home)
  2. With point in the buffer showing the file, C-c C-o
  3. Move point to the magma buffer, evaluate GetCurrentDirectory();, it shows the directory containing the file
  4. Move point back to the file
  5. Press C-c C-a
  6. Move point back to the magma buffer, evaluate GetCurrentDirectory();, it shows your home directory

Is that correct?

Could you check that the installed version (in melpa) is 20150923? And have you restarted emacs after updating?

mjrodgers commented 9 years ago

Ahh! You are right, I had not restarted emacs maybe. It is working as expected now. Cheers!