emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: George Kettleborough <g.kettleborough@uea.ac.uk>
To: Matt Lundin <mdl@imapmail.org>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>,
	Mike McLean <mike.mclean@pobox.com>
Subject: Re: Org Clock Timer in Frame Title bug
Date: Sat, 28 Apr 2012 13:51:45 +0100	[thread overview]
Message-ID: <uw7wr509fz2.fsf@cmp-d-8k1gx2j.cmp.uea.ac.uk> (raw)
In-Reply-To: <87d37038b7.fsf@fastmail.fm> (Matt Lundin's message of "Sun, 22 Apr 2012 01:43:24 +0100")

On Sun, Apr 22 2012, Matt Lundin wrote:
> Mike McLean <mike.mclean@pobox.com> 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.

  parent reply	other threads:[~2012-04-28 12:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-21 23:45 Org Clock Timer in Frame Title bug Mike McLean
2012-04-22  0:43 ` Matt Lundin
2012-04-22  7:02   ` Bastien
2012-04-28 12:51   ` George Kettleborough [this message]
2012-04-29  9:37     ` Bastien
2012-04-30 13:47       ` George Kettleborough
2012-05-05 13:49         ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uw7wr509fz2.fsf@cmp-d-8k1gx2j.cmp.uea.ac.uk \
    --to=g.kettleborough@uea.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.org \
    --cc=mike.mclean@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).