Open sondr3 opened 6 years ago
Any way to make it look like org-indent-mode isn't enabled even when it is? Cheers smile
org-indent-mode
is black magic to me; I'm happy avy works with it as well as it does now.
Here's a modification of avy-goto-line
that disables and enables org-indent-mode
:
(defun avy-goto-line (&optional arg)
"Jump to a line start in current buffer.
When ARG is 1, jump to lines currently visible, with the option
to cancel to `goto-line' by entering a number.
When ARG is 4, negate the window scope determined by
`avy-all-windows'.
Otherwise, forward to `goto-line' with ARG."
(interactive "p")
(setq arg (or arg 1))
(if (not (memq arg '(1 4)))
(progn
(goto-char (point-min))
(forward-line (1- arg)))
(avy-with avy-goto-line
(let ((org-indent (bound-and-true-p org-indent-mode)))
(when org-indent
(org-indent-mode -1))
(let* ((avy-handler-old avy-handler-function)
(avy-handler-function
(lambda (char)
(if (or (< char ?0)
(> char ?9))
(funcall avy-handler-old char)
(let ((line (read-from-minibuffer
"Goto line: " (string char))))
(when line
(avy-push-mark)
(save-restriction
(widen)
(goto-char (point-min))
(forward-line (1- (string-to-number line))))
(throw 'done 'exit))))))
(r (avy--line (eq arg 4))))
(unless (eq r t)
(avy-action-goto r)))
(when org-indent
(org-indent-mode 1))))))
While it does what you ask, the UI response time isn't acceptable. So I don't want to make this modification.
If anyone manages to figure this out, PRs welcome.
Other workarounds: set avy-styles-alist
entry to either post
or at
.
I have the same issue, this closed ticket seems related: https://github.com/abo-abo/avy/issues/110
I'm having some issues with how
avy-goto-line
displays in Emacs when you are in a org-mode file withorg-indent-mode
activated. I can reproduce the error with the latest Emacs on master, Org version 9.1.6 and the latest Avy from MELPA.This is how it looks when I run
emacs -Q
, load into an org-mode file, doM-x org-indent-mode
andM-x load-file RET ~/.emacs.d/elpa/avy-20171230.220/avy.el RET
:When I disable
org-indent-mode
it looks fine:Any way to make it look like
org-indent-mode
isn't enabled even when it is? Cheers 😄