unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12581: 24.2.50: redo+ fails to modify edit menu
@ 2012-10-05 21:00 Konstantinos Efstathiou
  2012-10-05 21:55 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantinos Efstathiou @ 2012-10-05 21:00 UTC (permalink / raw)
  To: 12581

In the latest versions from the repository it is impossible to load redo+.el
(version 1.15 available from ELPA). The command (require 'redo+)
fails with (error "Attempt to modify read-only object").

I have tracked this down to the command

(setcar (cdr (memq :enable (assq 'undo menu-bar-edit-menu))) nil)

that fails with the same error. Actually redo+ attempts to setcar to 
something else but obviously the problem is that for some reason

(car (cdr (memq :enable (assq 'undo menu-bar-edit-menu)))

is now read-only while it used to be modifiable.

Is this a bug or expected behavior? Should redo+ be modified?






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

* bug#12581: 24.2.50: redo+ fails to modify edit menu
  2012-10-05 21:00 bug#12581: 24.2.50: redo+ fails to modify edit menu Konstantinos Efstathiou
@ 2012-10-05 21:55 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2012-10-05 21:55 UTC (permalink / raw)
  To: Konstantinos Efstathiou; +Cc: 12581-done

> I have tracked this down to the command
> (setcar (cdr (memq :enable (assq 'undo menu-bar-edit-menu))) nil)
[...]
> that fails with the same error. Actually redo+ attempts to setcar to
> something else but obviously the problem is that for some reason
[...]
> Is this a bug or expected behavior? Should redo+ be modified?

It's not a bug, AFAIC.  You can change redo+ to use something like:

   (define-key menu-bar-edit-menu [undo]
     ;; We use `cdr+assq' instead of `lookup-key' because lookup-key
     ;; would return the actual binding inside the menu-item, whereas
     ;; we want the whole menu-item (IOW we don't want the get_keyelt
     ;; part of lookup-key).  We could use
     ;; (catch 'found
     ;;   (map-keymap (lambda (k v)
     ;;                 (if (eq k 'undo) (throw 'found v)))
     ;;               menu-bar-edit-menu))
     ;; instead.
     (let ((elem (copy-sequence (cdr (assq 'undo menu-bar-edit-menu)))))
       (setcar (cdr (memq :enable elem)) <your-exp-here>)
       elem))

       
-- Stefan






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

end of thread, other threads:[~2012-10-05 21:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05 21:00 bug#12581: 24.2.50: redo+ fails to modify edit menu Konstantinos Efstathiou
2012-10-05 21:55 ` Stefan Monnier

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