[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
type-break.el: Should allow to disable the usage of the session file (pa
From: |
Jorgen Schaefer |
Subject: |
type-break.el: Should allow to disable the usage of the session file (patch) |
Date: |
Fri, 07 Jan 2005 21:28:40 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
Hello!
type-break.el stores the type break information in a session file.
This is annoying, as it leaves a visible #.type-break# file in the
home directory, requires user interaction on kill-emacs, and
leaves a file in the home directory that some people don't need
nor want: I start emacs when I log in, and I kill it when I switch
the computer off. No need to store the type break information.
Attached is a patch which allows `type-break-file-name' to be set
to nil and just doesn't use the file.
ChangeLog entry:
2005-01-07 Jorgen Schaefer <address@hidden>
Allow type-break-file-name to be nil and if so, don't use
a session file.
* type-break.el (type-break-file-name): Document the
behavior.
* 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 none specified.
In GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2004-12-18 on forcix
Greetings,
-- Jorgen
--
((email . "address@hidden") (www . "http://www.forcix.cx/")
(gpg . "1024D/028AF63C") (irc . "nick forcer on IRCnet"))
diff -purN emacs.orig/lisp/type-break.el emacs/lisp/type-break.el
--- emacs.orig/lisp/type-break.el 2005-01-07 20:49:11.000000000 +0100
+++ emacs/lisp/type-break.el 2005-01-07 20:58:09.000000000 +0100
@@ -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)
@@ -399,7 +400,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
@@ -431,12 +434,13 @@ 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)
- (setq buffer-save-without-query t)
- (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)
+ (setq buffer-save-without-query t)
+ (set-buffer-modified-p nil)
+ (unlock-buffer)
+ (kill-this-buffer)))
(and (interactive-p)
(message "Type Break mode is disabled")))))
type-break-mode)
@@ -496,7 +500,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))
@@ -507,7 +512,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
@@ -534,6 +540,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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- type-break.el: Should allow to disable the usage of the session file (patch),
Jorgen Schaefer <=