-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using avy-goto-line for goto-line
throws an error
#182
Comments
Can't reproduce on Emacs25. The last commit for avy was 3 weeks ago. So the cause is likely a regression by a change made to Emacs master (or your config). Can you reproduce with a stable version of Emacs and |
Argh. I feared that. Will deep dive into debug for this issue. |
This will be an interesting debug.. my config is fine.. works on emacs 25.1, doesn't work on master. |
Running update.. It is this line: (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* ((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)))) ; <<<<<<<<<<<<<<<<<<<<< THIS LINE
(unless (eq r t)
(avy-action-goto r)))))) That |
Just built master for like 20 minutes, a lot longer than what it used to take. Still no bug.
|
I can recreate the bug on emacs -Q using the master version: You can eval the below in emacs -Q and then do (defmacro emacs-pkg-debug-setup (pkg-alist &rest body)
"Install packages in PKG-ALIST and evaluate BODY.
Each element of PKG-ALIST has the form (((ID . LOCATION) . (PKG1 PKG2 ..)) ..).
The ID and LOCATION are the same as the ones in `package-archives'.
PKG1, PKG2, .. are package names from the ID archive.
Example usage:
1. Launch 'emacs -Q'.
2. Copy this macro definition to its scratch buffer and evaluate it.
3. Evaluate a minimum working example using this macro as below:
(emacs-pkg-debug-setup '(;; Install hydra from GNU Elpa
(nil . (hydra))
;; Install org from Org Elpa
((\"org\" . \"http://orgmode.org/elpa/\") . (org)))
;; Then evaluate the below forms
(org-mode)) "
(declare (indent 1) (debug t))
`(progn
(require 'package)
(setq user-emacs-directory (concat temporary-file-directory
(getenv "USER") "/" ".emacs.d-debug/"))
(setq package-user-dir (format "%selpa_%s/"
user-emacs-directory emacs-major-version))
(let (archive pkgs)
(dolist (archive-alist ,pkg-alist)
(setq archive (car archive-alist))
(when archive
(add-to-list 'package-archives archive :append))
(setq pkgs (append pkgs (cdr archive-alist))))
(package-initialize)
(package-refresh-contents)
(dolist (pkg pkgs)
(when (and pkg (not (package-installed-p pkg)))
(package-install pkg))
(require pkg))
,@body)))
(emacs-pkg-debug-setup '((nil . (avy)))
(message "Done!")) BTW the compiled code of emacs 26.x is incompatible with 25.x. So I keep separate elpa dirs for major versions. |
Interestingly, only the interactive call causes the error; |
Here's the backtrace from emacs -Q:
|
UPDATE: Re-compiling does not 'fix' it.. the problem goes away because I re-eval I then again tried the above method to recreate the problem in emacs -Q and I was able to do it. Then when I re-evaluated just |
I confirmed that this issue doesn't occur on emacs 25.2.1 too. Filed bug report. |
So if you remove |
Yes, that's correct. |
Turns out this bug was introduced by a different byte compilation implementation of cond/pcase/cl-case forms. As noted here, setting the Developer of this new feature, @vibhavp, has a patch which I have verified to have resolved this issue: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25941#14 So closing this ticket. Thanks @vibhavp! |
I confirmed the fix in http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=092071345f265efcd3abd6de01552ebe95ffb9a1 To the people who happen to come to this thread as they still see this problem: Make sure you byte-recompile the .el files.. I did that for all packages. (byte-recompile-directory package-user-dir nil :force) |
I needed to have a function like this after a bytecomp.el bug was fixed on emacs master (http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=092071345f265efcd3abd6de01552ebe95ffb9a1) that affected the `avy-goto-line` function from avy.el (abo-abo/avy#182).
I needed to have a function like this after a bytecomp.el bug was fixed on emacs master (http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=092071345f265efcd3abd6de01552ebe95ffb9a1) that affected the `avy-goto-line` function from avy.el (abo-abo/avy#182).
How to recreate the problem?
Backtrace
Emacs version: Latest build from master as of today.
The text was updated successfully, but these errors were encountered: