[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti 997ae52 001/134: Initial
From: |
Stefan Monnier |
Subject: |
[elpa] externals/olivetti 997ae52 001/134: Initial |
Date: |
Thu, 25 Apr 2019 09:57:13 -0400 (EDT) |
branch: externals/olivetti
commit 997ae52da79ac9242b254a76c16fadc018e88167
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>
Initial
---
.gitignore | 1 +
olivetti.el | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c531d98
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.elc
diff --git a/olivetti.el b/olivetti.el
new file mode 100644
index 0000000..431cba3
--- /dev/null
+++ b/olivetti.el
@@ -0,0 +1,88 @@
+;;; olivetti.el --- Minor mode for a nice writing environment
+
+;; Copyright (C) 2014 Paul Rankin
+
+;; Author: Paul Rankin <address@hidden>
+;; Keywords: wp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(defgroup olivetti ()
+ "Minor mode for a nice writing environment"
+ :prefix "olivetti-"
+ :group 'wp
+ :group 'fountain
+ :group 'markdown)
+
+(defcustom olivetti-body-width 66
+ "Text body width in columns to which to adjust margin width.
+
+Does not affect file contents."
+ :type 'integer
+ :group 'olivetti)
+
+(defcustom olivetti-hide-mode-line t
+ "Hide the mode line."
+ :type 'boolean
+ :group 'olivetti)
+
+(defun olivetti-set-window-margins ()
+ "Set window-body-width to `olivetti-body-width' with relative margins."
+ (let ((margin
+ (/ (- (window-total-width) olivetti-body-width) 2)))
+ (set-window-margins (selected-window) margin margin)))
+
+;; (easy-menu-define olivetti-mode-menu olivetti-mode-map
+;; "Menu for Olivetti Mode."
+;; '("Olivetti"
+;; ["Use Clean Margins" ignore]
+;; ["Hide Mode Line" ignore
+;; :style toggle
+;; :selected olivetti-hide-mode-line]))
+
+;; (defvar olivetti-mode-map nil
+;; "Mode map for `olivetti-mode'.")
+
+;;;###autoload
+(defun turn-on-olivetti-mode ()
+ "Turn on `olivetti-mode' unconditionally."
+ (interactive)
+ (olivetti-mode 1))
+
+;;;###autoload
+(define-minor-mode olivetti-mode
+ ""
+ :init-value nil
+ :lighter " Olv"
+ (if olivetti-mode
+ (progn
+ (setq-local scroll-conservatively 101)
+ (when olivetti-hide-mode-line
+ (setq-local mode-line-format nil))
+ (add-hook 'window-configuration-change-hook
+ 'olivetti-set-window-margins nil t)
+ (run-hook-with-args 'window-configuration-change-hook))
+ (kill-local-variable 'mode-line-format)
+ (remove-hook 'window-configuration-change-hook
+ 'olivetti-set-window-margins t)
+ (set-window-margins nil nil)))
+
+(provide 'olivetti)
+;;; olivetti.el ends here
- [elpa] branch externals/olivetti created (now 46fdcfe), Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 01af0c7 003/134: Fixed doc, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 997ae52 001/134: Initial,
Stefan Monnier <=
- [elpa] externals/olivetti bd06cf1 004/134: Added mode-map and menu, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 6533514 002/134: Added a bunch of custom options, allow body-width float, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti fd3d39d 006/134: Removed extraneous vars and fns, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 158db93 005/134: Added set-mode-line, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti af1d719 010/134: Revert "Using run-window-configuration-change-hook fn", Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 5cfe277 020/134: Changed body-width standard-value to 80, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 514bc46 009/134: Using run-window-configuration-change-hook fn, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 2363de6 008/134: Fixed margin reset on exit, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 885fb20 019/134: Added minimum-body-width, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 06bf86f 016/134: Add hook when changing fonts, Stefan Monnier, 2019/04/25