Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions lib/tools/doc/guides/erlang_mode_chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,8 @@ the Erlang module `tags`.
`etags` is a program that is part of the Emacs distribution. It is normally
executed from a command line, like a Unix shell or a DOS box.

The `etags` program of fairly modern versions of Emacs and XEmacs has native
support for Erlang. To check if your version does include this support, issue
the command `etags --help` at a the command line prompt. At the end of the help
text there is a list of supported languages. Unless Erlang is a member of this
list I suggest that you should upgrade to a newer version of Emacs.

As seen in the help text — unless you have not upgraded your Emacs yet — `etags`
associate the file extensions `.erl` and `.hrl` with Erlang.
The `etags` program has native support for Erlang and associates the file
extensions `.erl` and `.hrl` with Erlang.

Basically, the `etags` utility is run using the following form:

Expand Down
24 changes: 12 additions & 12 deletions lib/tools/doc/references/erlang.el.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ The following command are directly available for indentation.

- _`TAB`_ (`erlang-indent-command`) - Indents the current line of code.
- _`M-C-\`_ (`indent-region`) - Indents all lines in the region.
- _`M-l`_ (`indent-for-comment`) - Insert a comment character to the right of
the code on the line (if any).
- _`M-;`_ (`comment-indent`) - Insert a comment character to the right of the
code on the line (if any).

Lines containing comment are indented differently depending on the number of
%-characters used:
Expand Down Expand Up @@ -149,15 +149,16 @@ sum([], Sum) -> Sum. % base case

## Syntax highlighting

The syntax highlighting can be activated from the Erlang menu. There are four
The syntax highlighting can be activated from the Erlang menu. There are five
different alternatives:

- Off: Normal black and white display.
- Level 1: Function headers, reserved words, comments, strings, quoted atoms,
and character constants will be colored.
- Level 2: The above, attributes, Erlang bif:s, guards, and words in comments
enclosed in single quotes will be colored.
- Level 3: The above, variables, records, and macros will be colored. (This
- Level 3: The above, variables, records, and macros will be colored.
- Level 4: The above plus everything else that can be highlighted. (This
level is also known as the Christmas tree level.)

## Tags
Expand Down Expand Up @@ -191,20 +192,19 @@ package "tempo". Here follows a brief description of the available skeletons:
information about the module), and Large Header (medium header with some
extra layout structure).
- Small Server - skeleton for a simple server not using OTP.
- Application - skeletons for the OTP application behavior
- Application - skeleton for the OTP application behavior
- Supervisor - skeleton for the OTP supervisor behavior
- Supervisor Bridge - skeleton for the OTP supervisor bridge behavior
- gen_server - skeleton for the OTP gen_server behavior
- gen_event - skeleton for the OTP gen_event behavior
- gen_fsm - skeleton for the OTP gen_fsm behavior
- gen_statem (StateName/3) - skeleton for the OTP gen_statem behavior using
state name functions
- gen_statem (handle_event/4) - skeleton for the OTP gen_statem behavior using
one state function
- wx_object - skeleton for the wx_object behavior
- Library module - skeleton for a module that does not implement a process.
- Corba callback - skeleton for a Corba callback module.
- Erlang test suite - skeleton for a callback module for the erlang test
server.
- Small Common Test suite - skeleton for a basic Common Test suite
- Large Common Test suite - skeleton for a full Common Test suite
- Common Test Hook - skeleton for a Common Test hook module

## Shell

Expand Down Expand Up @@ -239,8 +239,8 @@ final slash. Practically, you should add a line on the following form to your
## Starting IMenu

- _`M-x imenu-add-to-menubar RET`_ - This command will create the IMenu menu
containing all the functions in the current buffer.The command will ask you
for a suitable name for the menu. Not supported by Xemacs.
containing all the functions in the current buffer. The command will ask you
for a suitable name for the menu.

## Version

Expand Down
2 changes: 0 additions & 2 deletions lib/tools/emacs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ RELSYSDIR = $(RELEASE_PATH)/lib/tools-$(VSN)
EMACS_FILES= \
erldoc \
erlang-skels \
erlang-skels-old \
erlang_appwiz \
erlang-start \
erlang-eunit \
erlang-edoc \
Expand Down
62 changes: 24 additions & 38 deletions lib/tools/emacs/erlang-eunit.el
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,34 @@
;;;
;;; Author: Klas Johansson

(eval-when-compile
(require 'cl-lib))
(require 'cl-lib)
(require 'erlang)

(defvar erlang-eunit-src-candidate-dirs '("../src" ".")
"*Name of directories which to search for source files matching
an EUnit test file. The first directory in the list will be used,
if there is no match.")
(defcustom erlang-eunit-src-candidate-dirs '("../src" ".")
"Directories to search for source files matching an EUnit test file.
The first directory in the list will be used if there is no match."
:type '(repeat string)
:group 'erlang)

(defvar erlang-eunit-test-candidate-dirs '("../test" ".")
"*Name of directories which to search for EUnit test files matching
a source file. The first directory in the list will be used,
if there is no match.")
(defcustom erlang-eunit-test-candidate-dirs '("../test" ".")
"Directories to search for EUnit test files matching a source file.
The first directory in the list will be used if there is no match."
:type '(repeat string)
:group 'erlang)

(defvar erlang-eunit-autosave nil
"*Set to non-nil to automatically save unsaved buffers before running tests.
This is useful, reducing the save-compile-load-test cycle to one keychord.")
(defcustom erlang-eunit-autosave nil
"Non-nil means automatically save unsaved buffers before running tests."
:type 'boolean
:group 'erlang)

(defvar erlang-eunit-recent-info '((mode . nil) (module . nil) (test . nil) (cover . nil))
"Info about the most recent running of an EUnit test representation.")

(defvar erlang-error-regexp-alist
(defcustom erlang-error-regexp-alist
'(("^\\([^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\)[:) \t]" . (1 2)))
"*Patterns for matching Erlang errors.")
"Patterns for matching Erlang errors."
:type '(alist :key-type regexp :value-type sexp)
:group 'erlang)

;;;
;;; Switch between src/EUnit test buffers
Expand Down Expand Up @@ -108,9 +112,9 @@ buffer and vice versa"
(defun erlang-eunit-buddy-file-path (orig-file-path buddy-dir-name)
(let* ((orig-dir-name (file-name-directory orig-file-path))
(buddy-dir-name (file-truename
(erlang-eunit-filename-join orig-dir-name buddy-dir-name)))
(expand-file-name buddy-dir-name orig-dir-name)))
(buddy-base-name (erlang-eunit-buddy-basename orig-file-path)))
(erlang-eunit-filename-join buddy-dir-name buddy-base-name)))
(expand-file-name buddy-base-name buddy-dir-name)))

;;; Return the basename of the buddy file:
;;; /tmp/foo/src/x.erl --> x_tests.erl
Expand Down Expand Up @@ -147,13 +151,6 @@ buffer and vice versa"
(file-name-sans-extension (file-name-nondirectory file-path)))


;;; Join filenames
(defun erlang-eunit-filename-join (dir file)
(if (or (= (elt file 0) ?/)
(= (car (last (append dir nil))) ?/))
(concat dir file)
(concat dir "/" file)))

;;; Get info about the most recent running of EUnit
(defun erlang-eunit-recent (key)
(cdr (assq key erlang-eunit-recent-info)))
Expand Down Expand Up @@ -256,17 +253,12 @@ code along with the coverage analysis results."
;; analysis from a file into a new buffer (or an old, if one with
;; the specified name already exists). Also we want the erlang-mode
;; *and* view-mode to be enabled.
(save-excursion
(let ((buf (get-buffer-create (format "*%s coverage*" module-name))))
(set-buffer buf)
(let ((buf (get-buffer-create (format "*%s coverage*" module-name))))
(with-current-buffer buf
(setq buffer-read-only nil)
(insert-file-contents tmp-filename nil nil nil t)
(if (= (buffer-size) 0)
(kill-buffer buf)
;; FIXME: this would be a good place to enable (emacs-mode)
;; to get some nice syntax highlighting in the
;; coverage report, but it doesn't play well with
;; flymake. Leave it off for now.
(view-buffer buf))))
(delete-file tmp-filename)))

Expand Down Expand Up @@ -390,13 +382,7 @@ With prefix arg, compiles for debug and runs tests with the verbose flag set."
"[0-9]+: Warning:"
(buffer-substring (line-beginning-position) (line-end-position))))

(defun erlang-eunit-all-list-elems-fulfill-p (pred list)
(let ((matches-p t))
(while (and list matches-p)
(if (not (funcall pred (car list)))
(setq matches-p nil))
(setq list (cdr list)))
matches-p))
(defalias 'erlang-eunit-all-list-elems-fulfill-p #'cl-every)

;;; Evaluate a command in an erlang buffer
(defun erlang-eunit-inferior-erlang-send-command (command)
Expand Down
Loading
Loading