[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb 25aa0f1 173/449: Use a marker in conjunction with
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb 25aa0f1 173/449: Use a marker in conjunction with window conf |
Date: |
Fri, 27 Nov 2020 23:15:33 -0500 (EST) |
branch: externals/gnorb
commit 25aa0f1f3c1582d280e6ecf410c680ccc24cc2c1
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Use a marker in conjunction with window conf
We use gnorb-window-conf for returning from various actions. You're
not supposed to rely on that for position of point, so pair it with a
marker for finding point.
* lisp/gnorb-utils.el (gnorb-return-marker): New variable pointing at
marker
* lisp/gnorb-gnus.el: Use it
* lisp/gnorb-org.el: Use it
---
lisp/gnorb-gnus.el | 1 +
lisp/gnorb-org.el | 22 +++++++++++++++-------
lisp/gnorb-utils.el | 4 ++++
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/lisp/gnorb-gnus.el b/lisp/gnorb-gnus.el
index 0fc2fcd..2a244f4 100644
--- a/lisp/gnorb-gnus.el
+++ b/lisp/gnorb-gnus.el
@@ -513,6 +513,7 @@ to t (it is, by default)."
;; present. Take a look at calling it non-interactively.
(call-interactively 'org-store-link)
(setq gnorb-window-conf (current-window-configuration))
+ (move-marker gnorb-return-marker (point))
(let* ((msg-id (mail-header-id headers))
(sender (mail-header-from headers))
(subject (mail-header-subject headers))
diff --git a/lisp/gnorb-org.el b/lisp/gnorb-org.el
index 336ee7c..9e8c7e0 100644
--- a/lisp/gnorb-org.el
+++ b/lisp/gnorb-org.el
@@ -192,12 +192,13 @@ might have been in the outgoing message's headers and call
`gnorb-org-do-restore-action' on each one."
(when (eq major-mode 'gnus-summary-mode)
(gnus-summary-exit nil t))
- (when (window-configuration-p gnorb-window-conf)
- (set-window-configuration gnorb-window-conf))
+ (when (and (window-configuration-p gnorb-window-conf)
+ gnorb-return-marker)
+ (set-window-configuration gnorb-window-conf)
+ (goto-char gnorb-return-marker))
(dolist (id gnorb-message-org-ids)
(gnorb-trigger-todo-action nil id))
;; this is a little unnecessary, but it may save grief
- (setq gnorb-window-conf nil)
(setq gnorb-gnus-sending-message-info nil)
(setq gnorb-message-org-ids nil))
@@ -417,8 +418,10 @@ headings."
(message-goto-to)
(insert ", ")
(insert (mapconcat 'identity mails ", "))))
- (error (when (window-configuration-p gnorb-window-conf)
- (set-window-configuration gnorb-window-conf))
+ (error (when (and (window-configuration-p gnorb-window-conf)
+ gnorb-return-marker)
+ (set-window-configuration gnorb-window-conf)
+ (goto-char gnorb-return-marker))
(signal (car err) (cdr err)))))
;; Return us after message is sent.
(add-to-list 'message-exit-actions
@@ -489,6 +492,7 @@ current heading."
"Handle current headline as a mail TODO."
(interactive "P")
(setq gnorb-window-conf (current-window-configuration))
+ (move-marker gnorb-return-marker (point))
(when (eq major-mode 'org-agenda-mode)
(org-agenda-check-type t 'agenda 'timeline 'todo 'tags)
(org-agenda-check-no-diary)
@@ -709,6 +713,7 @@ default set of parameters."
,gnorb-org-email-subtree-file-parameters))))
text file)
(setq gnorb-window-conf (current-window-configuration))
+ (move-marker gnorb-return-marker (point))
(if (bufferp result)
(setq text result)
(setq file result))
@@ -835,6 +840,7 @@ your gnus select methods."
;; this should also work on the active region, if there is one.
(interactive)
(setq gnorb-window-conf (current-window-configuration))
+ (move-marker gnorb-return-marker (point))
(when (eq major-mode 'org-agenda-mode)
(org-agenda-check-type t 'agenda 'timeline 'todo 'tags)
(org-agenda-check-no-diary)
@@ -851,8 +857,10 @@ your gnus select methods."
(setq id (concat "id+" (org-id-get-create t))))
(gnorb-gnus-search-messages
id
- `(when (window-configuration-p gnorb-window-conf)
- (set-window-configuration gnorb-window-conf)))))
+ `(when (and (window-configuration-p gnorb-window-conf)
+ gnorb-return-marker)
+ (set-window-configuration gnorb-window-conf)
+ (goto-char gnorb-return-marker)))))
(provide 'gnorb-org)
;;; gnorb-org.el ends here
diff --git a/lisp/gnorb-utils.el b/lisp/gnorb-utils.el
index 650b1f5..538bdc3 100644
--- a/lisp/gnorb-utils.el
+++ b/lisp/gnorb-utils.el
@@ -85,6 +85,10 @@
"Save window configurations here, for restoration after mails
are sent, or Org headings triggered.")
+(defvar gnorb-return-marker (make-marker)
+ "Return point here after various actions, to be used together
+with `gnorb-window-conf'.")
+
(defcustom gnorb-mail-header "X-Org-ID"
"Name of the mail header used to store the ID of a related Org
heading. Only used locally: always stripped when the mail is
- [elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail and email-subtree, (continued)
- [elpa] externals/gnorb d254f39 140/449: Merge and simplify handle-mail and email-subtree, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3a512 244/449: Releasing version 1, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 4b8a6da 255/449: New function for removing message/heading association, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb aaf8556 261/449: Be a good citizen about the cl package, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb de3182e 263/449: Shift location of org-reveal during trigger process, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 6246244 106/449: Hinting for potentially-relevant incoming messages, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a79cf72 126/449: Unwrap "if" from around function, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 0255247 133/449: Only notice records on message receipt, not sending, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b70d845 168/449: Handle nil group values in registry entries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 880afd6 158/449: Register sent messages so we can view them later, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 25aa0f1 173/449: Use a marker in conjunction with window conf,
Stefan Monnier <=
- [elpa] externals/gnorb e1129e9 170/449: Fix problems when BBDB is not present and gnorb-bbdb is not loaded., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5f96b98 167/449: Stupid typo, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9a2f747 175/449: Don't hint messages in nnir or virtual summaries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ec44a6d 182/449: Continue shifting candidate finding to the registry, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 927e401 184/449: New function for restoring window layout, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a352586 189/449: Improve lookups for entries with unknown groups, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 81fed4b 193/449: Helper function for transitioning to the new system, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d7327b5 192/449: The big switch! Rely only on registry for tracking, Stefan Monnier, 2020/11/27
- [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