-
Notifications
You must be signed in to change notification settings - Fork 31
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
Checking a narrowed org subtree confuses langtool #27
Comments
Having the same problem. I thought it was an issue with my setup, but being able to check on only one section of an org file would be great. Not a deal breaker since you can widen out, but when you have a large org file and want to focus in a narrowed tree it would be nice to have langtool available as well. |
This could probably be easily patched by rewriting the way @@ -1676,8 +1676,12 @@
(langtool--check-command)
;; probablly ok...
(let* ((region-p (langtool-region-active-p))
- (begin (and region-p (region-beginning)))
- (finish (and region-p (region-end))))
+ (begin (cond
+ (region-p (region-beginning))
+ (buffer-narrowed-p) (point-min)))
+ (finish (cond
+ (region-p (region-end))
+ (buffer-narrowed-p) (point-max)))) This way, if the buffer is narrowed, a tmpfile is created |
another workaround is to define an advice that will simply mark whole buffer: (define-advice langtool-check-buffer (:around (fn &optional lang) fix-narrowing)
(save-mark-and-excursion
(unless (use-region-p)
(let ((inhibit-message t))
(mark-whole-buffer)))
(funcall fn lang))) |
Open a narrowed org subtree in a separate window or frame and launch langtool-check.
The highlighted areas will be shifted to a position that counts from the beginning of the original buffer, not of that narrowed buffer.
So all the highlighted areas will not correspond to the area that has a problem and the correction will be applied to the wrong area.
The text was updated successfully, but these errors were encountered: