[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb 2be4a71 240/449: Save point with marker when addi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb 2be4a71 240/449: Save point with marker when adding headers to replies |
Date: |
Fri, 27 Nov 2020 23:15:47 -0500 (EST) |
branch: externals/gnorb
commit 2be4a71a96573cf9c01f172186447b34c3df0a21
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Save point with marker when adding headers to replies
* gnorb-gnus.el (gnorb-gnus-outgoing-do-todo): Don't use
message-goto-body, because there's a good chance that wasn't where
point was originally.
* nngnorb.el (gnorb-summary-reply-hook): Don't use save-excursion,
because that saves point, and point probably has moved.
In both cases, it's safest to preserve point using a marker.
---
gnorb-gnus.el | 6 +++++-
nngnorb.el | 24 +++++++++++++-----------
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/gnorb-gnus.el b/gnorb-gnus.el
index 5ebb2b9..e6c6a1d 100644
--- a/gnorb-gnus.el
+++ b/gnorb-gnus.el
@@ -324,6 +324,7 @@ the outgoing message will still be available -- nothing
else will
work."
(interactive "P")
(let ((org-refile-targets gnorb-gnus-trigger-refile-targets)
+ (compose-marker (make-marker))
header-ids ref-ids rel-headings gnorb-window-conf
reply-id reply-group in-reply-to)
(when arg
@@ -363,6 +364,9 @@ work."
;; to, if this is actually a reply.
(when message-reply-headers
(setq reply-id (aref message-reply-headers 4)))
+ ;; Save-excursion won't work, because point will move if we
+ ;; insert headings.
+ (move-marker compose-marker (point))
(save-restriction
(widen)
(message-narrow-to-headers-or-head)
@@ -404,7 +408,7 @@ work."
;; tell the rest of the function that this is a relevant
;; message
(push h header-ids)))))
- (message-goto-body)
+ (goto-char compose-marker)
(add-to-list
'message-exit-actions
(if header-ids
diff --git a/nngnorb.el b/nngnorb.el
index 8048304..930f8e2 100644
--- a/nngnorb.el
+++ b/nngnorb.el
@@ -239,19 +239,21 @@ continue to provide tracking of sent messages."
"Function that runs after any command that creates a reply."
;; Not actually a "hook"
(let* ((msg-id (aref message-reply-headers 4))
- (org-id (car-safe (gnus-registry-get-id-key msg-id 'gnorb-ids))))
+ (org-id (car-safe (gnus-registry-get-id-key msg-id 'gnorb-ids)))
+ (compose-marker (make-marker)))
(when org-id
+ (move-marker compose-marker (point))
(save-restriction
- (save-excursion
- (widen)
- (message-narrow-to-headers-or-head)
- (goto-char (point-at-bol))
- (open-line 1)
- (message-insert-header
- (intern gnorb-mail-header)
- org-id)
- (add-to-list 'message-exit-actions
- 'gnorb-org-restore-after-send t))))))
+ (widen)
+ (message-narrow-to-headers-or-head)
+ (goto-char (point-at-bol))
+ (open-line 1)
+ (message-insert-header
+ (intern gnorb-mail-header)
+ org-id)
+ (add-to-list 'message-exit-actions
+ 'gnorb-org-restore-after-send t))
+ (goto-char compose-marker))))
(defun gnorb-summary-exit ()
"Like `gnus-summary-exit', but restores the gnorb window conf."
- [elpa] externals/gnorb 7ba1786 196/449: Use gnorb-gnus-message-info for incoming and outgoing, (continued)
- [elpa] externals/gnorb 7ba1786 196/449: Use gnorb-gnus-message-info for incoming and outgoing, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0cb4d1a 201/449: Docstring for gnorb-scan-links, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5c9ef6e 203/449: Don't create Org IDs when scanning for mails, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9ac84b7 218/449: Return links in the order which they were found, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a9535ae 223/449: Merge branch 'registry', Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb dd4e013 225/449: Restore action shouldn't quit summary buffer, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 08e0742 229/449: Empty News and gnorb.texi files, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb bcfd501 236/449: gitignore Elpa-generated stuff, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 55a630d 238/449: Gnus hinting needs to check in-reply-to as well, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d2831b8 237/449: Refactor summary buffer hinting into separate function, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 2be4a71 240/449: Save point with marker when adding headers to replies,
Stefan Monnier <=
- [elpa] externals/gnorb ba99110 242/449: Check for relevant headings when handling attachments, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 1a0cfc7 243/449: Delete duplicates before and after finding candidates, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 35284f2 248/449: Add TODO for collecting BBDB messages by thread, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 2c0f43d 249/449: Refinements to link extraction, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e1fb666 257/449: Function for deleting all assocations of an Org heading, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5688114 258/449: Bugfix: Adding mailtos to newly-setup messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 04ec3ab 264/449: Fix logic of choosing heading to trigger, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de0dff5 274/449: Protection for message disassociation, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 321b23b 276/449: Remove gnus-interactive, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 8a9c167 277/449: Fix the cl-lib loading stuff, Stefan Monnier, 2020/11/27