5

You're compiling the file using lexical binding, so I suspect the problem is that your file does neither of the following: (defvar bibtex-completion-bibliography) (require 'bibtex-completion) either of which would tell the code in your file that bibtex-completion-bibliography is a dynamic variable. Without that information, the following creates a lexical ...


4

Lexical scope (recently added to emacs) changes the rules, and some documentation is still out of date. The current documentation for setq is this manual page which says When dynamic variable binding is in effect (the default), set has the same effect as setq, apart from the fact that set evaluates its symbol argument whereas setq does not. But when a ...


3

How to temporarily change the definition of a function? Calling a function by its (symbol) name means calling that symbol's function slot. So, to temporarily change the definition of a function that is called by its name, you need to temporarily modify its symbol-function value. The shortest way to do that is with cl-letf; see (info "(cl) Modify ...


2

Looking at Using Lexical Binding it appears that a needs to be defined special which in using setq it is not. Modifying your example to use defvar gives the answers expected. ;;; -*- lexical-binding: t; -*- (defvar b 5) (let ((b nil)) (setq b t) (print b)) ;; prints t (print b) ;; prints 5 (let ((b nil)) (set 'b t) (print b)) ;; prints t (...


1

There are many options for overriding functions, with many different behaviours. https://stackoverflow.com/questions/39550578/in-emacs-what-is-the-difference-between-cl-flet-and-cl-letf will probably resolve the confusion for you. The first thing to know is that cl-flet is not the same thing as flet! flet was dynamically scoped (and hence would have worked ...


1

You are out of luck here; this is the correct intended behavior. #'counsel-fzf-action refers to the global function definition of counsel-fzf-action, not the local one. The cl-flet binding is local, similar to the lexical binding of let: unless the variable being bound is dynamic (i.e., defined using defvar), the nested functions do not see the binding. Thus ...


Only top voted, non community-wiki answers of a minimum length are eligible