emacs-devel
[Top][All Lists]
Advanced

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

Re: url-history.el: variable url-history-track defined but not used


From: Klaus Straubinger
Subject: Re: url-history.el: variable url-history-track defined but not used
Date: Fri, 2 Dec 2005 16:41:00 +0100 (CET)

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





reply via email to

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