unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Fwd: PC-completion and trailing dashes.
Date: Mon, 17 Apr 2006 01:24:11 -0400	[thread overview]
Message-ID: <87zmikpyoi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1FUodK-0001p6-89@fencepost.gnu.org> (Richard Stallman's message of "Sat, 15 Apr 2006 13:32:30 -0400")

> Would someone else who knows and uses partial-completion-mode
> please take a look and see if this is a good fix?

I just looked at the problem and I think it's not a bad fix.
The problem is that the default completion has changed (the text after
point is not considered any more) whereas partial-completion-mode hasn't
been changed accordingly (and some of its features clash with it).

Maybe a cleaner fix would be to add a variable, similar to
`completion-base-size' but which describes the number of chars at the end of
the buffer which are not part of completion: such a fix would require
changes in the default completion, but would make partial-completion-mode
work unchanged (i.e. it makes the new functionality more
backward-compatible).  Not sure if it's worth the trouble.

So I guess the proposed patch is OK, but it would benefit from having
a larger comment explaining a bit of the problem.  Should I install it?


        Stefan


> ------- Start of forwarded message -------
> From: michael.cadilhac@lrde.org (=?iso-8859-1?Q?Micha=EBl?= Cadilhac)
> To: emacs-devel@gnu.org
> Organization: Epita/LRDE
> Date: Fri, 14 Apr 2006 18:30:49 +0200
> MIME-Version: 1.0
> Subject: PC-completion and trailing dashes.
> Content-Type: multipart/mixed; boundary="===============0652986555=="
> X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO 
> 	autolearn=failed version=3.0.4

> - --===============0652986555==
> Content-Type: multipart/signed; boundary="==-=-=";
> 	micalg=pgp-sha1; protocol="application/pgp-signature"

> - --==-=-=
> Content-Type: multipart/mixed; boundary="=-=-="

> - --=-=-=


>   Here's the problem:

>   emacs -Q
>   M-x partial-completion-mode RET
>   M-x set- RET then click a choice, you'll have the error message
>   `Symbol function definition is void: set-yourchoice-'

>   M-x set-s- RET then select one and your choice will be suffixed with
>   `-s-'.

>   The smallest change I can propose is the following:


> - --=-=-=
> Content-Type: text/x-patch; charset=iso-8859-1
> Content-Disposition: inline; filename=complete.patch
> Content-Transfer-Encoding: quoted-printable

> Index: ChangeLog
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
> retrieving revision 1.9401
> diff -b -c -w -r1.9401 ChangeLog
> *** ChangeLog	14 Apr 2006 11:30:20 -0000	1.9401
> =2D-- ChangeLog	14 Apr 2006 16:22:47 -0000
> ***************
> *** 1,3 ****
> =2D-- 1,11 ----
> + 2006-04-14  Micha=EBl Cadilhac  <michael.cadilhac@lrde.org>  (tiny change)
> +=20
> + 	* complete.el (PC-goto-eob-and-ret-nil): Function to go to the
> + 	end of buffer and that returns `nil'.
> + 	(partial-completion-mode): Use it as a function of
> + 	`choose-completion-string-functions' to be sure that the whole
> + 	buffer will be erased before choice insertion.
> +=20
>   2006-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
> =20=20
>   	* progmodes/cc-langs.el (c-mode-menu):
> Index: complete.el
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> RCS file: /cvsroot/emacs/emacs/lisp/complete.el,v
> retrieving revision 1.45
> diff -b -c -w -r1.45 complete.el
> *** complete.el	6 Aug 2005 22:13:42 -0000	1.45
> =2D-- complete.el	14 Apr 2006 16:22:47 -0000
> ***************
> *** 1,7 ****
>   ;;; complete.el --- partial completion mechanism plus other goodies
> =20=20
>   ;; Copyright (C) 1990, 1991, 1992, 1993, 1999, 2000, 2002, 2003, 2004,
> ! ;;   2005 Free Software Foundation, Inc.
> =20=20
>   ;; Author: Dave Gillespie <daveg@synaptics.com>
>   ;; Keywords: abbrev convenience
> =2D-- 1,7 ----
>   ;;; complete.el --- partial completion mechanism plus other goodies
> =20=20
>   ;; Copyright (C) 1990, 1991, 1992, 1993, 1999, 2000, 2002, 2003, 2004,
> ! ;;   2005, 2006 Free Software Foundation, Inc.
> =20=20
>   ;; Author: Dave Gillespie <daveg@synaptics.com>
>   ;; Keywords: abbrev convenience
> ***************
> *** 221,226 ****
> =2D-- 221,230 ----
>   	       (symbol-function 'read-file-name-internal))
>   	 (fset 'read-file-name-internal
>   	       'PC-read-include-file-name-internal)))
> +   ;; Fix for completion-list selections.
> +   (if partial-completion-mode
> +       (add-hook 'choose-completion-string-functions 'PC-goto-eob-and-ret-=
> nil)
> +     (remove-hook 'choose-completion-string-functions 'PC-goto-eob-and-ret=
> - -nil))
>     (when (and partial-completion-mode (null PC-env-vars-alist))
>       (setq PC-env-vars-alist
>   	  (mapcar (lambda (string)
> ***************
> *** 941,946 ****
> =2D-- 945,958 ----
>       (funcall PC-old-read-file-name-internal string dir action)))
>   \f
> =20=20
> + ;; Hack to be sure that on validation in the completion list, everything
> + ;; will be erased before the choice is inserted.
> + (defun PC-goto-eob-and-ret-nil (&rest args)
> +   (goto-char (point-max))
> +   nil)
> +=20
> + \f
> +=20
>   (provide 'complete)
> =20=20
>   ;; arch-tag: fc7e2768-ff44-4e22-b579-4d825b968458

> - --=-=-=
> Content-Type: text/plain; charset=iso-8859-1
> Content-Transfer-Encoding: quoted-printable


>   The  aim  is  that `choose-completion-string'  will  `delete-region'
>   everything from (+ base-size (point-min)) to (point-max).

>   The added  function could  also directly erase  the region,  I don't
>   know what's the best here. I don't even know if this way is ok ;-)

>   Thanks in advance, however.

> =2D-=20
>  |      Micha=EBl `Micha' Cadilhac   |   Un certain Blaise Pascal          =
>    |
>  |         Epita/LRDE Promo 2007   |     etc... etc...                     =
>  |
>  | http://www.lrde.org/~cadilh_m   |   -- Pr=E9vert (Les paris stupides)   =
>    |
>  `--  -   JID: micha@amessage.be --'                                   -  -=
> - -'

> - --=-=-=--

> - --==-=-=
> Content-Type: application/pgp-signature

> - -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (GNU/Linux)

> iD8DBQFEP848ZYNf4qobZ7kRApI1AJ4letQEzZcuQM8/SxK74BM3ozL2vACcDMdl
> MtyCqsftA3bRl5YL7NgM9nQ=
> =wUgR
> - -----END PGP SIGNATURE-----
> - --==-=-=--



> - --===============0652986555==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline

> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
> - --===============0652986555==--
> ------- End of forwarded message -------


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

  reply	other threads:[~2006-04-17  5:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-15 17:32 [michael.cadilhac@lrde.org: PC-completion and trailing dashes.] Richard Stallman
2006-04-17  5:24 ` Stefan Monnier [this message]
2006-04-18  1:42   ` Fwd: PC-completion and trailing dashes Richard Stallman
2006-04-18 17:34     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87zmikpyoi.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).