When I typed C-y
to call yank
, I got this.
apply: Symbol's value as variable is void: n
Debugger entered--Lisp error: (void-variable n)
ad-Advice-current-kill( ... [interprogram-paste-function interprogram-cut-function kill-ring kill-ring-yank-pointer yank-pop-change-selection 0 nil mapc kill-new error "Kill ring is empty" mod] 6 2016971] 0)
apply(ad-Advice-current-kill ... [interprogram-paste-function interprogram-cut-function kill-ring kill-ring-yank-pointer yank-pop-change-selection 0 nil mapc kill-new error "Kill ring is empty" mod] 6 2016971] 0)
current-kill(0)
yank(nil)
call-interactively(yank nil nil)
command-execute(yank)
The '...' in the traceback is messy code.
I have found it's this sentence that caused this error.
(require 'multiple-cursors)
The contents after querying function current-kill
.
current-kill is a compiled Lisp function in `simple.el'.
(current-kill ARG1 &optional ARG2)
:around advice: `ad-Advice-current-kill'
And the contents after pressing ad-Advice-current-kill
.
ad-Advice-current-kill is a compiled Lisp function.
(ad-Advice-current-kill AD--ADDOIT-FUNCTION ARG1 &optional ARG2)
Before-advice `interprogram-paste-for-all-cursors'.
It's really inconvenient that yank can't work. Hoping to solve it quickly, I post the source code for interprogram-paste-for-all-cursors
(defadvice current-kill (before interprogram-paste-for-all-cursors activate)
(let ((interprogram-paste (and (= n 0)
interprogram-paste-function
(funcall interprogram-paste-function))))
(when interprogram-paste
;; Add interprogram-paste to normal kill ring, just
;; like current-kill usually does for itself.
;; We have to do the work for it tho, since the funcall only returns
;; something once. It is not a pure function.
(let ((interprogram-cut-function nil))
(if (listp interprogram-paste)
(mapc 'kill-new (nreverse interprogram-paste))
(kill-new interprogram-paste))
;; And then add interprogram-paste to the kill-rings
;; of all the other cursors too.
(mc/for-each-fake-cursor
(let ((kill-ring (overlay-get cursor 'kill-ring))
(kill-ring-yank-pointer (overlay-get cursor 'kill-ring-yank-pointer)))
(if (listp interprogram-paste)
(mapc 'kill-new (nreverse interprogram-paste))
(kill-new interprogram-paste))
(overlay-put cursor 'kill-ring kill-ring)
(overlay-put cursor 'kill-ring-yank-pointer kill-ring-yank-pointer)))))))