]> git.eshelyaron.com Git - emacs.git/commitdiff
(type-break-file-name): Doc update as per the above.
authorEli Zaretskii <eliz@gnu.org>
Sat, 15 Jan 2005 13:06:55 +0000 (13:06 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 15 Jan 2005 13:06:55 +0000 (13:06 +0000)
(type-break-mode, type-break-file-time, type-break-file-keystroke-count)
(type-break-choose-file): Don't store data in or load data from the file
if none specified.

lisp/ChangeLog
lisp/type-break.el

index 9339bc1f87b48a461f8c2c19406b2baf122932b2..324c00cd3baeba53165862a97909816cb1dcf19b 100644 (file)
@@ -1,3 +1,11 @@
+2005-01-15  Jorgen Schaefer  <forcer@forcix.cx>  (tiny change)
+
+       * type-break.el (type-break-mode, type-break-file-time)
+       (type-break-file-keystroke-count, type-break-choose-file): Don't
+       store data in or load data from the file if type-break-file-name
+       is nil.
+       (type-break-file-name): Doc update as per the above.
+
 2005-01-15  Stephen Eglen  <S.J.Eglen@damtp.cam.ac.uk>  (tiny change)
 
        * woman.el (woman-dired-define-key-maybe): If KEY is undefined,
index 7a387bfe062578e125dcc585f83213ee5532b1f9..3a0b8b5adccc4da9d1481d63c8ff193ba4578185 100644 (file)
@@ -229,7 +229,8 @@ key is pressed."
   :group 'type-break)
 
 (defcustom type-break-file-name (convert-standard-filename "~/.type-break")
-  "*Name of file used to save state across sessions."
+  "*Name of file used to save state across sessions.
+If this is nil, no data will be saved across sessions."
   :type 'file
   :group 'type-break)
 
@@ -402,7 +403,9 @@ problems."
       (type-break-keystroke-reset)
       (type-break-mode-line-countdown-or-break nil)
 
-      (setq type-break-time-last-break (type-break-get-previous-time))
+      (setq type-break-time-last-break
+            (or (type-break-get-previous-time)
+                (current-time)))
 
       ;; schedule according to break time from session file
       (type-break-schedule
@@ -434,11 +437,12 @@ problems."
       (type-break-mode-line-countdown-or-break nil)
       (type-break-cancel-schedule)
       (do-auto-save)
-      (with-current-buffer (find-file-noselect type-break-file-name
-                                               'nowarn)
-       (set-buffer-modified-p nil)
-        (unlock-buffer)
-        (kill-this-buffer))
+      (when type-break-file-name
+       (with-current-buffer (find-file-noselect type-break-file-name
+                                                'nowarn)
+         (set-buffer-modified-p nil)
+         (unlock-buffer)
+         (kill-this-buffer)))
       (and (interactive-p)
            (message "Type Break mode is disabled")))))
   type-break-mode)
@@ -498,7 +502,8 @@ variable of the same name."
 
 (defun type-break-file-time (&optional time)
   "File break time in `type-break-file-name', unless the file is locked."
-  (if (not (stringp (file-locked-p type-break-file-name)))
+  (if (and type-break-file-name
+           (not (stringp (file-locked-p type-break-file-name))))
       (with-current-buffer (find-file-noselect type-break-file-name
                                                'nowarn)
         (let ((inhibit-read-only t))
@@ -509,7 +514,8 @@ variable of the same name."
 
 (defun type-break-file-keystroke-count ()
   "File keystroke count in `type-break-file-name', unless the file is locked."
-  (if (not (stringp (file-locked-p type-break-file-name)))
+  (if (and type-break-file-name
+           (not (stringp (file-locked-p type-break-file-name))))
       ;; Prevent deactivation of the mark in some other buffer.
       (let (deactivate-mark)
        (with-current-buffer (find-file-noselect type-break-file-name
@@ -536,6 +542,8 @@ return TIME, else return nil."
 (defun type-break-choose-file ()
   "Return file to read from."
   (cond
+   ((not type-break-file-name)
+    nil)
    ((and (file-exists-p type-break-auto-save-file-name)
          (file-readable-p type-break-auto-save-file-name))
     type-break-auto-save-file-name)