GNU bug report logs - #28774
[ido] Can't add text property to built-in function name.

Previous Next

Package: emacs;

Reported by: Ilya Khaprov <ilya.khaprov <at> publitechs.com>

Date: Tue, 10 Oct 2017 07:58:01 UTC

Severity: normal

Tags: fixed

Found in version 26.0.90

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

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 28774 in the body.
You can then email your comments to 28774 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 bug-gnu-emacs <at> gnu.org:
bug#28774; Package emacs. (Tue, 10 Oct 2017 07:58:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ilya Khaprov <ilya.khaprov <at> publitechs.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 10 Oct 2017 07:58:01 GMT) Full text and rfc822 format available.

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

From: Ilya Khaprov <ilya.khaprov <at> publitechs.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Master, emacs-26: Can't add text property to built-in function name.
Date: Tue, 10 Oct 2017 07:57:04 +0000
Hi

After commit :3db388b0bf the following stopped working:

(global-set-key
 "\M-x"
 (lambda ()
   (interactive)
   (call-interactively
    (intern
     (ido-completing-read
      "M-x "
      (all-completions "" obarray 'commandp))))))

This package no longer works too: https://github.com/DarwinAwardWinner/ido-completing-read-plus

Example error message:
Error in post-command-hook (ido-exhibit): (error "Attempt to modify read-only object" "rename-buffer")

On the surface it looks like if I try to complete function defined in C (i.e, built-in),
I get this error because the symbol/name is read only.

Call chain like this :
ido-completions
put-text-property
add_text_properties_1
validate_inerval_range
create_root_interval
CHECK_IMPURE
pure_write_error

I still reproduce it on

emacs-26 - 5d51403ceb
master      - 6abff55b55

Temporary fixed with ido-name override:

(defun ido-name (item)
  ;; Return file name for current item, whether in a normal list
  ;; or a merged work directory list.
  (concat (if (consp item) (car item) item)))


Thanks,
Ilya



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28774; Package emacs. (Tue, 10 Oct 2017 10:22:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Ilya Khaprov <ilya.khaprov <at> publitechs.com>
Cc: 28774 <at> debbugs.gnu.org
Subject: Re: bug#28774: Master,
 emacs-26: Can't add text property to built-in function name.
Date: Tue, 10 Oct 2017 06:21:41 -0400
Ilya Khaprov <ilya.khaprov <at> publitechs.com> writes:
>
> After commit :3db388b0bf the following stopped working:
>
> (global-set-key
>  "\M-x"
>  (lambda ()
>    (interactive)
>    (call-interactively
>     (intern
>      (ido-completing-read
>       "M-x "
>       (all-completions "" obarray 'commandp))))))

It seems ido-completions relies on (format "%s" str) to return a copy of
str.  This fixes it:

--- i/lisp/ido.el
+++ w/lisp/ido.el
@@ -4701,7 +4701,7 @@ ido-completions
     (if (and ido-use-faces comps)
 	(let* ((fn (ido-name (car comps)))
 	       (ln (length fn)))
-	  (setq first (format "%s" fn))
+	  (setq first (copy-sequence fn))
 	  (put-text-property 0 ln 'face
 			     (if (= (length comps) 1)
                                  (if ido-incomplete-regexp






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28774; Package emacs. (Tue, 10 Oct 2017 14:03:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>, Ilya Khaprov
 <ilya.khaprov <at> publitechs.com>
Cc: 28774 <at> debbugs.gnu.org
Subject: RE: bug#28774: Master, emacs-26: Can't add text property to built-in
 function name.
Date: Tue, 10 Oct 2017 07:01:52 -0700 (PDT)
> It seems ido-completions relies on (format "%s" str) to return a copy of
> str.  This fixes it:

If `format' no longer always copies STR in this context then
its doc should be updated, I think.

This:

 Format a string out of a format-string and arguments.
 The first argument is a format control string.
 The other arguments are substituted into it to make the
 result, a string.

suggests that it creates a new string, or at most reuses
the format string (e.g., "%s"), modifying it by substituting
STR for %s in it.  If in fact it can sometimes simply return
STR then this should be mentioned explicitly, to avoid confusion.

(And why was this change made?  Was it just to save a string
copy?)

This is an incompatible Lisp change, if it is new.  In that
case, it should be documented as such.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28774; Package emacs. (Tue, 10 Oct 2017 14:13:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 28774 <at> debbugs.gnu.org, Ilya Khaprov <ilya.khaprov <at> publitechs.com>
Subject: Re: bug#28774: Master, emacs-26: Can't add text property to built-in
 function name.
Date: Tue, 10 Oct 2017 10:12:08 -0400
On Tue, Oct 10, 2017 at 10:01 AM, Drew Adams <drew.adams <at> oracle.com> wrote:
>> It seems ido-completions relies on (format "%s" str) to return a copy of
>> str.  This fixes it:
>
> If `format' no longer always copies STR in this context then
> its doc should be updated, I think.

It has been, see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28625




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28774; Package emacs. (Thu, 12 Oct 2017 00:58:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Ilya Khaprov <ilya.khaprov <at> publitechs.com>
Cc: 28774 <at> debbugs.gnu.org
Subject: Re: bug#28774: Master,
 emacs-26: Can't add text property to built-in function name.
Date: Wed, 11 Oct 2017 20:56:55 -0400
retitle 28774 [ido] Can't add text property to built-in function name.
found 28774 26.0.90
tags 28774 fixed
close 28774
quit

Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

> -	  (setq first (format "%s" fn))
> +	  (setq first (copy-sequence fn))

Pushed to emacs-26.

[1: b78332c3c6]: 2017-10-11 20:53:22 -0400
  Don't use (format "%s" ...) for string copying (Bug#28774)
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b78332c3c646be12d252a637ce0fc949919a840b




Changed bug title to '[ido] Can't add text property to built-in function name.' from 'Master, emacs-26: Can't add text property to built-in function name.' Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Thu, 12 Oct 2017 00:58:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 26.0.90. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Thu, 12 Oct 2017 00:58:02 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Thu, 12 Oct 2017 00:58:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 28774 <at> debbugs.gnu.org and Ilya Khaprov <ilya.khaprov <at> publitechs.com> Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Thu, 12 Oct 2017 00:58:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 09 Nov 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 218 days ago.

Previous Next


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