* riece-compat.el (riece-read-passwd): Changed default value.
[riece] / lisp / riece-compat.el
index bcc82ac..d3b9155 100644 (file)
 
 ;;; Code:
 
+(if (featurep 'xemacs)
+    (require 'riece-xemacs)
+  (require 'riece-emacs))
+
 (defalias 'riece-mode-line-buffer-identification
   'identity)
 
     (end-of-line)
     (point)))
 
-(defvar riece-read-passwd nil)
+(defvar riece-read-passwd
+  (if (functionp 'read-passwd)
+      #'read-passwd
+    (if (load "passwd" t)
+       #'read-passwd
+      (autoload 'ange-ftp-read-passwd "ange-ftp")
+      #'ange-ftp-read-passwd)))
+
 (defun riece-read-passwd (prompt)
-  (if (not riece-read-passwd)
-      (if (functionp 'read-passwd)
-         (setq riece-read-passwd 'read-passwd)
-       (if (load "passwd" t)
-           (setq riece-read-passwd 'read-passwd)
-         (autoload 'ange-ftp-read-passwd "ange-ftp")
-         (setq riece-read-passwd 'ange-ftp-read-passwd))))
-  (funcall riece-read-passwd prompt))
+  (condition-case nil
+      (let (inhibit-quit)
+       (funcall riece-read-passwd prompt))
+    (quit
+     (message "%sQuit" prompt)
+     'quit)))
+
+(if (string-match "0\\{0\\}" "")
+    (defun riece-make-interval-regexp (regexp min &optional max)
+      (if max
+         (format "%s\\{%d,%d\\}" regexp min max)
+       (format "%s\\{%d\\}" regexp min)))
+  ;; Emacs 20.7 doesn't support \{...\} in regexps.
+  (defun riece-make-interval-regexp (regexp min &optional max)
+    (mapconcat #'identity
+              (nconc (make-list min regexp)
+                     (if max
+                         (make-list (- max min) (concat regexp "?"))))
+              "")))
 
 (provide 'riece-compat)