0

I have defined the following:

(defun narrow-into []
  (narrow-to-defun)
  (hs-show-block))
(define-key evil-normal-state-map (kbd "zi") 'narrow-into)

My Goal

The goal is that I can open up a file, hit "zi", and it will (1) narrow to the current defn and (2) open it up for editing.

My Problem

When I try to run it, I get "Wrong type argument: commandp, narrow-into"

Question

What am I doing wrong and how do I fix it?

Drew
  • 29,895
  • 7
  • 74
  • 104
eav db
  • 595
  • 3
  • 13
  • FYI there's also http://emacs.stackexchange.com/ – pawel Nov 10 '16 at 09:09
  • There are additional duplicates or near duplicates of this question. For instance, [this question](https://stackoverflow.com/questions/378942/what-does-interactive-mean-in-an-emacs-lisp-function). – Drew Nov 10 '16 at 17:09
  • Sorry! Did not see the duplicates. Thanks for suggestion on emacs.stackexchange! – eav db Nov 10 '16 at 22:50

1 Answers1

2

You need to declare your function interactive if you want to call it interactively. That explains the error you are getting. Other than that, the brackets should be parens:

(defun narrow-into ()
  (interactive)
  (narrow-to-defun)
  (hs-show-block))
juanleon
  • 9,220
  • 30
  • 41