* [bojohan+mail@dd.chalmers.se: Partial completion]
@ 2007-02-24 8:28 Richard Stallman
2007-02-24 11:57 ` Nick Roberts
0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2007-02-24 8:28 UTC (permalink / raw)
To: emacs-devel
Would someone please DTRT about this?
------- Start of forwarded message -------
From: bojohan+mail@dd.chalmers.se (Johan =?utf-8?Q?Bockg=C3=A5rd?=)
To: emacs-pretest-bug@gnu.org
Date: Fri, 23 Feb 2007 22:14:55 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: Partial completion
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed
version=3.0.4
$ emacs -Q -l complete
Insert (defma )
Place point after "a" and run M-x PC-lisp-complete-symbol
=> Wrong type argument: sequencep, t
- --
Johan Bockgård
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-24 8:28 [bojohan+mail@dd.chalmers.se: Partial completion] Richard Stallman
@ 2007-02-24 11:57 ` Nick Roberts
2007-02-24 13:46 ` martin rudalics
2007-02-24 19:52 ` martin rudalics
0 siblings, 2 replies; 13+ messages in thread
From: Nick Roberts @ 2007-02-24 11:57 UTC (permalink / raw)
To: rms; +Cc: emacs-devel
Richard Stallman writes:
> Would someone please DTRT about this?
>
> ------- Start of forwarded message -------
> From: bojohan+mail@dd.chalmers.se (Johan Bockgård)
> To: emacs-pretest-bug@gnu.org
> Date: Fri, 23 Feb 2007 22:14:55 +0100
> MIME-Version: 1.0
> Content-Type: text/plain; charset=utf-8
> Subject: Partial completion
> X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed
> version=3.0.4
>
>
> $ emacs -Q -l complete
> Insert (defma )
> Place point after "a" and run M-x PC-lisp-complete-symbol
>
> => Wrong type argument: sequencep, t
I think it's due to this change:
2002-07-07
(Ftry_completion): Return t even if the string appears multiple times.
Now (try-completion "" '(("") (""))) returns t.
Previously it returned "".
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-24 11:57 ` Nick Roberts
@ 2007-02-24 13:46 ` martin rudalics
2007-02-24 19:52 ` martin rudalics
1 sibling, 0 replies; 13+ messages in thread
From: martin rudalics @ 2007-02-24 13:46 UTC (permalink / raw)
To: Nick Roberts; +Cc: d, rms, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 556 bytes --]
> Now (try-completion "" '(("") (""))) returns t.
> Previously it returned "".
I attached a patch for the offending occurrence of `try-completion'.
Please test it. There are two more occurrences that should be checked
though. And there's an additional problem: When, in *scratch*, I type
(defma )
do M-x PC-lisp-complete-symbol and choose say `defmath', the _entire_
contents of the buffer preceding defma are erased. I think this is due
to the fact that complete.el doesn't set `completion-base-size'
appropriately. Should this be corrected too?
[-- Attachment #2: complete.diff --]
[-- Type: text/plain, Size: 1645 bytes --]
*** complete.el Tue Jan 23 07:40:00 2007
--- complete.el Sat Feb 24 14:26:14 2007
***************
*** 661,679 ****
(looking-at PC-delim-regex))
(setq skip (concat skip
(regexp-quote prefix)
! PC-ndelims-regex)
! prefix (try-completion
! (PC-chunk-after
! ;; not basestr, because that does
! ;; not reflect insertions
! (buffer-substring
! (+ beg (length dirname)) end)
! skip)
! (mapcar
! (lambda (x)
! (when (string-match skip x)
! (substring x (match-end 0))))
! poss)))
(or (> i 0) (> (length prefix) 0))
(or (not (eq mode 'word))
(and first (> (length prefix) 0)
--- 661,683 ----
(looking-at PC-delim-regex))
(setq skip (concat skip
(regexp-quote prefix)
! PC-ndelims-regex))
! (let ((chunk
! (PC-chunk-after
! ;; not basestr, because that does
! ;; not reflect insertions
! (buffer-substring-no-properties
! (+ beg (length dirname)) end)
! skip)))
! (setq prefix (try-completion
! chunk
! (mapcar
! (lambda (x)
! (when (string-match skip x)
! (substring x (match-end 0))))
! poss)))
! (or (stringp prefix)
! (setq prefix (if prefix chunk ""))))
(or (> i 0) (> (length prefix) 0))
(or (not (eq mode 'word))
(and first (> (length prefix) 0)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-24 11:57 ` Nick Roberts
2007-02-24 13:46 ` martin rudalics
@ 2007-02-24 19:52 ` martin rudalics
2007-02-25 4:24 ` Nick Roberts
` (2 more replies)
1 sibling, 3 replies; 13+ messages in thread
From: martin rudalics @ 2007-02-24 19:52 UTC (permalink / raw)
To: Nick Roberts; +Cc: rms, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 101 bytes --]
Please try the attached patch instead. It's simpler and should take
care of the remaining problems.
[-- Attachment #2: complete.diff --]
[-- Type: text/plain, Size: 3285 bytes --]
*** complete.el Tue Jan 23 07:40:00 2007
--- complete.el Sat Feb 24 20:46:14 2007
***************
*** 383,388 ****
--- 383,393 ----
(let ((completion-ignore-case nil))
(test-completion str table pred))))
+ (defun try-completion-old (string alist &optional predicate)
+ "Like `try-completion' but return empty string instead of t."
+ (let ((result (try-completion string alist predicate)))
+ (if (eq result t) "" result)))
+
(defun PC-do-completion (&optional mode beg end)
(or beg (setq beg (minibuffer-prompt-end)))
(or end (setq end (point-max)))
***************
*** 390,396 ****
(pred minibuffer-completion-predicate)
(filename (funcall PC-completion-as-file-name-predicate))
(dirname nil) ; non-nil only if a filename is being completed
! (dirlength 0)
(str (buffer-substring beg end))
(incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
(ambig nil)
--- 395,401 ----
(pred minibuffer-completion-predicate)
(filename (funcall PC-completion-as-file-name-predicate))
(dirname nil) ; non-nil only if a filename is being completed
! dirlength
(str (buffer-substring beg end))
(incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
(ambig nil)
***************
*** 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.
--- 628,635 ----
;; Check if next few letters are the same in all cases
(if (and (not (eq mode 'help))
! (setq prefix (try-completion-old
! (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
--- 667,673 ----
(setq skip (concat skip
(regexp-quote prefix)
PC-ndelims-regex)
! prefix (try-completion-old
(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
--- 1001,1007 ----
(cond
((not completion-table) nil)
((eq action 'lambda) (test-completion str2 completion-table nil))
! ((eq action nil) (try-completion-old 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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-24 19:52 ` martin rudalics
@ 2007-02-25 4:24 ` Nick Roberts
2007-02-25 9:31 ` martin rudalics
2007-02-25 19:30 ` Richard Stallman
2007-03-02 1:24 ` Johan Bockgård
2007-03-08 20:44 ` Chong Yidong
2 siblings, 2 replies; 13+ messages in thread
From: Nick Roberts @ 2007-02-25 4:24 UTC (permalink / raw)
To: martin rudalics; +Cc: rms, emacs-devel
> Please try the attached patch instead. It's simpler and should take
> care of the remaining problems.
> *** complete.el Tue Jan 23 07:40:00 2007
> --- complete.el Sat Feb 24 20:46:14 2007
> ***************
> *** 383,388 ****
> --- 383,393 ----
> (let ((completion-ignore-case nil))
> (test-completion str table pred))))
>
> + (defun try-completion-old (string alist &optional predicate)
> + "Like `try-completion' but return empty string instead of t."
> + (let ((result (try-completion string alist predicate)))
> + (if (eq result t) "" result)))
>...
I don't use partial completion (complete.el) so the OP will have to test it.
However the above function is not equivalent to the old try-completion e.g
old (try-completion "" '((""))) returns t
(try-completion-old "" '((""))) returns ""
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-25 4:24 ` Nick Roberts
@ 2007-02-25 9:31 ` martin rudalics
2007-02-25 19:30 ` Richard Stallman
1 sibling, 0 replies; 13+ messages in thread
From: martin rudalics @ 2007-02-25 9:31 UTC (permalink / raw)
To: Nick Roberts; +Cc: rms, emacs-devel
> I don't use partial completion (complete.el) so the OP will have to test it.
> However the above function is not equivalent to the old try-completion e.g
>
> old (try-completion "" '((""))) returns t
>
> (try-completion-old "" '((""))) returns ""
Right. But complete.el has the following stretch of code:
...
(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.
(if (eq mode 'word)
(setq prefix (PC-chop-word prefix basestr)))
...
where `PC-chop-word' is defined as
(defun PC-chop-word (new old)
(let ((i -1)
(j -1))
(while (and (setq i (string-match PC-delim-regex old (1+ i)))
(setq j (string-match PC-delim-regex new (1+ j)))))
(if (and j
(or (not PC-word-failed-flag)
(setq j (string-match PC-delim-regex new (1+ j)))))
(substring new 0 (1+ j))
new)))
which, in my opinion, could choke on t with the old `try-completion' as
well. I don't use partial completion either and hardly anyone else does
(at least for completing Lisp symbols). Otherwise, the other bug where
entire buffer contents could get erased would have been noticed earlier.
In any case, people using PC mode for filename completion would have to
test whether the `dirlength' change breaks anything for them. If it
does, I'd opt for removing `PC-lisp-complete-symbol' altogether.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-25 4:24 ` Nick Roberts
2007-02-25 9:31 ` martin rudalics
@ 2007-02-25 19:30 ` Richard Stallman
2007-02-26 20:28 ` Nick Roberts
1 sibling, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2007-02-25 19:30 UTC (permalink / raw)
To: Nick Roberts; +Cc: rudalics, emacs-devel
If a new function is to be added to complete.el,
shouldn't it have a name which starts with PC-
instead of `try-completion-old'?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-24 19:52 ` martin rudalics
2007-02-25 4:24 ` Nick Roberts
@ 2007-03-02 1:24 ` Johan Bockgård
2007-03-08 20:44 ` Chong Yidong
2 siblings, 0 replies; 13+ messages in thread
From: Johan Bockgård @ 2007-03-02 1:24 UTC (permalink / raw)
To: emacs-devel
martin rudalics <rudalics@gmx.at> writes:
> Please try the attached patch instead.
It seems to work fine so far.
--
Johan Bockgård
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-02-24 19:52 ` martin rudalics
2007-02-25 4:24 ` Nick Roberts
2007-03-02 1:24 ` Johan Bockgård
@ 2007-03-08 20:44 ` Chong Yidong
2007-03-08 22:34 ` martin rudalics
2007-03-09 16:20 ` Richard Stallman
2 siblings, 2 replies; 13+ messages in thread
From: Chong Yidong @ 2007-03-08 20:44 UTC (permalink / raw)
To: emacs-devel
martin rudalics <rudalics@gmx.at> writes:
> Please try the attached patch instead. It's simpler and should take
> care of the remaining problems.
I think it's time to check this patch in.
> *** complete.el Tue Jan 23 07:40:00 2007
> --- complete.el Sat Feb 24 20:46:14 2007
> ***************
> *** 383,388 ****
> --- 383,393 ----
> (let ((completion-ignore-case nil))
> (test-completion str table pred))))
>
> + (defun try-completion-old (string alist &optional predicate)
> + "Like `try-completion' but return empty string instead of t."
> + (let ((result (try-completion string alist predicate)))
> + (if (eq result t) "" result)))
> +
> (defun PC-do-completion (&optional mode beg end)
> (or beg (setq beg (minibuffer-prompt-end)))
> (or end (setq end (point-max)))
> ***************
> *** 390,396 ****
> (pred minibuffer-completion-predicate)
> (filename (funcall PC-completion-as-file-name-predicate))
> (dirname nil) ; non-nil only if a filename is being completed
> ! (dirlength 0)
> (str (buffer-substring beg end))
> (incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
> (ambig nil)
> --- 395,401 ----
> (pred minibuffer-completion-predicate)
> (filename (funcall PC-completion-as-file-name-predicate))
> (dirname nil) ; non-nil only if a filename is being completed
> ! dirlength
> (str (buffer-substring beg end))
> (incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
> (ambig nil)
> ***************
> *** 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.
> --- 628,635 ----
>
> ;; Check if next few letters are the same in all cases
> (if (and (not (eq mode 'help))
> ! (setq prefix (try-completion-old
> ! (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
> --- 667,673 ----
> (setq skip (concat skip
> (regexp-quote prefix)
> PC-ndelims-regex)
> ! prefix (try-completion-old
> (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
> --- 1001,1007 ----
> (cond
> ((not completion-table) nil)
> ((eq action 'lambda) (test-completion str2 completion-table nil))
> ! ((eq action nil) (try-completion-old str2 completion-table nil))
> ((eq action t) (all-completions str2 completion-table nil)))))
> ad-do-it))
> \f
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-03-08 20:44 ` Chong Yidong
@ 2007-03-08 22:34 ` martin rudalics
2007-03-08 23:01 ` Chong Yidong
2007-03-09 16:20 ` Richard Stallman
1 sibling, 1 reply; 13+ messages in thread
From: martin rudalics @ 2007-03-08 22:34 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
> I think it's time to check this patch in.
The last version of this with a correction supplied by Glenn Morris
and a thick comment layer requested by Stefan is on the thread
[alinsoar@voila.fr: EVAL and mouse selection in *Completions*]
please have a look.
It does _not_ handle the buffer erasure problem since I thought you'd
take care of this in a more general way. What do you intend to do?
What shall I do?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-03-08 22:34 ` martin rudalics
@ 2007-03-08 23:01 ` Chong Yidong
0 siblings, 0 replies; 13+ messages in thread
From: Chong Yidong @ 2007-03-08 23:01 UTC (permalink / raw)
To: martin rudalics; +Cc: emacs-devel
martin rudalics <rudalics@gmx.at> writes:
>> I think it's time to check this patch in.
>
> The last version of this with a correction supplied by Glenn Morris
> and a thick comment layer requested by Stefan is on the thread
>
> [alinsoar@voila.fr: EVAL and mouse selection in *Completions*]
>
> please have a look.
The patch looks OK to me.
> It does _not_ handle the buffer erasure problem since I thought you'd
> take care of this in a more general way. What do you intend to do?
> What shall I do?
The way standard completion handles this now, with my recent checkin,
is to check minibuffer-completing-symbol and not bind completion-base
size if it is non-nil (eval-expression binds
minibuffer-completing-symbol to indicate that it is currently reading
a symbol):
(setq completion-base-size
(cond
..
(minibuffer-completing-symbol nil)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [bojohan+mail@dd.chalmers.se: Partial completion]
2007-03-08 20:44 ` Chong Yidong
2007-03-08 22:34 ` martin rudalics
@ 2007-03-09 16:20 ` Richard Stallman
1 sibling, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2007-03-09 16:20 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
I think it's time to check this patch in.
Please do, but please change the name try-completion-old
to PC-try-completion-old.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-03-09 16:20 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-24 8:28 [bojohan+mail@dd.chalmers.se: Partial completion] Richard Stallman
2007-02-24 11:57 ` Nick Roberts
2007-02-24 13:46 ` martin rudalics
2007-02-24 19:52 ` martin rudalics
2007-02-25 4:24 ` Nick Roberts
2007-02-25 9:31 ` martin rudalics
2007-02-25 19:30 ` Richard Stallman
2007-02-26 20:28 ` Nick Roberts
2007-03-02 1:24 ` Johan Bockgård
2007-03-08 20:44 ` Chong Yidong
2007-03-08 22:34 ` martin rudalics
2007-03-08 23:01 ` Chong Yidong
2007-03-09 16:20 ` Richard Stallman
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.