justinbarclay / elegant-agenda-mode

My only agenda is to be more elegant.
GNU Affero General Public License v3.0
55 stars 3 forks source link

Align issue #2

Open randomwangran opened 3 years ago

randomwangran commented 3 years ago

Thanks for writing this elegant package.

I found one issue with regard to alignment. Following is a figure to show the difference.

image

Thanks for your effort.

justinbarclay commented 3 years ago

Hey thanks for this report. Unfortunately, I can't really recreate the "File Name" issue with a mono or non-mono spaced font.

As for tags with a variable width font there are concerns about tags being aligned. There has been work done to make sure they align. Namely, I apply the solution described here. Recently, I also discovered issues with monospaced fonts and tags appearing off screen. I have wrote a fix for that and I am waiting for MELPA to pick that up.

randomwangran commented 3 years ago

Hi @justinbarclay

For the "File Name" issue, I mock an ideal situation: image

The issue is with "TODO" items.

For the tag issue, I tested the following code without success.

  (defun org-agenda-fix-tag-alignment ()
    "Use 'display :align-to instead of spaces in agenda."
    (goto-char (point-min))
    (setq-local word-wrap nil) ; tags would be moved to next line if 
`word-wrap'` is non-nil and `truncate-lines' is nil
    (while (re-search-forward org-tag-group-re nil 'noerror)
      (put-text-property (match-beginning 0) (match-beginning 1) 'display 
`(space . (:align-to (- right (,(string-display-pixel-width (match-string 
1)))))))))

  (add-hook 'org-agenda-finalize-hook #'org-agenda-fix-tag-alignment)

Thanks for patching this issue on MELPA, I will test it later or study the source code to see what I can do.

justinbarclay commented 3 years ago

Thanks for looking into this, unfortunately, I don't know of a good way to resolve this myself. But if you find one I would happily accept a PR :)

One small suggestion or area to look into, but you might what to apply spacing based on todo-keywords and not tags, Org treats these differently and has different variables for them.