Cấu hình emacs, slime, sbcl để chạy cùng nhau.
Tất cả đều nằm trong file .emacs, nội dung tham khảo như bên dưới:
;;; Common Lisp Mode
;(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "/usr/local/bin/sbcl --noinform")
(add-to-list 'load-path "/home/nvntung/softs/slime/")
(add-to-list 'auto-mode-alist '("\\.lisp$" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.cl$" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.asd$" . lisp-mode))
(setq slime-net-coding-system 'utf-8-unix)
(set-language-environment "utf-8")
(require 'slime)
(slime-setup '(slime-repl))
;; (eval-after-load "slime"
;; '(progn
;; (setq slime-complete-symbol*-fancy t
;; slime-complete-symbol-function 'slime-fuzzy-complete-symbol
;; slime-when-complete-filename-expand t
;; slime-truncate-lines nil
;; slime-autodoc-use-multiline-p t)
;; (slime-setup '(slime-fancy slime-asdf))
;; (define-key slime-repl-mode-map (kbd "C-c ;")
;; 'slime-insert-balanced-comments)
;; (define-key slime-repl-mode-map (kbd "C-c M-;")
;; 'slime-remove-balanced-comments)
;; (define-key slime-mode-map (kbd "C-c ;")
;; 'slime-insert-balanced-comments)
;; (define-key slime-mode-map (kbd "C-c M-;")
;; 'slime-remove-balanced-comments)
;; (define-key slime-mode-map (kbd "RET") 'newline-and-indent)
;; (define-key slime-mode-map (kbd "C-j") 'newline)))
;; (add-hook 'lisp-mode-hook (lambda ()
;; (cond ((not (featurep 'slime))
;; (require 'slime)
;; (normal-mode)))
;; (indent-tabs-mode nil)
;; (pair-mode t)))
(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.
'(cua-mode t nil (cua-base))
'(safe-local-variable-values (quote ((Package . ASDF)))))
(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.
)
(defun kill-emacs-slime ()
(interactive)
(when (slime-connected-p)
(if (equal (slime-machine-instance) "Gregory-Gelfonds-MacBook-Pro.local")
(slime-quit-lisp)
(slime-disconnect)))
(slime-kill-all-buffers)
(save-buffers-kill-emacs))
(global-set-key (kbd "C-x C-c") 'kill-emacs-slime)
;; highlight text selection (on by default since emacs 23.2)
(transient-mark-mode 1)
;; make typing overwrite text selection
(setq delete-selection-mode 1) ; this turns on transient-mark-mode automatically
;;; Mot so mode
;; turn on highlight matching parens when cursor is on one
(setq show-paren-style 'parenthesis) ; highlight just parens
;(setq show-paren-style 'expression) ; highlight entire expression
(show-paren-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; (defun toggle-fullscreen ()
;; (interactive)
;; (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
;; '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
;; (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
;; '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
;; )
;; (toggle-fullscreen)
(defun set-frame-size-according-to-resolution ()
(interactive)
(if window-system
(progn
;; use 120 char wide window for largeish displays
;; and smaller 80 column windows for smaller displays
;; pick whatever numbers make sense for you
(if (> (x-display-pixel-width) 1280)
(add-to-list 'default-frame-alist (cons 'width 120))
(add-to-list 'default-frame-alist (cons 'width 80)))
;; for the height, subtract a couple hundred pixels
;; from the screen height (for panels, menubars and
;; whatnot), then divide by the height of a char to
;; get the height we want
(add-to-list 'default-frame-alist
(cons 'height (/ (- (x-display-pixel-height) 200)
(frame-char-height)))))))
(set-frame-size-according-to-resolution)
;;;;; ess-emacs
;;(setq load-path (cons "/usr/share/emacs/site-lisp/ess-5.14/lisp" load-path))
;;(require 'ess-site)
;;http://jekyll.math.byuh.edu/other/howto/R/RE.shtml
(add-to-list 'load-path "/home/nvntung/softs/ess-5.14/lisp/")
(require 'ess-site)
;; (add-to-list 'load-path "/media/Elements/Doctorate/Emacs/")
;; (require 'php-mode)
;; (autoload 'php-mode "php-mode" "Major mode for editing php code." t)
;; (add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
;; (add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))
;; (add-to-list 'load-path "/media/Elements/Doctorate/Emacs/mmm-mode-0.4.8/")
;; (require 'mmm-mode)
;; (setq mmm-global-mode 'maybe)
;; (mmm-add-mode-ext-class nil "\\.php3?\\'" 'html-php)
;; (mmm-add-classes
;; '((html-php
;; :submode php-mode
;; :front "<\\?\\(php\\)?"
;; :back "\\?>")))
;; (autoload 'php-mode "php-mode" "PHP editing mode" t)
;; (add-to-list 'auto-mode-alist '("\\.php3?\\'" . sgml-html-mode))
Save done!
Hiển thị các bài đăng có nhãn Emacs. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Emacs. Hiển thị tất cả bài đăng
Thứ Bảy, 20 tháng 10, 2012
Cấu hình emacs để chạy Common Lisp
Thứ Ba, 15 tháng 11, 2011
Soạn thảo mã lệnh Lisp với Emacs
Làm việc với Linux chắc chúng ta không quên emacs, một bộ soạn thảo cực kỳ mạnh mẽ và hiệu quả. Phần này sẽ giới thiệu cho các bạn một số mẹo vặt làm việc với nó.
Có nhiều ngôn ngữ sử dụng các dấu ngoặc để bắt đầu hoặc kết thúc một câu lệnh, chẳng hạn Scheme, Common Lisp, Clojure, hay XML. Nếu chúng ta cài đặt tính năng để emacs tự động highlight các dấu ngoặc (gồm có (, ), <, >) thì điều này cũng có hiệu lực cho các ngôn ngữ như nêu trên.
Lưu ý: Tất cả những trình bày ở dưới đều cấu hình trong file .emacs. Các tác giả [1] đã trình bày khá rõ ràng, tôi chỉ tóm tắt ở đây.
Cài đặt tiện ích làm sáng các dấu ngoặc
;; highlight text selection (on by default since emacs 23.2)
(transient-mark-mode 1)
;; make typing overwrite text selection
(setq delete-selection-mode 1) ; this turns on transient-mark-mode automatically
Hiển thị mode dấu ngoặc đơn
;; turn on highlight matching parens when cursor is on one
(show-paren-mode 1)
Tham khảo:
[1] http://xahlee.org/emacs/emacs_editing_lisp.html
Có nhiều ngôn ngữ sử dụng các dấu ngoặc để bắt đầu hoặc kết thúc một câu lệnh, chẳng hạn Scheme, Common Lisp, Clojure, hay XML. Nếu chúng ta cài đặt tính năng để emacs tự động highlight các dấu ngoặc (gồm có (, ), <, >) thì điều này cũng có hiệu lực cho các ngôn ngữ như nêu trên.
Lưu ý: Tất cả những trình bày ở dưới đều cấu hình trong file .emacs. Các tác giả [1] đã trình bày khá rõ ràng, tôi chỉ tóm tắt ở đây.
Cài đặt tiện ích làm sáng các dấu ngoặc
;; highlight text selection (on by default since emacs 23.2)
(transient-mark-mode 1)
;; make typing overwrite text selection
(setq delete-selection-mode 1) ; this turns on transient-mark-mode automatically
Hiển thị mode dấu ngoặc đơn
;; turn on highlight matching parens when cursor is on one
(show-paren-mode 1)
Tham khảo:
[1] http://xahlee.org/emacs/emacs_editing_lisp.html
Đăng ký:
Bài đăng (Atom)