* Attempt to modify read-only value
@ 2002-04-23 7:50 Juanma Barranquero
2002-04-23 8:43 ` Miles Bader
0 siblings, 1 reply; 5+ messages in thread
From: Juanma Barranquero @ 2002-04-23 7:50 UTC (permalink / raw)
After this:
2002-04-23 Miles Bader <miles@gnu.org>
* menu-bar.el (menu-bar-update-buffers): Add `Select Named Buffer'.
Add separator line before commands
Remove old crufty code that tried to line things up by adding
spaces to entries (it doesn't work).
Move `Frames' submenu after the normal buffers, and add a
separator line before it.
(menu-bar-buffers-menu-list-buffers-entry): Variable removed.
I'm getting "attempt to modify read-only value" while bootstraping.
/L/e/k/t/u
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Attempt to modify read-only value
@ 2002-04-23 8:12 Kenichi Handa
2002-04-23 8:48 ` Miles Bader
0 siblings, 1 reply; 5+ messages in thread
From: Kenichi Handa @ 2002-04-23 8:12 UTC (permalink / raw)
Cc: emacs-devel
Juanma Barranquero <lektu@terra.es> writes:
> After this:
> 2002-04-23 Miles Bader <miles@gnu.org>
> * menu-bar.el (menu-bar-update-buffers): Add `Select Named Buffer'.
> Add separator line before commands
> Remove old crufty code that tried to line things up by adding
> spaces to entries (it doesn't work).
> Move `Frames' submenu after the normal buffers, and add a
> separator line before it.
> (menu-bar-buffers-menu-list-buffers-entry): Variable removed.
> I'm getting "attempt to modify read-only value" while bootstraping.
Me too. This is because, in keyboard.c, we do this:
if (NILP (cachelist))
{
/* We have to create a cachelist. */
CHECK_IMPURE (start); <-- this causes the error
XSETCDR (start, Fcons (Fcons (Qnil, Qnil), XCDR (start)));
Changing this part (line 1363 of menu-bar.el):
'((command-separator "--")
(select-named-buffer
menu-item
"Select Named Buffer..."
switch-to-buffer
:help "Prompt for a buffer name, and select that buffer in the current window")
(list-all-buffers
menu-item
"List All Buffers"
list-buffers
:help "Pop up a window listing all emacs buffers"))))
to something like:
`((command-separator "--")
,(list 'select-named-buffer
'menu-item
"Select Named Buffer..."
'switch-to-buffer
...)
,(list 'list-all-buffers
'menu-item
"List All Buffers"
'list-buffers
...))
fixes this problem. But, this workaround is very weird.
There should be a better solution.
---
Ken'ichi HANDA
handa@etl.go.jp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Attempt to modify read-only value
2002-04-23 7:50 Attempt to modify read-only value Juanma Barranquero
@ 2002-04-23 8:43 ` Miles Bader
0 siblings, 0 replies; 5+ messages in thread
From: Miles Bader @ 2002-04-23 8:43 UTC (permalink / raw)
Cc: emacs-devel
Juanma Barranquero <lektu@terra.es> writes:
> I'm getting "attempt to modify read-only value" while bootstraping.
I've fixed it in CVS:
2002-04-23 Miles Bader <miles@gnu.org>
* menu-bar.el (menu-bar-update-buffers): Don't use constant lists
for command menu entries, since the low-level menu code modifies
them. Cache the resulting list.
(menu-bar-buffers-menu-command-entries): New variable.
Index: menu-bar.el
===================================================================
RCS file: /cvs/emacs/lisp/menu-bar.el,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -p -r1.207 -r1.208
--- menu-bar.el 23 Apr 2002 05:01:50 -0000 1.207
+++ menu-bar.el 23 Apr 2002 08:34:57 -0000 1.208
@@ -1282,6 +1282,9 @@ key (or menu-item)"))
file))
(car elt)))
+;; Used to cache the menu entries for commands in the Buffers menu
+(defvar menu-bar-buffers-menu-command-entries nil)
+
(defun menu-bar-update-buffers (&optional force)
;; If user discards the Buffers item, play along.
(and (lookup-key (current-global-map) [menu-bar buffer])
@@ -1357,20 +1360,27 @@ key (or menu-item)"))
`((frames-separator "--")
(frames menu-item "Frames" ,frames-menu))))))
- ;; Add in some normal commands at the end of the menu
+ ;; Add in some normal commands at the end of the menu. We use
+ ;; the copy cached in `menu-bar-buffers-menu-command-entries'
+ ;; if it's been set already. Note that we can't use constant
+ ;; lists for the menu-entries, because the low-level menu-code
+ ;; modifies them.
+ (unless menu-bar-buffers-menu-command-entries
+ (setq menu-bar-buffers-menu-command-entries
+ (list '(command-separator "--")
+ (list 'select-named-buffer
+ 'menu-item
+ "Select Named Buffer..."
+ 'switch-to-buffer
+ :help "Prompt for a buffer name, and select that buffer in the current window")
+ (list 'list-all-buffers
+ 'menu-item
+ "List All Buffers"
+ 'list-buffers
+ :help "Pop up a window listing all emacs buffers"
+ ))))
(setq buffers-menu
- (nconc buffers-menu
- '((command-separator "--")
- (select-named-buffer
- menu-item
- "Select Named Buffer..."
- switch-to-buffer
- :help "Prompt for a buffer name, and select that buffer in the current window")
- (list-all-buffers
- menu-item
- "List All Buffers"
- list-buffers
- :help "Pop up a window listing all emacs buffers"))))
+ (nconc buffers-menu menu-bar-buffers-menu-command-entries))
(setq buffers-menu (cons 'keymap (cons "Select Buffer" buffers-menu)))
(define-key (current-global-map) [menu-bar buffer]
-Miles
--
80% of success is just showing up. --Woody Allen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Attempt to modify read-only value
2002-04-23 8:12 Kenichi Handa
@ 2002-04-23 8:48 ` Miles Bader
0 siblings, 0 replies; 5+ messages in thread
From: Miles Bader @ 2002-04-23 8:48 UTC (permalink / raw)
Cc: lektu, emacs-devel
Kenichi Handa <handa@etl.go.jp> writes:
> fixes this problem. But, this workaround is very weird.
> There should be a better solution.
I suspect the prettiest thing would be to not construct raw menu
entries, but rather use official functions like `define-key' to make
them.
However, this throws away the cached key lookups that the low-level menu
code adds (this is why it's modifying the menu entry), which might be
bad because the Buffers menu can get rebuilt pretty often.
-Miles
--
Run away! Run away!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Attempt to modify read-only value
@ 2002-04-23 11:20 Kenichi Handa
0 siblings, 0 replies; 5+ messages in thread
From: Kenichi Handa @ 2002-04-23 11:20 UTC (permalink / raw)
Cc: lektu, emacs-devel
Miles Bader <miles@lsi.nec.co.jp> writes:
> Kenichi Handa <handa@etl.go.jp> writes:
>> fixes this problem. But, this workaround is very weird.
>> There should be a better solution.
> I suspect the prettiest thing would be to not construct raw menu
> entries, but rather use official functions like `define-key' to make
> them.
> However, this throws away the cached key lookups that the low-level menu
> code adds (this is why it's modifying the menu entry), which might be
> bad because the Buffers menu can get rebuilt pretty often.
Thank you for the explanation. I understand.
---
Ken'ichi HANDA
handa@etl.go.jp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-04-23 11:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-23 7:50 Attempt to modify read-only value Juanma Barranquero
2002-04-23 8:43 ` Miles Bader
-- strict thread matches above, loose matches on Subject: below --
2002-04-23 8:12 Kenichi Handa
2002-04-23 8:48 ` Miles Bader
2002-04-23 11:20 Kenichi Handa
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).