From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Hrvoje Niksic Newsgroups: gmane.emacs.devel Subject: Re: Saving minibuffer history Date: 19 Oct 2005 01:34:36 +0200 Message-ID: <87ll0qz9f7.fsf@xemacs.org> References: <87u0fkfc8c.fsf@xemacs.org> <873bn2s9cz.fsf@xemacs.org> <87zmp9sd0o.fsf-monnier+emacs@gnu.org> <87hdbe2948.fsf@xemacs.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1129678608 3075 80.91.229.2 (18 Oct 2005 23:36:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Oct 2005 23:36:48 +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 01:36:40 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ES0zs-00081G-4G for ged-emacs-devel@m.gmane.org; Wed, 19 Oct 2005 01:35:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ES0zq-00039E-VD for ged-emacs-devel@m.gmane.org; Tue, 18 Oct 2005 19:35:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ES0yl-00038K-Cv for emacs-devel@gnu.org; Tue, 18 Oct 2005 19:34:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ES0yg-00036C-DR for emacs-devel@gnu.org; Tue, 18 Oct 2005 19:34:44 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ES0yg-000363-0i for emacs-devel@gnu.org; Tue, 18 Oct 2005 19:34:42 -0400 Original-Received: from [195.29.150.97] (helo=ls405.htnet.hr) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ES0ye-0000o4-GI; Tue, 18 Oct 2005 19:34:41 -0400 Original-Received: from ls401.t-com.hr (ls401.t-com.hr [195.29.150.236]) by ls405.htnet.hr (0.0.0/8.12.10) with ESMTP id j9INYdWj002671; Wed, 19 Oct 2005 01:34:39 +0200 Original-Received: from ls401.t-com.hr (localhost.localdomain [127.0.0.1]) by ls401.t-com.hr (Qmlai) with ESMTP id 4322A70003; Wed, 19 Oct 2005 01:34:39 +0200 (CEST) X-Envelope-Sender: hniksic@xemacs.org X-Envelope-Sender: hniksic@xemacs.org X-Envelope-Sender: hniksic@xemacs.org Original-Received: from localhost.localdomain (83-131-16-128.adsl.net.t-com.hr [83.131.16.128]) by ls401.t-com.hr (Qmlai) with ESMTP id 32914A8006; Wed, 19 Oct 2005 01:34:38 +0200 (CEST) Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 6F437434003; Wed, 19 Oct 2005 01:34:36 +0200 (CEST) Original-To: Stefan Monnier In-Reply-To: Original-Lines: 62 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 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:44283 Archived-At: Stefan Monnier writes: > 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. > I put "reverted" in quotes because I still have gotten rid of > savehist-xemacs and replaced it with (featurep 'xemacs) since this > form is recognized/optimized by the byte-compiler. That's fine. > >> I have one question: what's the point of savehist-no-conversion? >=20 > > The code simply needs to check whether the buffer contents has change= d > > 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. >=20 > 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 =E9 replaced > by a latin-9 =E9, 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. savehist's buffer contents consists of lists with new entries pushed at the front -- it never changes a single character. Even if such a thing did happen, the file would be uselessly re-saved exactly once. > 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. > > What is your intended replacement? If I understand > > minibuffer-history-variable, it only records the minibuffer > > history for minibuffer input whose history is not otherwise > > specified. Which means that it doesn't record the history of M-x, > > M-:, C-x C-f, etc. >=20 > 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?