emacs-devel
[Top][All Lists]
Advanced

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

RE: let HISTORY arg to read functions be a list of history variables


From: Davis Herring
Subject: RE: let HISTORY arg to read functions be a list of history variables
Date: Mon, 2 Jul 2007 09:09:16 -0700 (PDT)
User-agent: SquirrelMail/1.4.8-6.el3.2lanl

>> A very easy way to achieve this is following:
>>
>> (let* ((history-add-new-input nil)
>>        (history (append hi-lock-regexp-history regexp-history))
>>        (str (read-string "Prompt: " nil 'history)))
>>   (add-to-history 'hi-lock-regexp-history str))
>
> Sure. But that's hardly as readable. My proposal was to build that into
> the
> read functions (but without the extraneous addition of the input to the
> temporary history variable). Anyway, Richard has nixed the idea.

That's what the history-add-new-input -> nil is for.  I don't think that
it's really less readable than

(read-string "Prompt: " nil '((hi-lock-regexp-history regexp-history)
                              hi-lock-regexp-history)))

(as your #2 option would have it) since the latter offers no hint as to
why three "...-history" words are present.  If it's just the length that
bothers you, one can write

(let ((history (append hi-lock-regexp-history regexp-history)))
   (add-to-history 'hi-lock-regexp-history
                   (read-string "Prompt: " nil 'history)))

and just let the extra append get GCed.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

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