emacs not accepting lambda in after-change-functions -
i'm attempting overload after-change-functions in given buffer through class method. notify-others-of-change arbitrary function.
(defmethod set-after-change-functions ((server server-class) name-of-buffer) "adds appropriate after-change-functions given name-of-buffer." (with-current-buffer name-of-buffer (setq-local after-change-functions (cons (lambda (beg end prev-length) (notify-others-of-change server beg end prev-length)) after-change-functions))))
when attempting run on given buffer (passing in valid server object, checked), emacs yells @ me "symbol's value variable void: server" , after-change-functions goes nil, if there elements in before. however, when changed to
(defmethod set-after-change-functions ((server server-class) name-of-buffer) "adds appropriate after-change-functions given name-of-buffer." (with-current-buffer name-of-buffer (setq-local after-change-functions (cons #'notify-others-of-change-simple after-change-functions))))
where notify-others-of-change-simple basic after-change function accepts 3 arguments in lambda above, seems work. i'd prefer use lambda here, appears it's not possible. why problem occurring , possible change allow lambdas used?
setting lexical-binding t file-local variable described in question linked legoscia, along making sure sharp-quote lambdas instead of quoting, managed fix problem. thanks!
Comments
Post a Comment