[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/olivetti 158db93 005/134: Added set-mode-line
From: |
Stefan Monnier |
Subject: |
[elpa] externals/olivetti 158db93 005/134: Added set-mode-line |
Date: |
Thu, 25 Apr 2019 09:57:14 -0400 (EDT) |
branch: externals/olivetti
commit 158db93bf15449ebbb65d6e6f00c9550b415e59c
Author: Paul Rankin <address@hidden>
Commit: Paul Rankin <address@hidden>
Added set-mode-line
---
olivetti.el | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/olivetti.el b/olivetti.el
index 1d832ee..1f6f306 100644
--- a/olivetti.el
+++ b/olivetti.el
@@ -31,6 +31,8 @@
:group 'fountain
:group 'markdown)
+;;; customizable variables =============================================
+
(defcustom olivetti-mode-hook
'(turn-on-visual-line-mode)
"Mode hook for `olivetti-mode', run after mode is turned on."
@@ -66,9 +68,10 @@ This option does not affect file contents."
:type 'boolean
:group 'olivetti)
-(defcustom olivetti-hide-mode-line t
+(defcustom olivetti-hide-mode-line nil
"Hide the mode line.
-Can cause display issues in console mode."
+Default is nil because this can cause display issues in console
+mode."
:type 'boolean
:group 'olivetti)
@@ -82,6 +85,21 @@ Can cause display issues in console mode."
:type 'boolean
:group 'olivetti)
+;;; functions ==========================================================
+
+(defun olivetti-set-mode-line (&optional arg)
+ (interactive)
+ (cond ((equal arg 'toggle)
+ (setq olivetti-hide-mode-line
+ (null olivetti-hide-mode-line))
+ (olivetti-set-mode-line))
+ ((or (equal arg 'exit)
+ (null olivetti-hide-mode-line))
+ (kill-local-variable 'mode-line-format))
+ (olivetti-hide-mode-line
+ (setq-local mode-line-format nil)))
+ (redraw-frame (selected-frame)))
+
(defun olivetti-set-environment ()
"Set text body width to `olivetti-body-width' with relative margins."
(let* ((n olivetti-body-width)
@@ -98,6 +116,8 @@ Can cause display issues in console mode."
(when olivetti-hide-fringes
(set-window-fringes (selected-window) 0 0 t)))
+;;; menu ===============================================================
+
(defvar olivetti-mode-map
(make-sparse-keymap)
"Mode map for `olivetti-mode'.")
@@ -111,10 +131,12 @@ Can cause display issues in console mode."
["Hide Tool Bar" ignore
:style toggle
:selected olivetti-hide-tool-bar]
- ["Hide Mode Line" ignore
+ ["Hide Mode Line" (olivetti-set-mode-line 'toggle)
:style toggle
:selected olivetti-hide-mode-line]))
+;; mode definition =====================================================
+
;;;###autoload
(defun turn-on-olivetti-mode ()
"Turn on `olivetti-mode' unconditionally."
@@ -134,19 +156,18 @@ hidden."
:lighter " Olv"
(if olivetti-mode
(progn
+ (olivetti-set-mode-line)
(setq-local scroll-conservatively 101)
(when olivetti-hide-menu-bar
(menu-bar-mode 0))
(when olivetti-hide-tool-bar
(tool-bar-mode 0))
- (when olivetti-hide-mode-line
- (setq-local mode-line-format nil))
(when olivetti-delete-selection
(delete-selection-mode 1))
(add-hook 'window-configuration-change-hook
'olivetti-set-environment nil t)
(run-hooks 'window-configuration-change-hook))
- (kill-local-variable 'mode-line-format)
+ (olivetti-set-mode-line 'exit)
(remove-hook 'window-configuration-change-hook
'olivetti-set-environment t)
(set-window-margins nil nil)))
- [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, 2019/04/25
- [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 <=
- [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
- [elpa] externals/olivetti 30e3cbe 014/134: Added README/Commentary, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 869221a 013/134: Removed delete-selection-mode, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti ea4a25f 011/134: Obsessive cleanliness, Stefan Monnier, 2019/04/25
- [elpa] externals/olivetti 554461c 012/134: Added toggle-hide-modeline, Stefan Monnier, 2019/04/25