bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#1754: 23.0.60; tool-bar is shown with tool-bar-mode off


From: martin rudalics
Subject: bug#1754: 23.0.60; tool-bar is shown with tool-bar-mode off
Date: Thu, 01 Jan 2009 16:24:35 +0100
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

> (tool-bar-mode -1)
[...]
>   (setq default-frame-alist
>         (append (list (cons 'tool-bar-lines 1))
>                 default-frame-alist))

Inherently, you're painting yourself into a corner by simultaneously
demanding and rejecting toolbars.  Moreover, that last assignment gets
you a second entry for `tool-bar-lines' in `default-frame-alist' (and we
have received _lots_ of mails from you complaining about such duplicate
entries before).  However, you do _not_ set `initial-frame-alist'
simultaneously, so you won't get a toolbar for the first frame which is
the correct behavior since you have toggled tool-bar-mode off before and
only that counts for the initial frame (unless you explicitly override
it).  Since `default-frame-alist' contains a tool-bar-lines entry you
will get a toolbar for future frames which is correct as well.

That said, the behavior of Emacs _is_ wrong because it should not say
that `tool-bar-mode' is on when there are no toolbars.  The reason is
that `tool-bar-mode' does

  (if tool-bar-mode
      (progn
        (dolist (frame (frame-list))
          (if (display-graphic-p frame)
              (set-frame-parameter frame 'tool-bar-lines 1)))
        (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
            (tool-bar-setup)))
    (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))

so you can easily see that for turning `tool-bar-mode' off, default and
initial frame parameters are set.  For turning it on, only the
parameters of the existing frames are set and _no_ default or initial
parameters.  Since the `display-graphic-p' test is not useful anyway, I
propose the attached patch.

Yours truly, martin.
*** tool-bar.el.~1.22.~ 2008-11-27 07:43:19.062500000 +0100
--- tool-bar.el 2009-01-01 16:20:25.968750000 +0100
***************
*** 54,62 ****
    :group 'frames
    (if tool-bar-mode
        (progn
!       (dolist (frame (frame-list))
!         (if (display-graphic-p frame)
!             (set-frame-parameter frame 'tool-bar-lines 1)))
        (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
            (tool-bar-setup)))
      (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))
--- 54,60 ----
    :group 'frames
    (if tool-bar-mode
        (progn
!       (modify-all-frames-parameters (list (cons 'tool-bar-lines 1)))
        (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
            (tool-bar-setup)))
      (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]