mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 01:21:38 -05:00
ein-file.el: handle text encoding on windows
Try to sanely decode text on windows sytems to avoid getting a buffer full of ^M EOL symbols when opening files through ein's notebooklist buffer. This doesn't appear to be necessary on Unix systems, and by extension I am going to assume it is also the same on Mac OS X.
This commit is contained in:
parent
5c2f34ceeb
commit
5ed0b871ce
1 changed files with 8 additions and 2 deletions
|
@ -42,10 +42,16 @@
|
||||||
(with-current-buffer (get-buffer-create (ein:file-buffer-name (ein:$content-url-or-port content)
|
(with-current-buffer (get-buffer-create (ein:file-buffer-name (ein:$content-url-or-port content)
|
||||||
(ein:$content-path content)))
|
(ein:$content-path content)))
|
||||||
(setq ein:content-file-buffer--content content)
|
(setq ein:content-file-buffer--content content)
|
||||||
(insert (ein:$content-raw-content content))
|
(let ((raw-content (ein:$content-raw-content content)))
|
||||||
|
(if (eql system-type 'windows-nt)
|
||||||
|
(insert (decode-coding-string raw-content 'utf-8))
|
||||||
|
(insert raw-content)))
|
||||||
(set-visited-file-name (buffer-name))
|
(set-visited-file-name (buffer-name))
|
||||||
(set-auto-mode)
|
(set-auto-mode)
|
||||||
(add-hook 'write-contents-functions 'ein:content-file-save)
|
(add-hook 'write-contents-functions 'ein:content-file-save) ;; FIXME Brittle, will not work
|
||||||
|
;; if user changes major mode.
|
||||||
|
(set-buffer-modified-p nil)
|
||||||
|
(goto-char (point-min))
|
||||||
(pop-to-buffer (buffer-name))))
|
(pop-to-buffer (buffer-name))))
|
||||||
|
|
||||||
(defun ein:content-file-save ()
|
(defun ein:content-file-save ()
|
||||||
|
|
Loading…
Add table
Reference in a new issue