From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Klaus Straubinger Newsgroups: gmane.emacs.devel Subject: Re: url-history.el: variable url-history-track defined but not used Date: Fri, 2 Dec 2005 16:41:00 +0100 (CET) Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1133544556 16706 80.91.229.2 (2 Dec 2005 17:29:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2005 17:29:16 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 02 18:29:14 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EiEeA-00049n-5i for ged-emacs-devel@m.gmane.org; Fri, 02 Dec 2005 18:24:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EiEe9-00054G-K3 for ged-emacs-devel@m.gmane.org; Fri, 02 Dec 2005 12:24:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EiD2E-0001We-Oh for emacs-devel@gnu.org; Fri, 02 Dec 2005 10:41:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EiD2A-0001UI-Nr for emacs-devel@gnu.org; Fri, 02 Dec 2005 10:41:17 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EiD2A-0001U8-CW for emacs-devel@gnu.org; Fri, 02 Dec 2005 10:41:14 -0500 Original-Received: from [155.56.68.140] (helo=smtpde03.sap-ag.de) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EiD29-00022y-8J for emacs-devel@gnu.org; Fri, 02 Dec 2005 10:41:14 -0500 Original-Received: from sap-ag.de (smtpde03) by smtpde03.sap-ag.de (out) with ESMTP id QAA00030 for ; Fri, 2 Dec 2005 16:41:06 +0100 (MEZ) Original-To: emacs-devel@gnu.org In-Reply-To: X-Mailer: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 X-SAP: out 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:46892 Archived-At: > I installed your patch. Thanks. Thank you. I had suggested that the improved :set function could also be of use for the defcustom of the variable url-history-save-interval where I copied my first suggestion from. And while looking at the code, I found two new possible improvements: The variable url-history-list is defined but not used and could be deleted. The variable url-history-hash-table is its replacement. The code in url-history-setup-save-timer checks for the availability of the functions run-at-time and start-itimer, as far as I understand it to be able to run on XEmacs as well. XEmacs compatibility has been removed elsewhere, so this could be simplified as well. I would propose the following patch: --- url-history.el.orig 2005-12-02 08:10:18.000000000 +0100 +++ url-history.el 2005-12-02 16:35:01.000000000 +0100 @@ -63,22 +63,15 @@ Default is 1 hour. Note that if you change this variable outside of the `customize' interface after `url-do-setup' has been run, you need to run the `url-history-setup-save-timer' function manually." - :set (function (lambda (var val) - (set-default var val) - (and (featurep 'url) - (fboundp 'url-history-setup-save-timer) - (let ((def (symbol-function - 'url-history-setup-save-timer))) - (not (and (listp def) (eq 'autoload (car def))))) - (url-history-setup-save-timer)))) + :set #'(lambda (var val) + (set-default var val) + (if (bound-and-true-p url-setup-done) + (url-history-setup-save-timer))) :type 'integer :group 'url-history) (defvar url-history-timer nil) -(defvar url-history-list nil - "List of urls visited this session.") - (defvar url-history-changed-since-last-save nil "Whether the history list has changed since the last save operation.") @@ -91,21 +84,12 @@ (defun url-history-setup-save-timer () "Reset the history list timer." (interactive) - (ignore-errors - (cond ((fboundp 'cancel-timer) (cancel-timer url-history-timer)) - ((fboundp 'delete-itimer) (delete-itimer url-history-timer)))) + (ignore-errors (cancel-timer url-history-timer)) (setq url-history-timer nil) (if (and (eq url-history-track t) url-history-save-interval) - (setq url-history-timer - (cond - ((fboundp 'run-at-time) - (run-at-time url-history-save-interval - url-history-save-interval - 'url-history-save-history)) - ((fboundp 'start-itimer) - (start-itimer "url-history-saver" 'url-history-save-history - url-history-save-interval - url-history-save-interval)))))) + (setq url-history-timer (run-at-time url-history-save-interval + url-history-save-interval + 'url-history-save-history)))) ;;;###autoload (defun url-history-parse-history (&optional fname)