emacs-devel
[Top][All Lists]
Advanced

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

Re: Saving minibuffer history


From: Stefan Monnier
Subject: Re: Saving minibuffer history
Date: Tue, 18 Oct 2005 12:12:27 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> Thank you.  Installed.  Along with a few minor changes, mostly to
>> remove run-time dependency on CL

> These changes seem to make the code less readable.  For example:

>     (delete-if-not #'savehist-printable value)

> is changed to:

>     (delq nil (mapcar (lambda (x) (if (savehist-printable x) x)) value))

> And:

>     (subseq value 0 savehist-length)

> is changed to:

>     (setq value (copy-sequence value))
>     (setcdr (nthcdr savehist-length value) nil)

> While I understand the desire to leave the namespace unfettered by cl
> compatibility code, maybe you should at least leave the original forms
> commented-out, so that the intention is clear(er)?

That's a good idea.  I'm in favor of preloading CL in the dumped Emacs, so
leaving in the original code is a way to remind people that preloadnig CL
would clean up various bits of code.

>> and to get rid of most checks for XEmacs, replaced by checks for
>> features.

> This is a bad idea.  There are extensions out there that approach
> cross-emacs compatibility by defining functions normally not present
> in the other implementation.  For example, w3 used to define (and
> maybe still does) `map-extents' under Emacs.  There are extensions
> that define `run-with-timer' under XEmacs.  Such emulations are
> incomplete and one does not wish to use them unless necessary.

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.  If you disagree, let me know and I'll also revert
this part.
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.

>> 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.
I know it's not an important case, but I'm wondering: why not simply use
savehist-coding-system?
BTW, I think that instead of `no-conversion' we should use `emacs-mule'
under Emacs.

>> Also see attached a proposed patch (100% guaranteed untested).  If
>> nobody objects, I'll install it.
>> 
>> I could also get rid of savehist-history-variables altogether.

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

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.


        Stefan






reply via email to

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