Re: [O] Org Clock Timer in Frame Title bug
Hi George, George Kettleborough writes: > On Sun, Apr 29 2012, Bastien wrote: >> `global-mode-string' and ̀frame-title-format' are list by default >> and they cannot be customized. They can be manually set to a string, >> but that's a mistake (okay, `global-mode-string' is a misleading name.) > > On my Fedora box, frame-title-format is by default: > > (multiple-frames "%b" >("" invocation-name "@" system-name)) > > This is the value even if --no-init-file is used so I don't think this > is distro-specific. Okay, I added a new option `org-clock-frame-title-format' for the `frame-title-format' string. This format string will /replace/ `frame-title-format' instead of just amending it. I don't find any way to safely set this var, as there is no equivalent of `global-mode-string' for the frame. Thanks, -- Bastien
Re: [O] Org Clock Timer in Frame Title bug
On Sun, Apr 29 2012, Bastien wrote: > `global-mode-string' and ̀frame-title-format' are list by default > and they cannot be customized. They can be manually set to a string, > but that's a mistake (okay, `global-mode-string' is a misleading name.) On my Fedora box, frame-title-format is by default: (multiple-frames "%b" ("" invocation-name "@" system-name)) This is the value even if --no-init-file is used so I don't think this is distro-specific. Since the first element in the list is a symbol, the behaviour is to treat it as a boolean which decides whether the second or third element is used. Anything appended to this list is just ignored. Is this what you mean by frame-title-format being a list by default? If so, it's the wrong type of list and we do need to ensure that it's of the correct form before we can append stuff to the end for display. global-mode-string, on the other hand, does seem to be of the right type by default: ("") Thanks, George.
Re: [O] Org Clock Timer in Frame Title bug
Hi George, George Kettleborough writes: > Checking (listp frame-title-format) ensures there will be no error when > calling delq, but it doesn't fix the feature. If the user's > frame-title-format is not a list then the feature will not work for no > apparent reason. The same thing goes for global-mode-string too, which > the current release of org-mode modifies. > > For the clock and timer display features to work as intended both of > these variables need to be lists with either a string or a list as the > first element. Note that simply being a list is not enough, it must > contain a string or list as first element. This format causes the > elements of the list to be treated as mode-line-formats recursively. `global-mode-string' and ̀frame-title-format' are list by default and they cannot be customized. They can be manually set to a string, but that's a mistake (okay, `global-mode-string' is a misleading name.) > The following in both org-clock.el and org-timer.el will ensure both > variables have the correct format to begin with: > > (unless (and (listp frame-title-format) > (or (stringp (first frame-title-format)) > (listp (first frame-title-format > (setq frame-title-format (list "" frame-title-format))) > > (unless (and (listp global-mode-string) > (or (stringp (first global-mode-string)) > (listp (first global-mode-string > (setq global-mode-string (list "" global-mode-string))) This can go into .emacs.el for those who set those two variables to a string... but they should not do it in the first place, right? > It might be better to do this just once in org.el or org-install.el, > since maybe other modules might want to put stuff in the mode-line or > frame-title. > > Of course the user or another mode might edit either of the variables to > something bad (like a symbol or string) afterwards. Maybe this should > be done every time before clock-in/timer-start or any time we wish to > append stuff to either of these lists? Org cannot fix all cases where the user is setting a variable to something that is non-standard. For this issue, it's already nice to not produce an error when the user set `global-mode-string' and `frame-title-format' to "" instead of (""). Or am I overlooking something? -- Bastien
Re: [O] Org Clock Timer in Frame Title bug
On Sun, Apr 22 2012, Matt Lundin wrote: > Mike McLean writes: > >> It appears that there is a small problem with commit >> 37fafb7b9e4e8e1eeb6b8faa76a1621c28970ef5 (Option for clock and timer to >> be displayed in frame-title). The default value offrame-title-format in >> my setup is t and this causes an error when clocking in/out. > > I can confirm this bug. The problem is that org-clock-out calls a delq > on frame-title-format regardless of the value of > org-clock-clocked-in-display. This is a problem because > frame-title-format can be either a list or a string. Note: the same > problem will occur when calling org-clock-in if the value of > frame-title-format is a string and if org-clock-clocked-in-display is > set to 'frame-title. Checking (listp frame-title-format) ensures there will be no error when calling delq, but it doesn't fix the feature. If the user's frame-title-format is not a list then the feature will not work for no apparent reason. The same thing goes for global-mode-string too, which the current release of org-mode modifies. For the clock and timer display features to work as intended both of these variables need to be lists with either a string or a list as the first element. Note that simply being a list is not enough, it must contain a string or list as first element. This format causes the elements of the list to be treated as mode-line-formats recursively. The following in both org-clock.el and org-timer.el will ensure both variables have the correct format to begin with: (unless (and (listp frame-title-format) (or (stringp (first frame-title-format)) (listp (first frame-title-format (setq frame-title-format (list "" frame-title-format))) (unless (and (listp global-mode-string) (or (stringp (first global-mode-string)) (listp (first global-mode-string (setq global-mode-string (list "" global-mode-string))) It might be better to do this just once in org.el or org-install.el, since maybe other modules might want to put stuff in the mode-line or frame-title. Of course the user or another mode might edit either of the variables to something bad (like a symbol or string) afterwards. Maybe this should be done every time before clock-in/timer-start or any time we wish to append stuff to either of these lists? Thanks, George.
Re: [O] Org Clock Timer in Frame Title bug
Fixed, thanks to Mike for reporting and to Matt for pointing at the detailed problem. -- Bastien
Re: [O] Org Clock Timer in Frame Title bug
Mike McLean writes: > It appears that there is a small problem with commit > 37fafb7b9e4e8e1eeb6b8faa76a1621c28970ef5 (Option for clock and timer to > be displayed in frame-title). The default value offrame-title-format in > my setup is t and this causes an error when clocking in/out. I can confirm this bug. The problem is that org-clock-out calls a delq on frame-title-format regardless of the value of org-clock-clocked-in-display. This is a problem because frame-title-format can be either a list or a string. Note: the same problem will occur when calling org-clock-in if the value of frame-title-format is a string and if org-clock-clocked-in-display is set to 'frame-title. Best, Matt