all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Subject: desktop.el and buffer-file-coding-system
Date: Wed, 05 Nov 2003 02:14:33 +0200	[thread overview]
Message-ID: <87r80nbriu.fsf@mail.jurta.org> (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/

             reply	other threads:[~2003-11-05  0:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-05  0:14 Juri Linkov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-11-05 13:36 desktop.el and buffer-file-coding-system Lars Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r80nbriu.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.