Emacs Packages and Development Environment

Table of Contents

Top

1 Useful Packages

1.1 Tools

  • Magit - Git interface for Emacs
  • company-mode- Completion framework
  • Helm - Menu with combobox-like interface.
  • EmacsWiki: Undo Tree
  • Projectile - Project Interaction Library for Emacs http://projectile.readthedocs.io
  • Evil-mode - VIM Emulation mode. Evil is an extensible vi layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions. - See Evil - WikEmacs
  • restclient - This is a tool to manually explore and test HTTP REST webservices. Runs queries from a plain-text query sheet, displays results as a pretty-printed XML, JSON and even images.

1.2 Utilities

From documentation:

El-Get allows you to install and manage elisp code for Emacs. It supports lots of different types of sources and is able to install them, update them and remove them, but more importantly it will init them for you. That means it will require the features you need, load the necessary files, set the Info paths so that C-h i shows the new documentation you now depend on, and finally call your own initialisation code for you to setup the extension. Or call it a package.

Features:

  • Download the package directly from source without central repository.
  • Asynchronous and fast download.
  • Easy Installation and update.
  • notmuch-emacs - Notmuch Emacs Interface - One of the more popular Notmuch message reading clients is notmuch.el, or notmuch-emacs, an Emacs major mode for interacting with Notmuch. It is included in the Notmuch package (notmuch-emacs in Debian). The screenshots give a good overview of the mode.

2 Programming Languages settings and Packages

2.1 Python

Packages

Settings

Set Python Interpreter:

(setq python-python-command "/path-to-python-/python")

To run the interpreter type: M-x run-python

Run more than one Python version, usage: M-x run-python3, M-x run-python2

(defun run-python3 ()
   (interactive)
   (run-python  "/usr/bin/python2" nil t))

(defun run-python2 ()
   (interactive)
   (run-python  "/usr/bin/python" nil t))

(defun run-ipython3 ()
   (interactive)
   (run-python  "~/anaconda3/bin/ipython" nil t))

Search Python packages at Pip:

(defun python/pip-search ()
  "Search for a pip package. at: https://pypi.python.org"

  (interactive)

  (browse-url

   (format "https://pypi.python.org/pypi?%%3Aaction=search&term=%s&submit=search"

           (read-string "Pip: ")

           (message "Searching pip.")

    )))

Search Python Documentation:

(defun python/doc-search ()
  "Search Python3 official documentation. at: https://docs.python.org"
  (interactive)

  (browse-url
   (format "https://docs.python.org/3/search.html?q=%s"

           (read-string "Python3 doc: ")
           )))

See also:

2.2 Haskell

Search Hoogle, the Haskell API search engine and the Hackage search engine.

(defun haskell/hoogle ()
  "Search Hoogle: Haskell API search engine

   https://www.haskell.org/hoogle
   "
  (interactive)

  (browse-url (format  "https://www.haskell.org/hoogle/?hoogle=%s"
                       (read-string "Hoogle: ")
                       ))

  (message "Searching Hoogle ...")
  )


(defun haskell/hoogle-region ()
  "Search selected text on Hoogle: Haskell API Search Engine
   https://www.haskell.org/hoogle
  "
  (interactive)
  (browse-url (format  "https://www.haskell.org/hoogle/?hoogle=%s"

                       (buffer-substring-no-properties
                        (region-beginning)
                        (region-end)
                        )

                       )))

(defun haskell/hackage ()
  " Search a Haskell library at:  https://hackage.haskell.org/
  "
  (interactive)

  (browse-url

   (format  "https://hackage.haskell.org/packages/search?terms=%s"

            (read-string "Hackage: ")))

  (message "Searching Hackage ...")

  )

See:

2.3 R and S

2.5 Lisp dialects

  • Paredit
  • Emacs Wiki: Rainbow Delimiters Rainbow delimiters is useful for all Lisps dialects like Elisp, Clojure, Scheme and etc. It also makes easier to match and spot delimiters at different levels.

rainbow_delimiters.png

2.6 Ocaml

2.7 JavaScript

Find Javascript package:

(defun javascript/npm-search ()
  "Search for a NPM package at: https://www.npmjs.com"
  (interactive)

  (browse-url

   (format "https://www.npmjs.com/search?q=%s"

           (url-hexify-string  (read-string "npm: "))

           )))

2.8 Java

Search Java package documentation:

(defun java/open-javadoc ()
  "Open Java Official documentation web site:
   https://docs.oracle.com/javase/8/docs

   Usage: M-x java/open-javadoc

   "
  (interactive)

  (browse-url "https://docs.oracle.com/javase/8/docs/"))

(defun java/search-class ()
  "Search a Java Class documentation.
   at: https://docs.oracle.com/javase/<java-version>

   It is assumed that is the Java 8.

   Example:  M-x java/search-class  javax.swing.JPanel

   "
  (interactive)

  (browse-url

   (format "https://docs.oracle.com/javase/8/docs/api/%s"

           (concat (replace-regexp-in-string "\\." "/"

                                             (read-string "Enter a java class: ")

                                             ) ".html"))))

2.9 Lisp Dialects

2.9.1 All Lisp Dialects

;; Turn on paren match highlighting
(show-paren-mode 1)
(setq show-paren-delay 0)

;; Highlight entire s-expression under cursor
(setq show-paren-style 'expression)

2.9.2 Common Lisp

Collection of information about using SLIME - a proto-manual.

Set Lisp Interpreter

(setq inferior-lisp-program "clisp")

2.9.3 Scheme

The variable scheme-program-name controls which Scheme implementation Emacs will run.

;; Racket Lang (Scheme Derived)
(setq scheme-program-name  "racket")

;; Racket Lang (Scheme Derived)
(setq scheme-program-name  "racket")

;; Chicken Scheme
(setq scheme-program-name "csi")
(setq scheme-program-name "/opt/bin/csi")

The function M-x run-scheme will run the selected scheme program.

The following functions are useful to run a specific Scheme version or implementation. Usage: M-x run-scheme-gambit, M-x run-scheme-guile …

(defun run-scheme-gambit ()
  (interactive)
  ;;; It could also be: (run-scheme "/opt/gambit/bin/gsc")
  ;;; executable-find will return the path to executable.
  ;;;
  (run-scheme (executable-find "gsc")))


(defun run-scheme-guile ()
  (interactive)
  (run-scheme (executable-find "guile")))

(defun run-scheme-chicken ()
  (interactive)
  (run-scheme  "/opt/chicken/bin/csi"))

(defun run-racket ()
  (interactive)
  (run-scheme "/opt/bin/racket"))

2.9.4 Clojure

Scheme inferior mode (Scheme shell support) can be used to run Clojure repl without Cider. It is a easy and faster to way to beginners run and explore Clojure.

The code below sets the following key bindings:

  • C-x C-e to Send the last Sexp to clojure repl.
  • C-c = to Send the definition to the repl, it sends the outermost s-expression to the repl regardless where is the cursor.
  • C-c C-p Send a region to the repl.
  • C-up Goes to the next input in the shell
  • C-down Goes to the previous input the shell
  • C-c C-l Opens the command history.
(progn
  (define-key clojure-mode-map
      (kbd "C-x C-e") #'scheme-send-last-sexp)

  (define-key clojure-mode-map
    (kbd "C-c =") #'scheme-send-definition)

  )


(defun cloujure-repl  ()
  (interactive)

  (run-scheme "java -jar /opt/clojure.jar"))



(defun run-clojure-batch ()
  "Run a clojure file in batch mode"
  (interactive)


  (start-process "clojure-batch1"     ;; Process name
                 "*clojure-batch*"   ;; Buffer name

                 ;;; Command line
                 "java" "-jar" "/opt/clojure.jar" (buffer-file-name))

  (split-window-vertically)

  (switch-to-buffer-other-window "*clojure-batch*"))

Download Clojure:

cd /opt/
curl -O http://central.maven.org/maven2/org/clojure/clojure/1.7.0/clojure-1.7.0.jar

See:

Non Categorized

2.10 Clojure

Created: 2018-07-26 Thu 07:42

Emacs 25.3.1 (Org mode 8.2.10)

Validate