From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Saving minibuffer history Date: Wed, 19 Oct 2005 14:51:44 -0400 Message-ID: <874q7ds5tu.fsf-monnier+emacs@gnu.org> References: <87u0fkfc8c.fsf@xemacs.org> <873bn2s9cz.fsf@xemacs.org> <87zmp9sd0o.fsf-monnier+emacs@gnu.org> <87hdbe2948.fsf@xemacs.org> <87ll0qz9f7.fsf@xemacs.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: sea.gmane.org 1129748136 16272 80.91.229.2 (19 Oct 2005 18:55:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 Oct 2005 18:55:36 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 19 20:55:28 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ESJ3s-0004B0-6q for ged-emacs-devel@m.gmane.org; Wed, 19 Oct 2005 20:53:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ESJ3r-0004qK-Im for ged-emacs-devel@m.gmane.org; Wed, 19 Oct 2005 14:53:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ESJ2t-0004Go-4w for emacs-devel@gnu.org; Wed, 19 Oct 2005 14:52:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ESJ2o-0004G6-G6 for emacs-devel@gnu.org; Wed, 19 Oct 2005 14:52:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ESJ2n-0004Fv-3S for emacs-devel@gnu.org; Wed, 19 Oct 2005 14:52:09 -0400 Original-Received: from [209.226.175.97] (helo=tomts40-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ESJ2S-0002lG-JI; Wed, 19 Oct 2005 14:51:48 -0400 Original-Received: from alfajor ([70.48.83.21]) by tomts40-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20051019185146.ZMTR1799.tomts40-srv.bellnexxia.net@alfajor>; Wed, 19 Oct 2005 14:51:46 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 835D9D72AD; Wed, 19 Oct 2005 14:51:44 -0400 (EDT) Original-To: Hrvoje Niksic In-Reply-To: <87ll0qz9f7.fsf@xemacs.org> (Hrvoje Niksic's message of "19 Oct 2005 01:34:36 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44337 Archived-At: >> For the case of start-itimer vs run-with-idle-timer, I can see you >> point, so I've "reverted" the change. For the case of (if >> (coding-system-p 'utf-8) 'utf-8 'iso-2022-8), I think the new code >> is preferable, since the choice is really not dependent on >> differences betwen Emacs and XEmacs but just on the availablility of >> utf-8. > That's true in a way, but it's also the case that under XEmacs the > utf-8 coding system is loaded from an external package. So it can > happen that it is present in one XEmacs invocation and not in another. > Because of that I made savehist not use utf-8 in XEmacs. OK, I'll revert that part as well, then. Thanks for the explanation. >> >> I have one question: what's the point of savehist-no-conversion? >> > The code simply needs to check whether the buffer contents has changed >> > since the last save. I wanted to checksum the raw buffer data, which >> > 'no-conversion achieves in Emacs, and 'binary in XEmacs. To make the >> > intentions clear and remove an `if' from the code, I used a defconst. >> So if the buffer contents changed but that change is not reflected >> in the saved file (e.g. the buffer contents has a latin-1 ? replaced >> by a latin-9 ?, but both get written (in utf-8) as the same >> byte-sequence) you end up uselessly re-saving the exact same file. > That seems like a contrived example. It is. >> I know it's not an important case, but I'm wondering: why not simply >> use savehist-coding-system? > Because this use has nothing to do with saving to file or any external > representation, it just needs to be fast and do as little as possible. > Remember that this is done off a timer, and this needs to be fast to > not interrupt the user's work. With large savehist buffers I prefer > to be on the safe side. OK, so it's done for performance reason, on the assumption that encoding with no-conversion is significantly faster than with utf-8. Thanks. >> minibuffer-history-variable has a default value used for when no >> histvar is specified, indeed, but it is also set by >> read-from-minibuffer to the history variable that should be used. >> So by recording its value in minibuffer-setup-hook I accumulate all >> the histvars that have been seen. > What about those that haven't been seen yet? Won't they be saved as > nil by savehist-save? I don't think so: they won't be saved at all. Notice also that the variable savehist-all-history-variables is also saved along with the actual history variables. Stefan