João Távora [Mon, 5 Jan 2015 11:09:29 +0000 (11:09 +0000)]
Add autoload cookies
* darkroom.el (darkroom-mode, darkroom-tentative-mode): Add autoload cookie.
(darkroom-tentative-mode): Use `declare-function` to try and
shoosh byte-compiler.
João Távora [Tue, 16 Dec 2014 10:10:31 +0000 (10:10 +0000)]
Fix margin calculation yet again.
For scaled char widths the margin width, in columns, also has to be
scaled accordingly.
* darkroom.el (darkroom-verbose): New variable.
(darkroom--window-width): New function.
(darkroom-guess-margins): Use it.
(darkroom--reset-margins): Cleanup.
João Távora [Fri, 12 Dec 2014 12:18:00 +0000 (12:18 +0000)]
Redesign setting of margins, which now works per-window
`darkroom-tentative-mode' is now broken, but the rest now works
better.
* darkroom.el (darkroom-margins): New semantics for function value.
(darkroom--real-window-width): Compensate for margins that might
already be there.
(darkroom--guess-margins-statistics-cache): New variable.
(darkroom-guess-margins): Use a cache.
(darkroom--compute-margins): Take WINDOW aprameter.
(darkroom--buffer-margins): Removed.
(darkroom--set-margins): Redesigned.
(darkroom--reset-margins): New function.
(darkroom-increase-margins): Unimplement.
(darkroom--saved-variables, darkroom--saved-state): New variables.
(darkroom--turn-on): Redesign.
(darkroom--turn-off): Redesign.
(darkroom--maybe-enable): Check for `darkroom--saved-state'.
João Távora [Thu, 11 Dec 2014 11:37:10 +0000 (11:37 +0000)]
Attempt a clearer design of modes
* darkroom.el (darkroom--turn-on): New function.
(darkroom--tentative-mode-driving): Removed this.
(darkroom-mode): Use new `darkroom--turn-on' and
`darkroom--turn-off'.
(darkroom-tentative-mode): Assert that no `darkroom-mode' and
`darkroom-tentative-mode' are mixed.
(darkroom--turn-off): New function.
João Távora [Thu, 11 Dec 2014 11:20:30 +0000 (11:20 +0000)]
Corrections after another review iteration with Rasmus
* darkroom.el (darkroom-margins): New default.
(darkroom-margins): Tweak docstring.
(darkroom-margins): Better type spec.
(darkroom-margins-if-failed-guess): New defcustom.
(darkroom--real-window-width): New function.
(darkroom-guess-margins): Simplified.
(darkroom--compute-margins)
(darkroom--saved-mode-line-format)
(darkroom--saved-header-line-format, darkroom--saved-margins): Add
docstring.
(darkroom-mode): Added an assertion.
(darkroom--tentative-mode-driving): New variable.
(darkroom--maybe-enable): Use `darkroom--tentative-mode-driving'
(darkroom-mode): Attempt to ensure `darkroom--set-margins' always
happens after `darkroom--maybe-enable' in
`window-configuration-change-hook'.
* darkroom.el: Require 'cl-lib
(darkroom-guess-margins): New function for putting in
`darkroom-margins'. But broken due to `window-width' not being
suitable probably.
(darkroom-compute-margins): Redesigned.
(darkroom-set-margins): Don't `darkroom-compute-margins'
(darkroom-mode): Reordered statements.
João Távora [Mon, 8 Dec 2014 20:35:27 +0000 (20:35 +0000)]
Tidy up margin calculation
* darkroom.el (darkroom-compute-margins): Renamed from `darkroom-margins'.
(darkroom-buffer-margins): New variable.
(darkroom-set-margins): Redesign. Set `darkroom-buffer-margins'.
(darkroom-increase-margins): Redesign.
(darkroom-mode-map): Fix whitespace.
(darkroom-mode): Use `set-mark-local-variable'
(darkroom-mode): Save and restore current margins.
(darkroom-tentative-mode): Fix whitespace.
João Távora [Mon, 8 Dec 2014 19:48:25 +0000 (19:48 +0000)]
Integrate another comment from Rasmus
* darkroom.el (darkroom-margin-increment): New defcustom.
(darkroom-increase-margins): Take a parameter.
(darkroom-decrease-margins): Use `darkroom-increase-margins'
Joao Tavora [Thu, 27 Feb 2014 14:56:21 +0000 (14:56 +0000)]
Now works with multiple windows for same darkroom buffer
* darkroom.el (darkroom-set-margins): set for every window separately.
(darkroom-fill-paragraph-maybe): Be smarter we filling
paragraph. TODO: use remap.
(darkroom-saved-mode-line-format)
(darkroom-saved-header-line-format)
(darkroom-saved-visual-line-mode): new buffer-local vars.
(darkroom-visual-mode-maybe-enable): new function.
(darkroom-mode): Remove hack here.
(darkroom-maybe-enable): new function.
(darkroom-tentative-mode): New minor mode.