Commits

Anonymous committed 082d1ba

Fix arg count to read-from-minibuffer on XEmacs < 21.4.
xemacs-beta <15786.58491.622936.920873@dragonfly.sportsdatabase.com>

Comments (0)

Files changed (2)

+2002-10-14  Ville Skyttä  <ville.skytta@xemacs.org>
+
+	* igrep.el (igrep-read-expression): Fix arg count to
+	read-from-minibuffer on XEmacs < 21.4.
+	Convert various comments to doc strings.
+
 2002-08-13  Rendhalver [Peter Brown]  <rendhalver@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.09 released.
 ;;; Utilities:
 
 (defsubst igrep-file-directory (name)
-  ;; Return the directory component of NAME, or "." if it has no
-  ;; directory component.
+  "Return the directory component of NAME, or \".\" if it has no
+directory component."
   (directory-file-name (or (file-name-directory name)
 			   (file-name-as-directory "."))))
 
 (defsubst igrep-file-pattern (name)
-  ;; Return the file component of NAME, or "*" if it has no file
-  ;; component.
+  "Return the file component of NAME, or \"*\" if it has no file component."
   (let ((pattern (file-name-nondirectory name)))
        (if (string= pattern "")
 	   "*"
 	 pattern)))
 
 (defun igrep-format-find-command (command files)
-  ;; Format `grep` COMMAND to be invoked via `find` on FILES.
+  "Format `grep` COMMAND to be invoked via `find` on FILES."
   (let ((directories '())
 	(patterns '()))
     (while files
 	    )))
 
 (defmacro igrep-default-arg (variable)
-  ;; Return the default arg based on VARIABLE.
+  "Return the default arg based on VARIABLE."
   `(if ,variable
        (cond ((get (quote ,variable) major-mode)
 	      (funcall (get (quote ,variable) major-mode)))
       default-files)))
 
 (defsubst igrep-prefix (prefix string &rest strings)
-  ;; If PREFIX is non-nil or any STRINGS are specified, concatenate them
-  ;; before and after STRING; otherwise, return the STRING.
+  "If PREFIX is non-nil or any STRINGS are specified, concatenate them
+before and after STRING; otherwise, return the STRING."
   (if (or prefix strings)
       (apply 'concat prefix string strings)
     string))
 
 (defun igrep-read-args (&optional no-files)
-  ;; Read and return a list: (PROGRAM EXPRESSION FILES OPTIONS).
-  ;; If NO-FILES is non-nil, then FILES is not read and nil is returned
-  ;; in its place.
+  "Read and return a list: (PROGRAM EXPRESSION FILES OPTIONS).
+If NO-FILES is non-nil, then FILES is not read and nil is returned
+in its place."
   (let* ((pre-prefix (if (and igrep-find (eq igrep-verbose-prompts t))
 			 "[find] "))
 	 (program
 	  options)))
 
 (defun igrep-read-program (&optional prompt-prefix)
-  ;; If igrep-program is nil, read and return a program name from the
-  ;; minibuffer; otherwise, return igrep-program.
-  ;; Optional PROMPT-PREFIX is prepended to the "Program: " prompt.
+  "If `igrep-program' is nil, read and return a program name from the
+minibuffer; otherwise, return `igrep-program'.
+Optional PROMPT-PREFIX is prepended to the \"Program: \" prompt."
   (or igrep-program
       (let ((prompt "Program: "))
 	(completing-read (igrep-prefix prompt-prefix prompt) igrep-program-table
 			 nil t igrep-program-default))))
 
 (defun igrep-read-options (&optional prompt-prefix)
-  ;; If current-prefix-arg is '(4) or '(64), read and return an options
-  ;; string from the minibuffer; otherwise, return igrep-options.
-  ;; Optional PROMPT-PREFIX is prepended to the "Options: " prompt.
+  "If `current-prefix-arg' is '(4) or '(64), read and return an options
+string from the minibuffer; otherwise, return `igrep-options'.
+Optional PROMPT-PREFIX is prepended to the \"Options: \" prompt."
   (if (or igrep-read-options
 	  (and (consp current-prefix-arg)
 	       (memq (prefix-numeric-value current-prefix-arg)
     igrep-options))
 
 (defun igrep-read-expression (&optional prompt-prefix)
-  ;; Read and return a `grep` expression string from the minibuffer.
-  ;; Optional PROMPT-PREFIX is prepended to the "Expression: " prompt.
+  "Read and return a `grep` expression string from the minibuffer.
+Optional PROMPT-PREFIX is prepended to the \"Expression: \" prompt."
   (if igrep-insert-default-key
       (define-key minibuffer-local-map igrep-insert-default-key
 	'igrep-insert-default-expression))
 				   (format "Expression [default: %s]: "
 					   default-expression)
 				 "Expression: ")))
-	 (expression (cond ((featurep 'xemacs) ; incompatible
+	 (expression (cond ((and (featurep 'xemacs) (emacs-version>= 21 4))
 			    (read-from-minibuffer prompt
 						  nil nil nil
 						  'igrep-expression-history
 						  nil ; ABBREV-TABLE
 						  default-expression))
-			   ((>= emacs-major-version 20)
+			   ((and (not (featurep 'xemacs))
+				 (>= emacs-major-version 20))
 			    (read-from-minibuffer prompt
 						  nil nil nil
 						  'igrep-expression-history
 		     " ")))
 
 (defsubst igrep-default-key (command &optional keymap key)
-  ;; Return the key bound to COMMAND in KEYMAP, preferably KEY.
+  "Return the key bound to COMMAND in KEYMAP, preferably KEY."
   (if (null keymap)
       (setq keymap (current-global-map)))
   (if (and key
     (where-is-internal command keymap t)))
 
 (defun igrep-read-files (&optional prompt-prefix)
-  ;; Read and return a file name pattern from the minibuffer.  If
-  ;; current-prefix-arg is '(16) or '(64), read multiple file name
-  ;; patterns and return them in a list.  Optional PROMPT-PREFIX is
-  ;; prepended to the "File(s): " prompt.
+  "Read and return a file name pattern from the minibuffer.
+If `current-prefix-arg' is '(16) or '(64), read multiple file name
+patterns and return them in a list.  Optional PROMPT-PREFIX is
+prepended to the \"File(s): \" prompt."
   (let* ((default-files (igrep-default-files))
 	 (default-files-string (mapconcat 'identity default-files " "))
 	 (insert-default-directory nil)	; use relative path names
 
 (defun igrep-read-file-name (prompt
   &optional directory default existing initial history)
-  ;; Just like read-file-name, but with optional HISTORY.
-  ;; Also: convert DIRECTORY to DIRECTORY/* file name pattern.
+  "Just like `read-file-name', but with optional HISTORY.
+Also: convert DIRECTORY to DIRECTORY/* file name pattern."
   (if igrep-insert-default-key
       (define-key minibuffer-local-completion-map igrep-insert-default-key
 	'igrep-insert-default-files))