* [PATCH] Preserve point when calling org-capture in gnus virtual group
@ 2017-11-29 15:23 Matt Lundin
2017-11-29 18:03 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Matt Lundin @ 2017-11-29 15:23 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 336 bytes --]
When calling org-capture in gnus virtual groups (for instance, groups
created through searches), I found that the region captured was
different than the region I had selected. This is because one of the
functions called in org-gnus-store-link moves the point to the end of
the buffer. The attached patch fixes the issue.
Thanks,
Matt
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Prevent-point-from-moving-when-storing-link-in-gnus-.patch --]
[-- Type: text/x-diff, Size: 1123 bytes --]
From 7f41fbb98c7cbaa09af8f78b06a57587e4f583a1 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Wed, 29 Nov 2017 09:17:55 -0600
Subject: [PATCH] Preserve position of point in gnus virtual group
* lisp/org-gnus.el: (org-gnus-store-link) Add a save-excursion to
protect the position of point. Otherwise, when calling org-capture
in an article with a virtual group, the point is moved and the
region captured is incorrect.
---
lisp/org-gnus.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 687bc08b1..27a968f75 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -120,7 +120,8 @@ If `org-store-link' was called with a prefix arg the meaning of
(let* ((group
(pcase (gnus-find-method-for-group gnus-newsgroup-name)
(`(nnvirtual . ,_)
- (car (nnvirtual-map-article (gnus-summary-article-number))))
+ (save-excursion
+ (car (nnvirtual-map-article (gnus-summary-article-number)))))
(`(nnir . ,_)
(nnir-article-group (gnus-summary-article-number)))
(_ gnus-newsgroup-name)))
--
2.15.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Preserve point when calling org-capture in gnus virtual group
2017-11-29 15:23 [PATCH] Preserve point when calling org-capture in gnus virtual group Matt Lundin
@ 2017-11-29 18:03 ` Nicolas Goaziou
2017-11-29 18:43 ` Matt Lundin
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2017-11-29 18:03 UTC (permalink / raw)
To: Org Mode
Hello,
Matt Lundin <mdl@imapmail.org> writes:
> When calling org-capture in gnus virtual groups (for instance, groups
> created through searches), I found that the region captured was
> different than the region I had selected. This is because one of the
> functions called in org-gnus-store-link moves the point to the end of
> the buffer. The attached patch fixes the issue.
Applied. Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Preserve point when calling org-capture in gnus virtual group
2017-11-29 18:03 ` Nicolas Goaziou
@ 2017-11-29 18:43 ` Matt Lundin
2017-11-29 20:05 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Matt Lundin @ 2017-11-29 18:43 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode
[-- Attachment #1: Type: text/plain, Size: 564 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Matt Lundin <mdl@imapmail.org> writes:
>
>> When calling org-capture in gnus virtual groups (for instance, groups
>> created through searches), I found that the region captured was
>> different than the region I had selected. This is because one of the
>> functions called in org-gnus-store-link moves the point to the end of
>> the buffer. The attached patch fixes the issue.
>
> Applied. Thank you.
Thanks! And here is another patch to fix the same issue in temporary
nnir search groups in gnus.
Best,
Matt
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Preserve-point-when-storing-link-in-Gnus-nnir-groups.patch --]
[-- Type: text/x-diff, Size: 1054 bytes --]
From 87299d4646b5c3895332e63b5c0419e8a1b7d027 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Wed, 29 Nov 2017 12:37:07 -0600
Subject: [PATCH] Preserve point when storing link in Gnus nnir groups
* lisp/org-gnus.el: (org-gnus-store-link) This fixes a similar issue
as commit 84b329516efbe92ea5385f2aa2ad2779ab44b427, but for
nnir search groups in gnus.
---
lisp/org-gnus.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 27a968f75..f0f5ca2fa 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -123,7 +123,8 @@ If `org-store-link' was called with a prefix arg the meaning of
(save-excursion
(car (nnvirtual-map-article (gnus-summary-article-number)))))
(`(nnir . ,_)
- (nnir-article-group (gnus-summary-article-number)))
+ (save-excursion
+ (nnir-article-group (gnus-summary-article-number))))
(_ gnus-newsgroup-name)))
(header (with-current-buffer gnus-summary-buffer
(gnus-summary-article-header)))
--
2.15.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-29 20:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-29 15:23 [PATCH] Preserve point when calling org-capture in gnus virtual group Matt Lundin
2017-11-29 18:03 ` Nicolas Goaziou
2017-11-29 18:43 ` Matt Lundin
2017-11-29 20:05 ` Nicolas Goaziou
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.