简体   繁体   中英

Emacs trident-mode key-binding not getting activated

I am a beginner in Emacs. I am trying to use trident-mode (for Parenscript). I have copied the commands from the trident-mode site trident-site-here into my init.el file. But the trident-mode keybindings Cc Ce don't work. I am copy-pasting my complete init.el file below:


;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.

;;;; Added from Melpa.org

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  ;; Comment/uncomment this line to enable MELPA Stable if desired.  See `package-archive-priorities`
  ;; and `package-pinned-packages`. Most users will not need or want to do this.
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  )
; Commented coz it is there in the next line (package-initialize)

;;;; End Melpa.ord addition

(package-initialize)

(load (expand-file-name "~/quicklisp/slime-helper.el"))
;; Replace "sbcl" with the path to your implementation
(setq inferior-lisp-program "sbcl")

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (trident-mode))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight normal :height 158 :width normal)))))

;;; From Trident-model.el site on Github

(add-to-list 'auto-mode-alist (cons "\\.paren\\'" 'lisp-mode))
(add-hook 'lisp-mode-hook
          #'(lambda ()
              (when (and buffer-file-name
                         (string-match-p "\\.paren\\>" buffer-file-name))
                (unless (slime-connected-p)
                  (save-excursion (slime)))
                (trident-mode +1))))


;;;; From same site, key bindings

(trident-add-keys-with-prefix "C-c C-e")

;; The key sequence for trident-eval-region is "e r", so it's now bound to "C-c C-e er" 

**This is What is Not getting Activated**


One thing that I observe if I open a.paren file is that, repl buffer gets to top, and file buffer (where.paren file is shown) gets below. I don't know how to fix that. But I did interchange them by clicking on the buffer names to change. I don't know if it is relevant, but I am writing it just in case that is the culprit. If possible I would prefer regular (program text on top and repl buffer below) setting.

What am I doing wrong? Thanks for the help.

Edit-1: I have added link to the trident-mode-site.

Thanks Phils Phils' answer worked.

I am posting the change I made:

Earlier I was using:

(trident-add-keys-with-prefix "C-c C-e")

This was not working. With Phil's suggestion, I replaced that line with

(with-eval-after-load "trident-mode" (trident-add-keys-with-prefix "C-c C-e"))

This Worked .

I am a newbie, so I have detailed a seemingly simple/obvious answer. This is to help other newbies like me. We can get confused about the smallest of things. :-)

Phils , thank you again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM