Code Monkey home page Code Monkey logo

Comments (5)

bcarrell avatar bcarrell commented on May 27, 2024

Its a void variable probably because you're attempting to set the key before the mode is loaded. You should double check that lispy is loaded before trying to define the key in the map.

from lispy.

c02y avatar c02y commented on May 27, 2024

OK, eval-after-load solved this Debugger entered--Lisp error: problem.

But the real problem is I cannot disable a key binding defined in lispy.

I have to quote my real problem.

lispy-newline-and-indent-plain basically do nothing but newline-and-indent, the thing is I made a defun in my .emacs to make RET more powerful, so the (define-key map (kbd "RET") 'lispy-newline-and-indent-plain) in lispy.el is in conflict with my RET.

and

And there is another function called lispy-move-end-of-line, but I got a more powerful customized C-e, I really need to disable lispy-move-end-of-line.

I believe there are more examples like these two.

So as I said in #30, since you use a lot of lispy-xx to replace the default bindings, I hope you can give us the abilities to disable them if we want, but I tries many ways, I cannot disable a single key binding defined in lispy.

If there is no way I can disable key binding of lispy without touching lispy.el, you should modify lispy package, check out rebox2

from lispy.

abo-abo avatar abo-abo commented on May 27, 2024

The simplest way to redefine bindings is like this:

(require 'lispy)
(define-key lispy-mode-map (kbd "RET") 'newline-and-indent)

Here's the actual approach that I'm using (requires use-package package):

(use-package lispy
    :load-path "~/git/lispy"
    :init
    (progn
      (define-key lispy-mode-map (kbd "φ") 'lispy-parens)
      (define-key lispy-mode-map (kbd "σ") 'lispy-braces)
      (define-key lispy-mode-map (kbd "ρ") 'lispy-brackets)
      (define-key lispy-mode-map (kbd "θ") 'lispy-quotes)
      (define-key lispy-mode-map (kbd "C-φ") 'lispy-parens-down)
      (define-key lispy-mode-map (kbd "χ") 'lispy-out-forward)
      (define-key lispy-mode-map "π" 'lispy-ace-char)
      (define-key lispy-mode-map "κ" 'lispy-ace-paren)
      (define-key lispy-mode-map (kbd "C-M-a") 'lispy-beginning-of-defun)
      (define-key lispy-mode-map (kbd "C-x C-j") 'lispy-debug-step-in)
      (define-key lispy-mode-map (kbd "C-8") nil)
      (define-key lispy-mode-map (kbd "C-9") nil)))

from lispy.

abo-abo avatar abo-abo commented on May 27, 2024

To disable a binding of lispy-mode and have the global one take over,
do this:

(define-key lispy-mode-map (kbd "RET") nil)

from lispy.

c02y avatar c02y commented on May 27, 2024

I know why I failed to disable the RET in lispy, because I disable it in

 (add-hook 'emacs-lisp-mode-hook 
      (lambda () 
           '(progn 
                (lispy-mode 1)
                (define-key lispy-mode-map (kbd "RET") nil))))

it will fail, or in

(eval-after-load "lispy-mode"
    '(define-key lispy-mode-map (kbd "RET") nil))

it should be "lispy" not "lispy-mode".

from lispy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.