Question about file coding system

View: New views
2 Messages — Rating Filter:   Alert me  

Question about file coding system

by Robert Goldman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am getting problems in aquamacs where files are getting their
buffer-file-coding-system reset to "Mac", which is /never/ what I want.

This seems to only happen when a save-file command /fails/.  E.g., my
common-lisp-mode checks for balanced parentheses.  When the
balance-check /fails/, the save is aborted, and (at least sometimes) I
see the coding system change to Mac.

Does this tickle anyone's idea bone?

I'm happy to track this down myself, but I don't have a clear sense of
the execution path that's followed when save-buffer fails, and I don't
know what might be trying to reset the coding system to mac.

I find the following suggestive snippet in files.el.gz:

            (if save-buffer-coding-system
                (setq save-buffer-coding-system last-coding-system-used)
              (setq buffer-file-coding-system last-coding-system-used))

Is there any chance that something could cause last-coding-system-used
to be set to mac?

It's hard for me to tell, because last-coding-system-used is in the C
code and while my elisp chops are reasonable, I have no familiarity with
the C code of lisp.

best,
r
_______________________________________________
Aquamacs-devel mailing list
Aquamacs-devel@...
http://lists.aquamacs.org/mailman/listinfo.cgi/aquamacs-devel

Re: Question about file coding system

by davidswelt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Robert,

have you figured out more regarding this?

This sounds like a bug where the coding system is set temporarily (for whatever reason) and not cleaned up.  Setting variables with a "let" expression can do that  (one has to use `unwind-protect' for that).  

The stuff called via `after-save-hook' comes to mind, even though there is nothing in there that obviously sets the coding system.  Try setting that hook to nil to see what happens.

Also, I would see how the save failure is communicated out of that balance check function (is it a Quit or another signal, or does it return some value that is interpreted as a failure?).  You can invoke the debugger with a Quit signal in that function or so in order to get a backtrace, which should tell you at least where to look.

Let me know if you find a bug!

- David

--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project!



On Dec 20, 2009, at 1:04 PM, Robert Goldman wrote:

> I am getting problems in aquamacs where files are getting their
> buffer-file-coding-system reset to "Mac", which is /never/ what I want.
>
> This seems to only happen when a save-file command /fails/.  E.g., my
> common-lisp-mode checks for balanced parentheses.  When the
> balance-check /fails/, the save is aborted, and (at least sometimes) I
> see the coding system change to Mac.
>
> Does this tickle anyone's idea bone?
>
> I'm happy to track this down myself, but I don't have a clear sense of
> the execution path that's followed when save-buffer fails, and I don't
> know what might be trying to reset the coding system to mac.
>
> I find the following suggestive snippet in files.el.gz:
>
>    (if save-buffer-coding-system
> (setq save-buffer-coding-system last-coding-system-used)
>      (setq buffer-file-coding-system last-coding-system-used))
>
> Is there any chance that something could cause last-coding-system-used
> to be set to mac?
>
> It's hard for me to tell, because last-coding-system-used is in the C
> code and while my elisp chops are reasonable, I have no familiarity with
> the C code of lisp.
>
> best,
> r
> _______________________________________________
> Aquamacs-devel mailing list
> Aquamacs-devel@...
> http://lists.aquamacs.org/mailman/listinfo.cgi/aquamacs-devel


_______________________________________________
Aquamacs-devel mailing list
Aquamacs-devel@...
http://lists.aquamacs.org/mailman/listinfo.cgi/aquamacs-devel

PGP.sig (210 bytes) Download Attachment