Skip to content

Commit

Permalink
Make another attempt to set the frame parameters and faces again
Browse files Browse the repository at this point in the history
This is still related to issue 13:
<#13>.
  • Loading branch information
protesilaos committed Apr 29, 2024
1 parent 11eee12 commit af8030e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions spacious-padding.el
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ parameter value."
(spacious-padding--define-get-frame-param "right-fringe-width" nil)
(spacious-padding--define-get-frame-param "scroll-bar-width" 8)

(defun spacious-padding-modify-frame-parameters (reset)
(defun spacious-padding-modify-frame-parameters (&optional reset)
"Modify all frame parameters to specify spacing.
With optional RESET argument as non-nil, restore the default
parameter values."
Expand All @@ -397,20 +397,27 @@ parameter values."
(spacious-padding--get-fringe-width reset)))
(scroll-bar-width . ,(spacious-padding--get-scroll-bar-width reset)))))

;;;###autoload
(defun spacious-padding-set-parameters-of-frame (frame)
"Set the layout parameters of FRAME and update the faces."
(with-selected-frame frame
(spacious-padding-modify-frame-parameters)
(spacious-padding-set-faces)))

(defun spacious-padding--enable-mode ()
"Enable `spacious-padding-mode'."
(spacious-padding--store-default-parameters)
(spacious-padding-modify-frame-parameters nil)
(add-hook 'after-make-frame-functions #'spacious-padding-set-invisible-dividers))
(spacious-padding-modify-frame-parameters)
(spacious-padding-set-faces)
(add-hook 'enable-theme-functions #'spacious-padding-set-faces)
(add-hook 'after-make-frame-functions #'spacious-padding-set-parameters-of-frame))

(defun spacious-padding--disable-mode ()
"Disable `spacious-padding-mode'."
(spacious-padding-modify-frame-parameters :reset)
(spacious-padding-unset-invisible-dividers)
(remove-hook 'after-make-frame-functions #'spacious-padding-set-invisible-dividers))
(remove-hook 'enable-theme-functions #'spacious-padding-set-faces)
(remove-hook 'after-make-frame-functions #'spacious-padding-set-parameters-of-frame))

;;;###autoload
(define-minor-mode spacious-padding-mode
Expand Down

0 comments on commit af8030e

Please sign in to comment.