WIN下scheme语言编程环境的搭建

  • 概要
    • 下载并安装emacs
    • 下载并安装chezscheme
    • 配置
    • 使用
    • 尾声

概要

在windows系统下(并不合适,阻力好大),使用chezscheme+emacs 搭建scheme语言的编程环境.

下载并安装emacs

请自行搜索并下载安装emacs(用来和语言实现交互的文本编辑器)

下载并安装chezscheme

在Github是有windows系统可用的安装包的,安装chezscheme后记得将要用的.exe文件配置到win系统的系统环境变量path中.一般会有两个版本的.exe文件,线程功能不同.
下文中 M 表示 Alt C 表示 Ctrl C-c 表示 Ctrl+c

配置

  1. 修改emacs/site-lisp下的subdirs.el,添加以下几行

`(defun fullpath-relative-to-call-location (file-path) (concat (file-name-directory (or load-file-name buffer-file-name)) file-path))

(defalias 'fullpath 'fullpath-relative-to-call-location)

(load (fullpath “…/CFG/init.el”) )`

注意CFG会在subdirs.el的上一级路径中,比如subdirs.el位于…\emacs-28.1\share\emacs\site-lisp,那么CFG就应当在…\emacs-28.1\share\emacs中

参考博文 https://blog.csdn.net/weixin_33208391/article/details/116579680
2. 在路径 *…\emacs-24.3* 中新建 CFG 文件夹
3. 在CFG文件家中建立init.el文件(可以新建文本文件,将后缀.txt改为.el,查看不了文件后缀的,自行搜索解决)
4. 打开init.el文件,在其中粘贴以下代码:

(message "Init init.el!")
;;-SET-ENVIRONMENT--------------------------------------------------------------------------------------------
(setq jinz-default-dir (concat default-directory "/../CFG"))
(setq jinz-default-path (concat default-directory "/.."))
(setq source-directory (concat jinz-default-path "/24.3"))
(setq-default frame-title-format (concat "%b - e@" (system-name)))
(setq user-init-file jinz-default-path)
(setq user-emacs-directory jinz-default-dir)
(setenv "HOME" jinz-default-dir)
(setenv "PATH" jinz-default-path)
;; set the default file path
(add-to-list 'load-path jinz-default-dir)
;; window-system 表示是否为x窗体,其判断为:
;; (if window-system nil)
;; (if (not window-system) nil);; system-type 表示系统类型
(cond((string-equal system-type "windows-nt") ; Microsoft Windows(progn(message "Microsoft Windows") ))((string-equal system-type "darwin") ; Mac OS X(progn(message "Mac OS X")))((string-equal system-type "gnu/linux") ; linux(progn(message "Linux") )))
  1. CFG文件夹中新建 .emacs 文件(emacs配置文件),打开后在其中粘贴如下代码:
(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.'(case-fold-search nil)'(column-number-mode t)'(cua-mode t nil (cua-base))'(current-language-environment "utf-8")'(safe-local-variable-values (quote ((package . net\.aserve\.client) (package . net\.aserve) (package . net\.html\.generator))))'(show-paren-mode t)'(text-mode-hook (quote (text-mode-hook-identify)))'(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(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.)
;============================================
(set-language-environment "utf-8")
;注意,下行不能u8,否则打开汉语名文件不显示内容
(setq file-name-coding-system 'gb18030)
(set-buffer-file-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-next-selection-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-clipboard-coding-system 'utf-8)
(setq ansi-color-for-comint-mode t)
(modify-coding-system-alist 'process "*" 'utf-8)
(setq-default pathname-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(setq default-process-coding-system '(utf-8 . utf-8))
(setq locale-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(setq slime-net-coding-system 'utf-8-unix)
;;===============================
;设置行号
(global-linum-mode 1)
(setq linum-format "%d")
(set-cursor-color "white")
(set-mouse-color "blue")
(set-foreground-color "green")
(set-background-color "black")
(set-border-color "lightgreen")
(set-face-foreground 'highlight "red")
(set-face-background 'highlight "lightblue")
(set-face-foreground 'region "darkcyan")
(set-face-background 'region "lightblue")
(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")
;将帮助命令绑定到 F1键
(global-set-key [f1]   'help-command)
(global-set-key "\C-c\M-q" 'slime-reindent-defun);;;======================================注意可移动模式,不然每次都要改
;;;关于scheme需要的包
;注意有时路径不对依旧可以启动scheme-mode
;下行需使用scheme.exe所在的路径
(add-to-list 'exec-path "C:\\Program Files\\Chez Scheme 9.5\\bin\\ta6nt")
(add-to-list 'load-path "C:\\Program Files\\Chez Scheme 9.5\\bin\\ta6nt");paredit是一个插件,M+x paredit-mode启动,
(autoload 'paredit-mode "paredit""Minor mode for pseudo-structurally editing Lisp code."t);; scheme配置
(require 'cmuscheme)
;ALT+x scheme-mode 即可对一个buffer开启scheme模式
(setq scheme-program-name "scheme");; bypass the interactive question and start the default interpreter
(defun scheme-proc ()"Return the current Scheme process, starting one if necessary."(unless (and scheme-buffer(get-buffer scheme-buffer)(comint-check-proc scheme-buffer))(save-window-excursion(run-scheme scheme-program-name)))(or (scheme-get-process)(error "No current process. See variable `scheme-buffer'")))(defun scheme-split-window ()(cond((= 1 (count-windows))(delete-other-windows)(split-window-vertically (floor (* 0.68 (window-height))))(other-window 1)(switch-to-buffer "*scheme*")(other-window 1))((not (find "*scheme*"(mapcar (lambda (w) (buffer-name (window-buffer w)))(window-list)):test 'equal))(other-window 1)(switch-to-buffer "*scheme*")(other-window -1))))(defun scheme-send-last-sexp-split-window ()(interactive)(scheme-split-window)(scheme-send-last-sexp))(defun scheme-send-definition-split-window ()(interactive)(scheme-split-window)(scheme-send-definition))(add-hook 'scheme-mode-hook(lambda ()(paredit-mode 1)(define-key scheme-mode-map (kbd "<f5>") 'scheme-send-last-sexp-split-window)(define-key scheme-mode-map (kbd "<f6>") 'scheme-send-definition-split-window)))

5.geiser配置,在.emacs文件中加入如下代码(记得将geiser解压到CFG/.emacs.d/路径下,没有的话,请去github下载geiser):

(load-file "~/.emacs.d/geiser-0.9/elisp/geiser.el") ;
(setq geiser-active-implementations '(chez))

geiser可以帮助emacs和chezscheme更好地交流,解决很多奇怪的问题, geiser是有使用手册的, 不长, C-c C-z 估计是最常用的:)
6.scheme代码自动索引和补全的配置,需要插件popup , fuzzy , pos-tip, auto-complete以及ac-geiser,这些都需要去github下载,解压到CFG/.emacs.d/路径下配置到emacs能找到就OK了

;; ==============================================代码自动补全==============================
;; ac的前件
;(setq expls '(popup fuzzy))
;(map 'require expls)
(add-to-list 'load-path "~/.emacs.d")
(require 'popup)
(require 'fuzzy)(add-to-list 'load-path "~/.emacs.d/auto-complete")
(require 'auto-complete)
(require 'auto-complete-config)(global-auto-complete-mode t)       ;全局自动补全;; 使用自带字典
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
(ac-config-default);; 输入2个字符才开始补全
(setq ac-auto-start 2);; 0输入即开始补全的快捷键
(global-set-key "\M-/" 'auto-complete)  ;; 使用增强的pos-tip
(require 'pos-tip)
(setq ac-quick-help-prefer-pos-tip t);;使用quick-help
(setq ac-use-quick-help t)
(setq ac-quick-help-delay 0.5);; Show 0.8 second later
(setq ac-auto-show-menu 0.8);;设置tab的使用模式--??
;;(setq ac-dwim t);;ʹ使用fuzzy的模糊匹配
(setq ac-fuzzy-enable t);;菜单参数
(setq ac-menu-height 12)
(set-face-background 'ac-candidate-face "lightgray")
(set-face-underline 'ac-candidate-face "darkgray")
(set-face-background 'ac-selection-face "steelblue")  ;; =========================================== ac-geiser配置========================
(add-to-list 'load-path "~/.emacs.d/ac-geiser")
(require 'ac-geiser)
(add-hook 'geiser-mode-hook 'ac-geiser-setup)
(add-hook 'geiser-repl-mode-hook 'ac-geiser-setup)
(eval-after-load "auto-complete"'(add-to-list 'ac-modes 'geiser-repl-mode))
  1. CFG文件夹中放入paredit.el文件(一个编辑器插件,用来高效处理lisp代码,提供括号自动匹配等功能)paredit.el应该也是可以下载到的.

使用

  1. emacs运行后,按C-c C-z, chezscheme就启动了
  2. 或者新建.ss文件,拖动到emacs窗口,再C-c C-z
  3. 接下来愉快地弹奏代码就OK.

尾声

目前就这样了,还请各位多多指教.

windows系统下scheme语言编程环境的搭建相关推荐

  1. linux c语言工具,Linux下C语言编程环境的工具.doc

    Linux下C语言编程环境的工具 Linux下C语言编程环境的工具 Linux下C语言编程环境的工具 要想在Linux下进行C语言编程,首先得搭建好一个编程环境.这里分别说明一下几个非常有用的软件包. ...

  2. GCC编译器简明教程(Linux下C语言开发环境的搭建)

    GCC编译器简明教程(Linux下C语言开发环境的搭建) 市面上常见的Linux都是发行版本,典型的Linux发行版包含了Linux内核.桌面环境(例如GNOME.KDE.Unity等)和各种常用的必 ...

  3. linux系统下c语言编程的,Linux操作系统下C语言编程从零开始

    这里向大家介绍一下在Linux/UNIX 的机器上,进行 C/C++ 编程的一些入门级知识. · 所需具备的背景知识 · 开发所需的基本环境 · 获得帮助的途径 · 通过一个实例了解基本步骤 Prer ...

  4. Windows系统下R语言环境搭建及高级图表绘制

    1.R语言环境及其编译软件下载安装: 链接:https://pan.baidu.com/s/186hjytYEqJB2kDUed0beAA  提取码:mtwh 先安装R-4.0.3-win.exe,这 ...

  5. Linux Ubuntu系统下配置c++编程环境

    一.前提: 1.本文环境采用的是VirtualBox搭建的Ubuntu 20 操作系统. 2.需了解Ubuntu的基本命令以及其他基本命令. 3.具备c语言或c++编程知识. 二.演示IDE简介: I ...

  6. windows系统下 VUE cli手脚架环境安装

    1.安装 node.js环境  (cmd命令工具里输入 node -v 检测是否安装成功) 2.安装VUE 全局环境 npm install --global vue-cli (cmd命令工具里面安装 ...

  7. windows php7 apache,windows系统下php7+apache2.4环境搭建

    一下载php7 到 http://windows.php.net/download/  下载php7,解压下载的文件,配置php扩展目录及php.ini配置项,打开extension_dir = &q ...

  8. windows系统下HMailServer免费邮件服务器简易搭建

    前几天接到一老同学打来电话要我帮她做一个免费简单点的邮件服务器的方案,向她了解了一下情况: 1:公司目前在发展阶段,20台电脑左右 2:未有搭建域环境,无专人管理网络.3:公司有一台对外邮件服务器,花 ...

  9. 最新Windows下Go语言开发环境搭建+GoLand配置

    一.下载Go语言开发包 大家可以在Go语言官网(https://golang.google.cn/dl/)下载 Windows 系统下的Go语言开发包,如下图所示. 这里我们下载的是 64 位的开发包 ...

  10. Linux下C语言编程

    第1章 Linux下C语言编程简介 本章将简要介绍一下什么是Linux,C语言的特点,程序开发的预备知识,Linux下C语言开发的环境,程序设计的特点和原则以及编码风格等.通过本章的学习,可以对在Li ...

最新文章

  1. SpringMVC项目前台利用ajaxFileUpload传递图片后台接收
  2. English trip M1 - AC6 How to make salad? Teacher:Patrick
  3. crontab 定时任务配置
  4. Qt Creator的下载和安装
  5. VC++ 轻松实现“闪屏” SplashWnd
  6. IIS 之 Asp.Net项目内部运行详解
  7. 并查集(UnionFindSet)
  8. Execution in the Kingdom of Nouns (名词王国中的死刑)
  9. Memcache 和 Radis 比较
  10. 服务器怎么操作系统版本,服务器怎么操作系统版本
  11. Hadoop学习总结(2)——Hadoop入门详解
  12. CentOS6上安装Flash Player
  13. 微信小程序的开篇文章----小程序更新推荐
  14. 全球顶级银行资管子公司的启示
  15. jdbc mysql 存储过程执行失败_JDBC连接执行MySQL存储过程报权限错误
  16. 全网最全-固定资本存量分省、市、地区、产业-含计算过程
  17. EMUELEC游戏添加删除工具
  18. Azure:云平台概述
  19. 触控操作新体验 云智汇M11记录仪首测
  20. 用html5 js实现浏览器全屏

热门文章

  1. 推荐几款网页截图工具可以全屏截图,也可对图片编辑
  2. 万亿估值来了!3次大难不死,蚂蚁金服终于登顶世界第一
  3. mysql netbeans_关于netbeans与mysql连接问题
  4. 房地产企业项目管理的特点与目标
  5. 我的helper模块(Python)
  6. 谈谈网络蜘蛛 爬开心网001的一些体会
  7. 怎样运行一个php的项目,第一章 如何加载运行已发布的PHP项目
  8. Excel表格转换为Word表格,并且保留Excel表格中公式不发生变化
  9. git(4)服务器上的 Git
  10. elasticsearch 使用