emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/olivetti 4bec5f2 022/134: Added expand/shrink interacti


From: Stefan Monnier
Subject: [elpa] externals/olivetti 4bec5f2 022/134: Added expand/shrink interactive funs
Date: Thu, 25 Apr 2019 09:57:20 -0400 (EDT)

branch: externals/olivetti
commit 4bec5f243fe88703fe6c3f3d062afb1899c2033f
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>

    Added expand/shrink interactive funs
---
 olivetti.el | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/olivetti.el b/olivetti.el
index 5ebdda4..f80f0bc 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -182,7 +182,27 @@ Toggles the value of `olivetti-hide-mode-line' and runs
   (interactive)
   (olivetti-set-mode-line 'toggle))
 
-;; Mode Definition 
=============================================================
+(defun olivetti-expand (&optional arg)
+  "Incrementally increase the value of `olivetti-body-width'.
+If prefixed with ARG, incrementally decrease."
+  (interactive "P")
+  (let* ((p (if arg -1 1))
+         (n (cond ((integerp olivetti-body-width)
+                   (+ olivetti-body-width (* 2 p)))
+                  ((floatp olivetti-body-width)
+                   (+ olivetti-body-width (* 0.01 p))))))
+    (setq olivetti-body-width (olivetti-safe-width n)))
+  (olivetti-set-environment)
+  (message "Text body width set to %s" olivetti-body-width))
+
+(defun olivetti-shrink (&optional arg)
+  "incrementally decrease the value of `olivetti-body-width'.
+If prefixed with ARG, incrementally increase."
+  (interactive "P")
+  (let ((p (unless arg t)))
+    (olivetti-expand p)))
+
+;; Mode Definition =====================================================
 
 ;;;###autoload
 (defun turn-on-olivetti-mode ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]