unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28774: Master, emacs-26: Can't add text property to built-in function name.
@ 2017-10-10  7:57 Ilya Khaprov
  2017-10-10 10:21 ` Noam Postavsky
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Khaprov @ 2017-10-10  7:57 UTC (permalink / raw)
  To: 28774

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




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

* bug#28774: Master, emacs-26: Can't add text property to built-in function name.
  2017-10-10  7:57 bug#28774: Master, emacs-26: Can't add text property to built-in function name Ilya Khaprov
@ 2017-10-10 10:21 ` Noam Postavsky
  2017-10-10 14:01   ` Drew Adams
  2017-10-12  0:56   ` Noam Postavsky
  0 siblings, 2 replies; 5+ messages in thread
From: Noam Postavsky @ 2017-10-10 10:21 UTC (permalink / raw)
  To: Ilya Khaprov; +Cc: 28774

Ilya Khaprov <ilya.khaprov@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







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

* bug#28774: Master, emacs-26: Can't add text property to built-in function name.
  2017-10-10 10:21 ` Noam Postavsky
@ 2017-10-10 14:01   ` Drew Adams
  2017-10-10 14:12     ` Noam Postavsky
  2017-10-12  0:56   ` Noam Postavsky
  1 sibling, 1 reply; 5+ messages in thread
From: Drew Adams @ 2017-10-10 14:01 UTC (permalink / raw)
  To: Noam Postavsky, Ilya Khaprov; +Cc: 28774

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





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

* bug#28774: Master, emacs-26: Can't add text property to built-in function name.
  2017-10-10 14:01   ` Drew Adams
@ 2017-10-10 14:12     ` Noam Postavsky
  0 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2017-10-10 14:12 UTC (permalink / raw)
  To: Drew Adams; +Cc: 28774, Ilya Khaprov

On Tue, Oct 10, 2017 at 10:01 AM, Drew Adams <drew.adams@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





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

* bug#28774: Master, emacs-26: Can't add text property to built-in function name.
  2017-10-10 10:21 ` Noam Postavsky
  2017-10-10 14:01   ` Drew Adams
@ 2017-10-12  0:56   ` Noam Postavsky
  1 sibling, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2017-10-12  0:56 UTC (permalink / raw)
  To: Ilya Khaprov; +Cc: 28774

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





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

end of thread, other threads:[~2017-10-12  0:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10  7:57 bug#28774: Master, emacs-26: Can't add text property to built-in function name Ilya Khaprov
2017-10-10 10:21 ` Noam Postavsky
2017-10-10 14:01   ` Drew Adams
2017-10-10 14:12     ` Noam Postavsky
2017-10-12  0:56   ` Noam Postavsky

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