branch: master commit 245b5d62feb6f276971be53e63311de4a243bfbc Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
avy.el: Fix compile warnings Re #214 --- avy.el | 69 ++++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/avy.el b/avy.el index 64353a6..16e4180 100644 --- a/avy.el +++ b/avy.el @@ -538,39 +538,6 @@ multiple DISPLAY-FN invokations." (funcall avy-handler-function char)))) (cdar alist)))) -;; ** Org-mode - -(defun avy-org-refile-as-child () - "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))) - -(defun avy-org-goto-heading-timer (&optional arg) - "Read one or many characters and jump to matching Org headings. -The window scope is determined by `avy-all-windows' (ARG negates it)." - (interactive "P") - (let ((avy-all-windows (if arg - (not avy-all-windows) - avy-all-windows))) - (avy-with avy-goto-char-timer - (avy--process - (avy--read-candidates - (lambda (input) - (format "^\\*+ .*\\(%s\\)" input))) - (avy--style-fn avy-style)) - (org-back-to-heading)))) - ;;** Rest (defun avy-window-list () "Return a list of windows depending on `avy-all-windows'." @@ -1905,6 +1872,42 @@ The window scope is determined by `avy-all-windows' (ARG negates it)." (error (set-mark-command 4))))) +;; ** Org-mode +(defvar org-reverse-note-order) +(declare-function org-refile "org") +(declare-function org-back-to-heading "org") + +(defun avy-org-refile-as-child () + "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))) + +(defun avy-org-goto-heading-timer (&optional arg) + "Read one or many characters and jump to matching Org headings. +The window scope is determined by `avy-all-windows' (ARG negates it)." + (interactive "P") + (let ((avy-all-windows (if arg + (not avy-all-windows) + avy-all-windows))) + (avy-with avy-goto-char-timer + (avy--process + (avy--read-candidates + (lambda (input) + (format "^\\*+ .*\\(%s\\)" input))) + (avy--style-fn avy-style)) + (org-back-to-heading)))) + (provide 'avy) ;;; avy.el ends here