all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Glenn Morris <rgm@gnu.org>
Cc: "Nick Roberts" <nickrob@snap.net.nz>,
	"Johan Bockgård" <bojohan+mail@dd.chalmers.se>,
	rms@gnu.org, emacs-devel@gnu.org
Subject: Re: [alinsoar@voila.fr: EVAL and mouse selection in *Completions*]
Date: Wed, 07 Mar 2007 11:24:42 +0100	[thread overview]
Message-ID: <45EE92EA.8010209@gmx.at> (raw)
In-Reply-To: <k6k5xtk6vu.fsf@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

 > I thought your try-completion-old was a better, more comprehensive
 > solution than mine. But I agree the name is poor. Why not call it
 > PC-try-completion?

OK

 > Also, shouldn't it return STRING, rather than "",
 > for an exact match?

It should, indeed, thanks.  Please look at the attached patch.  Johan,
please have another look at this too.

 > With regards to the partial completion erasing buffer thing, I don't
 > know if we need to tweak completion-base-size, apply the complex fix,
 > or both.

I removed this part from my patch.  Could people please try whether
Chong's `completion-base-size' fix solves this part of the symbol
completion problem.

[-- Attachment #2: complete.diff --]
[-- Type: text/plain, Size: 3740 bytes --]

*** complete.el	Tue Jan 23 07:40:00 2007
--- complete.el	Wed Mar  7 11:21:16 2007
***************
*** 383,388 ****
--- 383,411 ----
      (let ((completion-ignore-case nil))
        (test-completion str table pred))))

+ ;; The following function is an attempt to work around two problems:
+ 
+ ;; (1) When complete.el was written, (try-completion "" '(("") (""))) used to
+ ;; return the value "".  With a change from 2002-07-07 it returns t which caused
+ ;; `PC-lisp-complete-symbol' to fail with a "Wrong type argument: sequencep, t"
+ ;; error.  `PC-try-completion' returns STRING in this case.
+ 
+ ;; (2) (try-completion "" '((""))) returned t before the above-mentioned change.
+ ;; Since `PC-chop-word' operates on the return value of `try-completion' this
+ ;; case might have provoked a similar error as in (1).  `PC-try-completion'
+ ;; returns "" instead.  I don't know whether this is a real problem though.
+ 
+ ;; Since `PC-try-completion' is not a guaranteed to fix these bugs reliably, you
+ ;; should try to look at the following discussions when you encounter problems:
+ ;; - emacs-pretest-bug ("Partial Completion" starting 2007-02-23),
+ ;; - emacs-devel ("[address-of-OP: Partial completion]" starting 2007-02-24),
+ ;; - emacs-devel ("[address-of-OP: EVAL and mouse selection in *Completions*]"
+ ;;   starting 2007-03-05).
+ (defun PC-try-completion (string alist &optional predicate)
+   "Like `try-completion' but return STRING instead of t."
+   (let ((result (try-completion string alist predicate)))
+     (if (eq result t) string result)))
+ 
  (defun PC-do-completion (&optional mode beg end)
    (or beg (setq beg (minibuffer-prompt-end)))
    (or end (setq end (point-max)))
***************
*** 623,630 ****

  	    ;; Check if next few letters are the same in all cases
  	    (if (and (not (eq mode 'help))
! 		     (setq prefix (try-completion (PC-chunk-after basestr skip)
!                                                   poss)))
  		(let ((first t) i)
  		  ;; Retain capitalization of user input even if
  		  ;; completion-ignore-case is set.
--- 646,653 ----

  	    ;; Check if next few letters are the same in all cases
  	    (if (and (not (eq mode 'help))
! 		     (setq prefix (PC-try-completion
! 				   (PC-chunk-after basestr skip) poss)))
  		(let ((first t) i)
  		  ;; Retain capitalization of user input even if
  		  ;; completion-ignore-case is set.
***************
*** 662,668 ****
  			      (setq skip (concat skip
  						 (regexp-quote prefix)
  						 PC-ndelims-regex)
! 				    prefix (try-completion
  					    (PC-chunk-after
  					     ;; not basestr, because that does
  					     ;; not reflect insertions
--- 685,691 ----
  			      (setq skip (concat skip
  						 (regexp-quote prefix)
  						 PC-ndelims-regex)
! 				    prefix (PC-try-completion
  					    (PC-chunk-after
  					     ;; not basestr, because that does
  					     ;; not reflect insertions
***************
*** 996,1002 ****
                (cond
                 ((not completion-table) nil)
                 ((eq action 'lambda) (test-completion str2 completion-table nil))
!                ((eq action nil) (try-completion str2 completion-table nil))
                 ((eq action t) (all-completions str2 completion-table nil)))))
      ad-do-it))
  \f
--- 1019,1025 ----
                (cond
                 ((not completion-table) nil)
                 ((eq action 'lambda) (test-completion str2 completion-table nil))
!                ((eq action nil) (PC-try-completion str2 completion-table nil))
                 ((eq action t) (all-completions str2 completion-table nil)))))
      ad-do-it))
  \f

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-03-07 10:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-05 21:50 [alinsoar@voila.fr: EVAL and mouse selection in *Completions*] Richard Stallman
2007-03-06  2:50 ` Glenn Morris
2007-03-06  3:12   ` Chong Yidong
2007-03-06  3:22   ` Nick Roberts
2007-03-06  3:57     ` Glenn Morris
2007-03-06  3:59       ` Glenn Morris
2007-03-06  9:10         ` martin rudalics
2007-03-06 14:45           ` Stefan Monnier
2007-03-07  4:35           ` Glenn Morris
2007-03-07 10:24             ` martin rudalics [this message]
2007-03-08  9:28               ` Glenn Morris
2007-03-06 22:36   ` Richard Stallman
2007-03-07  4:22     ` Glenn Morris
2007-03-07 17:26       ` Richard Stallman
2007-03-07 18:35         ` Stefan Monnier
2007-03-08 17:40           ` Richard Stallman
2007-03-08 19:07             ` Stefan Monnier
2007-03-09 21:27               ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2007-03-06  9:57 A Soare
2007-03-08  8:28 A Soare
2007-03-08  8:41 ` Nick Roberts
2007-03-08 21:47 ` Richard Stallman
2007-03-08  8:31 A Soare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45EE92EA.8010209@gmx.at \
    --to=rudalics@gmx.at \
    --cc=bojohan+mail@dd.chalmers.se \
    --cc=emacs-devel@gnu.org \
    --cc=nickrob@snap.net.nz \
    --cc=rgm@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.