> I can only suggest something like > > (equal (org-element-begin link) > (save-excursion > (goto-char (org-element-contents-begin paragraph)) > (skip-chars-forward "\t ") > (point))) > > (equal (org-element-end link) > (save-excursion > (goto-char (org-element-contents-end paragraph)) > (skip-chars-backward "\t ") > (point))) This should be fine, it's what we do in many places in org-latex-preview. > > - Does org-element provide a property that can help here? I tried > > :pre-blank but it was nil, I'm not sure what it does. > > :pre-blank is for blank lines before contents. Leading whitespace is > considered a part of the paragraph: > (paragraph (...) " " (link ...) "\n") Good to know. I've attached the latest version of the patch. - 'justify is no longer an option - 'left is now supported as a value of `org-image-align', although of course this is a noop. - Leading and trailing whitespace are handled correctly. The image overlay swallows up any trailing whitespace if there is nothing else on that line. - Right alignment will still fail in some odd circumstances, such as if there's an overlay with a display property to the right of the image. To see an example of this, turn on whitespace-mode and try to right-align a standalone image. I don't think it's worth handling cases like these at least for now. Karthik