I want to slightly alter the behavior of counsel-fzf by locally changing the definition of counsel-fzf-action, which activates in the end of the definition of the former. See the source code of counsel-fzf (please pay attention to the second last line):
(defun counsel-fzf (&optional initial-input initial-directory fzf-prompt) (interactive (let ((fzf-basename (car (split-string counsel-fzf-cmd)))) (list nil (when current-prefix-arg (counsel-read-directory-name (concat fzf-basename " in directory: ")))))) (counsel-require-program counsel-fzf-cmd) (setq counsel--fzf-dir (or initial-directory (funcall counsel-fzf-dir-function))) (ivy-read (or fzf-prompt "fzf: ") #'counsel-fzf-function :initial-input initial-input :re-builder #'ivy--regex-fuzzy :dynamic-collection t :action #'counsel-fzf-action ; <=== This is what I'll alter :caller 'counsel-fzf)) To slightly alter it, I tried nulling #'counsel-fzf-action locally by cl-flet.
(cl-flet ((counsel-fzf-action (x) nil)) (counsel-fzf)) Question
However, the global function counsel-fzf-action is executed instead of the local one. This confuses me because shouldn't the local function gets favored first?