unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* save-history.el: visiting file literally
@ 2006-10-02 18:48 Torsten Bronger
  2006-10-02 19:10 ` Thorsten Bonow
  0 siblings, 1 reply; 3+ messages in thread
From: Torsten Bronger @ 2006-10-02 18:48 UTC (permalink / raw)


Hallöchen!

I've recently installed save-history.el by Lars R. Clausen.  Now,
every time I close Emacs, it asks to re-visit the file .save-history
"literally", because currently, it is opened in some non-literally
mode.  The code is rather short, so I dare to cite it here:

--8<---------------cut here---------------start------------->8---
(defun save-history-save ()
  "Save all histories in `save-history-varlist' to `save-history-file'"
  (let ((old-buffer (current-buffer))
        (histbuffer (find-file-noselect save-history-file t t)))
    (switch-to-buffer histbuffer)
    (if (> (buffer-size) 0)
        (delete-region 1 (buffer-size)))
    (insert "(setq\n")
    (mapcar (lambda (x)
              (if (and x (eval x))
                  (progn
                    (insert "  ")
                    (prin1 x histbuffer)
                    (insert "\n    '")
                    (if save-history-max-length
                        (let ((truncated (save-history-truncate-list
                                          (eval x)
                                          save-history-max-length)))
                          (prin1 truncated histbuffer))
                      (prin1 (eval x) histbuffer))
                    (insert "\n"))))
            save-history-varlist)
    (insert ")\n")
    (basic-save-buffer)
    (switch-to-buffer old-buffer)))

(defun save-history-load ()
  "Load histories from `save-history-file'"
  (if (file-exists-p save-history-file)
      (load-file save-history-file)))

(add-hook 'after-init-hook 'save-history-load)
(add-hook 'kill-emacs-hook 'save-history-save)
--8<---------------cut here---------------end--------------->8---

How can I achieve that the save-history-file is read in the proper
way so that re-visiting is not necessary anymore?  Many thanks!

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                                    ICQ 264-296-646
                   (See http://ime.webhop.org for Jabber, MSN, etc.)

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

end of thread, other threads:[~2006-10-02 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-02 18:48 save-history.el: visiting file literally Torsten Bronger
2006-10-02 19:10 ` Thorsten Bonow
2006-10-02 19:37   ` Torsten Bronger

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).