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

* Re: save-history.el: visiting file literally
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Bonow @ 2006-10-02 19:10 UTC (permalink / raw)


>>>>> "Torsten" == Torsten Bronger <bronger@physik.rwth-aachen.de> writes:

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

Hi,

just remembered that I used to have the same problem and checked how I fixed it:
Then I realized that I switched from "save-history.el" to "savehist.el" coming
along with CVS emacs. Does the same job. Works for me. Maybe you shouldn't
bother and make the switch, too. Checked quickly, it appears to work on Emacs
21.4...

Hope this helps...

Toto

-- 
Contact information and PGP key at
http://www-users.rwth-aachen.de/thorsten.bonow

...and I thought I'd live forever, but now I'm not so sure...

Lisa Loeb: Stay

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

* Re: save-history.el: visiting file literally
  2006-10-02 19:10 ` Thorsten Bonow
@ 2006-10-02 19:37   ` Torsten Bronger
  0 siblings, 0 replies; 3+ messages in thread
From: Torsten Bronger @ 2006-10-02 19:37 UTC (permalink / raw)


Hallöchen!

Thorsten Bonow writes:

>>>>>> "Torsten" == Torsten Bronger <bronger@physik.rwth-aachen.de> writes:
>
>     Torsten> Hallöchen!  I've recently installed save-history.el
>     Torsten> by Lars R. Clausen.  Now, every time I close Emacs,
>     Torsten> it asks to re-visit the file .save-history
>     Torsten> "literally", because currently, it is opened in some
>     Torsten> non-literally mode.  The code is rather short, so I
>     Torsten> dare to cite it here:
>
> just remembered that I used to have the same problem and checked
> how I fixed it: Then I realized that I switched from
> "save-history.el" to "savehist.el" coming along with CVS
> emacs. Does the same job. Works for me. Maybe you shouldn't bother
> and make the switch, too. Checked quickly, it appears to work on
> Emacs 21.4...

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