Issue installing phscroll on Doom Emacs
jingxuanlim opened this issue · 10 comments
Hi @misohena, many thanks for building this. I've been looking for a solution for a very long time and discovered your work when I revisited this issue this weekend.
I'm trying to install it on Doom Emacs.
This is what I've added to my config.el file:
(require 'phscroll)
(setq org-startup-truncated nil)
(load "~/emacs.default/lisp/org-phscroll.el")
I've tried to follow instructions on the readme and haven't received any errors, but I'm still not sure if I'm installing it right since it doesn't work with the tables I have in org-mode.
I therefore wonder if there are other settings on Doom that conflict with the configuration above.
Any help provided is much appreciated. Thanks!
Hello @jingxlim. I also installed Doom Emacs and tried it.
When I tried, phscroll was working, but a few characters on the right side of the table were sticking out on the next line. Running doom/toggle-line-numbers to erase the line numbers fixed it. doom/toggle-line-numbers uses display-line-numbers-mode. So the cause seems to be that phscroll doesn't support display-line-numbers-mode.
Is your situation the same?
If the situation is the same, a temporary solution may be to add (setq phscroll-margin-right 6) to the settings (6 is the width of the area displaying the line numbers).
The permanent solution is that phscroll supports display-line-numbers-mode. This takes time as I have to start by understanding how display-line-numbers-mode works. I will try it, but please wait for a while.
(Translated by Google Translate. The original message is as follows)
@jingxlimさんこんにちは。私もDoom Emacsをインストールして試してみました。
私が試したところ、phscrollは動作していましたが、表の右側の数文字が次の行にはみ出していました。doom/toggle-line-numbersを実行して行番号を消すと直りました。doom/toggle-line-numbersはdisplay-line-numbers-modeを使用しています。従って原因はphscrollがdisplay-line-numbers-modeをサポートしていないことにあるように見えます。
あなたの状況も同じでしょうか?
もし同じ状況であれば、一時的な解決策として、設定に(setq phscroll-margin-right 6) を追加することで回避できるかもしれません(6は行番号を表示する領域の幅)。
恒久的な解決策はphscrollがdisplay-line-numbers-modeをサポートすることです。これにはdisplay-line-numbers-modeの仕組みを私が理解することから始めなければならないので時間がかかります。やってみようとは思いますが少々お待ちください。
I have added support for display-line-numbers-mode.
(Translated by Google Translate. The original message is as follows)
私はdisplay-line-numbers-modeへのサポートを追加しました。
Doom Emacsでの動作を確認したので閉じますね。
Hi @misohena. Thanks for looking into this many months ago. I got busy and wasn't able to test it out. If you don't mind, I would like to reopen this issue.
I am still seeing an overhang that you described and I think I know what is causing it. phscroll
works for regular tables, but most of my tables have links to org headlines, as you can see in the screenshot below. In the latter case, you can see that the overhang still happens.
Also interesting is that, for regular tables, M-x phscroll-scroll-left
and M-x phscroll-scroll-right
moves in the opposite direction from expected, but that's fine as I can just use regular navigation to move around the table.
hello jingxlim
I think that the cause of the text overhang in the image you showed is that the text width of the link is larger than the normal text. To fix this you need to modify the line length to count in pixels. I'm using org-modern these days, and I'm having trouble recognizing the width of the borders correctly. This is the same cause. I'm busy right now, so I can't do it right away, but I'd like to try it someday. Of course, you can also avoid the problem with font settings.
The direction of phscroll-scroll-left, phscroll-scroll-right is the same as scroll-left, scroll-right. I also find it difficult to use, so I only use C-l.
(Translated by Google Translate. The original message is as follows)
jingxlimさんこんにちは。
お示し頂いた画像で文字がオーバーハングしている原因は、リンクの文字幅が通常の文字より大きいことだと思います。これを直すには行の長さをピクセル単位で数えるように修正する必要があります。私は最近org-modernを使っているのですが、罫線の幅を正しく認識してくれなくて困っています。これも同じ原因です。今私は忙しいのですぐには出来ませんが、いつか挑戦してみたいと思っています。もちろんフォント設定で問題を回避することも出来ます。
phscroll-scroll-left, phscroll-scroll-rightの方向はscroll-left, scroll-rightと同じにしました。私も使いづらいと思っているのでもっぱらC-lのみ使用しています。
Sorry, I may have written something wrong. Cancel the message above.
It doesn't reproduce in my environment. I don't know the cause. However, it is possible that there is something wrong with the line length calculation.
(Translated by Google Translate. The original message is as follows)
すみません、間違ったことを書いたかもしれません。上のメッセージは取り消します。
私の環境では再現しません。原因は分かりません。しかし、行の長さの計算に何らかの問題がある可能性はあります。
I installed Doom Emacs and did some testing. It certainly overhangs if there is a link in the table.
According to org-version Doom Emacs seems to use org-mode 9.6. I'm not familiar with the development status of org-mode, but this looks like an unreleased version. This version now sets the invisible text property value to org-link-description for the link description. This seems to be intended to allow detailed control of visibility using the buffer-invisibility-spec variable. phscroll doesn't support the buffer-invisibility-spec variable, so it misjudges the description as invisible and has a width of 0 (See: phscroll-invisible-property-width function in phscroll.el).
I don't think it would be too difficult to support it.
(Translated by Google Translate. The original message is as follows)
私はDoom Emacsをインストールして少し試験をしてみました。確かに表の中にリンクがあるとオーバーハングします。
org-versionによるとDoom Emacsはorg-mode 9.6を使用しているようです。私はorg-modeの開発状況には詳しくありませんが、これはまだリリースされていないバージョンのように見えます。このバージョンでは、リンクの説明部分にinvisibleテキストプロパティの値としてorg-link-descriptionが設定されるようになりました。これはbuffer-invisibility-spec変数を使用して細かく可視状態を制御できるようにする意図でだと思われます。phscrollはbuffer-invisibility-spec変数をサポートしていないため説明部分を全て不可視と判定して幅が0だと誤認してしまいます(See: phscroll-invisible-property-width function in phscroll.el)。
それをサポートするのはそれほど難しくないと思います。
Hey @misohena, great thanks for going to the extent of installing doom emacs just to investigate this bug, despite your busy schedule. I really appreciate it!
I added code to support buffer-invisibility-spec (f3b6fa5). It seems to work correctly in my Doom Emacs.
Could you please check that as well?
(Translated by Google Translate. The original message is as follows)
私はbuffer-invisibility-specに対応するためのコードを追加しました(f3b6fa5)。手元のDoom Emacsでは正しく機能しているように見えます。
そちらでも確認して頂けますか?
Works flawlessly! Thanks @misohena! You went above and beyond!