all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* change to try-completion behavior in 21.3?
@ 2005-12-16  2:32 bigfaceworm
  2005-12-16  8:22 ` Anselm Helbig
  2005-12-17  2:33 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: bigfaceworm @ 2005-12-16  2:32 UTC (permalink / raw)


My company has some RedHat systems (32 bit) and some 64-bit Suse
systems.
The Emacs on the two is behaving differently, and

64-bit version: 21.3.50.1
32-bit version: 21.3.1

The try-completion reacts differently to completion-ignore-case.

This code snippet:

(cons
 (let ((completion-ignore-case nil))
   (try-completion "w" ex-token-alist))
 (let ((completion-ignore-case t))
   (try-completion "w" ex-token-alist)))

Returns
("w" . "w") on the 32-bit machine

returns
("w" . "W") on the 64-bit machine

Is this expected (new) behavior?
Or did the computing support screw up the build/install?

Why should it ever return the capital letter W?

thanks,

BFW

ps. I don't use viper, a friend does and I'm helping him out.
pps. ex-token-alist is defined in viper-ex.el as:

(defconst ex-token-alist '(
	("!"			(ex-command))
	("&"			(ex-substitute t))
	("="			(ex-line-no))
	(">"			(ex-line "right"))
	("<"			(ex-line "left"))
	("Buffer"		(if ex-cycle-other-window
				    (viper-switch-to-buffer)
				  (viper-switch-to-buffer-other-window)))
	("Next"			(ex-next (not ex-cycle-other-window)))
	("PreviousRelatedFile"  (ex-next-related-buffer -1))
	("RelatedFile"	    	(ex-next-related-buffer 1))
	("W"			"Write")
	("WWrite"		(save-some-buffers t))
	("Write"		(save-some-buffers))
	("a"			"append")
	("args"			(ex-args))
	("buffer"		(if ex-cycle-other-window
				    (viper-switch-to-buffer-other-window)
				  (viper-switch-to-buffer)))
	("c"			"change")
	;; ch should be "change" but maintain old viper compatibility
	("ch"			"chdir")
	("cd"			(ex-cd))
	("chdir"		(ex-cd))
	("copy"			(ex-copy nil))
	("customize"	    	(customize-group "viper"))
	("delete"		(ex-delete))
	("edit"			(ex-edit))
	("file"			(ex-set-visited-file-name))
	("g"			"global")
	("global"		(ex-global nil) is-mashed)
	("goto"			(ex-goto))
	("help"			(ex-help))
	("join"			(ex-line "join"))
	("k"			(ex-mark) one-letter)
	("kmark"		(ex-mark))
	("m"			"move")
	("make"     	    	(ex-compile))
	; old viper doesn't specify a default for "ma" so leave it undefined
	("map"			(ex-map))
	("mark"			(ex-mark))
	("move"			(ex-copy t))
	("next"			(ex-next ex-cycle-other-window))
	("p"			"print")
	("preserve"		(ex-preserve))
	("print"		(ex-print))
	("put"			(ex-put))
	("pwd"			(ex-pwd))
	("quit"			(ex-quit))
	("r"			"read")
	("re"			"read")
	("read"			(ex-read))
	("recover"		(ex-recover))
	("rewind"		(ex-rewind))
	("s"			"substitute")
	("su"			"substitute")
	("sub"			"substitute")
	("set"			(ex-set))
	("shell"		(ex-shell))
	("source"		(ex-source))
	("stop"			(suspend-emacs))
	("sr"			(ex-substitute t t))
	("submitReport"	    	(viper-submit-report))
	("substitute"	    	(ex-substitute) is-mashed)
	("suspend"		(suspend-emacs))
	("t"			"transfer")
	("tag"			(ex-tag))
	("transfer"		(ex-copy nil))
	("u"			"undo")
	("un"			"undo")
	("undo"			(viper-undo))
	("unmap"		(ex-unmap))
	("v"			"vglobal")
	("version"		(viper-version))
	("vglobal"		(ex-global t) is-mashed)
	("visual"		(ex-edit))
	("w"			"write")
	("wq"			(ex-write t))
	("write"		(ex-write nil))
	("xit"			(ex-write t))
	("yank"			(ex-yank))
	("~"			(ex-substitute t t))

	("append"		(ex-cmd-obsolete "append"))
	("change"		(ex-cmd-obsolete "change"))
	("insert"		(ex-cmd-obsolete "insert"))
	("open"			(ex-cmd-obsolete "open"))

	("list"			(ex-cmd-not-yet "list"))
	("z"			(ex-cmd-not-yet "z"))
	("#"			(ex-cmd-not-yet "#"))

	("abbreviate"	    	(error "`%s': Vi abbreviations are obsolete.  Use
the more powerful Emacs abbrevs" ex-token))
	("unabbreviate"	    	(error "`%s': Vi abbreviations are obsolete.  Use
the more powerful Emacs abbrevs" ex-token))
	))

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-16  2:32 change to try-completion behavior in 21.3? bigfaceworm
@ 2005-12-16  8:22 ` Anselm Helbig
  2005-12-16 18:21   ` bigfaceworm
  2005-12-17  2:33 ` Stefan Monnier
  1 sibling, 1 reply; 9+ messages in thread
From: Anselm Helbig @ 2005-12-16  8:22 UTC (permalink / raw)


At 15 Dec 2005 18:32:42 -0800,
bigfaceworm@gmail.com wrote:
> 
> My company has some RedHat systems (32 bit) and some 64-bit Suse
> systems.
> The Emacs on the two is behaving differently, and
> 
> 64-bit version: 21.3.50.1
> 32-bit version: 21.3.1

Hi!

The version of emacs on your 64-bit machine is an old cvs version,
i.e., older than february 6th 2005, when 21.4 was released (which was
merely a security fix) and the cvs version was renumbered to 22. The
version on your 32-bit machine is the stable release (without the
security fix). 

> The try-completion reacts differently to completion-ignore-case.

I can reproduce this behaviour with emacs 21.4 on debian linux and a
pretty recent cvs version on osf/1 respectively. You should look
through the NEWS file of your cvs emacs, or, even better, have a look
in the source code to see what changed.

regards, 

anselm

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-16  8:22 ` Anselm Helbig
@ 2005-12-16 18:21   ` bigfaceworm
  2005-12-18 21:05     ` Anselm Helbig
  0 siblings, 1 reply; 9+ messages in thread
From: bigfaceworm @ 2005-12-16 18:21 UTC (permalink / raw)


One question: *which* behavior can you reproduce, the ("w" . "w") or
the ("w" . "W")?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-16  2:32 change to try-completion behavior in 21.3? bigfaceworm
  2005-12-16  8:22 ` Anselm Helbig
@ 2005-12-17  2:33 ` Stefan Monnier
  2005-12-17  6:49   ` Johan Bockgård
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2005-12-17  2:33 UTC (permalink / raw)


> Why should it ever return the capital letter W?

Because in your completion table, you have "W".

If case is not significant (which implies among other things that Emacs can
choose case) then Emacs-CVS will try to use the capitalization found in the
completion table.


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-17  2:33 ` Stefan Monnier
@ 2005-12-17  6:49   ` Johan Bockgård
  2005-12-17  9:27     ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Johan Bockgård @ 2005-12-17  6:49 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Why should it ever return the capital letter W?
>
> Because in your completion table, you have "W".

"w" was also in the table.

This change

  revision 1.237
  date: 2002-04-09 19:28:42 +0000;  author: monnier;  state: Exp; lines: +89 -47 [...]
  (Ftry_completion): Allow lambda forms and lists of strings for
  `alist'.
  Short-circuit the search as soon as it "failed". [...]

added this piece of code (approximately)

  if (matchsize <= SCHARS (string)
      && matchcount > 1)
    /* No need to look any further.  */
    break;

When completion-ignore-case is t this doesn't necessarily find the
best match _including case_ (AFAICS).

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-17  6:49   ` Johan Bockgård
@ 2005-12-17  9:27     ` Stefan Monnier
  2005-12-17 18:30       ` bigfaceworm
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2005-12-17  9:27 UTC (permalink / raw)


>>> Why should it ever return the capital letter W?
>> Because in your completion table, you have "W".
> "w" was also in the table.

Good point.  Could you give us more detail about your context: why do you
have such a table with two redundant entries and why do you care which of
the two is returned?

> This change

>   revision 1.237
>   date: 2002-04-09 19:28:42 +0000;  author: monnier;  state: Exp; lines: +89 -47 [...]
>   (Ftry_completion): Allow lambda forms and lists of strings for
>   `alist'.
>   Short-circuit the search as soon as it "failed". [...]

> added this piece of code (approximately)

>   if (matchsize <= SCHARS (string)
>       && matchcount > 1)
>     /* No need to look any further.  */
>     break;

> When completion-ignore-case is t this doesn't necessarily find the
> best match _including case_ (AFAICS).

Yes, I'd completely forgotten about this one ;-)


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-17  9:27     ` Stefan Monnier
@ 2005-12-17 18:30       ` bigfaceworm
  2005-12-18 15:32         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: bigfaceworm @ 2005-12-17 18:30 UTC (permalink / raw)


Ask the implementers of viper mode why there are two seemingly
redundant entries in the table.  :)

In actuality, the 'w' and 'W' represent different commands.  The first
represents 'save-buffer' and the second 'save-some-buffers'.

So, with the change to try-completion, the user typing a 'w' no longer
gets the same command s/he used to get.

The workaround is to advise the function that ends up resolving this
issue with a let statement temporarily rebinding completion-ignore-case
to get the appropriate behavior.

Also, I tried looking at the NEWS file for the newer Emacs, but
everything is screwed up in the installation - the file was not found
(nor are the info pages).  So that's why I thought it was entirely
possible that our IT department screwed things up.  Every time there is
an "upgrade" to the Emacs or OS, they mess something up with
non-default behavior.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-17 18:30       ` bigfaceworm
@ 2005-12-18 15:32         ` Stefan Monnier
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2005-12-18 15:32 UTC (permalink / raw)


> Ask the implementers of viper mode why there are two seemingly
> redundant entries in the table.  :)

> In actuality, the 'w' and 'W' represent different commands.  The first
> represents 'save-buffer' and the second 'save-some-buffers'.

Then, please report this bug via M-x report-emacs-bug, including as much
info as you can find.


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: change to try-completion behavior in 21.3?
  2005-12-16 18:21   ` bigfaceworm
@ 2005-12-18 21:05     ` Anselm Helbig
  0 siblings, 0 replies; 9+ messages in thread
From: Anselm Helbig @ 2005-12-18 21:05 UTC (permalink / raw)


At 16 Dec 2005 10:21:51 -0800,
bigfaceworm@gmail.com wrote:
> 
> One question: *which* behavior can you reproduce, the ("w" . "w") or
> the ("w" . "W")?

of course i meant, i can reproduce both, i get the first result from
cvs emacs and the second one from emacs 21.4. but i think you knew
that by now. 8;-)

regards, 

anselm

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-18 21:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-16  2:32 change to try-completion behavior in 21.3? bigfaceworm
2005-12-16  8:22 ` Anselm Helbig
2005-12-16 18:21   ` bigfaceworm
2005-12-18 21:05     ` Anselm Helbig
2005-12-17  2:33 ` Stefan Monnier
2005-12-17  6:49   ` Johan Bockgård
2005-12-17  9:27     ` Stefan Monnier
2005-12-17 18:30       ` bigfaceworm
2005-12-18 15:32         ` Stefan Monnier

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.