asm: clean up and tweaks

- Fix typos in README.org
- Add missing image
- Remove unecessary post-init functions
- Move SPC m h to SPC m h h to follow conventions
- Add correct copyright attribution
This commit is contained in:
syl20bnr 2016-01-11 22:58:57 -05:00
parent 4675760cf5
commit 408e710e39
6 changed files with 33 additions and 88 deletions

View File

@ -1,43 +1,42 @@
#+TITLE: asm layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../css/readtheorg.css" />
#+CAPTION: logo
# The maximum height of the logo should be 200 pixels.
[[img/asm.png]]
[[file:img/asm.png]]
* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Install][Install]]
- [[Layer][Layer]]
- [[PDFs][PDFs]]
- [[Key bindings][Key bindings]]
* Description
This layer supports for writing Assembly code. The built-in major mode for
editing assmebly code in Emacs is =asm-mode=. The layer adds =nasm-mode=, which
understands NASM-specific syntax. Also =nasm-mode= is intended for NASM, it
actually works well with other variants of Assembly in general, and provides Imenu
integration (so you can jump around with ~SPC s j~).
This layer adds support for Assembly code. The built-in major mode for
editing assembly code in Emacs is =asm-mode=.
The layer also adds =nasm-mode= for NASM-specific syntax. Although =nasm-mode=
is intended for NASM, it actually works well with other variants of Assembly
in general, and provides Imenu integration so you can jump around with ~SPC s j~.
_Features_:
- Improved syntax highllighting.
- Automatic indentatation.
- Improved syntax highlighting.
- Automatic indentation.
- Auto-completion for symbol in opened buffers.
- Look up documentation for current instruction at cursor.
- Imenu integration.
* Install
To use this contribution add it to your =~/.spacemacs=
#+begin_src emacs-lisp
(setq-default dotspacemacs-configuration-layers '(asm))
#+end_src
*** Layer
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =asm= to the existing =dotspacemacs-configuration-layers= list in this
file.
*** PDFs
To look up the x86 instructions, two things are required:
- =pdftotext= command line program from Poppler:
- the =pdftotext= command line tool from Poppler:
#+being_src sh
#+begin_src sh
sudo apt-get install poppler-utils
#+end_src
@ -53,15 +52,15 @@ file, and press ~C-c i~ to insert the path). For example, something like this:
(setq x86-lookup-pdf "~/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf")
#+end_src
The first time you launch the command, it took a while for indexing. After that,
the result is cached and the next time you start in an instant.
The first time you launch the command, it can take a while for indexing, this
is a one time operation and the result is cached for later use.
* Key bindings
| Key Binding | Description |
|-------------+----------------------------------------------------|
| ~<SPC> m h~ | Look up the documentation for instruction at point |
| ~;~ | Insert a comment |
| ~SPC m h h~ | Look up the documentation for instruction at point |
| ~;~ | Insert a comment |
_Note_: Quoted from the docstring of =asm-comment=, the command bound to ~;~:

View File

@ -1,9 +1,8 @@
;;; config.el --- Asm Layer config File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2016 Sylvain Benner & Contributors
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; Author: Tu, Do Hoang <tuhdo1710@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.

View File

@ -1,31 +0,0 @@
;;; extensions.el --- asm Layer extensions File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq asm-pre-extensions
'(
;; pre extension names go here
))
(setq asm-post-extensions
'(
;; post extension names go here
))
;; For each extension, define a function asm/init-<extension-name>
;;
;; (defun asm/init-my-extension ()
;; "Initialize my extension"
;; )
;;
;; Often the body of an initialize function uses `use-package'
;; For more info on `use-package', see readme:
;; https://github.com/jwiegley/use-package

View File

@ -1,7 +1,6 @@
;;; funcs.el --- C/C++ Layer functions File for Spacemacs
;;; funcs.el --- Asm Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Tu, Do Hoang <tuhdo1710@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -1,17 +1,14 @@
;;; packages.el --- asm Layer packages File for Spacemacs
;;; packages.el --- Asm Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; Author: Tu, Do Hoang <tuhdo1710@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; List of all packages to install and/or initialize. Built-in packages
;; which require an initialization must be listed explicitly in the list.
(setq asm-packages
'(
;; package names go here
@ -20,21 +17,10 @@
x86-lookup
))
;; List of packages to exclude.
(setq asm-excluded-packages '())
;; For each package, define a function asm/init-<package-name>
;;
;; (defun asm/init-my-package ()
;; "Initialize my package"
;; )
;;
;; Often the body of an initialize function uses `use-package'
;; For more info on `use-package', see readme:
;; https://github.com/jwiegley/use-package
(defun asm/init-asm-mode ()
"Setup for built-in `asm-mode'"
(use-package asm-mode
:init
(spacemacs/set-leader-keys-for-major-mode 'asm-mode "h" 'x86-lookup)
:config
(progn
;; We need to insert a non-indented line, otherwise it's annoying
@ -48,7 +34,8 @@
:init
(progn
(add-hook 'nasm-mode-hook #'asm-generic-setup)
(add-to-list 'auto-mode-alist '("\\.[n]*\\(asm\\|s\\)$" . nasm-mode)))
(add-to-list 'auto-mode-alist '("\\.[n]*\\(asm\\|s\\)$" . nasm-mode))
(spacemacs/set-leader-keys-for-major-mode 'nasm-mode "h" 'x86-lookup))
:config
(progn
;; We need to insert a non-indented line, otherwise it's annoying
@ -69,11 +56,3 @@
(defun asm/post-init-company ()
(spacemacs|add-company-hook asm-mode)
(spacemacs|add-company-hook nasm-mode))
(defun asm/post-init-asm-mode ()
(spacemacs/set-leader-keys-for-major-mode 'nasm-mode
"h" 'x86-lookup))
(defun asm/post-init-nasm-mode ()
(spacemacs/set-leader-keys-for-major-mode 'nasm-mode
"h" 'x86-lookup))