diff options
Diffstat (limited to 'configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327')
6 files changed, 1087 insertions, 0 deletions
diff --git a/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/dir b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/dir new file mode 100644 index 000000000000..2de9818729f7 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/dir @@ -0,0 +1,19 @@ +This is the file .../info/dir, which contains the +topmost node of the Info hierarchy, called (dir)Top. +The first time you invoke Info you start off looking at this node. + +File: dir, Node: Top This is the top of the INFO tree + + This (the Directory node) gives a menu of major topics. + Typing "q" exits, "?" lists all Info commands, "d" returns here, + "h" gives a primer for first-timers, + "mEmacs<Return>" visits the Emacs manual, etc. + + In Emacs, you can click mouse button 2 on a menu item or cross reference + to select it. + +* Menu: + +Emacs +* Writeroom Mode: (writeroom-mode). + Distraction-free writing. diff --git a/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode-autoloads.el b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode-autoloads.el new file mode 100644 index 000000000000..882680e58180 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode-autoloads.el @@ -0,0 +1,49 @@ +;;; writeroom-mode-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +;;;### (autoloads nil "writeroom-mode" "writeroom-mode.el" (23377 +;;;;;; 61299 67614 851000)) +;;; Generated autoloads from writeroom-mode.el + +(autoload 'writeroom-mode "writeroom-mode" "\ +Minor mode for distraction-free writing. + +\(fn &optional ARG)" t nil) + +(defvar global-writeroom-mode nil "\ +Non-nil if Global Writeroom mode is enabled. +See the `global-writeroom-mode' command +for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-writeroom-mode'.") + +(custom-autoload 'global-writeroom-mode "writeroom-mode" nil) + +(autoload 'global-writeroom-mode "writeroom-mode" "\ +Toggle Writeroom mode in all buffers. +With prefix ARG, enable Global Writeroom mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Writeroom mode is enabled in all buffers where +`turn-on-writeroom-mode' would do it. +See `writeroom-mode' for more information on Writeroom mode. + +\(fn &optional ARG)" t nil) + +;;;*** + +;;;### (autoloads nil nil ("writeroom-mode-pkg.el") (23377 61299 +;;;;;; 73576 375000)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; writeroom-mode-autoloads.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode-pkg.el b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode-pkg.el new file mode 100644 index 000000000000..861e49ac6b5a --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode-pkg.el @@ -0,0 +1,8 @@ +(define-package "writeroom-mode" "20170623.327" "Minor mode for distraction-free writing" + '((emacs "24.1") + (visual-fill-column "1.9")) + :keywords + '("text")) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.el b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.el new file mode 100644 index 000000000000..777b37233ec2 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.el @@ -0,0 +1,468 @@ +;;; writeroom-mode.el --- Minor mode for distraction-free writing -*- lexical-binding: t -*- + +;; Copyright (c) 2012-2017 Joost Kremers + +;; Author: Joost Kremers <joostkremers@fastmail.fm> +;; Maintainer: Joost Kremers <joostkremers@fastmail.fm> +;; Created: 11 July 2012 +;; Package-Requires: ((emacs "24.1") (visual-fill-column "1.9")) +;; Version: 3.7 +;; Keywords: text + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; 3. The name of the author may not be used to endorse or promote products +;; derived from this software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +;; OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +;; IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +;; INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE, +;; DATA, OR PROFITS ; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +;; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: + +;; writeroom-mode is a minor mode for Emacs that implements a +;; distraction-free writing mode similar to the famous Writeroom editor for +;; OS X. writeroom-mode is meant for GNU Emacs 24 and isn't tested on older +;; versions. +;; +;; See the README or info manual for usage instructions. +;; +;;; Code: + +(require 'visual-fill-column) + +(defvar writeroom--frame nil + "The frame in which `writeroom-mode' is activated. +The global effects only apply to this frame.") + +(defvar writeroom--buffers nil + "List of buffers in which `writeroom-mode' is activated.") + +(defvar writeroom--local-variables '(mode-line-format + header-line-format + line-spacing) + "Local variables whose values need to be saved when `writeroom-mode' is activated.") + +(defvar writeroom--saved-data nil + "Buffer-local data to be stored when `writeroom-mode' is activated. +These settings are restored when `writeroom-mode' is +deactivated.") +(make-variable-buffer-local 'writeroom--saved-data) + +(defvar writeroom--saved-visual-fill-column nil + "Status of `visual-fill-column-mode' before activating `writeroom-mode'.") +(make-variable-buffer-local 'writeroom--saved-visual-fill-column) + +(defvar writeroom--saved-window-config nil + "Window configuration active before `writeroom-mode' is activated.") + +(defgroup writeroom nil "Minor mode for distraction-free writing." + :group 'wp + :prefix "writeroom-") + +(defcustom writeroom-width 80 + "Width of the writeroom writing area. +This can be specified as an absolute width (the number of +characters in a line), or as a fraction of the total window +width, in the latter it should be a number between 0 and 1." + :group 'writeroom + :type '(choice (integer :tag "Absolute width:") + (float :tag "Relative width:" :value 0.5))) + +(defcustom writeroom-mode-line nil + "The mode line format to use with `writeroom-mode'. +By default, this option is set to nil, which disables the mode +line when `writeroom-mode' is activated. By setting this option +to t, the standard mode line is retained. Alternatively, it is +possible to specify a special mode line for `writeroom-mode' +buffers. If this option is chosen, the default is to only show +the buffer's modification status and the buffer name, but the +format can be customized. See the documentation for the variable +`mode-line-format' for further information. Note that if you set +this option, it may be more visually pleasing to set +`writeroom-bottom-divider-width' to 0." + :group 'writeroom + :type '(choice (const :tag "Disable the mode line" nil) + (const :tag "Use default mode line" t) + (sexp :tag "Customize mode line" + :value (" " mode-line-modified " " mode-line-buffer-identification)))) + +(defcustom writeroom-mode-line-toggle-position 'header-line-format + "Position to temporarily show the mode line. +When the mode line is disabled, the function +`writeroom-toggle-mode-line' makes the mode line visible. This +option determines whether it is shown as the mode line or as the +header line." + :group 'writeroom + :type '(choice (const :tag "Use the mode line" 'mode-line-format) + (const :tag "Use the header line" 'header-line-format))) + +(defcustom writeroom-bottom-divider-width 1 + "Width of the bottom window divider in pixels." + :group 'writeroom + :type '(integer :tag "Width")) + +(make-obsolete-variable 'writeroom-disable-fringe + "The variable `writeroom-disable-fringe' is no longer used." + "`writeroom-mode' version 2.9") + +(defcustom writeroom-maximize-window t + "Whether to maximize the current window in its frame. +When set to t, `writeroom-mode' deletes all other windows in +the current frame." + :group 'writeroom + :type '(choice (const :tag "Maximize window" t) + (const :tag "Do not maximize window" nil))) + +(defcustom writeroom-fullscreen-effect 'fullboth + "Effect applied when enabling fullscreen. +The value can be `fullboth', in which case fullscreen is +activated, or `maximized', in which case the relevant frame is +maximized but window decorations are still available." + :group 'writeroom + :type '(choice (const :tag "Fullscreen" fullboth) + (const :tag "Maximized" maximized))) + +(defcustom writeroom-border-width 30 + "Width in pixels of the border. +To use this option, select the option \"Add border\" in `Global +Effects'. This adds a border around the text area." + :group 'writeroom + :type '(integer :tag "Border width")) + +(defcustom writeroom-fringes-outside-margins t + "If set, place the fringes outside the margins." + :group 'writeroom + :type '(choice (const :tag "Place fringes outside margins" t) + (const :tag "Place fringes inside margins" nil))) + +(defcustom writeroom-major-modes '(text-mode) + "List of major modes in which writeroom-mode is activated. +The command `global-writeroom-mode' activates `writeroom-mode' in +every buffer that has one of the major modes listed in this +option. Modes can be specified as symbols or as regular +expressions. If a buffer has one of the specified major modes or +if its major mode name matches one of the regular expressions, +`writeroom-mode' is activated." + :group 'writeroom + :type '(repeat (choice (symbol :tag "Major mode") + (string :tag "Regular expression")))) + +(defcustom writeroom-use-derived-modes t + "Activate `writeroom-mode' in derived modes as well.'. +If this option is set, the command `global-writeroom-mode' +activates `writeroom-mode' in modes that are derived from those +listed in `writeroom-major-modes'. Note that this option applies +only to symbols in `writeroom-major-modes'. Regular expressions +are ignored." + :group 'writeroom + :type '(choice (const :tag "Use derived modes" t) + (const :tag "Do not use derived modes" nil))) + +(defcustom writeroom-major-modes-exceptions nil + "List of major modes in which `writeroom-mode' should not be activated. +This option lists exceptions to `writeroom-major-modes'. Modes +can be specified as symbols or as regular expressions." + :group 'writeroom + :type '(repeat (choice (symbol :tag "Major mode exception") + (string :tag "Regular expression")))) + +(defcustom writeroom-restore-window-config nil + "If set, restore window configuration after disabling `writeroom-mode'. +Setting this option makes sense primarily if `writeroom-mode' is +used in one buffer only. The window configuration that is stored +is the one that exists when `writeroom-mode' is first called, and +it is restored when `writeroom-mode' is deactivated in the last +buffer." + :group 'writeroom + :type '(choice (const :tag "Do not restore window configuration" nil) + (const :tag "Restore window configuration" t))) + +(defcustom writeroom-extra-line-spacing nil + "Additional line spacing for `writeroom-mode`." + :group 'writeroom + :type '(choice (const :tag "Do not add extra line spacing" :value nil) + (integer :tag "Absolute height" :value 5) + (float :tag "Relative height" :value 0.8))) + +(defcustom writeroom-global-effects '(writeroom-set-fullscreen + writeroom-set-alpha + writeroom-set-menu-bar-lines + writeroom-set-tool-bar-lines + writeroom-set-vertical-scroll-bars + writeroom-set-bottom-divider-width) + "List of global effects for `writeroom-mode'. +These effects are enabled when `writeroom-mode' is activated in +the first buffer and disabled when it is deactivated in the last +buffer." + :group 'writeroom + :type '(set (const :tag "Fullscreen" writeroom-set-fullscreen) + (const :tag "Disable transparency" writeroom-set-alpha) + (const :tag "Disable menu bar" writeroom-set-menu-bar-lines) + (const :tag "Disable tool bar" writeroom-set-tool-bar-lines) + (const :tag "Disable scroll bar" writeroom-set-vertical-scroll-bars) + (const :tag "Enable bottom window divider" writeroom-set-bottom-divider-width) + (const :tag "Add border" writeroom-set-internal-border-width) + (const :tag "Display frame on all workspaces" writeroom-set-sticky) + (repeat :inline t :tag "Custom effects" function))) + +(define-obsolete-variable-alias 'writeroom-global-functions 'writeroom-global-effects "`writeroom-mode' version 2.0") + +(defmacro define-writeroom-global-effect (fp value) + "Define a global effect for `writeroom-mode'. +The effect is activated by setting frame parameter FP to VALUE. +FP should be an unquoted symbol, the name of a frame parameter; +VALUE must be quoted (unless it is a string or a number, of +course). It can also be an unquoted symbol, in which case it +should be the name of a global variable whose value is then +assigned to FP. + +This macro defines a function `writeroom-set-<FP>' that takes one +argument and activates the effect if this argument is 1 and +deactivates it if it is -1. When the effect is activated, the +original value of frame parameter FP is stored in a frame +parameter `writeroom-<FP>', so that it can be restored when the +effect is deactivated." + (declare (indent defun)) + (let ((wfp (intern (format "writeroom-%s" fp)))) + `(fset (quote ,(intern (format "writeroom-set-%s" fp))) + (lambda (&optional arg) + (when (frame-live-p writeroom--frame) + (cond + ((= arg 1) ; activate + (set-frame-parameter writeroom--frame (quote ,wfp) (frame-parameter writeroom--frame (quote ,fp))) + (set-frame-parameter writeroom--frame (quote ,fp) ,value)) + ((= arg -1) ; deactivate + (set-frame-parameter writeroom--frame (quote ,fp) (frame-parameter writeroom--frame (quote ,wfp))) + (set-frame-parameter writeroom--frame (quote ,wfp) nil)))))))) + +(define-writeroom-global-effect fullscreen writeroom-fullscreen-effect) +(define-writeroom-global-effect alpha '(100 100)) +(define-writeroom-global-effect vertical-scroll-bars nil) +(define-writeroom-global-effect menu-bar-lines 0) +(define-writeroom-global-effect tool-bar-lines 0) +(define-writeroom-global-effect internal-border-width writeroom-border-width) +(define-writeroom-global-effect sticky t) +(define-writeroom-global-effect bottom-divider-width writeroom-bottom-divider-width) + +(defun turn-on-writeroom-mode () + "Turn on `writeroom-mode'. +This function activates `writeroom-mode' in a buffer if that +buffer's major mode matchs against one of `writeroom-major-modes'." + (unless (writeroom--match-major-mode writeroom-major-modes-exceptions) + (if (writeroom--match-major-mode writeroom-major-modes writeroom-use-derived-modes) + (writeroom-mode 1)))) + +(defun writeroom--match-major-mode (modes &optional derived) + "Match the current buffer's major mode against MODES. +MODES a list of mode names (symbols) or regular expressions. +Return t if the current major mode matches one of the elements of +MODES, nil otherwise. Comparison is done with `eq` (for symbols +in MODES) or with `string-match-p' (for strings in MODES). That +is, if the major mode is e.g., `emacs-lisp-mode', it will not +match the symbol `lisp-mode', but it will match the string +\"lisp-mode\". + +If DERIVED is non-nil, also return t if the current buffer's +major mode is a derived mode of one of the major mode symbols in +MODES." + (catch 'match + (dolist (elem modes) + (if (cond ((symbolp elem) + (or (eq elem major-mode) + (and derived (derived-mode-p elem)))) + ((string-match-p elem (symbol-name major-mode)))) + (throw 'match t))))) + +(defvar writeroom-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "s-?") #'writeroom-toggle-mode-line) + map) + "Keymap for writeroom-mode.") + +;;;###autoload +(define-minor-mode writeroom-mode + "Minor mode for distraction-free writing." + :init-value nil :lighter nil :global nil + (if writeroom-mode + (writeroom--enable) + (writeroom--disable))) + +;;;###autoload +(define-globalized-minor-mode global-writeroom-mode writeroom-mode turn-on-writeroom-mode + :require 'writeroom-mode + :group 'writeroom) + +(defun writeroom--kill-buffer-function () + "Disable `writeroom-mode' before killing a buffer, if necessary. +This function is for use in `kill-buffer-hook'. It checks whether +`writeroom-mode' is enabled in the buffer to be killed and +adjusts `writeroom--buffers' and the global effects accordingly." + (when writeroom-mode + (setq writeroom--buffers (delq (current-buffer) writeroom--buffers)) + (when (not writeroom--buffers) + (writeroom--set-global-effects -1) + (setq writeroom--frame nil)))) + +(add-hook 'kill-buffer-hook #'writeroom--kill-buffer-function) + +(defun writeroom--set-global-effects (arg) + "Activate or deactivate global effects. +The effects are activated if ARG is 1, deactivated if it is -1." + (mapc (lambda (fn) + (funcall fn arg)) + writeroom-global-effects)) + +(defun writeroom--calculate-width () + "Calculate the width of the writing area." + (if (floatp writeroom-width) + (truncate (* (window-total-width) writeroom-width)) + writeroom-width)) + +(defvar writeroom--mode-line-showing nil + "Flag indicating whether the original mode line is displayed.") +(make-variable-buffer-local 'writeroom--mode-line-showing) + +(defvar writeroom--orig-header-line nil + "Original format of the header line. +When the header line is used to temporarily display the mode +line, its original format is saved here.") +(make-variable-buffer-local 'writeroom--orig-header-line) + +(defun writeroom-toggle-mode-line () + "Toggle display of the original mode." + (interactive) + (unless (eq writeroom-mode-line t) ; This means the original mode-line is displayed already. + (cond + ((not writeroom--mode-line-showing) + (setq writeroom--orig-header-line header-line-format) + (set writeroom-mode-line-toggle-position (or (cdr (assq 'mode-line-format writeroom--saved-data)) + (default-value 'mode-line-format))) + (setq writeroom--mode-line-showing t)) + (writeroom--mode-line-showing + (if (eq writeroom-mode-line-toggle-position 'header-line-format) + (setq header-line-format writeroom--orig-header-line) + (setq mode-line-format writeroom-mode-line)) + (setq writeroom--mode-line-showing nil))) + (force-mode-line-update))) + +(defun writeroom-adjust-width (amount) + "Adjust the width of the writing area on the fly by AMOUNT. +A numeric prefix argument can be used to specify the adjustment. +When called without a prefix, this will reset the width to the default value." + (interactive "P") + (if amount + (setq visual-fill-column-width (max 1 (+ visual-fill-column-width amount))) + (setq visual-fill-column-width (writeroom--calculate-width))) + (visual-fill-column--adjust-window) + (message "Writing area is now %d characters wide" visual-fill-column-width)) + +(defun writeroom-increase-width () + "Increase the width of the writing area by 2 characters." + (interactive) + (writeroom-adjust-width 2)) + +(defun writeroom-decrease-width () + "Decrease the width of the writing area by 2 characters." + (interactive) + (writeroom-adjust-width -2)) + +(defun writeroom--enable () + "Set up writeroom-mode for the current buffer. +Also run the functions in `writeroom-global-effects' if the +current buffer is the first buffer in which `writeroom-mode' is +activated." + ;; save buffer-local variables, if they have a buffer-local binding + (setq writeroom--saved-data (mapcar (lambda (sym) + (if (local-variable-p sym) + (cons sym (buffer-local-value sym (current-buffer))) + sym)) + writeroom--local-variables)) + (setq writeroom--saved-visual-fill-column visual-fill-column-mode) + + ;; activate global effects + (when (not writeroom--buffers) + (setq writeroom--frame (selected-frame)) + (writeroom--set-global-effects 1) + (if writeroom-restore-window-config + (setq writeroom--saved-window-config (current-window-configuration)))) + + (push (current-buffer) writeroom--buffers) + + (when writeroom-maximize-window + (delete-other-windows)) + + (when writeroom-extra-line-spacing + (setq line-spacing writeroom-extra-line-spacing)) + + (unless (eq writeroom-mode-line t) ; if t, use standard mode line + (setq mode-line-format writeroom-mode-line)) + + (setq visual-fill-column-width (writeroom--calculate-width) + visual-fill-column-center-text t + visual-fill-column-fringes-outside-margins writeroom-fringes-outside-margins) + (visual-fill-column-mode 1) + + ;; if the current buffer is displayed in some window, the windows' + ;; margins and fringes must be adjusted. + (mapc (lambda (w) + (with-selected-window w + (visual-fill-column--adjust-window))) + (get-buffer-window-list (current-buffer) nil))) + +(defun writeroom--disable () + "Reset the current buffer to its normal appearance. +Also run the functions in `writeroom-global-effects' to undo +their effects if `writeroom-mode' is deactivated in the last +buffer in which it was active." + ;; disable visual-fill-column-mode + (visual-fill-column-mode -1) + (kill-local-variable 'visual-fill-column-width) + (kill-local-variable 'visual-fill-column-center-text) + (kill-local-variable 'visual-fill-column-fringes-outside-margins) + + ;; restore global effects if necessary + (setq writeroom--buffers (delq (current-buffer) writeroom--buffers)) + (when (not writeroom--buffers) + (writeroom--set-global-effects -1) + (setq writeroom--frame nil) + (if writeroom-restore-window-config + (set-window-configuration writeroom--saved-window-config))) + + ;; restore local variables + (mapc (lambda (val) + (if (symbolp val) + (kill-local-variable val) + (set (car val) (cdr val)))) + writeroom--saved-data) + + ;; if the current buffer is displayed in some window, the windows' + ;; margins and fringes must be adjusted. + (mapc (lambda (w) + (with-selected-window w + (set-window-margins (selected-window) 0 0) + (set-window-fringes (selected-window) nil))) + (get-buffer-window-list (current-buffer) nil)) + + ;; reenable `visual-fill-colummn-mode' with original settings if it was + ;; active before activating `writeroom-mode'. + (if writeroom--saved-visual-fill-column + (visual-fill-column-mode 1))) + +(provide 'writeroom-mode) + +;;; writeroom-mode.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.elc b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.elc new file mode 100644 index 000000000000..ea68c32bd5ae --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.elc Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.info b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.info new file mode 100644 index 000000000000..56947bd9bdc4 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/writeroom-mode-20170623.327/writeroom-mode.info @@ -0,0 +1,543 @@ +This is writeroom-mode.info, produced by makeinfo version 6.1 from +writeroom-mode.texi. + +INFO-DIR-SECTION Emacs +START-INFO-DIR-ENTRY +* Writeroom Mode: (writeroom-mode). Distraction-free writing. +END-INFO-DIR-ENTRY + + +File: writeroom-mode.info, Node: Top, Next: Writeroom-mode, Up: (dir) + +Top +*** + +* Menu: + +* Writeroom-mode:: + + +File: writeroom-mode.info, Node: Writeroom-mode, Prev: Top, Up: Top + +1 Writeroom-mode +**************** + +‘writeroom-mode’ is a minor mode for Emacs that implements a +distraction-free writing mode similar to the famous Writeroom editor for +OS X. ‘writeroom-mode’ is meant for GNU Emacs 24, lower versions are not +actively supported. +* Menu: + +* Installation:: +* Usage:: +* Multiple writeroom-mode buffers:: +* Frame effects:: +* Customisation:: +* Changing the width interactively:: +* Text size adjustments:: +* Displaying the mode line:: +* Adding global effects:: +* Other similar modes:: + + +File: writeroom-mode.info, Node: Installation, Next: Usage, Up: Writeroom-mode + +1.1 Installation +================ + +‘writeroom-mode’ can be installed through the package manager from Melpa +(http://melpa.org/). If installing manually, make sure to also install +its dependency ‘visual-fill-column’ +(https://github.com/joostkremers/visual-fill-column). + + +File: writeroom-mode.info, Node: Usage, Next: Multiple writeroom-mode buffers, Prev: Installation, Up: Writeroom-mode + +1.2 Usage +========= + +‘writeroom-mode’ can be activated in a buffer by calling ‘M-x +writeroom-mode RET’. By default, ‘writeroom-mode’ does the following +things: + + • activate fullscreen + • disable transparency + • disable the menu bar + • disable the tool bar + • disable the scroll bar + • enable a bottom window divider of 1 pixel + • maximise the current window (i.e., delete all other windows in the + frame) + • place the fringes outside the margins + • disable the mode line + • add window margins to the current buffer so that the text is 80 + characters wide + +The last three effects are buffer-local. The other effects apply to the +current frame. Because ‘writeroom-mode’ is a minor mode, this isn’t +entirely on the up and up, since minor modes aren’t supposed to have +such global effects. But ‘writeroom-mode’ is meant for distraction-free +writing, so these effects do make sense. + +All these effects can be disabled or customised. In addition, there are +several more options that are disabled by default but can be enabled in +the customisation buffer. + + +File: writeroom-mode.info, Node: Multiple writeroom-mode buffers, Next: Frame effects, Prev: Usage, Up: Writeroom-mode + +1.3 Multiple writeroom-mode buffers +=================================== + +It is possible to activate ‘writeroom-mode’ in more than one buffer. +The global effects are of course activated only once and they remain +active until ‘writeroom-mode’ is deactivated in _all_ buffers. +Alternatively, if you wish to use ‘writeroom-mode’ in all buffers that +have a particular major mode (e.g., ‘text-mode’, ‘markdown-mode’), you +can use the global minor mode ‘global-writeroom-mode’. This function +enables the global effects and activates the buffer-local effects in all +(current and future) buffers that have a major mode listed in the user +option ‘writeroom-major-modes’ (by default only ‘text-mode’). + +When ‘global-writeroom-mode’ is active, the function ‘writeroom-mode’ +can still be called to enable or disable ‘writeroom-mode’ in individual +buffers (regardless of their major mode, of course). Calling +‘global-writeroom-mode’ again disables ‘writeroom-mode’ in all buffers +in which it is active, also those in which it was activated manually. + + +File: writeroom-mode.info, Node: Frame effects, Next: Customisation, Prev: Multiple writeroom-mode buffers, Up: Writeroom-mode + +1.4 Frame effects +================= + +Most of the global effects that ‘writeroom-mode’ enables are handled by +setting specific frame parameters. This means that they apply to the +current frame. If you switch to another frame and display a +‘writeroom-mode’ buffer, only the buffer-local effects will be visible. + +‘writeroom-mode’ tries to make sure that it only affects one frame, and +that it restores that particular frame when it is deactivated in the +last buffer. This means it should be safe to activate ‘writeroom-mode’ +in one frame and deactivate it in another. Killing the ‘writeroom-mode’ +frame should also be safe. + +The affected frame is always restored to its original state, before +‘writeroom-mode’ was activated, even if you change any of the frame +parameters manually while ‘writeroom-mode’ is active. + + +File: writeroom-mode.info, Node: Customisation, Next: Changing the width interactively, Prev: Frame effects, Up: Writeroom-mode + +1.5 Customisation +================= + +* Menu: + +* Global Writeroom Mode:: +* Border Width:: +* Extra Line Spacing:: +* Fringes Outside Margins:: +* Fullscreen Effect:: +* Bottom Divider Width:: +* Global Effects:: +* Major Modes:: +* Use Derived Modes:: +* Major Modes Exceptions:: +* Maximize Window:: +* Mode Line:: +* Mode Line Toggle Position:: +* Restore Window Config:: +* Width:: + + +File: writeroom-mode.info, Node: Global Writeroom Mode, Next: Border Width, Up: Customisation + +1.5.1 Global Writeroom Mode +--------------------------- + +Activate this option to automatically turn on ‘writeroom-mode’ in any +buffer that has one of the major modes matched any mask listed in +‘writeroom-major-modes’ and not in ‘writeroom-major-modes’. + + +File: writeroom-mode.info, Node: Border Width, Next: Extra Line Spacing, Prev: Global Writeroom Mode, Up: Customisation + +1.5.2 Border Width +------------------ + +Width of the border around the text area. Disabled by default, see +‘writeroom-global-effects’ to enable the border. + + +File: writeroom-mode.info, Node: Extra Line Spacing, Next: Fringes Outside Margins, Prev: Border Width, Up: Customisation + +1.5.3 Extra Line Spacing +------------------------ + +Increase the line spacing. Can be an absolute value (the number of +pixels to add to the line) or a number relative to the default line +height. Disabled by default. + + +File: writeroom-mode.info, Node: Fringes Outside Margins, Next: Fullscreen Effect, Prev: Extra Line Spacing, Up: Customisation + +1.5.4 Fringes Outside Margins +----------------------------- + +If set, place the fringes outside the margins. ‘writeroom-mode’ expands +the window margins, causing the fringes to be pushed inside, which may +be visually distracting. This option keeps the fringes at the window’s +edges. Unset it if you prefer to have the fringes close to the text. + + +File: writeroom-mode.info, Node: Fullscreen Effect, Next: Bottom Divider Width, Prev: Fringes Outside Margins, Up: Customisation + +1.5.5 Fullscreen Effect +----------------------- + +Effect to apply when ‘writeroom-mode’ activates fullscreen. Can be +‘fullboth’, which uses the entire screen (i.e., window decorations are +disabled and the window manager’s panel or task bar is covered by the +Emacs frame) or ‘maximized’, in which case the Emacs frame is maximised +but keeps its window decorations and does not cover the panel. + + +File: writeroom-mode.info, Node: Bottom Divider Width, Next: Global Effects, Prev: Fullscreen Effect, Up: Customisation + +1.5.6 Bottom Divider Width +-------------------------- + +Width in pixels of the bottom window divider. Default value is 1. The +bottom window divider helps in distinguishing the minibuffer from the +text area, and also in distinguishing two windows split top-to-bottom. + + +File: writeroom-mode.info, Node: Global Effects, Next: Major Modes, Prev: Bottom Divider Width, Up: Customisation + +1.5.7 Global Effects +-------------------- + +List of global effects: + + • fullscreen + • transparency + • scroll bar + • menu bar + • tool bar + • bottom window divider + • border (add a border around the text area; disabled by default) + • sticky (display the window on all virtual workspaces; disabled by + default) + +Each option can be enabled or disabled individually. + + +File: writeroom-mode.info, Node: Major Modes, Next: Use Derived Modes, Prev: Global Effects, Up: Customisation + +1.5.8 Major Modes +----------------- + +List of major modes in which ‘writeroom-mode’ should be activated +automatically. Use in conjunction with ‘global-writeroom-mode’. + +The elements in this list can be major-mode symbols, or regular +expressions (in which case they must of course be strings). + + +File: writeroom-mode.info, Node: Use Derived Modes, Next: Major Modes Exceptions, Prev: Major Modes, Up: Customisation + +1.5.9 Use Derived Modes +----------------------- + +If this option is set, ‘global-writeroom-mode’ also activates +‘writeroom-mode’ in buffers whose major mode is a derived mode of one of +the modes in ‘writeroom-major-modes’. (Only the major mode symbols in +‘writeroom-major-modes’ are relevant.) + + +File: writeroom-mode.info, Node: Major Modes Exceptions, Next: Maximize Window, Prev: Use Derived Modes, Up: Customisation + +1.5.10 Major Modes Exceptions +----------------------------- + +List of major modes in which ‘writeroom-mode’ should not be activated by +‘global-writeroom-mode’. (It is still possible to activate +‘writeroom-mode’ manually). This can also be a mixed list of major-mode +symbols and regular expressions. + + +File: writeroom-mode.info, Node: Maximize Window, Next: Mode Line, Prev: Major Modes Exceptions, Up: Customisation + +1.5.11 Maximize Window +---------------------- + +Maximise the current window in its frame, i.e., delete all other +windows. + + +File: writeroom-mode.info, Node: Mode Line, Next: Mode Line Toggle Position, Prev: Maximize Window, Up: Customisation + +1.5.12 Mode Line +---------------- + +The mode line format to use. This option can be ‘nil’, which disables +the mode line altogether (which is the default), it can be ‘t’, which +retains the mode line, or it can be set to a customised format to only +show some information. If the latter option is chosen, the mode line +shows only the file name and the file modification status, but the +format can be customised. See the documentation for the variable +‘mode-line-format’ for details. If you set this option, it may be more +visually pleasing to set the option Bottom Divider Width to 0. + + +File: writeroom-mode.info, Node: Mode Line Toggle Position, Next: Restore Window Config, Prev: Mode Line, Up: Customisation + +1.5.13 Mode Line Toggle Position +-------------------------------- + +If you disable or customise the mode line, you may sometimes want to see +the entire mode line. ‘writeroom-mode’ provides the function +‘writeroom-toggle-mode-line’ (see below) to do this. You can specify +where you want to make the mode line visible when using this function: +in the mode line itself, or in the header line. + +Note that the default value of this option is to display the mode line +in the header line, because for some reason that is more reliable. +(Toggling the mode line multiple times in a row does not always work +very well.) + + +File: writeroom-mode.info, Node: Restore Window Config, Next: Width, Prev: Mode Line Toggle Position, Up: Customisation + +1.5.14 Restore Window Config +---------------------------- + +Restore the window configuration that existed before ‘writeroom-mode’ +was activated. This is primarily useful if you use ‘writeroom-mode’ in +only a single buffer, since the window configuration that is restored is +the one that existed at the moment when ‘writeroom-mode’ is called for +the first time. Disabled by default. + + +File: writeroom-mode.info, Node: Width, Prev: Restore Window Config, Up: Customisation + +1.5.15 Width +------------ + +Width of the text area. Can be specified as an absolute value (number +of characters) or as a fraction of the total window width (in which case +it should be a number between 0 and 1). + + +File: writeroom-mode.info, Node: Changing the width interactively, Next: Text size adjustments, Prev: Customisation, Up: Writeroom-mode + +1.6 Changing the width interactively +==================================== + +The width of the text area in the current buffer can be changed +interactively with the commands ‘writeroom-increase-width’ and +‘writeroom-decrease-width’, which increase and decrease the text width +by 2 characters. There is also a more general command +‘writeroom-adjust-width’, which adjusts the width of the text area by +the amount passed as prefix argument. That is, calling it with ‘M-5 M-x +writeroom-adjust-width’ increases the text width by 5 characters. +Calling ‘writeroom-adjust-width’ without prefix argument resets the +width to the default value. + +These commands are not bound to any keys, but you can bind them in the +following manner (the actual keys are just examples, of course; choose +any keys you like): + +(with-eval-after-load 'writeroom-mode + (define-key writeroom-mode-map (kbd "C-M-<") #'writeroom-decrease-width) + (define-key writeroom-mode-map (kbd "C-M->") #'writeroom-increase-width) + (define-key writeroom-mode-map (kbd "C-M-=") #'writeroom-adjust-width)) + + +File: writeroom-mode.info, Node: Text size adjustments, Next: Displaying the mode line, Prev: Changing the width interactively, Up: Writeroom-mode + +1.7 Text size adjustments +========================= + +Text size adjustments are taken into account in calculating the margins, +which means that if the text size is increased, the margins are +decreased, so that the number of characters on the line remains more or +less the same. Since it is not possible to detect interactive text size +adjustments (e.g., with ‘text-size-adjust’), the adjustments of the +margins cannot be made automatically. You need to force a redisplay, +e.g., with the command ‘redraw-display’. + +Alternatively, you can advise the command you use for adjusting the text +size (most likely ‘text-size-adjust’): + +(advice-add 'text-scale-adjust :after + #'visual-fill-column-adjust) + + +File: writeroom-mode.info, Node: Displaying the mode line, Next: Adding global effects, Prev: Text size adjustments, Up: Writeroom-mode + +1.8 Displaying the mode line +============================ + +By default, ‘writeroom-mode’ disables the mode line. If you +occasionally need to see the full mode line, you can use the command +‘writeroom-toggle-mode-line’, which makes the mode line visible. +Calling it again hides the mode line. This command is bound to ‘s-?’ +(‘s’ is the super key, i.e., the Windows key on PCs, the ⌘ key on Macs), +but it can be rebound by putting something like the following in your +‘init.el’: + +(with-eval-after-load 'writeroom-mode + (define-key writeroom-mode-map (kbd "s-?") nil) + (define-key writeroom-mode-map (kbd "<some-key>") #’writeroom-toggle-mode-line)) + +The first ‘define-key’ disables the binding for ‘s-?’. Substitute your +preferred key binding in the second line to bind +‘writeroom-toggle-mode-line’ to it. + + +File: writeroom-mode.info, Node: Adding global effects, Next: Other similar modes, Prev: Displaying the mode line, Up: Writeroom-mode + +1.9 Adding global effects +========================= + +It is possible to add your own global effects to ‘writeroom-mode’. If +there is a global minor mode that you want turned on when +‘writeroom-mode’ is activated for the first time, you can simply add it +to the user option ‘writeroom-global-effects’ by checking the box +"Custom effects", clicking the [INS] button and adding the function to +the list. + +Alternatively, you can also write your own function. This function +should take one argument and enable the effect if the argument is ‘1’ +and disable it if the argument is ‘-1’. To give an example, if you want +to activate a minimalist colour theme in ‘writeroom-mode’, you can write +the following function: + +(defun my-writeroom-theme (arg) + (cond + ((= arg 1) + (enable-theme 'minimalist-dark)) + ((= arg -1) + (disable-theme 'minimalist-dark)))) + +If your function affects the frame, you should make sure that it only +affects the ‘writeroom-mode’ frame by passing the variable +‘writeroom--frame’ to all frame-changing functions. If your frame +effect involves changing the value of a frame parameter, you may be able +to use the macro ‘define-writeroom-global-effect’; see its doc string +for details. + +In principle, it is not a good idea to define a custom global effect +function as a toggle, but if you are sure you’ll only ever use a single +frame, it should be safe enough. For example, sometimes setting the +‘fullscreen’ frame parameter does not work. In this case, if you’re on +Linux, you could send an X client message directly: + +(defun my-toggle-fullscreen (_) + (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 + '(2 "_NET_WM_STATE_FULLSCREEN" 0))) + + +File: writeroom-mode.info, Node: Other similar modes, Prev: Adding global effects, Up: Writeroom-mode + +1.10 Other similar modes +======================== + +There are two other modes that I know of that also implement a +distraction-free writing environment: Darkroom +(https://github.com/joaotavora/darkroom) and Olivetti +(https://github.com/rnkn/olivetti). Both are narrower in scope than +‘writeroom-mode’. + +In particular, both Darkroom and Olivetti only affect the buffer (or +more precisely, its window), not the frame. They centre the text by +adding window margins, and optionally resize the text and hide the mode +line. They do not make Emacs fullscreen and do not remove the menu and +tool bars, the scroll bar or the window decorations. This is a +conscious choice (see, e.g., this pull request +(https://github.com/joaotavora/darkroom/pull/2) and this issue +(https://github.com/rnkn/olivetti/issues/6)), motivated by the fact that +affecting the frame in this way may lead to problems when using multiple +Emacs frames. + +It is true that changing the appearance of the current frame (the global +effects, as ‘writeroom-mode’ calls them) is risky if you use multiple +frames. ‘writeroom-mode’ applies its global effects to the frame that +is current when it is first activated and tries to make sure that _only_ +this frame is ever affected. Therefore, it should be safe to use +‘writeroom-mode’, even if you use multiple frames. (If you do run into +issues, however, I would welcome a bug report.) Alternatively, you can +turn off all global effects and use ‘writeroom-mode’ in much the same +way as Darkroom or Olivetti. + +Another difference with Darkroom and Olivetti is that ‘writeroom-mode’ +tries to be as customisable as possible. It has a larger number of +customisation options than either of the other modes and also provides a +way to add custom global effects. This may or may not be what you need, +of course. + + + +Tag Table: +Node: Top222 +Node: Writeroom-mode336 +Ref: #writeroom-mode445 +Node: Installation931 +Ref: #installation1051 +Node: Usage1295 +Ref: #usage1441 +Node: Multiple writeroom-mode buffers2547 +Ref: #multiple-writeroom-mode-buffers2746 +Node: Frame effects3764 +Ref: #frame-effects3935 +Node: Customisation4744 +Ref: #customisation4916 +Node: Global Writeroom Mode5251 +Ref: #global-writeroom-mode5408 +Node: Border Width5617 +Ref: #border-width5783 +Node: Extra Line Spacing5905 +Ref: #extra-line-spacing6085 +Node: Fringes Outside Margins6252 +Ref: #fringes-outside-margins6447 +Node: Fullscreen Effect6740 +Ref: #fullscreen-effect6925 +Node: Bottom Divider Width7284 +Ref: #bottom-divider-width7466 +Node: Global Effects7680 +Ref: #global-effects7844 +Node: Major Modes8199 +Ref: #major-modes8354 +Node: Use Derived Modes8619 +Ref: #use-derived-modes8794 +Node: Major Modes Exceptions9056 +Ref: #major-modes-exceptions9247 +Node: Maximize Window9499 +Ref: #maximize-window9668 +Node: Mode Line9743 +Ref: #mode-line9903 +Node: Mode Line Toggle Position10466 +Ref: #mode-line-toggle-position10664 +Node: Restore Window Config11217 +Ref: #restore-window-config11403 +Node: Width11740 +Ref: #width11860 +Node: Changing the width interactively12045 +Ref: #changing-the-width-interactively12263 +Node: Text size adjustments13268 +Ref: #text-size-adjustments13475 +Node: Displaying the mode line14132 +Ref: #displaying-the-mode-line14334 +Node: Adding global effects15120 +Ref: #adding-global-effects15314 +Node: Other similar modes16999 +Ref: #other-similar-modes17158 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: |