unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* desktop.el and buffer-file-coding-system
@ 2003-11-05  0:14 Juri Linkov
  0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2003-11-05  0:14 UTC (permalink / raw)


Currently desktop.el don't restore file codings when it reads saved
files.  This problem can be fixed by saving local variable
`buffer-file-coding-system' in the desktop file and using it during
file restoring in the function `desktop-buffer-file'.  Unless there is
a better method to achieve the same goal, the following patch could be
installed into CVS.  Does it also make sense to add the same code
to other buffer handlers (dired, rmail, mh, info)?

This patch also fixes a bug where desktop.el asked user to insert
default contents into restored empty files.  This shouldn't be done
by desktop.el, because if user created a new empty file and saved it,
such was his intention.

2003-11-05  Juri Linkov  <juri@jurta.org>

	* desktop.el (desktop-locals-to-save): Add buffer-file-coding-system.
	(desktop-buffer-file): Use saved buffer-file-coding-system
	for file reading.  Set auto-insert to nil to prevent automatic
	insertion into restored empty files.

Index: emacs/lisp/desktop.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/desktop.el,v
retrieving revision 1.65
diff -c -w -r1.65 desktop.el
*** emacs/lisp/desktop.el	30 Sep 2003 07:22:22 -0000	1.65
--- emacs/lisp/desktop.el	4 Nov 2003 22:54:44 -0000
***************
*** 227,233 ****
    fill-column
    overwrite-mode
    change-log-default-name
!   line-number-mode)
    "List of local variables to save for each buffer.
  The variables are saved only when they really are local."
    :type '(repeat symbol)
--- 227,234 ----
    fill-column
    overwrite-mode
    change-log-default-name
!   line-number-mode
!   buffer-file-coding-system)
    "List of local variables to save for each buffer.
  The variables are saved only when they really are local."
    :type '(repeat symbol)
***************
*** 872,878 ****
  		   (y-or-n-p (format
  			      "File \"%s\" no longer exists. Re-create? "
  			      desktop-buffer-file-name))))
! 	  (let ((buf (find-file-noselect desktop-buffer-file-name)))
  	    (condition-case nil
  		(switch-to-buffer buf)
  	      (error (pop-to-buffer buf)))
--- 873,884 ----
  		   (y-or-n-p (format
  			      "File \"%s\" no longer exists. Re-create? "
  			      desktop-buffer-file-name))))
! 	  (let* (auto-insert
! 		 (coding-system-for-read
! 		  (or coding-system-for-read
! 		      (cdr (assq 'buffer-file-coding-system
! 				 desktop-buffer-locals))))
! 		 (buf (find-file-noselect desktop-buffer-file-name)))
  	    (condition-case nil
  		(switch-to-buffer buf)
  	      (error (pop-to-buffer buf)))

-- 
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: desktop.el and buffer-file-coding-system
@ 2003-11-05 13:36 Lars Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Hansen @ 2003-11-05 13:36 UTC (permalink / raw)
  Cc: emacs-devel

Your patch looks correct to me, and it works in my test.
I have just installed it.

Thank you!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-05 13:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05  0:14 desktop.el and buffer-file-coding-system Juri Linkov
  -- strict thread matches above, loose matches on Subject: below --
2003-11-05 13:36 Lars Hansen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).