emacs-devel
[Top][All Lists]
Advanced

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

Re: saveplace: don't ask for coding system


From: David Reitter
Subject: Re: saveplace: don't ask for coding system
Date: Sun, 2 Dec 2007 16:51:57 +0000

On 29 Nov 2007, at 09:05, Juanma Barranquero wrote:


I think you should also add a "-*- coding: XXX -*-" line to the file.


Good idea. I left the coding system at `utf-8', because that's what ido seems to use. If there are characters not in utf-8 that file systems accept for file names, it should probably be emacs-mule.

I'll post a separate patch for log level based message filtering another time.


2007-12-02  David Reitter <address@hidden>

        * saveplace.el (load-save-place-alist-from-file): set coding system
        for places file and improve write error message.




*** lisp/saveplace.el   25 Jul 2007 05:47:04 +0100      1.37.2.1
--- lisp/saveplace.el   02 Dec 2007 16:44:59 +0000      
***************
*** 205,215 ****
        (setq save-place-alist (cdr save-place-alist)))))

  (defun save-place-alist-to-file ()
!   (let ((file (expand-file-name save-place-file)))
      (save-excursion
        (message "Saving places to %s..." file)
        (set-buffer (get-buffer-create " *Saved Places*"))
        (delete-region (point-min) (point-max))
        (when save-place-forget-unreadable-files
        (save-place-forget-unreadable-files))
        (let ((print-length nil)
--- 205,220 ----
        (setq save-place-alist (cdr save-place-alist)))))

  (defun save-place-alist-to-file ()
!   (let ((file (expand-file-name save-place-file))
!       (coding-system-for-write 'utf-8))
      (save-excursion
        (message "Saving places to %s..." file)
        (set-buffer (get-buffer-create " *Saved Places*"))
        (delete-region (point-min) (point-max))
+       (insert
+        (format ";; -*- mode: emacs-lisp; coding: %s -*-\n"
+              coding-system-for-write)
+ ";; Positions for files, automatically generated by `saveplace'.\n\n")
        (when save-place-forget-unreadable-files
        (save-place-forget-unreadable-files))
        (let ((print-length nil)
***************
*** 225,231 ****
        (condition-case nil
            ;; Don't use write-file; we don't want this buffer to visit it.
            (write-region (point-min) (point-max) file)
!         (file-error (message "Can't write %s" file)))
          (kill-buffer (current-buffer))
          (message "Saving places to %s...done" file)))))

--- 230,236 ----
        (condition-case nil
            ;; Don't use write-file; we don't want this buffer to visit it.
            (write-region (point-min) (point-max) file)
!         (file-error (message "Saving places: Can't write %s" file)))
          (kill-buffer (current-buffer))
          (message "Saving places to %s...done" file)))))






reply via email to

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