Re: hyperspec issues?

David <[email protected]> Tue, 18 Mar 2003 18:46:45 -0700
Newsgroups gmane.lisp.ilisp.general
Message-ID <[email protected]>
Hello rif,

I am using ilisp, emacs 21.2, RH7.x Linux, and have done so
successfully for the last eighteen months.

I can confirm that there *was* a problem with completer; the patch
that I was sent is at the bottom of this mail.

I have checked my code and, unless I have missed something, I do not
have any (require 'completer) expression.  A (provide 'completer) in
user code would not be correct - you are not providing that capability
after all.

I suggest that you look in completer.el, find function
completer-region, and see what it looks like.  Mine is below, you can
see that the old (and malfunctioning) code is commented-out, and you
can see the good code.  If yours is not this way then use the patch.
Also work out how you managed to get hold of the old version and let
the appropriate party know what has happened.

I hope that this helps; it took me some time to remember this problem,
it is old.  The good news is that ilisp completer does work when
configured correctly.

dajo


(defun completer-region (delimiters)
  "Return the completion region bounded by characters in DELIMITERS.
The search is for the current buffer assuming that point is in it."
;;;  (cons (save-excursion (skip-chars-backward delimiters) (point))
;;;	(save-excursion (skip-chars-forward delimiters) (point))))
  (cons (save-excursion (skip-chars-backward delimiters (minibuffer-prompt-end))
                        (point))
	(save-excursion (skip-chars-forward delimiters)
                        (point))))


Content-Type: text/x-patch
Content-Disposition: attachment;
  filename=ilisp-completer-emacs-21.patch
Content-Description: Patch to make ILISP's completer work in Emacs 21

Index: completer.el
===================================================================
RCS file: /home/azure/.cvs_root/ilisp/completer.el,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -U3 -r1.1.1.1 -r1.2
--- completer.el	1999/09/04 22:19:29	1.1.1.1
+++ completer.el	2001/10/24 14:19:36	1.2
@@ -133,6 +133,12 @@
 	    'display-completion-list)))
 
 
+(unless (fboundp 'minibuffer-prompt-end)
+  (defun minibuffer-prompt-end ()
+    "Return the buffer position of the end of the minibuffer prompt.
+Return (point-min) if current buffer is not a mini-buffer."
+    (point-min)))
+
 ;;;%Utilities
 (defun completer-message (message &optional point)
   "Display MESSAGE at optional POINT for two seconds."
@@ -304,8 +310,10 @@
 (defun completer-region (delimiters)
   "Return the completion region bounded by characters in DELIMITERS.
 The search is for the current buffer assuming that point is in it."
-  (cons (save-excursion (skip-chars-backward delimiters) (point))
-	(save-excursion (skip-chars-forward delimiters) (point))))
+  (cons (save-excursion (skip-chars-backward delimiters (minibuffer-prompt-end))
+                        (point))
+	(save-excursion (skip-chars-forward delimiters)
+                        (point))))
 	 
 ;;;
 (defun completer-last-component (string)
@@ -736,9 +744,9 @@
   (save-excursion
     (goto-char (point-max))
     (if (and (eq minibuffer-completion-table 'read-file-name-internal)
-	     (re-search-backward "//\\|/~\\|.\\$" nil t))
-	(delete-region (point-min) (1+ (point))))
-    (buffer-substring (point-min) (point-max))))
+	     (re-search-backward "//\\|/~\\|.\\$" (minibuffer-prompt-end) t))
+	(delete-region (minibuffer-prompt-end) (1+ (point))))
+    (buffer-substring (minibuffer-prompt-end) (point-max))))
 
 ;;;
 (defun completer-minibuf-exit ()
@@ -885,7 +893,7 @@
 	      guess (car completions)))
     (if guess
 	(progn
-	  (goto-char (point-min))
+	  (goto-char (minibuffer-prompt-end))
 	  (insert guess)
 	  (delete-region (point) (point-max))
 	  (exit-minibuffer))




-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? 
You could win a Tablet PC. Get a free Tablet PC hat just for playing. 
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en