unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [per.starback@gmail.com: completion of coding systems]
@ 2007-10-11 17:41 Richard Stallman
  2007-10-13 19:54 ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-10-11 17:41 UTC (permalink / raw)
  To: emacs-devel

Would someone please do this in Emacs 22, then ack?

------- Start of forwarded message -------
X-Spam-Status: No, score=0.6 required=5.0 tests=NO_REAL_NAME,
	UNPARSEABLE_RELAY autolearn=no version=3.1.0
Date: Thu, 11 Oct 2007 13:00:14 +0200
From: per.starback@gmail.com
To: bug-gnu-emacs@gnu.org
Subject: completion of coding systems

In GNU Emacs 22.1:

This happened to a user here recently:

  C-x RET f UTF-8 RET	=>  [No match]

(since the coding system is really called "utf-8" in lowercase).

Small suggestion: Set completion-ignore-case during
read-coding-system.

Reason: Some coding systems are often given with uppercase letters
outside of Emacs so one might thing that is the proper form to use.
It wouldn't hurt anyway, since all coding systems in Emacs have
all-lower-case names anyway.
------- End of forwarded message -------

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

* Re: [per.starback@gmail.com: completion of coding systems]
  2007-10-11 17:41 [per.starback@gmail.com: completion of coding systems] Richard Stallman
@ 2007-10-13 19:54 ` Glenn Morris
  2007-10-15  1:36   ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2007-10-13 19:54 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:

> Would someone please do this in Emacs 22, then ack?

Is this right?


*** coding.c	25 Jul 2007 07:49:38 -0000	1.351.2.2
--- coding.c	13 Oct 2007 03:11:31 -0000
***************
*** 6563,6573 ****
--- 6563,6577 ----
       Lisp_Object prompt, default_coding_system;
  {
    Lisp_Object val;
+   int count = SPECPDL_INDEX ();
+ 
    if (SYMBOLP (default_coding_system))
      default_coding_system = SYMBOL_NAME (default_coding_system);
+   specbind (intern ("completion-ignore-case"), Qt);
    val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil,
  			  Qt, Qnil, Qcoding_system_history,
  			  default_coding_system, Qnil);
+   unbind_to (count, Qnil);
    return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil));
  }
  

> From: per.starback@gmail.com
> Subject: completion of coding systems
> To: bug-gnu-emacs@gnu.org
> Date: Thu, 11 Oct 2007 13:00:14 +0200
[...]
> Small suggestion: Set completion-ignore-case during read-coding-system.

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

* Re: [per.starback@gmail.com: completion of coding systems]
  2007-10-13 19:54 ` Glenn Morris
@ 2007-10-15  1:36   ` Richard Stallman
  2007-10-15  7:16     ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-10-15  1:36 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

    +   int count = SPECPDL_INDEX ();
    + 
	if (SYMBOLP (default_coding_system))
	  default_coding_system = SYMBOL_NAME (default_coding_system);
    +   specbind (intern ("completion-ignore-case"), Qt);
	val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil,
			      Qt, Qnil, Qcoding_system_history,
			      default_coding_system, Qnil);
    +   unbind_to (count, Qnil);

That would work, but it would be cleaner to use 

    specbind (Qcompletion_ignore_case, Qt);

instead of interning it again.

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

* Re: [per.starback@gmail.com: completion of coding systems]
  2007-10-15  1:36   ` Richard Stallman
@ 2007-10-15  7:16     ` Glenn Morris
  2007-10-15 18:31       ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2007-10-15  7:16 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:

> That would work, but it would be cleaner to use 
>
>     specbind (Qcompletion_ignore_case, Qt);
>
> instead of interning it again.

I was copying the behaviour of read-file-name in fileio.c.

You mean you would rather have this:


--- coding.c	25 Jul 2007 07:49:38 -0000	1.351.2.2
+++ coding.c	15 Oct 2007 07:13:18 -0000
@@ -386,6 +386,8 @@
    decided.  */
 Lisp_Object eol_mnemonic_undecided;
 
+Lisp_Object Qcompletion_ignore_case;
+
 /* Format of end-of-line decided by system.  This is CODING_EOL_LF on
    Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac.
    This has an effect only for external encoding (i.e. for output to
@@ -6558,16 +6560,22 @@
 
 DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0,
        doc: /* Read a coding system from the minibuffer, prompting with string PROMPT.
-If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.  */)
+If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.
+Ignores case when completing coding systems (all Emacs coding systems
+are lower-case).  */)
      (prompt, default_coding_system)
      Lisp_Object prompt, default_coding_system;
 {
   Lisp_Object val;
+  int count = SPECPDL_INDEX ();
+
   if (SYMBOLP (default_coding_system))
     default_coding_system = SYMBOL_NAME (default_coding_system);
+  specbind (Qcompletion_ignore_case, Qt);
   val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil,
 			  Qt, Qnil, Qcoding_system_history,
 			  default_coding_system, Qnil);
+  unbind_to (count, Qnil);
   return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil));
 }
 
@@ -7733,6 +7741,9 @@
   /* Target FILENAME is the third argument.  */
   Fput (Qwrite_region, Qtarget_idx, make_number (2));
 
+  Qcompletion_ignore_case = intern ("completion-ignore-case");
+  staticpro (&Qcompletion_ignore_case);
+
   Qcall_process = intern ("call-process");
   staticpro (&Qcall_process);
   /* Target PROGRAM is the first argument.  */

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

* Re: [per.starback@gmail.com: completion of coding systems]
  2007-10-15  7:16     ` Glenn Morris
@ 2007-10-15 18:31       ` Richard Stallman
  2007-10-15 18:46         ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-10-15 18:31 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

There is already a variable Qcompletion_ignore_case.
You just have to use it.

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

* Re: [per.starback@gmail.com: completion of coding systems]
  2007-10-15 18:31       ` Richard Stallman
@ 2007-10-15 18:46         ` Glenn Morris
  2007-10-16 19:10           ` Richard Stallman
  0 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2007-10-15 18:46 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:

> There is already a variable Qcompletion_ignore_case.

Only in some #ifdef VMS code in dired.c AFAICS.

> You just have to use it.

I'm probably missing your point by several miles...

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

* Re: [per.starback@gmail.com: completion of coding systems]
  2007-10-15 18:46         ` Glenn Morris
@ 2007-10-16 19:10           ` Richard Stallman
  2007-10-17  1:41             ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-10-16 19:10 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

    > There is already a variable Qcompletion_ignore_case.

    Only in some #ifdef VMS code in dired.c AFAICS.

I did not see it was #ifdef VMS.

We only need one (unconditional) definition of the variable in Emacs.
You may as well unconditionalize the one in dired.c.

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

* Re: [per.starback@gmail.com: completion of coding systems]
  2007-10-16 19:10           ` Richard Stallman
@ 2007-10-17  1:41             ` Glenn Morris
  0 siblings, 0 replies; 8+ messages in thread
From: Glenn Morris @ 2007-10-17  1:41 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman wrote:

> We only need one (unconditional) definition of the variable in Emacs.
> You may as well unconditionalize the one in dired.c.

It made more sense to me to define it in minibuf.c, so that's what I did.

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

end of thread, other threads:[~2007-10-17  1:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-11 17:41 [per.starback@gmail.com: completion of coding systems] Richard Stallman
2007-10-13 19:54 ` Glenn Morris
2007-10-15  1:36   ` Richard Stallman
2007-10-15  7:16     ` Glenn Morris
2007-10-15 18:31       ` Richard Stallman
2007-10-15 18:46         ` Glenn Morris
2007-10-16 19:10           ` Richard Stallman
2007-10-17  1:41             ` Glenn Morris

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).