Is there a variable I can set to disable the call of octave-sync-function-file-names
after saving a file?
Asked
Active
Viewed 81 times
1

Daniel Hitzel
- 507
- 4
- 13
2 Answers
1
There's no such variable. However, you can still do this, by removing the function from before-save-hook
. This is untested, but try:
(remove-hook 'before-save-hook 'octave-sync-function-file-names t)
You'll have to do this in each octave-mode buffer, so you should probably do it from octave-mode-hook
like this:
(defun my-octave-deactivate-sync-function ()
"Don't check equality of function and file names.
Add this to `octave-mode-hook'."
(remove-hook 'before-save-hook 'octave-sync-function-file-names t))
(add-hook 'octave-mode-hook #'my-octave-deactivate-sync-function)

Tobias
- 32,569
- 1
- 34
- 75

Tom Tromey
- 759
- 4
- 8
-
1thanks a lot for this piece! I accidentally found out that you can cheat around it by have a statement in the first line of the file. It can be anything like `0;` or `a=4;` – Daniel Hitzel Feb 28 '17 at 19:42
-
Removing the hook had no effect for me, but Daniel's kluge did. – holocronweaver Dec 06 '17 at 06:30
-
@DanielHitzel Yes that works because the file is no longer a function file but an [octave script file](https://octave.org/doc/v4.0.0/Script-Files.html). This is detected by `octave-function-file-p`: "Return non-nil if the first token is \"function\"." – Tobias Apr 20 '18 at 09:23
-
@holocronweaver I've added some code example that works for me. – Tobias Apr 20 '18 at 09:33