   (pcomplete-here (ecasound-input-file-or-device)))
 
 (defun pcomplete/ecasound-iam-mode/cop-add ()
-  (unless eci-cop-register
-    (eci-cop-register))
-  (unless eci-ladspa-register
-    (eci-ladspa-register))
   (cond
    ((= pcomplete-last 1)
     (pcomplete-here
-     (cons
-      "-el:"
+     (append
+      '("-el:" "-pn:")
       (mapcar
        (lambda (elt)
-         (concat (nth 1 elt) ":"))
-      eci-cop-register))))
+	 (concat (nth 1 elt) ":"))
+       (if eci-cop-register
+	   eci-cop-register
+	 (eci-cop-register))))))
+   ((string= (pcomplete-arg) "-el")
+    (unless eci-ladspa-register
+      (eci-ladspa-register))
+    (cond
+     ((= pcomplete-last 2)
+      (pcomplete-next-arg)
+      (pcomplete-here
+       (sort (mapcar (lambda (elt) (substring (nth 1 elt) 4))
+		     eci-ladspa-register)
+	     #'string-lessp)))
+     ((> pcomplete-last 2)
+      (let* ((args (eci-register-find-arg (concat "-el:" (pcomplete-arg -1))
+					eci-ladspa-register))
+	   (arg (nth (- pcomplete-last 3) args)))
+      (if arg
+	  (message "%s" arg)
+	(message "No help available"))))))
+   ((string= (pcomplete-arg) "-pn")
+    (unless eci-preset-register
+      (eci-preset-register))
+    (cond
+     ((= pcomplete-last 2)
+      (pcomplete-next-arg)
+      (pcomplete-here
+       (sort (mapcar (lambda (elt) (substring (nth 1 elt) 4))
+		     eci-preset-register)
+	     #'string-lessp)))
+     ((> pcomplete-last 2)
+      (let* ((args (eci-register-find-arg (concat "-pn:" (pcomplete-arg -1))
+					eci-preset-register))
+	     (arg (nth (- pcomplete-last 3) args)))
+	(if arg
+	    (message "%s" arg)
+	  (message "No help available"))))))
    ((> pcomplete-last 1)
-    (if (and (= pcomplete-last 2)
-             (string= (pcomplete-arg) "-el"))
-            (progn (pcomplete-next-arg)
-                   (pcomplete-here
-                    (sort (mapcar (lambda (elt) (substring (nth 1 elt) 4))
-                                  eci-ladspa-register)
-                          #'string-lessp)))
-      (if (and (string= (pcomplete-arg) "-el")
-               (> pcomplete-last 2))
-              (let* ((args (eci-register-find-arg (pcomplete-arg -1)
-                                                  eci-ladspa-register))
-                     (arg (nth (- pcomplete-last 3) args)))
-                (if arg
-                    (message "%s" arg)
-                  (message "No help available")))
-        (let* ((args (eci-register-find-arg (pcomplete-arg)
-                                            eci-cop-register))
-               (arg (nth (- pcomplete-last 2) args)))
-          (if arg
-              (message "%s" arg)
-            (message "No help available")))))))
+    (let* ((args (eci-register-find-arg (pcomplete-arg)
+					(if eci-cop-register eci-cop-register
+					  (eci-cop-register))))
+	   (arg (nth (- pcomplete-last 2) args)))
+      (if arg
+	  (message "%s" arg)
+	(message "No help available")))))
   (throw 'pcompleted t))
+
+ 
 ;;; ECI --- The Ecasound Control Interface
 

       'ecasound-ewf-keyword-completion-function)
  (set (make-local-variable 'pcomplete-command-name-function)
       (lambda ()
         (pcomplete-arg 'first)))
  (set (make-local-variable 'pcomplete-arg-quote-list)
       (list ? )))


(defun ecasound-ewf-play ()
  (interactive)
  (let ((ecasound-arguments (list "-c"
				  "-i" buffer-file-name
				  "-o" ecasound-ewf-output-device)))
    (and (buffer-modified-p)
	 (y-or-n-p "Save file before playing? ")
	 (save-buffer))
    (ecasound "*Ecasound-ewf Player*")))

(add-to-list 'auto-mode-alist (cons "\\.ewf$" 'ecasound-ewf-mode))

;; Local variables:
;; mode: outline-minor
;; outline-regexp: ";;;;* \\|"
;; End:


