roman / golden-ratio.el

Automatic resizing of Emacs windows to the golden ratio
MIT License
589 stars 38 forks source link

Asymmetry on defining-minor-mode #70

Closed FrancisMurillo closed 4 years ago

FrancisMurillo commented 8 years ago

I noticed a strange asymmetry on defining the mode

(define-minor-mode golden-ratio-mode
    "Enable automatic window resizing with golden ratio."
  :lighter " Golden"
  :global t
  (if golden-ratio-mode
      (progn
        (add-hook 'window-configuration-change-hook 'golden-ratio)
        (add-hook 'post-command-hook 'golden-ratio--post-command-hook)
        (add-hook 'mouse-leave-buffer-hook 'golden-ratio--mouse-leave-buffer-hook)
        (ad-activate 'other-window)
        (ad-activate 'pop-to-buffer))
      (remove-hook 'window-configuration-change-hook 'golden-ratio)
      (remove-hook 'post-command-hook 'golden-ratio--post-command-hook)
      (remove-hook 'mouse-leave-buffer-hook 'golden-ratio--mouse-leave-buffer-hook)
      (ad-deactivate 'other-window)
      (ad-deactivate 'pop-to-buffer)))

The first branch of the if statement has progn but the other does not but they look similar. Shouldn't they be wrapped around by a symmetrical progn too?

(define-minor-mode golden-ratio-mode
    "Enable automatic window resizing with golden ratio."
  :lighter " Golden"
  :global t
  (if golden-ratio-mode
      (progn
        (add-hook 'window-configuration-change-hook 'golden-ratio)
        (add-hook 'post-command-hook 'golden-ratio--post-command-hook)
        (add-hook 'mouse-leave-buffer-hook 'golden-ratio--mouse-leave-buffer-hook)
        (ad-activate 'other-window)
        (ad-activate 'pop-to-buffer))
      (progn ;; Progn here
        (remove-hook 'window-configuration-change-hook 'golden-ratio)
        (remove-hook 'post-command-hook 'golden-ratio--post-command-hook)
        (remove-hook 'mouse-leave-buffer-hook 'golden-ratio--mouse-leave-buffer-hook)
        (ad-deactivate 'other-window)
        (ad-deactivate 'pop-to-buffer))))

Not really as issue, just spotted it.