Skip to content

Commit

Permalink
Fix: (activities-tabs-mode) When re-enabled without being disabled
Browse files Browse the repository at this point in the history
Fixes #7.
  • Loading branch information
alphapapa committed Jan 31, 2024
1 parent 3114cf6 commit 693b4af
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ When option ~activities-bookmark-store~ is enabled, an Emacs bookmark is stored

** v0.3.1-pre

Nothing new yet.
*Fixes*
+ Handle case in which ~activities-tabs-mode~ is enabled again without having been disabled (which caused an error in ~tab-bar-mode~). ([[https://github.com/alphapapa/activities.el/issues/7][#7]])

** v0.3

Expand Down
16 changes: 12 additions & 4 deletions activities-tabs.el
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,21 @@ accordingly."
(advice-add #'activities-resume :before #'activities-tabs-before-resume)
(pcase-dolist (`(,symbol . ,function) override-map)
(advice-add symbol :override function))
(setf activities-tabs-tab-bar-tab-face-function-original tab-bar-tab-face-function
tab-bar-tab-face-function #'activities-tabs--tab-bar-tab-face-function))
;; The mode command could be called to activate the mode
;; when it already is, in which case we must not swap the
;; tab-face-function again, which would discard the actual,
;; original value. (IOW, this must be idempotent.)
;; TODO: A way to prevent modes' body forms from being
;; reevaluated when they are already active.
(unless activities-tabs-tab-bar-tab-face-function-original
(setf activities-tabs-tab-bar-tab-face-function-original tab-bar-tab-face-function
tab-bar-tab-face-function #'activities-tabs--tab-bar-tab-face-function)))
(advice-remove #'activities-resume #'activities-tabs-before-resume)
(pcase-dolist (`(,symbol . ,function) override-map)
(advice-remove symbol function))
(setf tab-bar-tab-face-function activities-tabs-tab-bar-tab-face-function-original
activities-tabs-tab-bar-tab-face-function-original nil))))
(when activities-tabs-tab-bar-tab-face-function-original
(setf tab-bar-tab-face-function activities-tabs-tab-bar-tab-face-function-original
activities-tabs-tab-bar-tab-face-function-original nil)))))

;;;; Functions

Expand Down
18 changes: 11 additions & 7 deletions activities.info
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,11 @@ File: README.info, Node: v031-pre, Next: v03, Up: Changelog
4.1 v0.3.1-pre
==============

Nothing new yet.
*Fixes*
• Handle case in which ‘activities-tabs-mode’ is enabled again
without having been disabled (which caused an error in
‘tab-bar-mode’). (#7
(https://github.com/alphapapa/activities.el/issues/7))


File: README.info, Node: v03, Next: v02, Prev: v031-pre, Up: Changelog
Expand Down Expand Up @@ -409,12 +413,12 @@ Node: Bookmarks8500
Node: FAQ8852
Node: Changelog11928
Node: v031-pre12135
Node: v0312250
Node: v0212644
Node: v01313136
Node: v01213285
Node: v01113462
Node: v0113625
Node: v0312464
Node: v0212858
Node: v01313350
Node: v01213499
Node: v01113676
Node: v0113839

End Tag Table

Expand Down

0 comments on commit 693b4af

Please sign in to comment.