From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrii Kolomoiets Subject: [PATCH] org-clock-out overrides frame-title-format [9.2.3 (9.2.3-17-g4df705-elpa @ ~/.emacs.d/elpa/org-20190513/)] Date: Fri, 17 May 2019 15:15:01 +0300 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRblT-0004xp-PX for emacs-orgmode@gnu.org; Fri, 17 May 2019 08:15:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRblS-0000hH-Kh for emacs-orgmode@gnu.org; Fri, 17 May 2019 08:15:07 -0400 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:47084) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hRblS-0000eM-AZ for emacs-orgmode@gnu.org; Fri, 17 May 2019 08:15:06 -0400 Received: by mail-lf1-x141.google.com with SMTP id l26so5123304lfh.13 for ; Fri, 17 May 2019 05:15:05 -0700 (PDT) Received: from [10.1.1.182] (188-42-207-82.ip.ukrtel.net. [82.207.42.188]) by smtp.gmail.com with ESMTPSA id i187sm1535509lfe.64.2019.05.17.05.15.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 05:15:02 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hello. The org-frame-title-format-backup variable is initialized on org-clock.el loading and future changes to frame-title-format is ignored: 1. emacs -Q 2. M-: frame-title-format It's "%b" 3. M-: (require 'org-clock) 4. (setq frame-title-format "%b bar") 5. C-x b test.org 6. M-x org-mode 7. Insert heading (M-RET foo) 8. M-x org-clock-in 9. M-x org-clock-out 10. M-: frame-title-format It's "%b" again =20 With provided patch org-frame-title-format-backup is initialized on org-clock-in. Also frame-title-format is restored to org-frame-title-format-backup only if current frame-title-format is equal to org-clock-frame-title-format in case frame title format is changed after org-clock-in. diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 9a8928a49..b07f4b221 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1359,6 +1359,7 @@ the default behavior." ;; add to frame title (when (or (eq org-clock-clocked-in-display 'frame-title) (eq org-clock-clocked-in-display 'both)) + (setq org-frame-title-format-backup frame-title-format) (setq frame-title-format org-clock-frame-title-format)) (org-clock-update-mode-line) (when org-clock-mode-line-timer @@ -1560,7 +1561,8 @@ to, overriding the existing value of = `org-clock-out-switch-to-state'." (when (not (org-clocking-p)) (setq global-mode-string (delq 'org-mode-line-string global-mode-string)) - (setq frame-title-format org-frame-title-format-backup) + (when (equal frame-title-format org-clock-frame-title-format) + (setq frame-title-format org-frame-title-format-backup)) (force-mode-line-update) (if fail-quietly (throw 'exit t) (user-error "No active clock"))) (let ((org-clock-out-switch-to-state @@ -1618,7 +1620,8 @@ to, overriding the existing value of = `org-clock-out-switch-to-state'." (setq org-clock-idle-timer nil)) (setq global-mode-string (delq 'org-mode-line-string global-mode-string)) - (setq frame-title-format org-frame-title-format-backup) + (when (equal frame-title-format org-clock-frame-title-format) + (setq frame-title-format org-frame-title-format-backup)) (when org-clock-out-switch-to-state (save-excursion (org-back-to-heading t) @@ -1718,7 +1721,8 @@ Optional argument N tells to change by that many = units." (when (not (org-clocking-p)) (setq global-mode-string (delq 'org-mode-line-string global-mode-string)) - (setq frame-title-format org-frame-title-format-backup) + (when (equal frame-title-format org-clock-frame-title-format) + (setq frame-title-format org-frame-title-format-backup)) (force-mode-line-update) (error "No active clock")) (save-excursion ; Do not replace this with `with-current-buffer'. @@ -1734,7 +1738,8 @@ Optional argument N tells to change by that many = units." (move-marker org-clock-hd-marker nil) (setq global-mode-string (delq 'org-mode-line-string global-mode-string)) - (setq frame-title-format org-frame-title-format-backup) + (when (equal frame-title-format org-clock-frame-title-format) + (setq frame-title-format org-frame-title-format-backup)) (force-mode-line-update) (message "Clock canceled") (run-hooks 'org-clock-cancel-hook))