unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20334: What does all-completions with COLLECTION == obarray return?
       [not found]             ` <87twwh1omu.fsf@web.de>
@ 2015-04-15 15:14               ` Stefan Monnier
  2015-04-15 15:30                 ` Andreas Schwab
  2015-04-15 16:15                 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-04-15 15:14 UTC (permalink / raw)
  To: 20334; +Cc: Michael Heerdegen

> 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;





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

* bug#20334: What does all-completions with COLLECTION == obarray return?
  2015-04-15 15:14               ` bug#20334: What does all-completions with COLLECTION == obarray return? Stefan Monnier
@ 2015-04-15 15:30                 ` Andreas Schwab
  2015-04-15 16:15                 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2015-04-15 15:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, 20334

Stefan Monnier <monnier@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@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





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

* bug#20334: What does all-completions with COLLECTION == obarray return?
  2015-04-15 15:14               ` bug#20334: What does all-completions with COLLECTION == obarray return? Stefan Monnier
  2015-04-15 15:30                 ` Andreas Schwab
@ 2015-04-15 16:15                 ` Stefan Monnier
  2015-04-15 17:24                   ` Michael Heerdegen
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2015-04-15 16:15 UTC (permalink / raw)
  To: 20334; +Cc: Michael Heerdegen

>    (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;





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

* bug#20334: What does all-completions with COLLECTION == obarray return?
  2015-04-15 16:15                 ` Stefan Monnier
@ 2015-04-15 17:24                   ` Michael Heerdegen
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2015-04-15 17:24 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 20334

Stefan Monnier <monnier@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.





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

end of thread, other threads:[~2015-04-15 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87k2xr7skh.fsf@web.de>
     [not found] ` <jwv619bmcyj.fsf-monnier+emacs@gnu.org>
     [not found]   ` <87iodaxvg0.fsf@web.de>
     [not found]     ` <jwv7ftplxfk.fsf-monnier+emacs@gnu.org>
     [not found]       ` <87lhi3hs6d.fsf@web.de>
     [not found]         ` <jwvpp7espj3.fsf-monnier+emacs@gnu.org>
     [not found]           ` <87iod68tj3.fsf@web.de>
     [not found]             ` <87twwh1omu.fsf@web.de>
2015-04-15 15:14               ` bug#20334: What does all-completions with COLLECTION == obarray return? Stefan Monnier
2015-04-15 15:30                 ` Andreas Schwab
2015-04-15 16:15                 ` Stefan Monnier
2015-04-15 17:24                   ` Michael Heerdegen

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