GNU bug report logs - #20334
What does all-completions with COLLECTION == obarray return?

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Date: Wed, 15 Apr 2015 15:15:01 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20334 in the body.
You can then email your comments to 20334 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to michael_heerdegen <at> web.de, bug-gnu-emacs <at> gnu.org:
bug#20334; Package emacs. (Wed, 15 Apr 2015 15:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
New bug report received and forwarded. Copy sent to michael_heerdegen <at> web.de, bug-gnu-emacs <at> gnu.org. (Wed, 15 Apr 2015 15:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: What does all-completions with COLLECTION == obarray return?
Date: Wed, 15 Apr 2015 11:14:16 -0400
> I guess this should not happen, so it is a bug in Emacs in think.

Indeed.  Thanks for the test case.  I reduced it to:

   (progn
     (intern "Bahá'í Date") ;this happens when requiring org
     (facep "Bahá'í Date")
     ;; Test if "Bahá'í Date" is the name of more than one interned symbol
     (let ((ss nil))
       (mapatoms (lambda (s) (when (string= (symbol-name s) "Bahá'í Date")
   			    (push s ss)))
   	      nil)
       (length ss)))

So the patch below fixes it, but it points at a problem in the
C function `intern' which I haven't tracked down yet.


        Stefan


diff --git a/src/xfaces.c b/src/xfaces.c
index 9f8a816..d079be8 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1822,7 +1822,8 @@ resolve_face_name (Lisp_Object face_name, bool signal_p)
   Lisp_Object tortoise, hare;
 
   if (STRINGP (face_name))
-    face_name = intern (SSDATA (face_name));
+    /* face_name = intern (SSDATA (face_name)); */
+    face_name = Fintern (face_name, Qnil);
 
   if (NILP (face_name) || !SYMBOLP (face_name))
     return face_name;




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20334; Package emacs. (Wed, 15 Apr 2015 15:31:02 GMT) Full text and rfc822 format available.

Message #8 received at 20334 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 20334 <at> debbugs.gnu.org
Subject: Re: bug#20334: What does all-completions with COLLECTION == obarray
 return?
Date: Wed, 15 Apr 2015 17:30:29 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> So the patch below fixes it, but it points at a problem in the
> C function `intern' which I haven't tracked down yet.

The C function only works with ASCII-only strings.

  Lisp_Object tem = oblookup (obarray, str, len, len);

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20334; Package emacs. (Wed, 15 Apr 2015 16:16:02 GMT) Full text and rfc822 format available.

Message #11 received at 20334 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: 20334 <at> debbugs.gnu.org
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>
Subject: Re: bug#20334: What does all-completions with COLLECTION == obarray
 return?
Date: Wed, 15 Apr 2015 12:15:43 -0400
>    (progn
>      (intern "Bahá'í Date") ;this happens when requiring org
>      (facep "Bahá'í Date")
>      ;; Test if "Bahá'í Date" is the name of more than one interned symbol
>      (let ((ss nil))
>        (mapatoms (lambda (s) (when (string= (symbol-name s) "Bahá'í Date")
>    			    (push s ss)))
>    	      nil)
>        (length ss)))

I installed the patch below which should fix this problem.  Thanks.


        Stefan


diff --git a/src/lread.c b/src/lread.c
index 050e43e..fa9a63e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3778,8 +3778,11 @@ intern_1 (const char *str, ptrdiff_t len)
   Lisp_Object obarray = check_obarray (Vobarray);
   Lisp_Object tem = oblookup (obarray, str, len, len);
 
-  return SYMBOLP (tem) ? tem : intern_driver (make_string (str, len),
-					      obarray, tem);
+  return (SYMBOLP (tem) ? tem
+	  /* The above `oblookup' was done on the basis of nchars==nbytes, so
+	     the string has to be unibyte.  */
+	  : intern_driver (make_unibyte_string (str, len),
+			   obarray, tem));
 }
 
 Lisp_Object
diff --git a/src/xfaces.c b/src/xfaces.c
index b269722..d198c4b 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1822,7 +1822,7 @@ resolve_face_name (Lisp_Object face_name, bool signal_p)
   Lisp_Object tortoise, hare;
 
   if (STRINGP (face_name))
-    face_name = intern (SSDATA (face_name));
+    face_name = Fintern (face_name, Qnil);
 
   if (NILP (face_name) || !SYMBOLP (face_name))
     return face_name;
diff --git a/test/indent/perl.perl b/test/indent/perl.perl
index 00ef312..ea48754 100755
--- a/test/indent/perl.perl
+++ b/test/indent/perl.perl
@@ -5,6 +5,15 @@ sub add_funds($) {
     return 0;
 }
 
+my $hash = {
+    foo => 'bar',
+    format => 'some',
+};
+
+sub some_code {
+    print "will not indent :(";
+};
+
 use v5.14;
 
 my $str= <<END;




bug closed, send any further explanations to 20334 <at> debbugs.gnu.org and Stefan Monnier <monnier <at> IRO.UMontreal.CA> Request was from Stefan Monnier <monnier <at> IRO.UMontreal.CA> to control <at> debbugs.gnu.org. (Wed, 15 Apr 2015 17:20:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20334; Package emacs. (Wed, 15 Apr 2015 17:25:02 GMT) Full text and rfc822 format available.

Message #16 received at 20334 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 20334 <at> debbugs.gnu.org
Subject: Re: bug#20334: What does all-completions with COLLECTION == obarray
 return?
Date: Wed, 15 Apr 2015 19:24:27 +0200
Stefan Monnier <monnier <at> IRO.UMontreal.CA> writes:

> I installed the patch below which should fix this problem.  Thanks.

It fixed my test case as well as the original issue in Helm.  Thanks!


P.S.: Your commit includes a change to test/indent/perl.perl that seems
unrelated to this issue.


Thanks again,

Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 May 2015 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.