unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to redraw the tool bar
@ 2014-12-25 14:48 Bostjan Vilfan
  2014-12-26 19:37 ` Michael Heerdegen
  2014-12-27  1:50 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Bostjan Vilfan @ 2014-12-25 14:48 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: bjvilfan

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

Hello,
I have the following problem with emacs: I like to employ tool bars in my work, and I add elements to them with tool-bar-add-item-from-menu or tool-bar-local-item. However, I notice that most of the time it takes some effort (multiple clicks) to make the changed tool bar appear. Is there any way I can force a redraw of the toolbar? Thanks in advance for an answer.
Regards,
bostjanv

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

* Re: how to redraw the tool bar
  2014-12-25 14:48 how to redraw the tool bar Bostjan Vilfan
@ 2014-12-26 19:37 ` Michael Heerdegen
  2014-12-27  1:50 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Heerdegen @ 2014-12-26 19:37 UTC (permalink / raw)
  To: help-gnu-emacs

Bostjan Vilfan <bostjanv@alum.mit.edu> writes:

> [...] Is there any way I can force a redraw of the toolbar? Thanks in
> advance for an answer.

I guess `redraw-frame' should do this.




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

* Re: how to redraw the tool bar
  2014-12-25 14:48 how to redraw the tool bar Bostjan Vilfan
  2014-12-26 19:37 ` Michael Heerdegen
@ 2014-12-27  1:50 ` Stefan Monnier
  2014-12-27 22:08   ` Bostjan Vilfan
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-12-27  1:50 UTC (permalink / raw)
  To: help-gnu-emacs

> I have the following problem with emacs: I like to employ tool bars in my
> work, and I add elements to them with tool-bar-add-item-from-menu or
> tool-bar-local-item. However, I notice that most of the time it takes some
> effort (multiple clicks) to make the changed tool bar appear. Is there any
> way I can force a redraw of the toolbar? Thanks in advance for an answer.

I think force-mode-line-update should do the trick,


        Stefan




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

* Re: how to redraw the tool bar
  2014-12-27  1:50 ` Stefan Monnier
@ 2014-12-27 22:08   ` Bostjan Vilfan
  2014-12-31 22:13     ` Michael Heerdegen
  0 siblings, 1 reply; 5+ messages in thread
From: Bostjan Vilfan @ 2014-12-27 22:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs Help

Hello,
Thanks for the replies. Unfortunately, neither of the two suggestions
works. Therefore, I'm going to include some more detail, and perhaps
somebody can point to what I am doing wrong

The problem arose when I tried to build a toolbar for tex-mode. So I
included the following line in my init file:

(add-hook 'tex-mode-hook 'bv-tex-mode)

where bv-tex-mode is the following function:

(defun bv-tex-mode ()
   "hook for building TeX tool bar"
   (interactive nil)
;; copy global tool-bar-map using copy-sequence
   (let ((temp (copy-sequence tool-bar-map)))
     (make-local-variable 'tool-bar-map)
     (setq tool-bar-map temp)
   )
   (define-key global-map [tool-bar bvdotex] 'tex-file)
   (tool-bar-local-item  "tex" 'tex-file 'bvdotex tool-bar-map
                    :help "Process file with default tex command")
   (define-key global-map [tool-bar bvpdfview] 'bv-pdf-view)
   (tool-bar-local-item  "pdf" 'bv-pdf-view 'bvpdfview tool-bar-map
 :help "view pdf file")
   (redraw-frame)
)

This version uses redraw-frame; but the result with force-mode-line-update
was the same. In effect, when I load a tex file I have to use several
clicks before the new icons appear.

Regards,
bostjanv

On Sat, Dec 27, 2014 at 2:50 AM, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > I have the following problem with emacs: I like to employ tool bars in my
> > work, and I add elements to them with tool-bar-add-item-from-menu or
> > tool-bar-local-item. However, I notice that most of the time it takes
> some
> > effort (multiple clicks) to make the changed tool bar appear. Is there
> any
> > way I can force a redraw of the toolbar? Thanks in advance for an answer.
>
> I think force-mode-line-update should do the trick,
>
>
>         Stefan
>
>
>


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

* Re: how to redraw the tool bar
  2014-12-27 22:08   ` Bostjan Vilfan
@ 2014-12-31 22:13     ` Michael Heerdegen
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Heerdegen @ 2014-12-31 22:13 UTC (permalink / raw)
  To: Bostjan Vilfan; +Cc: Emacs Help, Stefan Monnier

Bostjan Vilfan <bjvilfan@gmail.com> writes:

> This version uses redraw-frame; but the result with force-mode-line-update
> was the same. In effect, when I load a tex file I have to use several
> clicks before the new icons appear.

Indeed, this doesn't work for me too.

Here is a small example for emacs -Q:

(progn
  (define-key global-map [tool-bar bvdotex] 'tex-file)
  (tool-bar-local-item  "save" 'tex-file 'bvdotex tool-bar-map
                        :help "Process file with default tex command"))

Evaluate it, and you have to "do some things" until the item is displayed.
No way of redisplay helps to force the displaying of the button, and it
seems to appear after a random command.

I guess all the Emacs modes set up the toolbar before it is actually
displayed.  Doing it afterwards doesn't seem to work reliably.  I don't
see such a limitation being described in the manual, so Bostjan, please
M-x report-emacs-bug, preferably including a simple recipe as above.


Thanks,

Michael.



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

end of thread, other threads:[~2014-12-31 22:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-25 14:48 how to redraw the tool bar Bostjan Vilfan
2014-12-26 19:37 ` Michael Heerdegen
2014-12-27  1:50 ` Stefan Monnier
2014-12-27 22:08   ` Bostjan Vilfan
2014-12-31 22:13     ` Michael Heerdegen

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