[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[XWEM]: [PATCH (XWEM)] Trivial expand-file-name fixes
From: |
Steve Youngs |
Subject: |
[XWEM]: [PATCH (XWEM)] Trivial expand-file-name fixes |
Date: |
Sat, 08 May 2004 13:31:14 +1000 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Security Through Obscurity, linux) |
I've been asking a lot lately so I thought it was high time that I
gave something back. :-)
This is just some trivial expand-file-name fixes. Basically it
eliminates calling files with `(concat xwem-dir "/" file)'. Instead,
do `(expand-file-name file xwem-dir)'.
It also includes the fix to xwem-interactive.el to stop those "wrong
number of args" errors in `read-from-minibuffer'.
XWEM patch:
ChangeLog files diff command: cvs -q diff -U 0
Files affected: ChangeLog
Source files diff command: cvs -q diff -uN
Files affected: xwem-strokes.el xwem-main.el xwem-keymacro.el
xwem-interactive.el
Index: ChangeLog
===================================================================
RCS file: /cvsroot/xwem/xwem/xwem/ChangeLog,v
retrieving revision 1.4
diff -u -U0 -r1.4 ChangeLog
--- ChangeLog 15 Feb 2004 12:34:37 -0000 1.4
+++ ChangeLog 8 May 2004 03:24:39 -0000
@@ -0,0 +1,17 @@
+2004-05-08 Steve Youngs <address@hidden>
+
+ * xwem-keymacro.el (xwem-keymacro-save-macros): Use
+ `expand-file-name'.
+ (xwem-keymacro-load-macros): Ditto.
+
+ * xwem-strokes.el (xwem-strokes-save-strokes): Use
+ `expand-file-name' to define `strokes-file'.
+ (xwem-strokes-load-strokes): Ditto.
+
+ * xwem-main.el (xwem-dir): Change to custom type `directory' and
+ use `file-name-as-directory' to define the default.
+ (xwem-init): Simplify the `expand-file-name' call on xwemrc.el.
+
+ * xwem-interactive.el (xwem-read-from-minibuffer): Add a `notused'
+ arg to prevent wrong number of args error.
+
Index: xwem-interactive.el
===================================================================
RCS file: /cvsroot/xwem/xwem/xwem/xwem-interactive.el,v
retrieving revision 1.3
diff -u -u -r1.3 xwem-interactive.el
--- xwem-interactive.el 15 Feb 2004 12:34:37 -0000 1.3
+++ xwem-interactive.el 8 May 2004 03:24:15 -0000
@@ -56,7 +56,7 @@
;;; Keymacros safe variant of `read-from-minibuffer', i.e. does not
;; block if we are executing keyboard macro.
;;;###autoload
-(defun xwem-read-from-minibuffer (prompt &optional initial-contents keymap
readp history abbrev-table)
+(defun xwem-read-from-minibuffer (prompt &optional initial-contents keymap
readp history abbrev-table &rest notused)
"Read data from xwem minibuffer.
Arguments PROMPT, INITIAL-CONTENTS, KEYMAP, READP, HISTORY and
ABBREV-TABLE are same as for `read-from-minibuffer'."
Index: xwem-keymacro.el
===================================================================
RCS file: /cvsroot/xwem/xwem/xwem/xwem-keymacro.el,v
retrieving revision 1.4
diff -u -u -r1.4 xwem-keymacro.el
--- xwem-keymacro.el 15 Feb 2004 12:34:37 -0000 1.4
+++ xwem-keymacro.el 8 May 2004 03:24:15 -0000
@@ -367,14 +367,14 @@
(insert (format "(define-key xwem-user-macros-map '%S
%S)\n" kseq fbind))))
xwem-user-macros-map)
- (write-file (or file (concat xwem-dir "/" xwem-keymacro-macrofile)))
+ (write-file (or file (expand-file-name xwem-keymacro-macrofile
xwem-dir)))
(kill-buffer buf))))
;;;###autoload
(defun xwem-keymacro-load-macros (&optional file)
"Load macros saved with `xwem-key-save-macros' from FILE.
Default value for FILE is ~/.xwem/xwem-macros.el"
- (load (or file (concat xwem-dir "/" xwem-keymacro-macrofile))))
+ (load (or file (expand-file-name xwem-keymacro-macrofile xwem-dir))))
(provide 'xwem-keymacro)
Index: xwem-main.el
===================================================================
RCS file: /cvsroot/xwem/xwem/xwem/xwem-main.el,v
retrieving revision 1.5
diff -u -u -r1.5 xwem-main.el
--- xwem-main.el 15 Feb 2004 12:34:37 -0000 1.5
+++ xwem-main.el 8 May 2004 03:24:15 -0000
@@ -68,9 +68,10 @@
:group 'xwem)
;;;###autoload
-(defcustom xwem-dir "~/.xwem"
+(defcustom xwem-dir (file-name-as-directory
+ (expand-file-name ".xwem" (getenv "HOME")))
"Directory to store XWEM's files."
- :type 'string
+ :type 'directory
:group 'xwem)
;;;###autoload
@@ -208,7 +209,7 @@
(setq inhibit-startup-message t)
;; read configuration
- (let ((cfg (expand-file-name (concat xwem-dir "/xwemrc.el"))))
+ (let ((cfg (expand-file-name "xwemrc.el" xwem-dir)))
(if (file-exists-p cfg)
(load cfg)
(xwem-message 'warn "Configuration file `%s' does not exists" cfg)))
Index: xwem-strokes.el
===================================================================
RCS file: /cvsroot/xwem/xwem/xwem/xwem-strokes.el,v
retrieving revision 1.4
diff -u -u -r1.4 xwem-strokes.el
--- xwem-strokes.el 15 Feb 2004 12:34:37 -0000 1.4
+++ xwem-strokes.el 8 May 2004 03:24:15 -0000
@@ -141,7 +141,7 @@
"Save user defined strokes to file named by `xwem-strokes-file'.
Modification to `strokes-prompt-user-save-strokes' to work with xwem's stuff."
(let ((strokes-global-map xwem-strokes-map)
- (strokes-file (concat xwem-dir "/" xwem-strokes-file)))
+ (strokes-file (expand-file-name xwem-strokes-file xwem-dir)))
(flet ((yes-or-no-p-maybe-dialog-box (prompt)
(lambda () (xwem-under-minib-focus (yes-or-no-p prompt)))))
@@ -159,12 +159,12 @@
(defun xwem-strokes-load-strokes ()
"Load user defined strokes from file named by `xwem-strokes-file'."
- (if (file-exists-p (concat xwem-dir "/" xwem-strokes-file))
+ (if (file-exists-p (expand-file-name xwem-strokes-file xwem-dir))
; (xwem-under-minib-focus
; (and (y-or-n-p
; (format "XWEM: No strokes loaded. Load `%s'? "
-; (concat xwem-dir "/" xwem-strokes-file)))
- (let ((strokes-file (concat xwem-dir "/" xwem-strokes-file)))
+; (expand-file-name xwem-strokes-file xwem-dir)))
+ (let ((strokes-file (expand-file-name xwem-strokes-file xwem-dir)))
(strokes-load-user-strokes))))
(defun xwem-strokes-cmd-valid-p (cmd)
--
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
| Ashes to ashes, dust to dust. |
| The proof of the pudding, is under the crust. |
|----------------------------------<address@hidden>---|
pgp2IjePXsxOx.pgp
Description: PGP signature
- [XWEM]: [PATCH (XWEM)] Trivial expand-file-name fixes,
Steve Youngs <=