[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bcc0cb0 085/110: avy.el (avy-org-refile-as-child): Don't r
From: |
Oleh Krehel |
Subject: |
[elpa] master bcc0cb0 085/110: avy.el (avy-org-refile-as-child): Don't refile when avy aborted |
Date: |
Sat, 11 May 2019 10:15:50 -0400 (EDT) |
branch: master
commit bcc0cb0891875ef12d997c3d90c3fd9c155fc8c5
Author: Adam Porter <address@hidden>
Commit: Oleh Krehel <address@hidden>
avy.el (avy-org-refile-as-child): Don't refile when avy aborted
And ensure refiled heading is visible by calling org-reveal in the
after-refile hook.
When the avy session is aborted with C-g, avy--generic-jump returns
t. Now we detect that and do not attempt to refile.
Fixes #258
---
avy.el | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/avy.el b/avy.el
index 569b604..4b92b87 100644
--- a/avy.el
+++ b/avy.el
@@ -2014,17 +2014,23 @@ The window scope is determined by `avy-all-windows'
(ARG negates it)."
"Refile current heading as first child of heading selected with `avy.'"
;; Inspired by `org-teleport':
http://kitchingroup.cheme.cmu.edu/blog/2016/03/18/Org-teleport-headlines/
(interactive)
- (let ((rfloc (save-excursion
- (let* ((org-reverse-note-order t)
- (pos (avy-with avy-goto-line
- (avy--generic-jump (rx bol (1+ "*") (1+ space))
- nil avy-style)
- (point)))
- (filename (buffer-file-name (or (buffer-base-buffer
(current-buffer))
- (current-buffer)))))
- (list nil filename nil pos)))))
- ;; org-refile must be called outside of the excursion
- (org-refile nil nil rfloc)))
+ (let* ((org-reverse-note-order t)
+ (marker (save-excursion
+ (avy-with avy-goto-line
+ (unless (eq 't (avy--generic-jump (rx bol (1+ "*") (1+
space))
+ nil avy-style))
+ ;; `avy--generic-jump' returns t when aborted with C-g.
+ (point-marker)))))
+ (filename (buffer-file-name (or (buffer-base-buffer (marker-buffer
marker))
+ (marker-buffer marker))))
+ (rfloc (list nil filename nil marker))
+ ;; Ensure the refiled heading is visible.
+ (org-after-refile-insert-hook (if (member 'org-reveal
org-after-refile-insert-hook)
+ org-after-refile-insert-hook
+ (cons #'org-reveal
org-after-refile-insert-hook))))
+ (when marker
+ ;; Only attempt refile if avy session was not aborted.
+ (org-refile nil nil rfloc))))
(defun avy-org-goto-heading-timer (&optional arg)
"Read one or many characters and jump to matching Org headings.
- [elpa] master 8606a89 072/110: avy.el (avy--process): Remove redundant copy-sequence, (continued)
- [elpa] master 8606a89 072/110: avy.el (avy--process): Remove redundant copy-sequence, Oleh Krehel, 2019/05/11
- [elpa] master 002b8f3 091/110: avy.el (avy--visible-p): Add to fix org-toggle-link-display, Oleh Krehel, 2019/05/11
- [elpa] master 16482e0 089/110: avy.el (avy--generic-jump): Remove `style' arg, Oleh Krehel, 2019/05/11
- [elpa] master 909483e 090/110: avy.el (avy--process): Make `overlay-fn' arg optional, Oleh Krehel, 2019/05/11
- [elpa] master 24b5137 087/110: Ignore mistyping when no candidates available, Oleh Krehel, 2019/05/11
- [elpa] master c4e2d50 077/110: avy.el: avy-goto-char will now display shortest overlays for cands near point, Oleh Krehel, 2019/05/11
- [elpa] master 1de6233 076/110: Add avy-goto-end-of-line, Oleh Krehel, 2019/05/11
- [elpa] master c2e2a4a 083/110: avy.el (avy--read-candidates): Custom keys for deleting last read char, Oleh Krehel, 2019/05/11
- [elpa] master 4f1b8a1 086/110: avy.el: Fix compiler warnings, Oleh Krehel, 2019/05/11
- [elpa] master e7c0fc0 088/110: avy.el (avy-pre-action): New defvar, Oleh Krehel, 2019/05/11
- [elpa] master bcc0cb0 085/110: avy.el (avy-org-refile-as-child): Don't refile when avy aborted,
Oleh Krehel <=
- [elpa] master 6331b7a 071/110: avy.el (avy--process): Fix avy-goto-line for empty buffer, Oleh Krehel, 2019/05/11
- [elpa] master fd7b929 078/110: Add option to display an indented goto line overlay, Oleh Krehel, 2019/05/11
- [elpa] master 70e384a 073/110: avy.el (avy--process-1): Extract, Oleh Krehel, 2019/05/11
- [elpa] master cd8fb10 081/110: avy.el (avy--read-candidates): Quit on ESC, Oleh Krehel, 2019/05/11
- [elpa] master df4c4ac 084/110: Show number of matches so far in prompt, Oleh Krehel, 2019/05/11
- [elpa] master 93d4bd2 066/110: avy.el: Fix indentation, Oleh Krehel, 2019/05/11
- [elpa] master 157486a 079/110: avy.el: Fix compiler warning, Oleh Krehel, 2019/05/11
- [elpa] master abe150c 082/110: Introduce single candidate jump customization, Oleh Krehel, 2019/05/11
- [elpa] master a29558d 080/110: Add C-h/DEL/RET info to README for avy-goto-char-timer, Oleh Krehel, 2019/05/11
- [elpa] master 7c40f5e 075/110: avy.el (avy--process): Fix the candidates list being modified when restarting, Oleh Krehel, 2019/05/11