andras-simonyi/org-cite-csl-activate

Line-wrapping in visual-line-mode gives long underscore line

Closed this issue · 3 comments

If visual-line-mode is active and the citation breaks over a line, the link's underscore will go all the way to the end of the line. This is in contrast to usual org links, where the underscore stops at the end of the word, which looks much better.

I'm not sure why this is the case, as the face is apparently the same old org-link. I guess it has to do with the paragraph filling issue mentioned in the README.

;; emacs -q
(setq debug-on-error t)
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)

(package-install 'citeproc)
(load (expand-file-name "oc-csl-activate"))	     
(setq org-cite-activate-processor 'csl-activate)
(add-hook 'org-mode-hook
	  (lambda ()
	    (cursor-sensor-mode 1)
	    (visual-line-mode 1)))

In this screenshot of an example file, the link in the top paragraph is fontified by oc-csl-activate from [cite:@cicero2023]. The bottom one is a manual link, [[(Cicero 2023)]].

oc-csl

Thanks for reporting! As far as I know, by default, rendered citations use a different face, org-cite but I managed to reproduce the problem by turning on underline for that face (normally I don't use it). The difference between the appearance of links and citations probably comes from how visual-line-mode deals with invisible text vs replaced text: in the case of Org's hyperlinks, it is enough to make some parts (the url and brackets) invisible, but for citations a full replacement is needed. I have some ideas about how to improve the situation (maybe combining invisibility and replacement or using overlays), but they are longer term plans I'm afraid. Could simply turning off underlining for the org-cite face be a viable workaround, at least for the time being?

Oh, right, thanks. I think I originally saw that it inherited from org-link but somehow forgot that again. Yeah, I guess just turning off the underlines works fine 😃 To be honest, I guess it's probably not really worth it to work on a deeper fix, if it's not related to any other problems.

While deactivating the underline for the org-cite face seemed to have fixed the issue, it sadly didn't for me. When rerendered the citations first look fine, but hitting space or enter somewhere in the buffer will trigger the citations to be rendered again and then with the long ugly view.

Screenshot from 2023-03-14 15-42-44

Turns out it was the underscore as well. I edited them out of my bib-file and it works! Zotero places them there automatically and org-pretty-entities hides the underscores so I wasn't aware.

Great Package! btw.