emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

desktop.el and buffer-file-coding-system


From: Juri Linkov
Subject: desktop.el and buffer-file-coding-system
Date: Wed, 05 Nov 2003 02:14:33 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

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  <address@hidden>

        * 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 via email to

[Prev in Thread] Current Thread [Next in Thread]