logos
logos copied to clipboard
Margins in logos mode
When narrowing to a subtree (or maybe always) I think it would be better to use the configured width than to indenting the text.
Maintaining headline indentation probably doesn't make much sense when reading.

BTW, I managed to get this lay-out. Although first line indentation probably is too much:

I sent this via email, but it never arrived. GitHub seems to have a problem with this, as it has happened many times already. Copying below.
Hello @Ypot!
Right now, logos simply narrows to the current segment of the buffer
(basically, narrow-to-region).
Do you use org-indent-mode, by any chance? I believe the command
org-narrow-to-subtree (bound to C-x n s by default) also preserves
indentation when that mode is active.
Yes, it is as you say, I use indent mode and org-narrow-to-subtree. Thanks
Very well! Maybe you can use the logos-focus-mode-hook to disable that mode? Do you think we should include such information in the manual?
I've tried to use the logos-focus-mode-hook, but I am not able to make an "off hook", I mean, I am not able to undone the changes when the logos-mode is deactivated.
About including that information in the manual, I think it could be easy, but not very useful. I like better your work, offering some tweaks in the customization group of logos. Although yet not sure what customizations would be adequate, since margins are tricky for me, for example I am using adaptive-wrap-prefix-mode to get the first line indented, but I don't know how to indent it less, and I don't know why it voids the org-indent-mode. Margins are mystic for a non-elisper ;D
Please evaluate these and then use logos-focus-mode:
(defcustom logos-org-indent t
"Work-in-progress."
:type 'boolean
:group 'logos
:local t)
(defun logos--setup ()
"Set up aesthetics for presentation."
;; modes
(logos--variable-pitch)
(logos--scroll-lock)
(logos--olivetti)
(logos--org-indent)
;; variables
(logos--hide-mode-line)
(logos--indicate-buffer-boundaries)
(logos--buffer-read-only)
;; faces
(logos--hide-fringe))
(defun logos--org-indent ()
"Set `logos-org-indent'."
(when logos-org-indent
(logos--mode 'org-indent-mode -1)))
What this does is check if org-indent-mode is enabled and, if it is,
it disables it. Then, when logos-focus-mode is disabled, it restores
org-indent-mode.
Then we can try the same for adaptive-wrap, though I have never used
it and would need to check the technicalities.
What do you think?
Anyhow, the diff with the above:
logos.el | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/logos.el b/logos.el
index b6c251c..b15879e 100644
--- a/logos.el
+++ b/logos.el
@@ -148,6 +148,12 @@ (defcustom logos-olivetti nil
:group 'logos
:local t)
+(defcustom logos-org-indent t
+ "Work-in-progress."
+ :type 'boolean
+ :group 'logos
+ :local t)
+
(defcustom logos-hide-fringe nil
"If non-nil make the `fringe' face the same as `default' background.
This is only relevant when `logos-focus-mode' is enabled."
@@ -364,6 +370,7 @@ (defun logos--setup ()
(logos--variable-pitch)
(logos--scroll-lock)
(logos--olivetti)
+ (logos--org-indent)
;; variables
(logos--hide-mode-line)
(logos--indicate-buffer-boundaries)
@@ -412,6 +419,11 @@ (defun logos--olivetti ()
(when (and logos-olivetti (require 'olivetti nil t))
(logos--mode 'olivetti-mode 1)))
+(defun logos--org-indent ()
+ "Set `logos-org-indent'."
+ (when logos-org-indent
+ (logos--mode 'org-indent-mode -1)))
+
(defvar-local logos--fringe-remap-cookie nil
"Cookie of remapped `fringe' face.")
Just to note that I am actually working on a better way to extend logos-focus-mode. Will share more shortly.
Okay, just pushed the changes. Please tell me how you indent the first line in the paragraph and I can document ways to toggle that effect.
Hi! I upgraded to 0.4.0
-
It seems org-indent is not disabled.
-
Although this has no relationship with focus mode, and probably it's some incompatibility, when indenting the first line, I am getting funny behavior: After disabling wrap-adaptive-prefix-mode text doesn't change,
Video: https://www.tiktok.com/@yporg/video/7105294778086001925?is_from_webapp=1&sender_device=pc&web_id=7100507416085399046
Note: I tried "stem-reading" because usually it "refreshed" the text, updating the margins. No result this time, probably because I upgraded to emacs 28.1.
Hello again!
It seems org-indent is not disabled.
I assume you used this code?
(defvar my-logos-org-indent nil
"When t, disable `org-indent-mode' during `logos-focus-mode'.")
(defun my-logos-org-indent ()
"Set `my-logos-org-indent' in `logos-focus-mode'."
(when my-logos-org-indent
;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and
;; restore it when `logos-focus-mode' is disabled. The
;; `logos--mode' function takes care of the technicalities.
(logos--mode 'org-indent-mode -1)))
(add-hook 'logos-focus-mode-extra-functions #'my-logos-org-indent)
I did not clarify this, but you need (setq my-logos-org-indent t) to enable the effect. I thought this would be better long-term for the user to try what they like more. But maybe it is confusing that way.
Otherwise use this code:
(defun my-logos-org-indent ()
"Set `my-logos-org-indent' in `logos-focus-mode'."
;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and
;; restore it when `logos-focus-mode' is disabled. The
;; `logos--mode' function takes care of the technicalities.
(logos--mode 'org-indent-mode -1))
(add-hook 'logos-focus-mode-extra-functions #'my-logos-org-indent)
Although this has no relationship with focus mode, and probably it's some incompatibility, when indenting the first line, I am getting funny behavior: After disabling wrap-adaptive-prefix-mode text doesn't change,
I have not added anything related to that package. We can do it after we are sure org-indent-mode behaves properly. Please show me how you indent the first line or, generally, whatever relevant configurations you are using.
I assume you used this code?
I didn't!! I thought it was pushed into 0.4.0 version :$
(defvar my-logos-org-indent nil "When t, disable `org-indent-mode' during `logos-focus-mode'.") (defun my-logos-org-indent () "Set `my-logos-org-indent' in `logos-focus-mode'." (when my-logos-org-indent ;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and ;; restore it when `logos-focus-mode' is disabled. The ;; `logos--mode' function takes care of the technicalities. (logos--mode 'org-indent-mode -1))) (setq my-logos-org-indent t) (add-hook 'logos-focus-mode-extra-functions #'my-logos-org-indent)
That works.
(defun my-logos-org-indent () "Set `my-logos-org-indent' in `logos-focus-mode'." ;; Disable `org-indent-mode' when `logos-focus-mode' is enabled and ;; restore it when `logos-focus-mode' is disabled. The ;; `logos--mode' function takes care of the technicalities. (logos--mode 'org-indent-mode -1)) (add-hook 'logos-focus-mode-extra-functions #'my-logos-org-indent)
And that works. :-)
For indenting the first line, I am using https://elpa.gnu.org/packages/adaptive-wrap.html I think it helps the reading.
It seems that package applies org-indent just to the first line, so paragraphs start with
the indentation of the headline and following lines have no indentation.
Whatever way I can help you, let me know.
Those emails are not being delivered... Copying what I wrote:
I assume you used this code?
I didn't!! I thought it was pushed into 0.4.0 version :$
No worries! That was the original plan, but I decided to implement the
logos-focus-mode-extra-functions which makes it easier to extend the
functionality.
For indenting the first line, I am using https://elpa.gnu.org/packages/adaptive-wrap.html I think that helps to the reading.
I do M-x adaptive-wrap-prefix-mode and it has no effect on existing
text. Do you have some sample text I can try? Maybe you are using
visual-line-mode or something else is in operation as well.
I do
M-x adaptive-wrap-prefix-modeand it has no effect on existing text. Do you have some sample text I can try? Maybe you are using visual-line-mode or something else is in operation as well.
The adaptive-wrap-prefix-mode doesn't work with the new hook, probably because after disabling org-indent-mode, it can't indent the first line. Although the adaptive-wrap-prefix-mode is just a partial solution, because indenting the first line to the headline could not be the ideal, it could be better to indent the first line to a customizable position.
These are my enabled minor modes. They look like too many:
Abbrev Async-Bytecomp-Package
Auto-Composition Auto-Compression Auto-Encryption Blink-Cursor
Buffer-Expose Company Ctrlf Ctrlf-Local Delete-Selection
Desktop-Save Electric-Indent File-Name-Shadow Font-Lock
Global-Company Global-Eldoc Global-Font-Lock Global-Subword
Global-Undo-Tree Global-Visible-Mark Global-Visual-Line
Line-Number Marginalia Menu-Bar Mouse-Wheel Org-Appear
Org-Fragtog Org-Indent Override-Global Save-Place Shell-Dirtrack
Show-Paren Subword Tab-Bar Tool-Bar Tooltip Transient-Mark
Undo-Tree Vertico Visible-Mark Visual-Line Wrap-Region
Wrap-Region-Global
Hello @Ypot!
Right now, logos simply narrows to the current segment of the buffer
(basically, narrow-to-region).
Do you use org-indent-mode, by any chance? I believe the command
org-narrow-to-subtree (bound to C-x n s by default) also preserves
indentation when that mode is active.
-- Protesilaos Stavrou https://protesilaos.com
I assume you used this code?
I didn't!! I thought it was pushed into 0.4.0 version :$
No worries! That was the original plan, but I decided to implement the
logos-focus-mode-extra-functions which makes it easier to extend the
functionality.
For indenting the first line, I am using https://elpa.gnu.org/packages/adaptive-wrap.html I think that helps to the reading.
I do M-x adaptive-wrap-prefix-mode and it has no effect on existing
text. Do you have some sample text I can try? Maybe you are using
visual-line-mode or something else is in operation as well.
-- Protesilaos Stavrou https://protesilaos.com
I assume you used this code? I didn't!! I thought it was pushed into 0.4.0 version :$ No worries! That was the original plan, but I decided to implement the
logos-focus-mode-extra-functionswhich makes it easier to extend the functionality. For indenting the first line, I am using https://elpa.gnu.org/packages/adaptive-wrap.html I think that helps to the reading. I doM-x adaptive-wrap-prefix-modeand it has no effect on existing text. Do you have some sample text I can try? Maybe you are using visual-line-mode or something else is in operation as well. … -- Protesilaos Stavrou https://protesilaos.com
Yes, I am using visual-line, wrap-region, org-indent... I am happy with the actual result (the original issue was solved), although of course I wished to be able to tweak it more ;D

I assume you used this code? I didn't!! I thought it was pushed into 0.4.0 version :$ No worries! That was the original plan, but I decided to implement the
logos-focus-mode-extra-functionswhich makes it easier to extend the functionality. For indenting the first line, I am using https://elpa.gnu.org/packages/adaptive-wrap.html I think that helps to the reading. I doM-x adaptive-wrap-prefix-modeand it has no effect on existing text. Do you have some sample text I can try? Maybe you are using visual-line-mode or something else is in operation as well. … -- Protesilaos Stavrou https://protesilaos.com
I think it doesn't work for you, because of org-indent-mode. I think adaptive-wrap-prefix-mode in fact doesn't indent the first line of each paragraph, instead when org-indent-mode is non-nil, adaptive-wrap-prefix-mode "de-indents" every line but the first one, so it gets an effect near to the indentation of the first line.