;;; strokes.el --- control Emacs through mouse strokes
;; Copyright (C) 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;; 2008, 2009 Free Software Foundation, Inc.
+;; 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: David Bakhash <cadet@alum.mit.edu>
;; Maintainer: FSF
;; don't try to update strokes window configuration
;; if window is dedicated or a minibuffer
nil)
- ((or (interactive-p)
+ ((or (called-interactively-p 'interactive)
(not (buffer-live-p (get-buffer strokes-buffer-name)))
(null strokes-window-configuration))
;; create `strokes-window-configuration' from scratch...
(save-excursion
(save-window-excursion
- (get-buffer-create strokes-buffer-name)
+ (set-buffer (get-buffer-create strokes-buffer-name))
(set-window-buffer current-window strokes-buffer-name)
(delete-other-windows)
(fundamental-mode)
(auto-save-mode 0)
- (if (featurep 'font-lock)
- (font-lock-mode 0))
+ (font-lock-mode 0)
(abbrev-mode 0)
(buffer-disable-undo (current-buffer))
(setq truncate-lines nil)
(cond ((and (file-exists-p strokes-file)
(file-readable-p strokes-file))
(load-file strokes-file))
- ((interactive-p)
+ ((called-interactively-p 'interactive)
(error "Trouble loading user-defined strokes; nothing done"))
(t
(message "No user-defined strokes, sorry"))))
(setq strokes-global-map nil)
(strokes-load-user-strokes)
(if (and (not (equal current strokes-global-map))
- (or (interactive-p)
+ (or (called-interactively-p 'interactive)
(yes-or-no-p "Save your strokes? ")))
(progn
(require 'pp) ; pretty-print variables
((strokes-lift-p point)
;; a lift--tell the loop to X out the next point...
(setq lift-flag t))))
- (when (interactive-p)
+ (when (called-interactively-p 'interactive)
(pop-to-buffer " *strokes-xpm*")
;; (xpm-mode 1)
(goto-char (point-min))
(defun strokes-xpm-to-compressed-string (&optional xpm-buffer)
"Convert XPM in XPM-BUFFER to compressed string representing the stroke.
XPM-BUFFER defaults to ` *strokes-xpm*'."
- (save-excursion
- (set-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*")))
+ (with-current-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*"))
(goto-char (point-min))
(search-forward "/* pixels */") ; skip past header junk
(forward-char 2)
Optional FORCE non-nil will ignore the buffer's read-only status."
(interactive)
;; (interactive "*bStrokify buffer: ")
- (save-excursion
- (set-buffer (setq buffer (get-buffer (or buffer (current-buffer)))))
+ (with-current-buffer (setq buffer (get-buffer (or buffer (current-buffer))))
(when (or (not buffer-read-only)
force
inhibit-read-only
;; buffer is killed?
;; (interactive "*bUnstrokify buffer: ")
(interactive)
- (save-excursion
- (set-buffer (setq buffer (or buffer (current-buffer))))
+ (with-current-buffer (setq buffer (or buffer (current-buffer)))
(when (or (not buffer-read-only)
force
inhibit-read-only
(defun strokes-xpm-for-compressed-string (compressed-string &optional bufname)
"Convert the stroke represented by COMPRESSED-STRING into an XPM.
Store XPM in buffer BUFNAME if supplied \(default is ` *strokes-xpm*'\)"
- (save-excursion
- (or bufname (setq bufname " *strokes-xpm*"))
- (set-buffer (get-buffer-create bufname))
+ (or bufname (setq bufname " *strokes-xpm*"))
+ (with-current-buffer (get-buffer-create bufname)
(erase-buffer)
(insert compressed-string)
(goto-char (point-min))