Subject: bug#12581: closed (Re: bug#12581: 24.2.50: redo+ fails to modify edit menu)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 05 Oct 2012 21:56:02 +0000

Your bug report

#12581: 24.2.50: redo+ fails to modify edit menu

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
12581: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12581
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#12581: 24.2.50: redo+ fails to modify edit menu
From: Stefan Monnier <[email-masked]>
To: Konstantinos Efstathiou <[email-masked]>
Cc: [email-masked]
Date: Fri, 05 Oct 2012 17:55:27 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> 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

Subject: 24.2.50: redo+ fails to modify edit menu
From: Konstantinos Efstathiou <[email-masked]>
To: [email-masked]
Date: Fri, 5 Oct 2012 23:00:43 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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?