-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore link syntax in org-mode #10
Comments
+1 for this feature, it's very important when enable real-insert-space mode in org-mode links. |
I found a way to solve this issue. But I'm not sure whether it's a good idea to raise a PR here since it's an ad hoc solution relying on (with-eval-after-load "org-element"
(defadvice pangu-spacing-search-and-replace (around pangu-spacing-org-link-fix activate)
"Replace regexp with match in buffer."
(if (eq 'org-mode (buffer-local-value 'major-mode (current-buffer)))
(pangu-spacing-search-buffer regexp (point-min) (point-max)
(if (member 'link
(mapcar
(lambda (point)
(save-excursion
(goto-char point)
(org-element-type (org-element-context))))
(list (match-beginning 0) (match-end 0))))
(goto-char (match-end 0))
(replace-match match nil nil)))
ad-do-it))) If you are a spacemacs user, you can also check on my private layer et2010/Han@28c049c |
Hi @et2010 , your solution looks good to me. I'll close this issue after fix it. Thanks :) |
Last commit will cause some serious issue. While saving buffer, some text will be replaced randomly. I believe it is due to org's parsing mechanism which will change match data during parsing. It is fixed now, by some save-match-data magic.
That fix itself caused some more serious trouble! Luckily, after spending couple of hours googling, I finally came up with a good solution. 😄 |
When enable real-insert-space mode, we should ignore the link syntax in org-mode to prevent generated file error :(
The text was updated successfully, but these errors were encountered: