diff options
-rw-r--r-- | view-conf.el | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/view-conf.el b/view-conf.el index 286fded..bed8495 100644 --- a/view-conf.el +++ b/view-conf.el @@ -328,30 +328,24 @@ If ARG is non-nil, do the same for Bluetooth." ;;; focus mode ;;;###autoload -(defvar durand-focus-p nil - "Whether we are focusing or not.") +(defvar durand-focus-map '(keymap "focus") + "The keymap for the focus mode.") -(make-variable-buffer-local 'durand-focus-p) +(define-key durand-focus-map (vector ?\s-v) #'view-mode) +(define-key durand-focus-map (vector ?\s-x) #'durand-focus) ;;;###autoload -(defun durand-focus (&optional arg) - "Focus. -This is a combination of `variable-pitch-mode', `olivetti-mode', -and `text-scale-increase'. - -If optional ARG is non-nil, then also enables `view-mode'." - (interactive "P") +(define-minor-mode durand-focus + "Focus mode." nil "Foc" nil (cond - (durand-focus-p - (setq durand-focus-p nil) - (setq olivetti-body-width 80) + (durand-focus + (setq olivetti-body-width 65) + (olivetti-mode 1) + (text-scale-increase 2) + (variable-pitch-mode 1)) + ((setq olivetti-body-width 80) (variable-pitch-mode -1) (view-mode -1) (olivetti-mode -1) - (text-scale-increase 0)) - ((setq olivetti-body-width 60) - (setq durand-focus-p t) - (olivetti-mode 1) - (text-scale-increase 2) - (variable-pitch-mode 1) - (cond (arg (view-mode 1)))))) + (text-scale-increase 0)))) + |