Changing display-table from a menu - strange behaviour

Changing display-table from a menu - strange behaviour

Post by Denis Kosyg » Sun, 01 Jun 1997 04:00:00

I am trying to write a menu which changes `buffer-display-table' in
the current buffer.  The buffer may be visible through several
windows.  I keep fighting with a problem in emacs-19.34 (GNU Emacs
19.34.1, sparc-sun-sunos4.1.4, X toolkit) whose origin I do not
completely understand. The piece of code below illustrates the

(setq test-table (make-display-table))
(aset test-table ?a [?b])

(defun test-b () "Display all \"a\" as \"b\" in the current buffer."
  (setq buffer-display-table test-table))
(defun test-a () "Restore the usual display conventions." (interactive)
  (setq buffer-display-table nil))

(define-key global-map [menu-bar test]
  (cons "Test" (make-sparse-keymap "Test")))
(define-key global-map [menu-bar test test-a] '("default". test-a))
(define-key global-map [menu-bar test test-b] '("\"a\" as \"b\"". test-b))

When I select the menu 'Test' with `tmm-menubar' and then choose the
entry '"a" as "b"' then all letters "a" in the current buffer are
displayed as "b".  However when I select the same entry using the
mouse, the display table is set to the right value but the buffer is
not redisplayed until I press some key on the keyboard (and what if
the buffer is read-only?). I'd like to have emacs redisplay the buffer
automatically whenever the buffer-display-table is changed.  It seems
from info pages (even though it is not obvious) that setting of
`buffer-display-table' must result in immediate redisplaying of the
buffer, or does one need `redraw-display'?  May be something is
missing in my function definitions?  The function `redraw-frame' does
not solve the problem since buffer may be displayed in several frames,
and `redraw-display' seems to be an overkill for my purposes.

Does anyone has a cure (or perhaps a reasonable explanation) for this?

                                        Many thanks, Denis Kosygin.


1. How to change display-table


I am editing dos-files in Emacs, but have some problems with
Swedish characters, though Windows95 and DOS has different
character set.

How do I change display-table, for showing Dos-character set in
Windows ?. Are there any dos-modes for this in the emacs
lisp-archive ?



2. Sharp PC3000 -> PC Connection.

3. Change display-table

4. Quantum trailblazer speed ??

5. strange behaviour of menu-bar-update-hook

6. is this possible??

7. emacs 19 display-table for IBMPC charset?

8. Strange spell check behaviour

9. genpage - strange behaviour

10. strange behavior of dired

11. Strange syntax-highlighting behaviour