How to install SLIME+SBCL+Quicklisp into Emacs

SLIME – SLIME is a Emacs mode for Common Lisp development. Inspired by existing systems such Emacs Lisp and ILISP, we are working to create an environment for hacking Common Lisp in. (https://common-lisp.net/project/slime/)

SBCL – Steel Bank Common Lisp (SBCL) is a high performance Common Lisp compiler. It is open source / free software, with a permissive license. In addition to the compiler and runtime system for ANSI Common Lisp, it provides an interactive environment including a debugger, a statistical profiler, a code coverage tool, and many other extensions. (http://www.sbcl.org/)

Quicklisp – Quicklisp is a library manager for Common Lisp. It works with your existing Common Lisp implementation to download, install, and load any of over 1,200 libraries with a few simple commands. (https://www.quicklisp.org/beta/)


This article is a simple instruction for installing SLIME, SBCL and Quicklisp into Emacs, which is the environment I recommend for learning Common Lisp.

Step 1 – Install SLIME

Firstly, you need to install the SLIME by MELPA or Git. Basically, the package in MELPA is always stable, while the files in official Git repository are newest.

If you choose to install it by MELPA, add lines below into your .emacs file.

(require 'package)
(add-to-list 'package-archives
'("melpa"     . "http://melpa.milkbox.net/packages/"))
(package-initialize)

After that, you should be able to install SLIME by M-x package-install RET slime RET. If you found that there is no package named “slime” in the list, running M-x package-refresh-contents will fix it.

By using Git, you need to run these commands in your terminal.

cd path/where/you/want/slime/installed
git clone https://github.com/slime/slime.git

Then add lines below into your .emacs file.

(add-to-list 'load-path "path/of/slime")
(require 'slime-autoloads)

Step 2 – Install SBCL

Download the source archive in official site and unzip it. Run commands below in your terminal after doing that.

cd path/where/files/unzipped
sh install.sh

SBCL should be installed right now, to make sure, run sbcl in your terminal, there should be a banner produced like this.

This is SBCL 1.2.14, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/&gt;.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
*

And you can install it by cloning the git repository (git://git.code.sf.net/p/sbcl/sbcl) as well.

After the steps above are done, add the line below into your .emacs file.

(setq inferior-lisp-program "path/of/sbcl")

The path of sbcl can be known by running command “which sbcl” in your terminal.

Step 3 – Install Quicklisp

Download the file for installation. (https://beta.quicklisp.org/quicklisp.lisp)

Then run sbcl with that file loaded by this command.

sbcl --load path/of/quicklisp.lisp

After sbcl launched, type in the command below.

(quicklisp-quickstart:install)

At this moment, Quicklisp has already been installed. If you want to load Quicklisp every time you start Lisp (which is recommended), type in command below.

(ql:add-to-init-file)

Then, type in the command which will create a file you can load in Emacs that configures the right load-path for loading Quicklisp’s installation of SLIME.

(ql:quickload "quicklisp-slime-helper")

Now, you should be able to see a message looks like this.

To use, add this to your ~/.emacs:

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

As we have already set for sbcl, you just need to copy the first line into your .emacs file.

Step 4 – Enjoy Common Lisp

The basic installation has already been done. You can enjoy that by running M-x slime in your Emacs.

How to setup GNU GLOBAL for Emacs (MAC)

GNU GLOBAL is a source code tagging system that works the same way across diverse environments, such as Emacs editor, Vi editor, Less viewer, Bash shell, various web browsers, etc. (http://www.gnu.org/software/global/)


 

This article is an instruction for installing GNU GLOBAL into your Emacs with MAC OS X.

Step 1 – Install GLOBAL

Users of MAC OS X are able to install GLOBAL simply by using Macports or Homebrew.

For example, if you are using the Macports, type in the command below in terminal.

sudo port install global

Step 2 – Download gtags.el

Download the newest source archive in official site, and unzip it. You should find the file named “gtags.el” in the folder unzipped. Then you can put it wherever you like.

Step 3 – Setup .emacs file

After installing of GLOBAL, we need to setup .emacs file by adding lines below into it.

(setq load-path (cons "path of global" load-path))
(setq load-path (cons "path of gtags" load-path))
(setq load-path (cons "path of gtags.el" load-path))
(autoload 'gtags-mode "gtags" "" t)

The path of global and gtags can be known by typing in “which global” and “which gtags” in terminal.

Optionally, you can add some keybinding for gtags by adding lines below.

(setq gtags-mode-hook
'(lambda ()
(local-set-key "\M-t" 'gtags-find-tag)
(local-set-key "\M-r" 'gtags-find-rtag)
(local-set-key "\M-s" 'gtags-find-symbol)
(local-set-key "\C-t" 'gtags-pop-stack)
))

And by now, you are able to load GLOBAL by M-x gtags-mode in Emacs. By adding lines below, you can make emacs load gtags-mode automatically when c-mode or c++-mode is loaded.

(setq c-mode-hook
'(lambda ()
(gtags-mode 1)))
(setq c++-mode-hook
'(lambda ()
(gtags-mode 1)))

GLOBAL supports Awk, Dos batch, COBOL, C, C++, C#, Erlang, Fortran, Java, JavaScript, Lisp, Lua, Pascal, Perl, PHP, Python, Ruby, Matlab, OCaml, Scheme, Tcl, TeX, Verilog, Vhdl and Vim.

Step 4 – Enjoy yourself

Now you are done with installing and should be able to use gtags-mode in your emacs.

To use it, for example, type in the command below in your terminal.

cd path-where-you-want-to-use-gtags-mode
gtags -v

After doing this, a few files for gtags will be created under target directory. And you can use gtags-mode when you are reading the file of that directory in Emacs.

How to remove an icon from LaunchPad in Mac

Basically, we can remove the icon of an application by just uninstalling it. But sometimes things would become a little complicated.

For example, I might have once installed chrome onto my Mac long time ago and then uninstalled it. (Maybe some other pattern, I’ve forgotten.) And now I installed it again, but I noticed that there is an extra icon for each chrome app such as Gmail, Google Search and Google Drive. I went to chrome://apps and removed everything from my chrome and one icon for each of that app has gone with the extra ones still there. So I believe the extra icons were there since my first installation of chrome.

In order to send them away, I tried some tricks that mentioned in internet but none of them worked. But I found that the files related to dock and launchpad are always with extension named “.db”. That means the information of the launchpad is stored in a database file which also means that we should be able to modify or even delete entries directly in that database file with a database management application.

Keeping searching in the internet, I found the location of launchpad’s database and the command to modify it, finally. That command is as below.

sqlite3 $(sudo find /private/var/folders -name com.apple.dock.launchpad)/db/db "DELETE FROM apps WHERE title='APP_NAME_CASE_SENSITIVE';" && killall Dock

This command uses sqlite3 to find that database file at /private/var/folders and modify it with a SQL command. Then kills the dock. After executing that in terminal and waiting for a second so that the dock will restart automatically, I opened the launchpad and the annoying icon is gone.

However, according to the person who provided this command, it seems that this is only available if you are using the Yosemite.

Hope that the article will help more people who are suffering with the same problem.