From 311cb41a39198ea791a0d603d008765bb935def3 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 26 Apr 2026 19:48:18 +0200 Subject: [PATCH] update erlang --- elpa/erlang-20250827.800/erlang-flymake.el | 125 -- elpa/erlang-20250827.800/erlang-skels-old.el | 1272 ----------------- elpa/erlang-20260420.1445/README-elpa | 43 + .../erlang-autoloads.el | 62 +- .../erlang-edoc.el | 0 .../erlang-eunit.el | 78 +- elpa/erlang-20260420.1445/erlang-flymake.el | 161 +++ .../erlang-pkg.el | 8 +- .../erlang-skels.el | 446 ------ .../erlang-start.el | 23 +- .../erlang-test.el | 9 +- .../erlang.el | 888 +++--------- .../erldoc.el | 110 +- 13 files changed, 478 insertions(+), 2747 deletions(-) delete mode 100644 elpa/erlang-20250827.800/erlang-flymake.el delete mode 100644 elpa/erlang-20250827.800/erlang-skels-old.el create mode 100644 elpa/erlang-20260420.1445/README-elpa rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang-autoloads.el (76%) rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang-edoc.el (100%) rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang-eunit.el (88%) create mode 100644 elpa/erlang-20260420.1445/erlang-flymake.el rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang-pkg.el (57%) rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang-skels.el (78%) rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang-start.el (83%) rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang-test.el (96%) rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erlang.el (87%) rename elpa/{erlang-20250827.800 => erlang-20260420.1445}/erldoc.el (85%) diff --git a/elpa/erlang-20250827.800/erlang-flymake.el b/elpa/erlang-20250827.800/erlang-flymake.el deleted file mode 100644 index e49367ae..00000000 --- a/elpa/erlang-20250827.800/erlang-flymake.el +++ /dev/null @@ -1,125 +0,0 @@ -;;; erlang-flymake.el -*- lexical-binding: t; -*- -;;; -;;; %CopyrightBegin% -;;; -;;; SPDX-License-Identifier: Apache-2.0 -;;; -;;; Copyright Ericsson AB 2010-2025. All Rights Reserved. -;;; -;;; Licensed under the Apache License, Version 2.0 (the "License"); -;;; you may not use this file except in compliance with the License. -;;; You may obtain a copy of the License at -;;; -;;; http://www.apache.org/licenses/LICENSE-2.0 -;;; -;;; Unless required by applicable law or agreed to in writing, software -;;; distributed under the License is distributed on an "AS IS" BASIS, -;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;;; See the License for the specific language governing permissions and -;;; limitations under the License. -;;; -;;; %CopyrightEnd% -;;; -;; erlang-flymake.el -;; -;; Syntax check erlang source code on the fly (integrates with flymake). -;; -;; Start using flymake with erlang by putting the following somewhere -;; in your .emacs file: -;; -;; (require 'erlang-flymake) -;; -;; Flymake is rather eager and does its syntax checks frequently by -;; default and if you are bothered by this, you might want to put the -;; following in your .emacs as well: -;; -;; (erlang-flymake-only-on-save) -;; -;; There are a couple of variables which control the compilation options: -;; * erlang-flymake-get-code-path-dirs-function -;; * erlang-flymake-get-include-dirs-function -;; * erlang-flymake-extra-opts -;; -;; This code is inspired by http://www.emacswiki.org/emacs/FlymakeErlang. - -(require 'flymake) -(require 'flymake-proc nil 'noerror) - -(eval-when-compile - (require 'cl-lib)) - -(defvar erlang-flymake-command - "erlc" - "The command that will be used to perform the syntax check") - -(defvar erlang-flymake-get-code-path-dirs-function - 'erlang-flymake-get-code-path-dirs - "Return a list of ebin directories to add to the code path.") - -(defvar erlang-flymake-get-include-dirs-function - 'erlang-flymake-get-include-dirs - "Return a list of include directories to add to the compiler options.") - -(defvar erlang-flymake-extra-opts - (list "+warn_unused_import" - "+warn_shadow_vars" - "+warn_export_vars" - "+strong_validation" - "+report") - "A list of options that will be passed to the compiler") - -(defun erlang-flymake-only-on-save () - "Trigger flymake only when the buffer is saved (disables syntax -check on newline and when there are no changes)." - (interactive) - ;; There doesn't seem to be a way of disabling this; set to the - ;; largest int available as a workaround (most-positive-fixnum - ;; equates to 8.5 years on my machine, so it ought to be enough ;-) ) - (setq flymake-no-changes-timeout most-positive-fixnum)) - - -(defun erlang-flymake-get-code-path-dirs () - (list (concat (erlang-flymake-get-app-dir) "ebin"))) - -(defun erlang-flymake-get-include-dirs () - (list (concat (erlang-flymake-get-app-dir) "include") - (concat (erlang-flymake-get-app-dir) "deps"))) - -(defun erlang-flymake-get-app-dir () - (let ((src-path (file-name-directory (buffer-file-name)))) - (file-name-directory (directory-file-name src-path)))) - -(defun erlang-flymake-init () - (let* ((temp-file - (cl-letf (((symbol-function 'flymake-get-temp-dir) #'erlang-flymake-temp-dir)) - (flymake-proc-init-create-temp-buffer-copy - 'flymake-create-temp-with-folder-structure))) - (code-dir-opts - (erlang-flymake-flatten - (mapcar (lambda (dir) (list "-pa" dir)) - (funcall erlang-flymake-get-code-path-dirs-function)))) - (inc-dir-opts - (erlang-flymake-flatten - (mapcar (lambda (dir) (list "-I" dir)) - (funcall erlang-flymake-get-include-dirs-function)))) - (compile-opts - (append inc-dir-opts - code-dir-opts - erlang-flymake-extra-opts))) - (list erlang-flymake-command (append compile-opts (list temp-file))))) - -(defun erlang-flymake-temp-dir () - ;; Squeeze the user's name in there in order to make sure that files - ;; for two users who are working on the same computer (like a linux - ;; box) don't collide - (format "%s/flymake-%s" temporary-file-directory user-login-name)) - -(defun erlang-flymake-flatten (list) - (apply #'append list)) - -(add-to-list 'flymake-allowed-file-name-masks - '("\\.erl\\'" erlang-flymake-init)) -(add-hook 'erlang-mode-hook 'flymake-mode) - -(provide 'erlang-flymake) -;; erlang-flymake ends here diff --git a/elpa/erlang-20250827.800/erlang-skels-old.el b/elpa/erlang-20250827.800/erlang-skels-old.el deleted file mode 100644 index ade95de7..00000000 --- a/elpa/erlang-20250827.800/erlang-skels-old.el +++ /dev/null @@ -1,1272 +0,0 @@ -;;; erlang-skels-old.el -*- lexical-binding: t; -*- - -;; %CopyrightBegin% -;; -;; SPDX-License-Identifier: Apache-2.0 -;; -;; Copyright Ericsson AB 2010-2025. All Rights Reserved. -;; -;; Licensed under the Apache License, Version 2.0 (the "License"); -;; you may not use this file except in compliance with the License. -;; You may obtain a copy of the License at -;; -;; http://www.apache.org/licenses/LICENSE-2.0 -;; -;; Unless required by applicable law or agreed to in writing, software -;; distributed under the License is distributed on an "AS IS" BASIS, -;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -;; See the License for the specific language governing permissions and -;; limitations under the License. -;; -;; %CopyrightEnd% - -;;; -;;; Purpose: Provide Erlang code skeletons. -;;; See 'erlang-skel-file' variable. - -(defvar erlang-tempo-tags nil - "Tempo tags for erlang mode") - -(defvar erlang-skel - '(("If" "if" erlang-skel-if) - ("Case" "case" erlang-skel-case) - ("Receive" "receive" erlang-skel-receive) - ("Receive After" "after" erlang-skel-receive-after) - ("Receive Loop" "loop" erlang-skel-receive-loop) - ("Module" "module" erlang-skel-module) - ("Author" "author" erlang-skel-author) - () - ("Small Header" "small-header" - erlang-skel-small-header erlang-skel-header) - ("Normal Header" "normal-header" - erlang-skel-normal-header erlang-skel-header) - ("Large Header" "large-header" - erlang-skel-large-header erlang-skel-header) - () - ("Small Server" "small-server" - erlang-skel-small-server erlang-skel-header) - () - ("Application" "application" - erlang-skel-application erlang-skel-header) - ("Supervisor" "supervisor" - erlang-skel-supervisor erlang-skel-header) - ("supervisor_bridge" "supervisor-bridge" - erlang-skel-supervisor-bridge erlang-skel-header) - ("gen_server" "generic-server" - erlang-skel-generic-server erlang-skel-header) - ("gen_event" "gen-event" - erlang-skel-gen-event erlang-skel-header) - ("gen_fsm" "gen-fsm" - erlang-skel-gen-fsm erlang-skel-header) - ("Library module" "gen-lib" - erlang-skel-lib erlang-skel-header) - ("Corba callback" "gen-corba-cb" - erlang-skel-corba-callback erlang-skel-header) - ("Small Common Test suite" "ct-test-suite-s" - erlang-skel-ct-test-suite-s erlang-skel-header) - ("Large Common Test suite" "ct-test-suite-l" - erlang-skel-ct-test-suite-l erlang-skel-header) - ("Erlang TS test suite" "ts-test-suite" - erlang-skel-ts-test-suite erlang-skel-header) - ) - "*Description of all skeleton templates. -Both functions and menu entries will be created. - -Each entry in `erlang-skel' should be a list with three or four -elements, or the empty list. - -The first element is the name which shows up in the menu. The second -is the `tempo' identifier (The string \"erlang-\" will be added in -front of it). The third is the skeleton descriptor, a variable -containing `tempo' attributes as described in the function -`tempo-define-template'. The optional fourth elements denotes a -function which should be called when the menu is selected. - -Functions corresponding to every template will be created. The name -of the function will be `tempo-template-erlang-X' where `X' is the -tempo identifier as specified in the second argument of the elements -in this list. - -A list with zero elements means that the a horizontal line should -be placed in the menu.") - -;; In XEmacs `user-mail-address' returns "x@y.z (Foo Bar)" ARGH! -;; What's wrong with that? RFC 822 says it's legal. [sverkerw] -;; This needs to use the customized value. If that's not sane, things like -;; add-log will lose anyhow. Avoid it if there _is_ a paren. -(defvar erlang-skel-mail-address - (if (or (not user-mail-address) (string-match "(" user-mail-address)) - (concat (user-login-name) "@" - (or (and (boundp 'mail-host-address) - mail-host-address) - (system-name))) - user-mail-address) - "Mail address of the user.") - -;; Expression templates: -(defvar erlang-skel-case - '((erlang-skel-skip-blank) o > - "case " p " of" n> p "_ ->" n> p "ok" n> "end" p) - "*The skeleton of a `case' expression. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-if - '((erlang-skel-skip-blank) o > - "if" n> p " ->" n> p "ok" n> "end" p) - "The skeleton of an `if' expression. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-receive - '((erlang-skel-skip-blank) o > - "receive" n> p "_ ->" n> p "ok" n> "end" p) - "*The skeleton of a `receive' expression. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-receive-after - '((erlang-skel-skip-blank) o > - "receive" n> p "_ ->" n> p "ok" n> "after " p "T ->" n> - p "ok" n> "end" p) - "*The skeleton of a `receive' expression with an `after' clause. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-receive-loop - '(& o "loop(" p ") ->" n> "receive" n> p "_ ->" n> - "loop(" p ")" n> "end.") - "*The skeleton of a simple `receive' loop. -Please see the function `tempo-define-template'.") - - -;; Attribute templates - -(defvar erlang-skel-module - '(& "-module(" - (erlang-add-quotes-if-needed (erlang-get-module-from-file-name)) - ")." n) - "*The skeleton of a `module' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-author - '(& "-author('" erlang-skel-mail-address "')." n) - "*The skeleton of a `author' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-vc nil - "*The skeleton template to generate a version control attribute. -The default is to insert nothing. Example of usage: - - (setq erlang-skel-vc \\='(& \"-rcs(\\\"$\Id: $ \\\").\") n) - -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-export - '(& "-export([" n> "])." n) - "*The skeleton of an `export' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-import - '(& "%%-import(Module, [Function/Arity, ...])." n) - "*The skeleton of an `import' attribute. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-compile nil - ;; '(& "%%-compile(export_all)." n) - "*The skeleton of a `compile' attribute. -Please see the function `tempo-define-template'.") - - -;; Comment templates. - -(defvar erlang-skel-date-function 'erlang-skel-dd-mmm-yyyy - "*Function which returns date string. -Look in the module `time-stamp' for a battery of functions.") - -(defvar erlang-skel-copyright-comment '() - "*The template for a copyright line in the header, normally empty. -This variable should be bound to a `tempo' template, for example: - \\='(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n) - -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-created-comment - '(& "%%% Created : " (funcall erlang-skel-date-function) " by " - (user-full-name) " <" erlang-skel-mail-address ">" n) - "*The template for the \"Created:\" comment line.") - -(defvar erlang-skel-author-comment - '(& "%%% Author : " (user-full-name) " <" erlang-skel-mail-address ">" n) - "*The template for creating the \"Author:\" line in the header. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-file-comment - '(& "%%% File : " (file-name-nondirectory buffer-file-name) n) -"*The template for creating the \"Module:\" line in the header. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-small-header - '(o (erlang-skel-include erlang-skel-module) - ;; erlang-skel-author) - n - (erlang-skel-include erlang-skel-compile - ;; erlang-skel-export - erlang-skel-vc)) - "*The template of a small header without any comments. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-normal-header - '(o (erlang-skel-include erlang-skel-copyright-comment - erlang-skel-file-comment - erlang-skel-author-comment) - "%%% Description : " p n - (erlang-skel-include erlang-skel-created-comment) n - (erlang-skel-include erlang-skel-small-header) n) - "*The template of a normal header. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-large-header - '(o (erlang-skel-separator) - (erlang-skel-include erlang-skel-copyright-comment - erlang-skel-file-comment - erlang-skel-author-comment) - "%%% Description : " p n - "%%%" n - (erlang-skel-include erlang-skel-created-comment) - (erlang-skel-separator) - (erlang-skel-include erlang-skel-small-header) ) - "*The template of a large header. -Please see the function `tempo-define-template'.") - - -;; Server templates. - -(defvar erlang-skel-small-server - '((erlang-skel-include erlang-skel-large-header) - "-export([start/0,init/1])." n n n - "start() ->" n> "spawn(" (erlang-get-module-from-file-name) - ", init, [self()])." n n - "init(From) ->" n> - "loop(From)." n n - "loop(From) ->" n> - "receive" n> - p "_ ->" n> - "loop(From)" n> - "end." - ) - "*Template of a small server. -Please see the function `tempo-define-template'.") - -;; Behaviour templates. - -(defvar erlang-skel-application - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(application)." n n - "%% Application callbacks" n - "-export([start/2, stop/1])." n n - (erlang-skel-double-separator 2) - "%% Application callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start(Type, StartArgs) -> {ok, Pid} |" n - "%% {ok, Pid, State} |" n - "%% {error, Reason}" n - "%% Description: This function is called whenever an application " n - "%% is started using application:start/1,2, and should start the processes" n - "%% of the application. If the application is structured according to the" n - "%% OTP design principles as a supervision tree, this means starting the" n - "%% top supervisor of the tree." n - (erlang-skel-separator 2) - "start(_Type, StartArgs) ->" n> - "case 'TopSupervisor':start_link(StartArgs) of" n> - "{ok, Pid} -> " n> - "{ok, Pid};" n> - "Error ->" n> - "Error" n> - "end." n - n - (erlang-skel-separator 2) - "%% Function: stop(State) -> void()" n - "%% Description: This function is called whenever an application" n - "%% has stopped. It is intended to be the opposite of Module:start/2 and" n - "%% should do any necessary cleaning up. The return value is ignored. "n - (erlang-skel-separator 2) - "stop(_State) ->" n> - "ok." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of an application behaviour. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-supervisor - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(supervisor)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% Supervisor callbacks" n - "-export([init/1])." n n - - "-define(SERVER, ?MODULE)." n n - - (erlang-skel-double-separator 2) - "%% API functions" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n - "%% Description: Starts the supervisor" n - (erlang-skel-separator 2) - "start_link() ->" n> - "supervisor:start_link({local, ?SERVER}, ?MODULE, [])." n - n - (erlang-skel-double-separator 2) - "%% Supervisor callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Func: init(Args) -> {ok, {SupFlags, [ChildSpec]}} |" n - "%% ignore |" n - "%% {error, Reason}" n - "%% Description: Whenever a supervisor is started using "n - "%% supervisor:start_link/[2,3], this function is called by the new process "n - "%% to find out about restart strategy, maximum restart frequency and child "n - "%% specifications." n - (erlang-skel-separator 2) - "init([]) ->" n> - "AChild = {'AName',{'AModule',start_link,[]}," n> - "permanent,2000,worker,['AModule']}," n> - "{ok,{{one_for_all,0,1}, [AChild]}}." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of an supervisor behaviour. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-supervisor-bridge - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(supervisor_bridge)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% supervisor_bridge callbacks" n - "-export([init/1, terminate/2])." n n - - "-define(SERVER, ?MODULE)." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n - "%% Description: Starts the supervisor bridge" n - (erlang-skel-separator 2) - "start_link() ->" n> - "supervisor_bridge:start_link({local, ?SERVER}, ?MODULE, [])." n - n - (erlang-skel-double-separator 2) - "%% supervisor_bridge callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, Pid, State} |" n - "%% ignore |" n - "%% {error, Reason} " n - "%% Description:Creates a supervisor_bridge process, linked to the calling" n - "%% process, which calls Module:init/1 to start the subsystem. To ensure a" n - "%% synchronized start-up procedure, this function does not return until" n - "%% Module:init/1 has returned. " n - (erlang-skel-separator 2) - "init([]) ->" n> - "case 'AModule':start_link() of" n> - "{ok, Pid} ->" n> - "{ok, Pid, #state{}};" n> - "Error ->" n> - "Error" n> - "end." n - n - (erlang-skel-separator 2) - "%% Func: terminate(Reason, State) -> void()" n - "%% Description:This function is called by the supervisor_bridge when it is"n - "%% about to terminate. It should be the opposite of Module:init/1 and stop"n - "%% the subsystem and do any necessary cleaning up.The return value is ignored." - (erlang-skel-separator 2) - "terminate(Reason, State) ->" n> - "'AModule':stop()," n> - "ok." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of an supervisor_bridge behaviour. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-generic-server - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(gen_server)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% gen_server callbacks" n - "-export([init/1, handle_call/3, handle_cast/2, " - "handle_info/2," n> - "terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n - "%% Description: Starts the server" n - (erlang-skel-separator 2) - "start_link() ->" n> - "gen_server:start_link({local, ?SERVER}, ?MODULE, [], [])." n - n - (erlang-skel-double-separator 2) - "%% gen_server callbacks" n - (erlang-skel-double-separator 2) - n - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, State} |" n - "%% {ok, State, Timeout} |" n - "%% ignore |" n - "%% {stop, Reason}" n - "%% Description: Initializes the server" n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: " - "%% handle_call(Request, From, State) -> {reply, Reply, State} |" n - "%% {reply, Reply, State, Timeout} |" n - "%% {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, Reply, State} |" n - "%% {stop, Reason, State}" n - "%% Description: Handling call messages" n - (erlang-skel-separator 2) - "handle_call(_Request, _From, State) ->" n> - "Reply = ok," n> - "{reply, Reply, State}." n - n - (erlang-skel-separator 2) - "%% Function: handle_cast(Msg, State) -> {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, State}" n - "%% Description: Handling cast messages" n - - (erlang-skel-separator 2) - "handle_cast(_Msg, State) ->" n> - "{noreply, State}." n - n - (erlang-skel-separator 2) - "%% Function: handle_info(Info, State) -> {noreply, State} |" n - "%% {noreply, State, Timeout} |" n - "%% {stop, Reason, State}" n - "%% Description: Handling all non call/cast messages" n - (erlang-skel-separator 2) - "handle_info(_Info, State) ->" n> - "{noreply, State}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, State) -> void()" n - "%% Description: This function is called by a gen_server when it is about to"n - "%% terminate. It should be the opposite of Module:init/1 and do any necessary"n - "%% cleaning up. When it returns, the gen_server terminates with Reason." n - "%% The return value is ignored." n - - (erlang-skel-separator 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}" n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%%% Internal functions" n - (erlang-skel-separator 2) - ) - "*The template of a generic server. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-gen-event - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(gen_event)." n - - "%% API" n - "-export([start_link/0, add_handler/0])." n n - - "%% gen_event callbacks" n - "-export([init/1, handle_event/2, handle_call/2, " n> - "handle_info/2, terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% gen_event callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> {ok,Pid} | {error,Error} " n - "%% Description: Creates an event manager." n - (erlang-skel-separator 2) - "start_link() ->" n> - "gen_event:start_link({local, ?SERVER}). " n - n - (erlang-skel-separator 2) - "%% Function: add_handler() -> ok | {'EXIT',Reason} | term()" n - "%% Description: Adds an event handler" n - (erlang-skel-separator 2) - "add_handler() ->" n> - "gen_event:add_handler(?SERVER, ?MODULE, [])." n - n - (erlang-skel-double-separator 2) - "%% gen_event callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, State}" n - "%% Description: Whenever a new event handler is added to an event manager,"n - "%% this function is called to initialize the event handler." n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: "n - "%% handle_event(Event, State) -> {ok, State} |" n - "%% {swap_handler, Args1, State1, Mod2, Args2} |"n - "%% remove_handler" n - "%% Description:Whenever an event manager receives an event sent using"n - "%% gen_event:notify/2 or gen_event:sync_notify/2, this function is called for"n - "%% each installed event handler to handle the event. "n - (erlang-skel-separator 2) - "handle_event(_Event, State) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_call(Request, State) -> {ok, Reply, State} |" n - "%% {swap_handler, Reply, Args1, State1, "n - "%% Mod2, Args2} |" n - "%% {remove_handler, Reply}" n - "%% Description: Whenever an event manager receives a request sent using"n - "%% gen_event:call/3,4, this function is called for the specified event "n - "%% handler to handle the request."n - (erlang-skel-separator 2) - "handle_call(_Request, State) ->" n> - "Reply = ok," n> - "{ok, Reply, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_info(Info, State) -> {ok, State} |" n - "%% {swap_handler, Args1, State1, Mod2, Args2} |" n - "%% remove_handler" n - "%% Description: This function is called for each installed event handler when"n - "%% an event manager receives any other message than an event or a synchronous"n - "%% request (or a system message)."n - (erlang-skel-separator 2) - "handle_info(_Info, State) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, State) -> void()" n - "%% Description:Whenever an event handler is deleted from an event manager,"n - "%% this function is called. It should be the opposite of Module:init/1 and "n - "%% do any necessary cleaning up. " n - (erlang-skel-separator 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-separator 2) - "%%% Internal functions" n - (erlang-skel-separator 2) - ) - "*The template of a gen_event. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-gen-fsm - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(gen_fsm)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% gen_fsm callbacks" n - "-export([init/1, state_name/2, state_name/3, handle_event/3," n> - "handle_sync_event/4, handle_info/3, terminate/3, code_change/4])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: start_link() -> ok,Pid} | ignore | {error,Error}" n - "%% Description:Creates a gen_fsm process which calls Module:init/1 to"n - "%% initialize. To ensure a synchronized start-up procedure, this function" n - "%% does not return until Module:init/1 has returned. " n - (erlang-skel-separator 2) - "start_link() ->" n> - "gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], [])." n - n - (erlang-skel-double-separator 2) - "%% gen_fsm callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, StateName, State} |" n - "%% {ok, StateName, State, Timeout} |" n - "%% ignore |" n - "%% {stop, StopReason} " n - "%% Description:Whenever a gen_fsm is started using gen_fsm:start/[3,4] or"n - "%% gen_fsm:start_link/3,4, this function is called by the new process to "n - "%% initialize. " n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, state_name, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: "n - "%% state_name(Event, State) -> {next_state, NextStateName, NextState}|" n - "%% {next_state, NextStateName, " n - "%% NextState, Timeout} |" n - "%% {stop, Reason, NewState}" n - "%% Description:There should be one instance of this function for each possible"n - "%% state name. Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:send_event/2, the instance of this function with the same name as"n - "%% the current state name StateName is called to handle the event. It is also "n - "%% called if a timeout occurs. " n - (erlang-skel-separator 2) - "state_name(_Event, State) ->" n> - "{next_state, state_name, State}." n - n - (erlang-skel-separator 2) - "%% Function:" n - "%% state_name(Event, From, State) -> {next_state, NextStateName, NextState} |"n - "%% {next_state, NextStateName, " n - "%% NextState, Timeout} |" n - "%% {reply, Reply, NextStateName, NextState}|"n - "%% {reply, Reply, NextStateName, " n - "%% NextState, Timeout} |" n - "%% {stop, Reason, NewState}|" n - "%% {stop, Reason, Reply, NewState}" n - "%% Description: There should be one instance of this function for each" n - "%% possible state name. Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:sync_send_event/2,3, the instance of this function with the same"n - "%% name as the current state name StateName is called to handle the event." n - (erlang-skel-separator 2) - "state_name(_Event, _From, State) ->" n> - "Reply = ok," n> - "{reply, Reply, state_name, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_event(Event, StateName, State) -> {next_state, NextStateName, "n - "%% NextState} |" n - "%% {next_state, NextStateName, "n - "%% NextState, Timeout} |" n - "%% {stop, Reason, NewState}" n - "%% Description: Whenever a gen_fsm receives an event sent using"n - "%% gen_fsm:send_all_state_event/2, this function is called to handle"n - "%% the event." n - (erlang-skel-separator 2) - "handle_event(_Event, StateName, State) ->" n> - "{next_state, StateName, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_sync_event(Event, From, StateName, "n - "%% State) -> {next_state, NextStateName, NextState} |" n - "%% {next_state, NextStateName, NextState, " n - "%% Timeout} |" n - "%% {reply, Reply, NextStateName, NextState}|" n - "%% {reply, Reply, NextStateName, NextState, " n - "%% Timeout} |" n - "%% {stop, Reason, NewState} |" n - "%% {stop, Reason, Reply, NewState}" n - "%% Description: Whenever a gen_fsm receives an event sent using"n - "%% gen_fsm:sync_send_all_state_event/2,3, this function is called to handle"n - "%% the event."n - (erlang-skel-separator 2) - "handle_sync_event(Event, From, StateName, State) ->" n> - "Reply = ok," n> - "{reply, Reply, StateName, State}." n - n - (erlang-skel-separator 2) - "%% Function: " n - "%% handle_info(Info,StateName,State)-> {next_state, NextStateName, NextState}|" n - "%% {next_state, NextStateName, NextState, "n - "%% Timeout} |" n - "%% {stop, Reason, NewState}" n - "%% Description: This function is called by a gen_fsm when it receives any"n - "%% other message than a synchronous or asynchronous event"n - "%% (or a system message)." n - (erlang-skel-separator 2) - "handle_info(_Info, StateName, State) ->" n> - "{next_state, StateName, State}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, StateName, State) -> void()" n - "%% Description:This function is called by a gen_fsm when it is about"n - "%% to terminate. It should be the opposite of Module:init/1 and do any"n - "%% necessary cleaning up. When it returns, the gen_fsm terminates with"n - "%% Reason. The return value is ignored." n - (erlang-skel-separator 2) - "terminate(_Reason, _StateName, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Function:" n - "%% code_change(OldVsn, StateName, State, Extra) -> {ok, StateName, NewState}" n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, StateName, State, _Extra) ->" n> - "{ok, StateName, State}." n - n - (erlang-skel-separator 2) - "%%% Internal functions" n - (erlang-skel-separator 2) - ) - "*The template of a gen_fsm. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-lib - '((erlang-skel-include erlang-skel-large-header) - - "%% API" n - "-export([])." n n - - (erlang-skel-double-separator 2) - "%% API" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: " n - "%% Description:" n - (erlang-skel-separator 2) - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-corba-callback - '((erlang-skel-include erlang-skel-large-header) - "%% Include files" n n - - "%% API" n - "-export([])." n n - - "%% Corba callbacks" n - "-export([init/1, terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator 2) - "%% Corba callbacks" n - (erlang-skel-double-separator 2) - (erlang-skel-separator 2) - "%% Function: init(Args) -> {ok, State} |" n - "%% {ok, State, Timeout} |" n - "%% ignore |" n - "%% {stop, Reason}" n - "%% Description: Initializes the server" n - (erlang-skel-separator 2) - "init([]) ->" n> - "{ok, #state{}}." n - n - (erlang-skel-separator 2) - "%% Function: terminate(Reason, State) -> void()" n - "%% Description: Shutdown the server" n - (erlang-skel-separator 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator 2) - "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n - "%% Description: Convert process state when code is changed" n - (erlang-skel-separator 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-double-separator 2) - "%% Internal functions" n - (erlang-skel-double-separator 2) - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-ts-test-suite - '((erlang-skel-include erlang-skel-large-header) - "%% Note: This directive should only be used in test suites." n - "-compile(export_all)." n n - - "-include_lib(\"common_test/include/ct.hrl\")." n n - - (erlang-skel-separator 2) - "%% TEST SERVER CALLBACK FUNCTIONS" n - (erlang-skel-separator 2) - n - (erlang-skel-separator 2) - "%% Function: init_per_suite(Config0) -> Config1 | {skip,Reason}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the suite." n - "%%" n - "%% Description: Initialization before the suite." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_suite(Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_suite(Config) -> term()" n - "%%" n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Description: Cleanup after the suite." n - (erlang-skel-separator 2) - "end_per_suite(_Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_testcase(TestCase, Config0) -> Config1 |" n - "%% {skip,Reason}" n - "%% TestCase = atom()" n - "%% Name of the test case that is about to run." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% Description: Initialization before each test case." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_testcase(_TestCase, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config) -> term()" n - "%%" n - "%% TestCase = atom()" n - "%% Name of the test case that is finished." n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Description: Cleanup after each test case." n - (erlang-skel-separator 2) - "end_per_testcase(_TestCase, _Config) ->" n > - "ok."n n - - (erlang-skel-separator 2) - "%% Function: all(Clause) -> Descr | Spec | {skip,Reason}" n - "%%" n - "%% Clause = doc | suite" n - "%% Indicates expected return value." n - "%% Descr = [string()] | []" n - "%% String that describes the test suite." n - "%% Spec = [TestCase]" n - "%% A test specification." n - "%% TestCase = ConfCase | atom()" n - "%% Configuration case, or the name of a test case function." n - "%% ConfCase = {conf,Init,Spec,End} |" n - "%% {conf,Properties,Init,Spec,End}" n - "%% Init = End = {Mod,Func} | Func" n - "%% Initialization and cleanup function." n - "%% Mod = Func = atom()" n - "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n - "%% Execution properties of the test cases (may be combined)." n - "%% Shuffle = shuffle | {shuffle,Seed}" n - "%% To get cases executed in random order." n - "%% Seed = {integer(),integer(),integer()}" n - "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n - "%% repeat_until_any_ok | repeat_until_any_fail" n - "%% To get execution of cases repeated." n - "%% N = integer() | forever" n - "%% Reason = term()" n - "%% The reason for skipping the test suite." n - "%%" n - "%% Description: Returns a description of the test suite when" n - "%% Clause == doc, and a test specification (list" n - "%% of the conf and test cases in the suite) when" n - "%% Clause == suite." n - (erlang-skel-separator 2) - "all(doc) -> " n > - "[\"Describe the main purpose of this suite\"];" n n - "all(suite) -> " n > - "[a_test_case]." n n - n - (erlang-skel-separator 2) - "%% TEST CASES" n - (erlang-skel-separator 2) - n - (erlang-skel-separator 2) - "%% Function: TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason}" n - "%%" n - "%% Arg = doc | suite | Config" n - "%% Indicates expected behaviour and return value." n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Descr = [string()] | []" n - "%% String that describes the test case." n - "%% Spec = [tuple()] | []" n - "%% A test specification, see all/1." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% Description: Test case function. Returns a description of the test" n - "%% case (doc), then returns a test specification (suite)," n - "%% or performs the actual test (Config)." n - (erlang-skel-separator 2) - "a_test_case(doc) -> " n > - "[\"Describe the main purpose of this test case\"];" n n - "a_test_case(suite) -> " n > - "[];" n n - "a_test_case(Config) when is_list(Config) -> " n > - "ok." n - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-ct-test-suite-l - '((erlang-skel-include erlang-skel-large-header) - "%% Note: This directive should only be used in test suites." n - "-compile(export_all)." n n - - "-include_lib(\"common_test/include/ct.hrl\")." n n - - (erlang-skel-separator 2) - "%% COMMON TEST CALLBACK FUNCTIONS" n - (erlang-skel-separator 2) - n - (erlang-skel-separator 2) - "%% Function: suite() -> Info" n - "%%" n - "%% Info = [tuple()]" n - "%% List of key/value pairs." n - "%%" n - "%% Description: Returns list of tuples to set default properties" n - "%% for the suite." n - "%%" n - "%% Note: The suite/0 function is only meant to be used to return" n - "%% default data values, not perform any other operations." n - (erlang-skel-separator 2) - "suite() ->" n > - "[{timetrap,{minutes,10}}]." n n - - (erlang-skel-separator 2) - "%% Function: init_per_suite(Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the suite." n - "%%" n - "%% Description: Initialization before the suite." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_suite(Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% Description: Cleanup after the suite." n - (erlang-skel-separator 2) - "end_per_suite(_Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_group(GroupName, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% GroupName = atom()" n - "%% Name of the test case group that is about to run." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding configuration data for the group." n - "%% Reason = term()" n - "%% The reason for skipping all test cases and subgroups in the group." n - "%%" n - "%% Description: Initialization before each test case group." n - (erlang-skel-separator 2) - "init_per_group(_GroupName, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_group(GroupName, Config0) ->" n - "%% term() | {save_config,Config1}" n - "%%" n - "%% GroupName = atom()" n - "%% Name of the test case group that is finished." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding configuration data for the group." n - "%%" n - "%% Description: Cleanup after each test case group." n - (erlang-skel-separator 2) - "end_per_group(_GroupName, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_testcase(TestCase, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% TestCase = atom()" n - "%% Name of the test case that is about to run." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% Description: Initialization before each test case." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - (erlang-skel-separator 2) - "init_per_testcase(_TestCase, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% term() | {save_config,Config1} | {fail,Reason}" n - "%%" n - "%% TestCase = atom()" n - "%% Name of the test case that is finished." n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for failing the test case." n - "%%" n - "%% Description: Cleanup after each test case." n - (erlang-skel-separator 2) - "end_per_testcase(_TestCase, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: groups() -> [Group]" n - "%%" n - "%% Group = {GroupName,Properties,GroupsAndTestCases}" n - "%% GroupName = atom()" n - "%% The name of the group." n - "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n - "%% Group properties that may be combined." n - "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n - "%% TestCase = atom()" n - "%% The name of a test case." n - "%% Shuffle = shuffle | {shuffle,Seed}" n - "%% To get cases executed in random order." n - "%% Seed = {integer(),integer(),integer()}" n - "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n - "%% repeat_until_any_ok | repeat_until_any_fail" n - "%% To get execution of cases repeated." n - "%% N = integer() | forever" n - "%%" n - "%% Description: Returns a list of test case group definitions." n - (erlang-skel-separator 2) - "groups() ->" n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n - "%%" n - "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n - "%% GroupName = atom()" n - "%% Name of a test case group." n - "%% TestCase = atom()" n - "%% Name of a test case." n - "%% Reason = term()" n - "%% The reason for skipping all groups and test cases." n - "%%" n - "%% Description: Returns the list of groups and test cases that" n - "%% are to be executed." n - (erlang-skel-separator 2) - "all() -> " n > - "[my_test_case]." n n - - n - (erlang-skel-separator 2) - "%% TEST CASES" n - (erlang-skel-separator 2) - n - - (erlang-skel-separator 2) - "%% Function: TestCase() -> Info" n - "%%" n - "%% Info = [tuple()]" n - "%% List of key/value pairs." n - "%%" n - "%% Description: Test case info function - returns list of tuples to set" n - "%% properties for the test case." n - "%%" n - "%% Note: This function is only meant to be used to return a list of" n - "%% values, not perform any other operations." n - (erlang-skel-separator 2) - "my_test_case() -> " n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: TestCase(Config0) ->" n - "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n - "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%% Comment = term()" n - "%% A comment about the test case that will be printed in the html log." n - "%%" n - "%% Description: Test case function. (The name of it must be specified in" n - "%% the all/0 list or in a test case group for the test case" n - "%% to be executed)." n - (erlang-skel-separator 2) - "my_test_case(_Config) -> " n > - "ok." n - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-ct-test-suite-s - '((erlang-skel-include erlang-skel-large-header) - "-compile(export_all)." n n - - "-include_lib(\"common_test/include/ct.hrl\")." n n - - (erlang-skel-separator 2) - "%% Function: suite() -> Info" n - "%% Info = [tuple()]" n - (erlang-skel-separator 2) - "suite() ->" n > - "[{timetrap,{seconds,30}}]." n n - - (erlang-skel-separator 2) - "%% Function: init_per_suite(Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "init_per_suite(Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_suite(Config0) -> term() | {save_config,Config1}" n - "%% Config0 = Config1 = [tuple()]" n - (erlang-skel-separator 2) - "end_per_suite(_Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_group(GroupName, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%% GroupName = atom()" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "init_per_group(_GroupName, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_group(GroupName, Config0) ->" n - "%% term() | {save_config,Config1}" n - "%% GroupName = atom()" n - "%% Config0 = Config1 = [tuple()]" n - (erlang-skel-separator 2) - "end_per_group(_GroupName, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: init_per_testcase(TestCase, Config0) ->" n - "%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}" n - "%% TestCase = atom()" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "init_per_testcase(_TestCase, Config) ->" n > - "Config." n n - - (erlang-skel-separator 2) - "%% Function: end_per_testcase(TestCase, Config0) ->" n - "%% term() | {save_config,Config1} | {fail,Reason}" n - "%% TestCase = atom()" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "end_per_testcase(_TestCase, _Config) ->" n > - "ok." n n - - (erlang-skel-separator 2) - "%% Function: groups() -> [Group]" n - "%% Group = {GroupName,Properties,GroupsAndTestCases}" n - "%% GroupName = atom()" n - "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n - "%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]" n - "%% TestCase = atom()" n - "%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}}" n - "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n - "%% repeat_until_any_ok | repeat_until_any_fail" n - "%% N = integer() | forever" n - (erlang-skel-separator 2) - "groups() ->" n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: all() -> GroupsAndTestCases | {skip,Reason}" n - "%% GroupsAndTestCases = [{group,GroupName} | TestCase]" n - "%% GroupName = atom()" n - "%% TestCase = atom()" n - "%% Reason = term()" n - (erlang-skel-separator 2) - "all() -> " n > - "[my_test_case]." n n - - (erlang-skel-separator 2) - "%% Function: TestCase() -> Info" n - "%% Info = [tuple()]" n - (erlang-skel-separator 2) - "my_test_case() -> " n > - "[]." n n - - (erlang-skel-separator 2) - "%% Function: TestCase(Config0) ->" n - "%% ok | exit() | {skip,Reason} | {comment,Comment} |" n - "%% {save_config,Config1} | {skip_and_save,Reason,Config1}" n - "%% Config0 = Config1 = [tuple()]" n - "%% Reason = term()" n - "%% Comment = term()" n - (erlang-skel-separator 2) - "my_test_case(_Config) -> " n > - "ok." n - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") diff --git a/elpa/erlang-20260420.1445/README-elpa b/elpa/erlang-20260420.1445/README-elpa new file mode 100644 index 00000000..73817e69 --- /dev/null +++ b/elpa/erlang-20260420.1445/README-elpa @@ -0,0 +1,43 @@ +Introduction: +------------ + +This package provides support for the programming language Erlang. +The package provides an editing mode with lots of bells and +whistles, compilation support, and it makes it possible for the +user to start Erlang shells that run inside Emacs. + +See the Erlang distribution for full documentation of this package. + +Installation: +------------ + +Place this file in Emacs load path, byte-compile it, and add the +following line to the appropriate init file: + + (require 'erlang-start) + +The full documentation contains much more extensive description of +the installation procedure. + +Reporting Bugs: +-------------- + +Please report bugs at: + https://github.com/erlang/otp/issues +Please state as exactly as possible: + - Version number of Erlang Mode (see the menu), Emacs, Erlang, + and of any other relevant software. + - What the expected result was. + - What you did, preferably in a repeatable step-by-step form. + - A description of the unexpected result. + - Relevant pieces of Erlang code causing the problem. + - Personal Emacs customisations, if any. +Patch suggestions are welcome at: + https://github.com/erlang/otp/pulls + +Should the Emacs generate an error, please set the Emacs variable +`debug-on-error' to `t'. Repeat the error and enclose the debug +information in your bug-report. + +To toggle the variable you can use the following command: + M-x toggle-debug-on-error RET diff --git a/elpa/erlang-20250827.800/erlang-autoloads.el b/elpa/erlang-20260420.1445/erlang-autoloads.el similarity index 76% rename from elpa/erlang-20250827.800/erlang-autoloads.el rename to elpa/erlang-20260420.1445/erlang-autoloads.el index f925f0b6..e06aced4 100644 --- a/elpa/erlang-20250827.800/erlang-autoloads.el +++ b/elpa/erlang-20260420.1445/erlang-autoloads.el @@ -11,8 +11,8 @@ ;;; Generated autoloads from erlang.el -(autoload 'erlang-mode "erlang" "\ -Major mode for editing Erlang source files in Emacs. +(autoload 'erlang-mode "erlang" +"Major mode for editing Erlang source files in Emacs. It knows about syntax and comment, it can indent code, it is capable of fontifying the source file, the TAGS commands are aware of Erlang modules, and the Erlang man pages can be accessed. @@ -69,31 +69,19 @@ Please see the beginning of the file `erlang.el' for more information and examples of hooks. Other commands: -\\{erlang-mode-map} - -(fn)" t) +\\{erlang-mode-map}" t) (dolist (r '("\\.erl$" "\\.app\\.src$" "\\.escript" "\\.hrl$" "\\.xrl$" "\\.yrl" "/ebin/.+\\.app")) (add-to-list 'auto-mode-alist (cons r 'erlang-mode))) -(autoload 'erlang-find-tag "erlang" "\ -Like `find-tag'. Capable of retrieving Erlang modules. - -Tags can be given on the forms `tag', `module:', `module:tag'. - -(fn MODTAGNAME &optional NEXT-P REGEXP-P)" t) -(autoload 'erlang-find-tag-other-window "erlang" "\ -Like `find-tag-other-window' but aware of Erlang modules. - -(fn TAGNAME &optional NEXT-P REGEXP-P)" t) -(autoload 'erlang-shell "erlang" "\ -Start a new Erlang shell. +(autoload 'erlang-shell "erlang" +"Start a new Erlang shell. The variable `erlang-shell-function' decides which method to use, default is to start a new Erlang host. It is possible that, in the future, a new shell on an already running host will be started." t) (autoload 'run-erlang "erlang" "Start a new Erlang shell." t) -(autoload 'erlang-compile "erlang" "\ -Compile Erlang module in current buffer." t) -(autoload 'inferior-erlang "erlang" "\ -Run an inferior Erlang. +(autoload 'erlang-compile "erlang" +"Compile Erlang module in current buffer." t) +(autoload 'inferior-erlang "erlang" +"Run an inferior Erlang. With prefix command, prompt for command to start Erlang with. This is just like running Erlang in a normal shell, except that @@ -115,8 +103,8 @@ editing control characters: ;;; Generated autoloads from erlang-edoc.el -(autoload 'erlang-edoc-mode "erlang-edoc" "\ -Toggle Erlang-EDoc mode on or off. +(autoload 'erlang-edoc-mode "erlang-edoc" +"Toggle Erlang-EDoc mode on or off. This is a minor mode. If called interactively, toggle the `Erlang-EDoc mode' mode. If the prefix argument is positive, enable the mode, and if @@ -138,7 +126,7 @@ disabled. ;;; Generated autoloads from erlang-eunit.el -(register-definition-prefixes "erlang-eunit" '("erlang-e" "filename-join")) +(register-definition-prefixes "erlang-eunit" '("erlang-e")) ;;; Generated autoloads from erlang-flymake.el @@ -150,17 +138,13 @@ disabled. (register-definition-prefixes "erlang-skels" '("erlang-")) - -;;; Generated autoloads from erlang-skels-old.el - -(register-definition-prefixes "erlang-skels-old" '("erlang-")) - ;;; Generated autoloads from erlang-start.el -(let ((a '("\\.erl\\'" . erlang-mode)) (b '("\\.hrl\\'" . erlang-mode))) (or (assoc (car a) auto-mode-alist) (setq auto-mode-alist (cons a auto-mode-alist))) (or (assoc (car b) auto-mode-alist) (setq auto-mode-alist (cons b auto-mode-alist)))) +(add-to-list 'auto-mode-alist '("\\.erl\\'" . erlang-mode)) +(add-to-list 'auto-mode-alist '("\\.hrl\\'" . erlang-mode)) (add-to-list 'interpreter-mode-alist (cons "escript" 'erlang-mode)) -(let ((erl-ext '(".jam" ".vee" ".beam"))) (while erl-ext (add-to-list 'completion-ignored-extensions (car erl-ext)) (when (boundp 'dired-omit-extensions) (add-to-list 'dired-omit-extensions (car erl-ext))) (setq erl-ext (cdr erl-ext)))) +(add-to-list 'completion-ignored-extensions ".beam") ;;; Generated autoloads from erlang-test.el @@ -170,18 +154,18 @@ disabled. ;;; Generated autoloads from erldoc.el -(autoload 'erldoc-browse "erldoc" "\ - +(autoload 'erldoc-browse "erldoc" +" (fn MFA)" t) -(autoload 'erldoc-apropos "erldoc" "\ - +(autoload 'erldoc-apropos "erldoc" +" (fn PATTERN)" t) -(autoload 'erldoc-eldoc-function "erldoc" "\ -A function suitable for `eldoc-documentation-function'.") -(autoload 'erldoc-browse-topic "erldoc" "\ - +(autoload 'erldoc-eldoc-function "erldoc" +"A function suitable for `eldoc-documentation-function'.") +(autoload 'erldoc-browse-topic "erldoc" +" (fn TOPIC)" t) (register-definition-prefixes "erldoc" '("erldoc-")) diff --git a/elpa/erlang-20250827.800/erlang-edoc.el b/elpa/erlang-20260420.1445/erlang-edoc.el similarity index 100% rename from elpa/erlang-20250827.800/erlang-edoc.el rename to elpa/erlang-20260420.1445/erlang-edoc.el diff --git a/elpa/erlang-20250827.800/erlang-eunit.el b/elpa/erlang-20260420.1445/erlang-eunit.el similarity index 88% rename from elpa/erlang-20250827.800/erlang-eunit.el rename to elpa/erlang-20260420.1445/erlang-eunit.el index 25e5e595..9d26b028 100644 --- a/elpa/erlang-20250827.800/erlang-eunit.el +++ b/elpa/erlang-20260420.1445/erlang-eunit.el @@ -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 @@ -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 - (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))) - (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 @@ -129,13 +133,12 @@ buffer and vice versa" ;;; Checks whether a file is a EUnit test file or not (defun erlang-eunit-test-file-p (file-path) - (erlang-eunit-string-match-p "^\\(.+\\)_tests.erl$" file-path)) + (string-match-p "^\\(.+\\)_tests.erl$" file-path)) ;;; Return the module name of the source file ;;; /tmp/foo/src/x.erl --> x ;;; /tmp/foo/test/x_tests.erl --> x (defun erlang-eunit-source-module-name (file-path) - (interactive) (let ((module-name (erlang-eunit-module-name file-path))) (if (string-match "^\\(.+\\)_tests$" module-name) (substring module-name (match-beginning 1) (match-end 1)) @@ -145,22 +148,8 @@ buffer and vice versa" ;;; /tmp/foo/src/x.erl --> x ;;; /tmp/foo/test/x_tests.erl --> x_tests (defun erlang-eunit-module-name (file-path) - (interactive) (file-name-sans-extension (file-name-nondirectory file-path))) -;;; Older emacsen don't have string-match-p. -(defun erlang-eunit-string-match-p (regexp string &optional start) - (if (fboundp 'string-match-p) ;; appeared in emacs 23 - (string-match-p regexp string start) - (save-match-data ;; fallback for earlier versions of emacs - (string-match regexp string start)))) - -;;; Join filenames -(defun 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) @@ -190,10 +179,10 @@ buffer and vice versa" (erlang-name-of-function))) (defun erlang-eunit-simple-test-p (test-name) - (if (erlang-eunit-string-match-p "^\\(.+\\)_test$" test-name) t nil)) + (if (string-match-p "^\\(.+\\)_test$" test-name) t nil)) (defun erlang-eunit-test-generator-p (test-name) - (if (erlang-eunit-string-match-p "^\\(.+\\)_test_$" test-name) t nil)) + (if (string-match-p "^\\(.+\\)_test_$" test-name) t nil)) ;;; Run one EUnit test (defun erlang-eunit-run-test (module-name test-name) @@ -264,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))) @@ -394,17 +378,11 @@ With prefix arg, compiles for debug and runs tests with the verbose flag set." (mapcar (lambda (e) (car e)) erlang-error-regexp-alist)))) (defun erlang-eunit-is-compilation-warning () - (erlang-eunit-string-match-p + (string-match-p "[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) diff --git a/elpa/erlang-20260420.1445/erlang-flymake.el b/elpa/erlang-20260420.1445/erlang-flymake.el new file mode 100644 index 00000000..f9cbf026 --- /dev/null +++ b/elpa/erlang-20260420.1445/erlang-flymake.el @@ -0,0 +1,161 @@ +;;; erlang-flymake.el -*- lexical-binding: t; -*- +;;; +;;; %CopyrightBegin% +;;; +;;; SPDX-License-Identifier: Apache-2.0 +;;; +;;; Copyright Ericsson AB 2010-2025. All Rights Reserved. +;;; +;;; Licensed under the Apache License, Version 2.0 (the "License"); +;;; you may not use this file except in compliance with the License. +;;; You may obtain a copy of the License at +;;; +;;; http://www.apache.org/licenses/LICENSE-2.0 +;;; +;;; Unless required by applicable law or agreed to in writing, software +;;; distributed under the License is distributed on an "AS IS" BASIS, +;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;;; See the License for the specific language governing permissions and +;;; limitations under the License. +;;; +;;; %CopyrightEnd% +;;; +;; erlang-flymake.el +;; +;; Syntax check erlang source code on the fly (integrates with flymake). +;; +;; Start using flymake with erlang by putting the following somewhere +;; in your .emacs file: +;; +;; (require 'erlang-flymake) +;; +;; There are a couple of variables which control the compilation options: +;; * erlang-flymake-get-code-path-dirs-function +;; * erlang-flymake-get-include-dirs-function +;; * erlang-flymake-extra-opts +;; +;; This code is inspired by http://www.emacswiki.org/emacs/FlymakeErlang. + +(require 'flymake) + +(defvar erlang-flymake-command + "erlc" + "The command that will be used to perform the syntax check.") + +(defvar erlang-flymake-get-code-path-dirs-function + 'erlang-flymake-get-code-path-dirs + "Return a list of ebin directories to add to the code path.") + +(defvar erlang-flymake-get-include-dirs-function + 'erlang-flymake-get-include-dirs + "Return a list of include directories to add to the compiler options.") + +(defvar erlang-flymake-extra-opts + (list "+warn_unused_import" + "+warn_shadow_vars" + "+warn_export_vars" + "+strong_validation" + "+report") + "A list of options that will be passed to the compiler.") + +(defun erlang-flymake-get-code-path-dirs () + (list (concat (erlang-flymake-get-app-dir) "ebin"))) + +(defun erlang-flymake-get-include-dirs () + (list (concat (erlang-flymake-get-app-dir) "include") + (concat (erlang-flymake-get-app-dir) "deps"))) + +(defun erlang-flymake-get-app-dir () + (let ((src-path (file-name-directory (buffer-file-name)))) + (file-name-directory (directory-file-name src-path)))) + +(defvar-local erlang-flymake--proc nil + "Internal variable for the Erlang flymake backend process.") + +(defun erlang-flymake-backend (report-fn &rest _args) + "Flymake backend for Erlang using erlc. +REPORT-FN is the flymake callback." + (when (process-live-p erlang-flymake--proc) + (kill-process erlang-flymake--proc)) + (let* ((source (current-buffer)) + (filename (buffer-file-name source)) + (code-dir-opts + (apply #'append + (mapcar (lambda (dir) (list "-pa" dir)) + (funcall erlang-flymake-get-code-path-dirs-function)))) + (inc-dir-opts + (apply #'append + (mapcar (lambda (dir) (list "-I" dir)) + (funcall erlang-flymake-get-include-dirs-function)))) + (compile-opts (append inc-dir-opts + code-dir-opts + erlang-flymake-extra-opts + (list filename)))) + (save-restriction + (widen) + (setq erlang-flymake--proc + (make-process + :name "erlang-flymake" + :noquery t + :connection-type 'pipe + :buffer (generate-new-buffer " *erlang-flymake*") + :command (cons erlang-flymake-command compile-opts) + :sentinel + (lambda (proc _event) + (when (memq (process-status proc) '(exit signal)) + (unwind-protect + (when (with-current-buffer source + (eq proc erlang-flymake--proc)) + (with-current-buffer (process-buffer proc) + (goto-char (point-min)) + (let (diagnostics) + (while (search-forward-regexp + "^\\(.*\\):\\([0-9]+\\):\\([0-9]+\\):\\s-*\\(warning\\|error\\):\\s-*\\(.*\\)$" + nil t) + (let* ((file (match-string 1)) + (line (string-to-number (match-string 2))) + (col (string-to-number (match-string 3))) + (type (if (string= (match-string 4) "warning") + :warning + :error)) + (msg (match-string 5)) + (region (flymake-diag-region source line col))) + (when (and region + (string= (file-truename file) + (file-truename filename))) + (push (flymake-make-diagnostic + source (car region) (cdr region) + type msg) + diagnostics)))) + ;; Also match old-style output without column: + ;; file.erl:LINE: warning/error: message + (goto-char (point-min)) + (while (search-forward-regexp + "^\\(.*\\):\\([0-9]+\\):\\s-*\\(warning\\|error\\):\\s-*\\(.*\\)$" + nil t) + (let* ((file (match-string 1)) + (line (string-to-number (match-string 2))) + (type (if (string= (match-string 3) "warning") + :warning + :error)) + (msg (match-string 4)) + (region (flymake-diag-region source line))) + (when (and region + (string= (file-truename file) + (file-truename filename))) + (push (flymake-make-diagnostic + source (car region) (cdr region) + type msg) + diagnostics)))) + (funcall report-fn (nreverse diagnostics))))) + (kill-buffer (process-buffer proc)))))))))) + +(defun erlang-flymake-setup () + "Set up the Erlang flymake backend for the current buffer." + (add-hook 'flymake-diagnostic-functions #'erlang-flymake-backend nil t)) + +(add-hook 'erlang-mode-hook #'erlang-flymake-setup) +(add-hook 'erlang-mode-hook #'flymake-mode) + +(provide 'erlang-flymake) +;; erlang-flymake ends here diff --git a/elpa/erlang-20250827.800/erlang-pkg.el b/elpa/erlang-20260420.1445/erlang-pkg.el similarity index 57% rename from elpa/erlang-20250827.800/erlang-pkg.el rename to elpa/erlang-20260420.1445/erlang-pkg.el index a9395f6d..2b042bc6 100644 --- a/elpa/erlang-20250827.800/erlang-pkg.el +++ b/elpa/erlang-20260420.1445/erlang-pkg.el @@ -1,8 +1,8 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "erlang" "20250827.800" +(define-package "erlang" "20260420.1445" "Major modes for editing and running Erlang." - '((emacs "24.3")) + '((emacs "27.1")) :url "https://github.com/erlang/otp" - :commit "ed8445a63861f510d21e27c9122e4fafa8039d9d" - :revdesc "ed8445a63861" + :commit "a42e46bab47432b988ee60e4c9d915c858bcf32d" + :revdesc "a42e46bab474" :keywords '("erlang" "languages" "processes")) diff --git a/elpa/erlang-20250827.800/erlang-skels.el b/elpa/erlang-20260420.1445/erlang-skels.el similarity index 78% rename from elpa/erlang-20250827.800/erlang-skels.el rename to elpa/erlang-20260420.1445/erlang-skels.el index e118b00b..ddd0a714 100644 --- a/elpa/erlang-20250827.800/erlang-skels.el +++ b/elpa/erlang-20260420.1445/erlang-skels.el @@ -56,14 +56,10 @@ erlang-skel-application erlang-skel-header) ("Supervisor" "supervisor" erlang-skel-supervisor erlang-skel-header) - ("supervisor_bridge" "supervisor-bridge" - erlang-skel-supervisor-bridge erlang-skel-header) ("gen_server" "generic-server" erlang-skel-generic-server erlang-skel-header) ("gen_event" "gen-event" erlang-skel-gen-event erlang-skel-header) - ("gen_fsm" "gen-fsm" - erlang-skel-gen-fsm erlang-skel-header) ("gen_statem (StateName/3)" "gen-statem-StateName" erlang-skel-gen-statem-StateName erlang-skel-header) ("gen_statem (handle_event/4)" "gen-statem-handle-event" @@ -72,16 +68,12 @@ erlang-skel-wx-object erlang-skel-header) ("Library module" "gen-lib" erlang-skel-lib erlang-skel-header) - ("Corba callback" "gen-corba-cb" - erlang-skel-corba-callback erlang-skel-header) ("Small Common Test suite" "ct-test-suite-s" erlang-skel-ct-test-suite-s erlang-skel-header) ("Large Common Test suite" "ct-test-suite-l" erlang-skel-ct-test-suite-l erlang-skel-header) ("Common Test Hook" "ct-hook" erlang-skel-ct-hook erlang-skel-header) - ("Erlang TS test suite" "ts-test-suite" - erlang-skel-ts-test-suite erlang-skel-header) ) "*Description of all skeleton templates. Both functions and menu entries will be created. @@ -438,76 +430,6 @@ Please see the function `tempo-define-template'.") "*The template of a supervisor behaviour. Please see the function `tempo-define-template'.") -(defvar erlang-skel-supervisor-bridge - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(supervisor_bridge)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% supervisor_bridge callbacks" n - "-export([init/1, terminate/2])." n n - - "-define(SERVER, ?MODULE)." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator-start 3) - "%%% API" n - (erlang-skel-double-separator-end 3) n - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Starts the supervisor bridge" n - (erlang-skel-separator-end 2) - "-spec start_link() -> {ok, Pid :: pid()} |" n> - "{error, {already_started, Pid :: pid()}} |" n> - "{error, term()} |" n> - "ignore." n - "start_link() ->" n> - "supervisor_bridge:start_link({local, ?SERVER}, ?MODULE, [])." n - n - (erlang-skel-double-separator-start 3) - "%%% supervisor_bridge callbacks" n - (erlang-skel-double-separator-end 3) n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Creates a supervisor_bridge process, linked to the calling process," n - "%% which calls Module:init/1 to start the subsystem. To ensure a" n - "%% synchronized start-up procedure, this function does not return" n - "%% until Module:init/1 has returned." n - (erlang-skel-separator-end 2) - "-spec init(Args :: term()) -> {ok, Pid :: pid(), State :: term()} |" n> - "{error, Error :: term()} |" n> - "ignore." n - "init([]) ->" n> - "case 'AModule':start_link() of" n> - "{ok, Pid} ->" n> - "{ok, Pid, #state{}};" n> - "Error ->" n> - "Error" n - "end." > n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% This function is called by the supervisor_bridge when it is about" n - "%% to terminate. It should be the opposite of Module:init/1 and stop" n - "%% the subsystem and do any necessary cleaning up.The return value is" n - "%% ignored." n - (erlang-skel-separator-end 2) - "-spec terminate(Reason :: shutdown | term(), State :: term()) -> any()." n - "terminate(_Reason, _State) ->" n> - "'AModule':stop()," n> - "ok." n - n - (erlang-skel-double-separator-start 3) - "%%% Internal functions" n - (erlang-skel-double-separator-end 3) - ) - "*The template of a supervisor_bridge behaviour. -Please see the function `tempo-define-template'.") - (defvar erlang-skel-generic-server '((erlang-skel-include erlang-skel-large-header) "-behaviour(gen_server)." n n @@ -790,172 +712,6 @@ Please see the function `tempo-define-template'.") "*The template of a gen_event. Please see the function `tempo-define-template'.") -(defvar erlang-skel-gen-fsm - '((erlang-skel-include erlang-skel-large-header) - "-behaviour(gen_fsm)." n n - - "%% API" n - "-export([start_link/0])." n n - - "%% gen_fsm callbacks" n - "-export([init/1, state_name/2, state_name/3, handle_event/3," n> - "handle_sync_event/4, handle_info/3, terminate/3, code_change/4])." n n - - "-define(SERVER, ?MODULE)." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator-start 3) - "%%% API" n - (erlang-skel-double-separator-end 3) n - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Creates a gen_fsm process which calls Module:init/1 to" n - "%% initialize. To ensure a synchronized start-up procedure, this" n - "%% function does not return until Module:init/1 has returned." n - "%%" n - "%% @spec start_link() -> {ok, Pid} | ignore | {error, Error}" n - (erlang-skel-separator-end 2) - "start_link() ->" n> - "gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], [])." n - n - (erlang-skel-double-separator-start 3) - "%%% gen_fsm callbacks" n - (erlang-skel-double-separator-end 3) n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Whenever a gen_fsm is started using gen_fsm:start/[3,4] or" n - "%% gen_fsm:start_link/[3,4], this function is called by the new" n - "%% process to initialize." n - "%%" n - "%% @spec init(Args) -> {ok, StateName, State} |" n - "%% {ok, StateName, State, Timeout} |" n - "%% ignore |" n - "%% {stop, StopReason}" n - (erlang-skel-separator-end 2) - "init([]) ->" n> - "process_flag(trap_exit, true)," n> - "{ok, state_name, #state{}}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% There should be one instance of this function for each possible" n - "%% state name. Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:send_event/2, the instance of this function with the same" n - "%% name as the current state name StateName is called to handle" n - "%% the event. It is also called if a timeout occurs." n - "%%" n - "%% @spec state_name(Event, State) ->" n - "%% {next_state, NextStateName, NextState} |" n - "%% {next_state, NextStateName, NextState, Timeout} |" n - "%% {stop, Reason, NewState}" n - (erlang-skel-separator-end 2) - "state_name(_Event, State) ->" n> - "{next_state, state_name, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% There should be one instance of this function for each possible" n - "%% state name. Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:sync_send_event/[2,3], the instance of this function with" n - "%% the same name as the current state name StateName is called to" n - "%% handle the event." n - "%%" n - "%% @spec state_name(Event, From, State) ->" n - "%% {next_state, NextStateName, NextState} |"n - "%% {next_state, NextStateName, NextState, Timeout} |" n - "%% {reply, Reply, NextStateName, NextState} |" n - "%% {reply, Reply, NextStateName, NextState, Timeout} |" n - "%% {stop, Reason, NewState} |" n - "%% {stop, Reason, Reply, NewState}" n - (erlang-skel-separator-end 2) - "state_name(_Event, _From, State) ->" n> - "Reply = ok," n> - "{reply, Reply, state_name, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:send_all_state_event/2, this function is called to handle" n - "%% the event." n - "%%" n - "%% @spec handle_event(Event, StateName, State) ->" n - "%% {next_state, NextStateName, NextState} |" n - "%% {next_state, NextStateName, NextState, Timeout} |" n - "%% {stop, Reason, NewState}" n - (erlang-skel-separator-end 2) - "handle_event(_Event, StateName, State) ->" n> - "{next_state, StateName, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Whenever a gen_fsm receives an event sent using" n - "%% gen_fsm:sync_send_all_state_event/[2,3], this function is called" n - "%% to handle the event." n - "%%" n - "%% @spec handle_sync_event(Event, From, StateName, State) ->" n - "%% {next_state, NextStateName, NextState} |" n - "%% {next_state, NextStateName, NextState, Timeout} |" n - "%% {reply, Reply, NextStateName, NextState} |" n - "%% {reply, Reply, NextStateName, NextState, Timeout} |" n - "%% {stop, Reason, NewState} |" n - "%% {stop, Reason, Reply, NewState}" n - (erlang-skel-separator-end 2) - "handle_sync_event(_Event, _From, StateName, State) ->" n> - "Reply = ok," n> - "{reply, Reply, StateName, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% This function is called by a gen_fsm when it receives any" n - "%% message other than a synchronous or asynchronous event" n - "%% (or a system message)." n - "%%" n - "%% @spec handle_info(Info,StateName,State)->" n - "%% {next_state, NextStateName, NextState} |" n - "%% {next_state, NextStateName, NextState, Timeout} |" n - "%% {stop, Reason, NewState}" n - (erlang-skel-separator-end 2) - "handle_info(_Info, StateName, State) ->" n> - "{next_state, StateName, State}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% This function is called by a gen_fsm when it is about to" n - "%% terminate. It should be the opposite of Module:init/1 and do any" n - "%% necessary cleaning up. When it returns, the gen_fsm terminates with" n - "%% Reason. The return value is ignored." n - "%%" n - "%% @spec terminate(Reason, StateName, State) -> void()" n - (erlang-skel-separator-end 2) - "terminate(_Reason, _StateName, _State) ->" n> - "ok." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Convert process state when code is changed" n - "%%" n - "%% @spec code_change(OldVsn, StateName, State, Extra) ->" n - "%% {ok, StateName, NewState}" n - (erlang-skel-separator-end 2) - "code_change(_OldVsn, StateName, State, _Extra) ->" n> - "{ok, StateName, State}." n - n - (erlang-skel-double-separator-start 3) - "%%% Internal functions" n - (erlang-skel-double-separator-end 3) - ) - "*The template of a gen_fsm. -Please see the function `tempo-define-template'.") - (defvar erlang-skel-gen-statem-StateName '((erlang-skel-include erlang-skel-large-header) "-behaviour(gen_statem)." n n @@ -1325,208 +1081,6 @@ Please see the function `tempo-define-template'.") "*The template of a library module. Please see the function `tempo-define-template'.") -(defvar erlang-skel-corba-callback - '((erlang-skel-include erlang-skel-large-header) - "%% Include files" n n - - "%% API" n - "-export([])." n n - - "%% Corba callbacks" n - "-export([init/1, terminate/2, code_change/3])." n n - - "-record(state, {})." n n - - (erlang-skel-double-separator-start 3) - "%%% Corba callbacks" n - (erlang-skel-double-separator-end 3) n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Initializes the server" n - "%%" n - "%% @spec init(Args) -> {ok, State} |" n - "%% {ok, State, Timeout} |" n - "%% ignore |" n - "%% {stop, Reason}" n - (erlang-skel-separator-end 2) - "init([]) ->" n> - "{ok, #state{}}." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Shutdown the server" n - "%%" n - "%% @spec terminate(Reason, State) -> void()" n - (erlang-skel-separator-end 2) - "terminate(_Reason, _State) ->" n> - "ok." n - n - (erlang-skel-separator-start 2) - "%% @private" n - "%% @doc" n - "%% Convert process state when code is changed" n - "%%" n - "%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}" n - (erlang-skel-separator-end 2) - "code_change(_OldVsn, State, _Extra) ->" n> - "{ok, State}." n - n - (erlang-skel-double-separator-start 3) - "%%% Internal functions" n - (erlang-skel-double-separator-end 3) - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - -(defvar erlang-skel-ts-test-suite - '((erlang-skel-include erlang-skel-large-header) - "%% Note: This directive should only be used in test suites." n - "-compile(export_all)." n n - - "-include_lib(\"common_test/include/ct.hrl\")." n n - - (erlang-skel-separator-start 2) - "%% TEST SERVER CALLBACK FUNCTIONS" n - (erlang-skel-separator 2) - n - (erlang-skel-separator-start 2) - "%%" n - "%% @doc" n - "%% Initialization before the suite." n - "%%" n - "%% Config0 = Config1 = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the suite." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - "%%" n - "%% @spec init_per_suite(Config) -> Config" n - (erlang-skel-separator-end 2) - "init_per_suite(Config) ->" n > - "Config." n n - - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Cleanup after the suite." n - "%% Config - [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% @spec end_per_suite(Config) -> _" n - (erlang-skel-separator-end 2) - "end_per_suite(_Config) ->" n > - "ok." n n - - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Initialization before each test case" n - "%%" n - "%% TestCase - atom()" n - "%% Name of the test case that is about to be run." n - "%% Config - [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% Note: This function is free to add any key/value pairs to the Config" n - "%% variable, but should NOT alter/remove any existing entries." n - "%%" n - "%% @spec init_per_testcase(TestCase, Config) -> Config" n - (erlang-skel-separator-end 2) - "init_per_testcase(_TestCase, Config) ->" n > - "Config." n n - - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Cleanup after each test case" n - "%%" n - "%% TestCase = atom()" n - "%% Name of the test case that is finished." n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%%" n - "%% @spec end_per_testcase(TestCase, Config) -> _" n - (erlang-skel-separator-end 2) - "end_per_testcase(_TestCase, _Config) ->" n > - "ok."n n - - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Returns a description of the test suite when" n - "%% Clause == doc, and a test specification (list" n - "%% of the conf and test cases in the suite) when" n - "%% Clause == suite." n - "%% Returns a list of all test cases in this test suite" n - "%%" n - "%% Clause = doc | suite" n - "%% Indicates expected return value." n - "%% Descr = [string()] | []" n - "%% String that describes the test suite." n - "%% Spec = [TestCase]" n - "%% A test specification." n - "%% TestCase = ConfCase | atom()" n - "%% Configuration case, or the name of a test case function." n - "%% ConfCase = {conf,Init,Spec,End} |" n - "%% {conf,Properties,Init,Spec,End}" n - "%% Init = End = {Mod,Func} | Func" n - "%% Initialization and cleanup function." n - "%% Mod = Func = atom()" n - "%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]" n - "%% Execution properties of the test cases (may be combined)." n - "%% Shuffle = shuffle | {shuffle,Seed}" n - "%% To get cases executed in random order." n - "%% Seed = {integer(),integer(),integer()}" n - "%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |" n - "%% repeat_until_any_ok | repeat_until_any_fail" n - "%% To get execution of cases repeated." n - "%% N = integer() | forever" n - "%% Reason = term()" n - "%% The reason for skipping the test suite." n - "%%" n - "%% @spec all(Clause) -> TestCases" n - (erlang-skel-separator-end 2) - "all(doc) ->" n > - "[\"Describe the main purpose of this suite\"];" n n - "all(suite) -> " n > - "[a_test_case]." n n - n - (erlang-skel-separator-start 2) - "%% TEST CASES" n - (erlang-skel-separator 2) - n - (erlang-skel-separator-start 2) - "%% @doc" n - "%% Test case function. Returns a description of the test" n - "%% case (doc), then returns a test specification (suite)," n - "%% or performs the actual test (Config)." n - "%%" n - "%% Arg = doc | suite | Config" n - "%% Indicates expected behaviour and return value." n - "%% Config = [tuple()]" n - "%% A list of key/value pairs, holding the test case configuration." n - "%% Descr = [string()] | []" n - "%% String that describes the test case." n - "%% Spec = [tuple()] | []" n - "%% A test specification, see all/1." n - "%% Reason = term()" n - "%% The reason for skipping the test case." n - "%%" n - "%% @spec TestCase(Arg) -> Descr | Spec | ok | exit() | {skip,Reason}" n - - (erlang-skel-separator-end 2) - "a_test_case(doc) -> " n > - "[\"Describe the main purpose of this test case\"];" n n - "a_test_case(suite) -> " n > - "[];" n n - "a_test_case(Config) when is_list(Config) -> " n > - "ok." n - ) - "*The template of a library module. -Please see the function `tempo-define-template'.") - (defvar erlang-skel-ct-test-suite-s '((erlang-skel-include erlang-skel-large-header) "-compile(export_all)." n n diff --git a/elpa/erlang-20250827.800/erlang-start.el b/elpa/erlang-20260420.1445/erlang-start.el similarity index 83% rename from elpa/erlang-20250827.800/erlang-start.el rename to elpa/erlang-20260420.1445/erlang-start.el index 6232af0c..271121ca 100644 --- a/elpa/erlang-20250827.800/erlang-start.el +++ b/elpa/erlang-20260420.1445/erlang-start.el @@ -91,11 +91,6 @@ (autoload 'erlang-man-function "erlang" "Find manual page for NAME, where NAME is module:function." t) -(autoload 'erlang-find-tag "erlang" - "Like `find-tag'. Capable of retrieving Erlang modules.") -(autoload 'erlang-find-tag-other-window "erlang" - "Like `find-tag-other-window'. Capable of retrieving Erlang modules.") - ;; ;; Declare functions in "erlang-edoc.el". ;; @@ -117,12 +112,9 @@ A function suitable for `eldoc-documentation-function'.\n\n(fn)" nil nil) ;; ;;;###autoload -(let ((a '("\\.erl\\'" . erlang-mode)) - (b '("\\.hrl\\'" . erlang-mode))) - (or (assoc (car a) auto-mode-alist) - (setq auto-mode-alist (cons a auto-mode-alist))) - (or (assoc (car b) auto-mode-alist) - (setq auto-mode-alist (cons b auto-mode-alist)))) +(add-to-list 'auto-mode-alist '("\\.erl\\'" . erlang-mode)) +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.hrl\\'" . erlang-mode)) ;; ;; Associate files using interpreter "escript" with Erlang mode. @@ -132,17 +124,12 @@ A function suitable for `eldoc-documentation-function'.\n\n(fn)" nil nil) (add-to-list 'interpreter-mode-alist (cons "escript" 'erlang-mode)) ;; -;; Ignore files ending in ".jam", ".vee", and ".beam" when performing +;; Ignore files ending in ".beam" when performing ;; file completion and in dired omit mode. ;; ;;;###autoload -(let ((erl-ext '(".jam" ".vee" ".beam"))) - (while erl-ext - (add-to-list 'completion-ignored-extensions (car erl-ext)) - (when (boundp 'dired-omit-extensions) - (add-to-list 'dired-omit-extensions (car erl-ext))) - (setq erl-ext (cdr erl-ext)))) +(add-to-list 'completion-ignored-extensions ".beam") ;; diff --git a/elpa/erlang-20250827.800/erlang-test.el b/elpa/erlang-20260420.1445/erlang-test.el similarity index 96% rename from elpa/erlang-20250827.800/erlang-test.el rename to elpa/erlang-20260420.1445/erlang-test.el index 0d44e5b4..015d2d8e 100644 --- a/elpa/erlang-20250827.800/erlang-test.el +++ b/elpa/erlang-20260420.1445/erlang-test.el @@ -103,14 +103,7 @@ concatenated to form an erlang file to test on.") (erlang-test-create-erlang-file erlang-file) (erlang-test-compile-tags erlang-file tags-file) (setq erlang-buffer (find-file-noselect erlang-file)) - (if (< emacs-major-version 26) - (progn - (with-current-buffer erlang-buffer - (setq-local tags-file-name tags-file)) - ;; Setting global tags-file-name is a workaround for - ;; GNU Emacs bug#23164. - (setq tags-file-name tags-file)) - (visit-tags-table tags-file t)) + (visit-tags-table tags-file t) (erlang-test-complete-at-point tags-file) (erlang-test-completion-table) (erlang-test-xref-find-definitions erlang-file erlang-buffer)) diff --git a/elpa/erlang-20250827.800/erlang.el b/elpa/erlang-20260420.1445/erlang.el similarity index 87% rename from elpa/erlang-20250827.800/erlang.el rename to elpa/erlang-20260420.1445/erlang.el index 45fbaae9..91313134 100644 --- a/elpa/erlang-20250827.800/erlang.el +++ b/elpa/erlang-20260420.1445/erlang.el @@ -24,9 +24,9 @@ ;; Author: Anders Lindgren ;; Keywords: erlang, languages, processes ;; Date: 2011-12-11 -;; Package-Version: 20250827.800 -;; Package-Revision: ed8445a63861 -;; Package-Requires: ((emacs "24.3")) +;; Package-Version: 20260420.1445 +;; Package-Revision: a42e46bab474 +;; Package-Requires: ((emacs "27.1")) ;; Lars Thorsén's modifications of 2000-06-07 included. ;; The original version of this package was written by Robert Virding. @@ -82,12 +82,6 @@ (require 'comint) (require 'tempo) (require 'cl-lib) -(require 'advice) - -;;; `caddr' is builtin since Emacs 26. -(eval-and-compile - (or (fboundp 'caddr) - (defun caddr (x) (car (cdr (cdr x)))))) ;; Variables: @@ -95,8 +89,9 @@ "The Erlang programming language." :group 'languages) -(defconst erlang-version "2.8.6" - "The version number of Erlang mode.") +(defconst erlang-version "29.0" + "The version number of Erlang mode. +This tracks the Erlang/OTP release version.") (defcustom erlang-root-dir nil "The directory where the Erlang man pages are installed. The @@ -168,10 +163,8 @@ variable.") ("Level 1" erlang-font-lock-level-1) ("Off" erlang-font-lock-level-0))) ("TAGS" - (("Find Tag" find-tag) - ("Find Next Tag" erlang-find-next-tag) - ;("Find Regexp" find-tag-regexp) - ("Complete Word" erlang-complete-tag) + (("Find Definition" xref-find-definitions) + ("Find References" xref-find-references) ("Tags Apropos" tags-apropos) ("Search Files" tags-search)))) "Description of menu used in Erlang mode. @@ -820,6 +813,7 @@ resulting regexp is surrounded by \\_< and \\_>." "erase" "error" "exit" + "exit_signal" "floor" "float" "float_to_binary" @@ -956,7 +950,6 @@ resulting regexp is surrounded by \\_< and \\_>." "dt_restore_tag" "dt_spread_tag" "convert_time_unit" - "exit_signal" "external_size" "finish_after_on_load" "finish_loading" @@ -1071,8 +1064,7 @@ behaviour.") (define-key map (kbd "C-m") 'erlang-electric-newline) (define-key map (kbd "DEL") 'backward-delete-char-untabify) (define-key map (kbd "M-q") 'erlang-fill-paragraph) - (define-key map (kbd "M-") 'erlang-complete-tag) - (define-key map (kbd "M-+") 'erlang-find-next-tag) + (define-key map (kbd "M-?") 'xref-find-references) (define-key map (kbd "C-c M-") 'tempo-complete-tag) (define-key map (kbd "C-c M-a") 'erlang-beginning-of-clause) (define-key map (kbd "C-c M-b") 'tempo-backward-mark) @@ -1100,11 +1092,9 @@ behaviour.") (defvar erlang-skel-file "erlang-skels" - "The type of erlang-skeletons that should be used, default - uses edoc type, for the old type, standard comments, - set \"erlang-skels-old\" in your .emacs and restart. - - Or define your own and set the variable to that file.") + "The skeleton file to load. +The default uses EDoc-style skeletons. Set to a different file +name to use custom skeletons.") ;; Tempo skeleton templates: (load erlang-skel-file) @@ -1206,9 +1196,7 @@ behaviour.") (defvar erlang-font-lock-keywords-attr (list (list (concat "^\\(-" erlang-atom-regexp "\\)\\(\\s-\\|\\.\\|(\\)") - 1 (if (boundp 'font-lock-preprocessor-face) - 'font-lock-preprocessor-face - 'font-lock-constant-face))) + 1 'font-lock-preprocessor-face)) "Font lock keyword highlighting attributes.") (defvar erlang-font-lock-keywords-quotes @@ -1242,9 +1230,7 @@ are highlighted by syntactic analysis.") 1 'font-lock-constant-face) (list (concat "^\\(-\\(?:define\\|ifn?def\\)\\)\\s-*(\\s-*\\(" erlang-atom-regexp "\\|" erlang-variable-regexp "\\)") - (if (boundp 'font-lock-preprocessor-face) - (list 1 'font-lock-preprocessor-face t) - (list 1 'font-lock-constant-face t)) + (list 1 'font-lock-preprocessor-face t) (list 3 'font-lock-type-face t t)) (list "^-e\\(lse\\|ndif\\)\\>" 0 'font-lock-preprocessor-face t)) "Font lock keyword highlighting macros. @@ -1444,7 +1430,7 @@ Other commands: (erlang-font-lock-init) (erlang-skel-init) (tempo-use-tag-list 'erlang-tempo-tags) - (when (and (fboundp 'add-function) (fboundp 'erldoc-eldoc-function)) + (when (fboundp 'erldoc-eldoc-function) (or eldoc-documentation-function (setq-local eldoc-documentation-function #'ignore)) (add-function :before-until (local 'eldoc-documentation-function) @@ -1617,8 +1603,7 @@ Other commands: (put 'bitsyntax-close-inner 'rear-nonsticky '(category)) (put 'bitsyntax-close-outer 'syntax-table '(5 . ?<)) (put 'bitsyntax-close-outer 'rear-nonsticky '(category)) - (make-local-variable 'parse-sexp-lookup-properties) - (setq parse-sexp-lookup-properties 't) + (setq-local parse-sexp-lookup-properties t) (add-hook 'post-self-insert-hook #'erlang-electric-pair-string-delimiter 'append t)) @@ -1627,43 +1612,32 @@ Other commands: (or erlang-mode-abbrev-table (define-abbrev-table 'erlang-mode-abbrev-table ())) (setq local-abbrev-table erlang-mode-abbrev-table) - (make-local-variable 'paragraph-start) - (setq paragraph-start (concat "^$\\|" page-delimiter)) - (make-local-variable 'paragraph-separate) - (setq paragraph-separate paragraph-start) - (make-local-variable 'paragraph-ignore-fill-prefix) - (setq paragraph-ignore-fill-prefix t) - (make-local-variable 'defun-prompt-regexp) - (setq defun-prompt-regexp erlang-defun-prompt-regexp) - (make-local-variable 'comment-start) - (setq comment-start "%") - (make-local-variable 'comment-start-skip) - (setq comment-start-skip "%+\\s *") - (make-local-variable 'comment-column) - (setq comment-column 48) - (make-local-variable 'indent-line-function) - (setq indent-line-function 'erlang-indent-command) - (make-local-variable 'indent-region-function) - (setq indent-region-function 'erlang-indent-region) - (set (make-local-variable 'comment-indent-function) 'erlang-comment-indent) - (set (make-local-variable 'parse-sexp-ignore-comments) t) - (set (make-local-variable 'dabbrev-case-fold-search) nil) - (set (make-local-variable 'imenu-prev-index-position-function) - 'erlang-beginning-of-function) - (set (make-local-variable 'imenu-extract-index-name-function) - 'erlang-get-function-name-and-arity) - (set (make-local-variable 'tempo-match-finder) - "[^-a-zA-Z0-9_]\\([-a-zA-Z0-9_]*\\)\\=") - (set (make-local-variable 'beginning-of-defun-function) - 'erlang-beginning-of-function) - (set (make-local-variable 'end-of-defun-function) 'erlang-end-of-function) - (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) - (set (make-local-variable 'fill-paragraph-function) 'erlang-fill-paragraph) - (set (make-local-variable 'comment-add) 1) - (set (make-local-variable 'outline-regexp) "[[:lower:]0-9_]+ *(.*) *-> *$") - (set (make-local-variable 'outline-level) (lambda () 1)) - (set (make-local-variable 'add-log-current-defun-function) - 'erlang-current-defun)) + (setq-local paragraph-start (concat "^$\\|" page-delimiter)) + (setq-local paragraph-separate paragraph-start) + (setq-local paragraph-ignore-fill-prefix t) + (setq-local defun-prompt-regexp erlang-defun-prompt-regexp) + (setq-local comment-start "%") + (setq-local comment-start-skip "%+\\s *") + (setq-local comment-column 48) + (setq-local indent-line-function 'erlang-indent-command) + (setq-local indent-region-function 'erlang-indent-region) + (setq-local comment-indent-function 'erlang-comment-indent) + (setq-local parse-sexp-ignore-comments t) + (setq-local dabbrev-case-fold-search nil) + (setq-local imenu-prev-index-position-function + 'erlang-beginning-of-function) + (setq-local imenu-extract-index-name-function + 'erlang-get-function-name-and-arity) + (setq-local tempo-match-finder + "[^-a-zA-Z0-9_]\\([-a-zA-Z0-9_]*\\)\\=") + (setq-local beginning-of-defun-function 'erlang-beginning-of-function) + (setq-local end-of-defun-function 'erlang-end-of-function) + (setq-local open-paren-in-column-0-is-defun-start nil) + (setq-local fill-paragraph-function 'erlang-fill-paragraph) + (setq-local comment-add 1) + (setq-local outline-regexp "[[:lower:]0-9_]+ *(.*) *-> *$") + (setq-local outline-level (lambda () 1)) + (setq-local add-log-current-defun-function 'erlang-current-defun)) (defun erlang-font-lock-init () "Initialize Font Lock for Erlang mode." @@ -1672,38 +1646,7 @@ Other commands: (let ((table (copy-syntax-table erlang-mode-syntax-table))) (modify-syntax-entry ?_ "w" table) table))) - (set (make-local-variable 'font-lock-syntax-table) - erlang-font-lock-syntax-table) - (set (make-local-variable (if (boundp 'syntax-begin-function) - 'syntax-begin-function - 'font-lock-beginning-of-syntax-function)) - 'erlang-beginning-of-clause) - (make-local-variable 'font-lock-keywords) - (let ((level (cond ((boundp 'font-lock-maximum-decoration) - (symbol-value 'font-lock-maximum-decoration)) - ((boundp 'font-lock-use-maximal-decoration) - (symbol-value 'font-lock-use-maximal-decoration)) - (t nil)))) - (if (consp level) - (setq level (cdr-safe (or (assq 'erlang-mode level) - (assq t level))))) - ;; `level' can here be: - ;; A number - The fontification level - ;; nil - Use the default - ;; t - Use maximum - (cond ((eq level nil) - (set 'font-lock-keywords erlang-font-lock-keywords)) - ((eq level 1) - (set 'font-lock-keywords erlang-font-lock-keywords-1)) - ((eq level 2) - (set 'font-lock-keywords erlang-font-lock-keywords-2)) - ((eq level 3) - (set 'font-lock-keywords erlang-font-lock-keywords-3)) - (t - (set 'font-lock-keywords erlang-font-lock-keywords-4)))) - - ;; Modern font-locks can handle the above much more elegantly: - (set (make-local-variable 'font-lock-defaults) + (setq-local font-lock-defaults '((erlang-font-lock-keywords erlang-font-lock-keywords-1 erlang-font-lock-keywords-2 erlang-font-lock-keywords-3 @@ -1818,7 +1761,7 @@ This highlights function headers, reserved keywords, strings and comments." (require 'font-lock) (set 'font-lock-keywords erlang-font-lock-keywords-1) (font-lock-mode 1) - (funcall (symbol-function 'font-lock-fontify-buffer))) + (font-lock-ensure)) (defun erlang-font-lock-level-2 () @@ -1830,7 +1773,7 @@ plus bifs, guards and `single quotes'." (require 'font-lock) (set 'font-lock-keywords erlang-font-lock-keywords-2) (font-lock-mode 1) - (funcall (symbol-function 'font-lock-fontify-buffer))) + (font-lock-ensure)) (defun erlang-font-lock-level-3 () @@ -1842,7 +1785,7 @@ plus variables, macros and records." (require 'font-lock) (set 'font-lock-keywords erlang-font-lock-keywords-3) (font-lock-mode 1) - (funcall (symbol-function 'font-lock-fontify-buffer))) + (font-lock-ensure)) (defun erlang-font-lock-level-4 () ;; DocStringCopy: font-cmd @@ -1853,7 +1796,7 @@ plus variables, macros and records." (require 'font-lock) (set 'font-lock-keywords erlang-font-lock-keywords-4) (font-lock-mode 1) - (funcall (symbol-function 'font-lock-fontify-buffer))) + (font-lock-ensure)) (defun erlang-menu-init () @@ -1891,8 +1834,7 @@ Please see the variable `erlang-menu-base-items'." (defun erlang-menu-make-keymap (name items) "Build a menu." - (let ((menumap (funcall (symbol-function 'make-sparse-keymap) - name)) + (let ((menumap (make-sparse-keymap name)) (count 0) id def first second third) (setq items (reverse items)) @@ -1928,27 +1870,6 @@ Please see the variable `erlang-menu-base-items'." (setq items (cdr items))) (cons name menumap))) -(defun erlang-menu-substitute (items alist) - "Substitute functions in menu described by ITEMS. - -The menu ITEMS is updated destructively. - -ALIST is list of pairs where the car is the old function and cdr the new." - (let (first second pair) - (while items - (setq first (car-safe (car items))) - (setq second (car-safe (cdr-safe (car items)))) - (cond ((null first)) - ((symbolp second) - (setq pair (and second (assq second alist))) - (if pair - (setcar (cdr (car items)) (cdr pair)))) - ((and (consp second) (eq (car second) 'lambda))) - (t - (erlang-menu-substitute second alist))) - (setq items (cdr items))))) - - (defun erlang-menu-add-above (entry above items) "Add menu ENTRY above menu entry ABOVE in menu ITEMS. Do nothing if the items already should be in the menu. @@ -2019,8 +1940,7 @@ The variable `erlang-man-dirs' contains entries describing the location of the manual pages." (interactive) (if (or erlang-man-inhibit - (and (boundp 'menu-bar-mode) - (not menu-bar-mode))) + (not menu-bar-mode)) () (setq erlang-menu-man-items '(nil @@ -2298,25 +2218,14 @@ patch to `Man-notify-when-ready'.") (setq modname name))) (when (or (null modname) (string= modname "")) (error "No Erlang module name given")) - (cond ((fboundp 'Man-notify-when-ready) - ;; From Emacs 19: The man command could possibly start an - ;; asynchronous process, i.e. we must hook ourselves into - ;; the system to be activated when the man-process - ;; terminates. - (if (null funcname) - () - (erlang-man-patch-notify) - (setq erlang-man-function-name funcname)) - (condition-case err - (erlang-man-module modname) - (error (setq erlang-man-function-name nil) - (signal (car err) (cdr err))))) - (t - (erlang-man-module modname) - (when funcname - (erlang-man-repeated-search-for-function nil - funcname - modname)))))) + (if (null funcname) + () + (erlang-man-patch-notify) + (setq erlang-man-function-name funcname)) + (condition-case err + (erlang-man-module modname) + (error (setq erlang-man-function-name nil) + (signal (car err) (cdr err)))))) (defun erlang-man-function (&optional name) "Find manual page for NAME, where NAME is module:function. @@ -2408,9 +2317,8 @@ the function name, or to nil. The reason for patching a function is that under Emacs 19, the man command is executed asynchronously." (require 'man) - (if (fboundp 'advice-add) - (advice-add 'Man-notify-when-ready :after - #'erlang-man-function-name-advice))) + (advice-add 'Man-notify-when-ready :after + #'erlang-man-function-name-advice)) (defun erlang-man-function-name-advice (arg) "Set point at the documentation of the function name in @@ -2536,7 +2444,7 @@ package not be present, this function does nothing." (cond ((null (car skel)) (setq menu (cons nil menu))) (t - (funcall (symbol-function 'tempo-define-template) + (tempo-define-template (concat "erlang-" (nth 1 (car skel))) ;; The tempo template used contains an `include' ;; function call only, hence changes to the @@ -2574,13 +2482,13 @@ package not be present, this function does nothing." (defun erlang-skel-insert (func) "Insert skeleton generated by FUNC and goto first tempo mark." (save-excursion (funcall func)) - (funcall (symbol-function 'tempo-forward-mark))) + (tempo-forward-mark)) (defun erlang-skel-header (func) "Insert the header generated by FUNC at the beginning of the buffer." (goto-char (point-min)) (save-excursion (funcall func)) - (funcall (symbol-function 'tempo-forward-mark))) + (tempo-forward-mark)) ;; Functions used inside the skeleton descriptions. @@ -3571,8 +3479,7 @@ With argument, do this that many times." (push-mark (point) nil t) (erlang-beginning-of-clause 1) ;; The above function deactivates the mark. - (if (boundp 'deactivate-mark) - (funcall (symbol-function 'set) 'deactivate-mark nil))) + (setq deactivate-mark nil)) (defun erlang-beginning-of-function (&optional arg) "Move backward to previous start of function. @@ -3668,20 +3575,7 @@ With negative argument go towards the beginning of the buffer." (goto-char (point-min))))) (setq arg (1+ arg))))) -(eval-and-compile - (if (default-boundp 'beginning-of-defun-function) - (defalias 'erlang-mark-function 'mark-defun) - (defun erlang-mark-function () - "Put mark at end of function, point at beginning." - (interactive) - (push-mark (point)) - (erlang-end-of-function 1) - ;; Sets the region. - (push-mark (point) nil t) - (erlang-beginning-of-function 1) - ;; The above function deactivates the mark. - (if (boundp 'deactivate-mark) - (funcall (symbol-function 'set) 'deactivate-mark nil))))) +(defalias 'erlang-mark-function 'mark-defun) (defun erlang-pass-over-function () (while (progn @@ -4610,7 +4504,7 @@ Return one of the three atoms `atom', `string', and `comment'. Should the point be inside none of the above mentioned types of context, nil is returned." (save-excursion - (let ((state (funcall (symbol-function 'syntax-ppss)))) + (let ((state (syntax-ppss))) (cond ((eq (nth 3 state) ?') 'atom) ((nth 3 state) 'string) ((nth 4 state) 'comment) @@ -4722,41 +4616,6 @@ This function is designed to be a member of a criteria list." (eval-when-compile (require 'etags)) - -;; Variables: - -(defvar erlang-tags-function-alist - '((find-tag . erlang-find-tag) - (find-tag-other-window . erlang-find-tag-other-window) - (find-tag-regexp . erlang-find-tag-regexp) - (find-tag-other-frame . erlang-find-tag-other-frame)) - "Alist of old tags commands and the replacement functions.") - -(defvar erlang-tags-installed nil - "Non-nil when the Erlang tags system is installed.") -(defvar erlang-tags-file-list '() - "List of files in tag list. Used when finding tag on form `module:'.") -(defvar erlang-tags-completion-table nil - "Like `tags-completion-table', this table contains `tag' and `module:tag'.") -(defvar erlang-tags-buffer-installed-p nil - "Non-nil when Erlang module recognising functions installed.") -(defvar erlang-tags-buffer-list '() - "Temporary list of buffers.") -(defvar erlang-tags-orig-completion-table nil - "Temporary storage for `tags-completion-table'.") -(defvar erlang-tags-orig-tag-order nil - "Temporary storage for `find-tag-tag-order'.") -(defvar erlang-tags-orig-regexp-tag-order nil - "Temporary storage for `find-tag-regexp-tag-order'.") -(defvar erlang-tags-orig-search-function nil - "Temporary storage for `find-tag-search-function'.") -(defvar erlang-tags-orig-regexp-search-function nil - "Temporary storage for `find-tag-regexp-search-function'.") -(defvar erlang-tags-orig-format-hooks nil - "Temporary storage for `tags-table-format-hooks'.") ;v19 -(defvar erlang-tags-orig-format-functions nil - "Temporary storage for `tags-table-format-functions'.") ;v > 19 - (defun erlang-tags-init () "Install an alternate version of tags, aware of Erlang modules. @@ -4767,362 +4626,25 @@ as on the old form `tag'. In the completion list, `module:tag' and `module:' shows up." (interactive) (require 'etags) - (set (make-local-variable 'find-tag-default-function) - 'erlang-find-tag-for-completion) - (if (>= emacs-major-version 25) - (add-hook 'xref-backend-functions - #'erlang-etags--xref-backend nil t) - (erlang-tags-define-keys (current-local-map)) - (setq erlang-tags-installed t))) - - - -;; Set all keys bound to `find-tag' et.al. in the global map and the -;; menu to `erlang-find-tag' et.al. in `map'. -;; -;; The function `substitute-key-definition' does not work properly -;; in all version of Emacs. - -(defun erlang-tags-define-keys (map) - "Bind tags commands to keymap MAP aware of Erlang modules." - (let ((alist erlang-tags-function-alist)) - (while alist - (let* ((old (car (car alist))) - (new (cdr (car alist))) - (keys (append (where-is-internal old global-map)))) - (while keys - (define-key map (car keys) new) - (setq keys (cdr keys)))) - (setq alist (cdr alist)))) - ;; Update the menu. - (erlang-menu-substitute erlang-menu-base-items erlang-tags-function-alist) - (erlang-menu-init)) - -;; Return `t' since it is used inside `tags-loop-form'. -;;;###autoload -(defun erlang-find-tag (modtagname &optional next-p regexp-p) - "Like `find-tag'. Capable of retrieving Erlang modules. - -Tags can be given on the forms `tag', `module:', `module:tag'." - (interactive (erlang-tag-interactive "Find `module:tag' or `tag': ")) - (switch-to-buffer (erlang-find-tag-noselect modtagname next-p regexp-p)) - t) - - -;; Code mainly from `find-tag-other-window' in `etags.el'. -;;;###autoload -(defun erlang-find-tag-other-window (tagname &optional next-p regexp-p) - "Like `find-tag-other-window' but aware of Erlang modules." - (interactive (erlang-tag-interactive - "Find `module:tag' or `tag' other window: ")) - - ;; This is to deal with the case where the tag is found in the - ;; selected window's buffer; without this, point is moved in both - ;; windows. To prevent this, we save the selected window's point - ;; before doing find-tag-noselect, and restore it afterwards. - (let* ((window-point (window-point (selected-window))) - (tagbuf (erlang-find-tag-noselect tagname next-p regexp-p)) - (tagpoint (progn (set-buffer tagbuf) (point)))) - (set-window-point (prog1 - (selected-window) - (switch-to-buffer-other-window tagbuf) - ;; We have to set this new window's point; it - ;; might already have been displaying a - ;; different portion of tagbuf, in which case - ;; switch-to-buffer-other-window doesn't set - ;; the window's point from the buffer. - (set-window-point (selected-window) tagpoint)) - window-point))) - - -(defun erlang-find-tag-other-frame (tagname &optional next-p) - "Like `find-tag-other-frame' but aware of Erlang modules." - (interactive (erlang-tag-interactive - "Find `module:tag' or `tag' other frame: ")) - (let ((pop-up-frames t)) - (erlang-find-tag-other-window tagname next-p))) - - -(defun erlang-find-tag-regexp (regexp &optional next-p other-window) - "Like `find-tag-regexp' but aware of Erlang modules." - (interactive (if (fboundp 'find-tag-regexp) - (erlang-tag-interactive - "Find `module:regexp' or `regexp': ") - (error "This version of Emacs can't find tags by regexps"))) - (funcall (if other-window - 'erlang-find-tag-other-window - 'erlang-find-tag) - regexp next-p t)) - - -;; Just like C-u M-. This could be added to the menu. -(defun erlang-find-next-tag () - "Find next tag, like \\[find-tag] with prefix arg." - (interactive) - (let ((current-prefix-arg '(4))) - (if erlang-tags-installed - (call-interactively 'erlang-find-tag) - (call-interactively 'find-tag)))) - - -;; Mimics `find-tag-noselect' found in `etags.el', but uses `find-tag' to -;; be compatible with `tags.el'. -;; -;; Handles three cases: -;; * `module:' Loop over all possible file names. Stop if a file-name -;; without extension and directory matches the module. -;; -;; * `module:tag' -;; Emacs 19: Replace test functions with functions aware of -;; Erlang modules. Tricky because the etags system wasn't -;; built for these kind of operations... -;; -;; Emacs 18: We loop over `find-tag' until we find a file -;; whose module matches the requested module. The -;; drawback is that a lot of files could be loaded into -;; Emacs. -;; -;; * `tag' Just give it to `find-tag'. - -(defun erlang-find-tag-noselect (modtagname &optional next-p regexp-p) - "Like `find-tag-noselect' but aware of Erlang modules." - (interactive (erlang-tag-interactive "Find `module:tag' or `tag': ")) - (or modtagname - (setq modtagname (symbol-value 'last-tag))) - (funcall (symbol-function 'set) 'last-tag modtagname) - ;; `tags.el' uses this variable to record how M-, would - ;; know where to restart a tags command. - (if (boundp 'tags-loop-form) - (funcall (symbol-function 'set) - 'tags-loop-form '(erlang-find-tag nil t))) - (save-window-excursion - (cond - ((string-match ":$" modtagname) - ;; Only the module name was given. Read all files whose file name - ;; match. - (let ((modname (substring modtagname 0 (match-beginning 0))) - (file nil)) - (if (not next-p) - (save-excursion - (visit-tags-table-buffer) - (setq erlang-tags-file-list - (funcall (symbol-function 'tags-table-files))))) - (while (null file) - (or erlang-tags-file-list - (save-excursion - (if (and (funcall - (symbol-function 'visit-tags-table-buffer) 'same) - (funcall - (symbol-function 'visit-tags-table-buffer) t)) - (setq erlang-tags-file-list - (funcall (symbol-function 'tags-table-files))) - (error "No %stags containing %s" (if next-p "more " "") - modtagname)))) - (if erlang-tags-file-list - (let ((this-module (erlang-get-module-from-file-name - (car erlang-tags-file-list)))) - (if (and (stringp this-module) - (string= modname this-module)) - (setq file (car erlang-tags-file-list))) - (setq erlang-tags-file-list (cdr erlang-tags-file-list))))) - (set-buffer (or (get-file-buffer file) - (find-file-noselect file))))) - - ((string-match ":" modtagname) - (progn - (erlang-tags-install-module-check) - (unwind-protect - (funcall (symbol-function 'find-tag) - modtagname next-p regexp-p) - (erlang-tags-remove-module-check)))) - (t - (funcall (symbol-function 'find-tag) modtagname next-p regexp-p))) - (current-buffer))) ; Return the new buffer. - - - - + (setq-local find-tag-default-function 'erlang-find-tag-for-completion) + (add-hook 'xref-backend-functions + #'erlang-etags--xref-backend nil t)) -;; Process interactive arguments for erlang-find-tag-*. -;; -;; Negative arguments work only for `etags', not `tags'. This is not -;; a problem since negative arguments means step back into the -;; history list, a feature not implemented in `tags'. - -(defun erlang-tag-interactive (prompt) - (condition-case nil - (require 'etags) - (error - (require 'tags))) - (if current-prefix-arg - (list nil (if (< (prefix-numeric-value current-prefix-arg) 0) - '- - t)) - (let* ((default (erlang-default-function-or-module)) - (prompt (if default - (format "%s(default %s) " prompt default) - prompt)) - (spec (completing-read prompt 'erlang-tags-complete-tag))) - (list (if (equal spec "") - (or default (error "There is no default tag")) - spec))))) - - -;; Search tag functions which are aware of Erlang modules. The tactic -;; is to store new search functions into the local variables of the -;; TAGS buffers. The variables are restored directly after the -;; search. The situation is complicated by the fact that new TAGS -;; files can be loaded during the search. -;; - -(defun erlang-tags-install-module-check () - "Install our own tag search functions." - ;; Make sure our functions are installed in TAGS files loaded - ;; into Emacs while searching. - (setq erlang-tags-orig-format-functions - (symbol-value 'tags-table-format-functions)) - (funcall (symbol-function 'set) 'tags-table-format-functions - (cons 'erlang-tags-recognize-tags-table - erlang-tags-orig-format-functions)) - (setq erlang-tags-buffer-list '()) - - ;; Install our functions in the TAGS files already resident. - (save-excursion - (let ((files (symbol-value 'tags-table-computed-list))) - (while files - (if (stringp (car files)) - (if (get-file-buffer (car files)) - (progn - (set-buffer (get-file-buffer (car files))) - (erlang-tags-install-local)))) - (setq files (cdr files)))))) -(defun erlang-tags-install-local () - "Install our tag search functions in current buffer." - (if erlang-tags-buffer-installed-p - () - ;; Mark this buffer as "installed" and record. - (set (make-local-variable 'erlang-tags-buffer-installed-p) t) - (setq erlang-tags-buffer-list - (cons (current-buffer) erlang-tags-buffer-list)) - - ;; Save the original values. - (set (make-local-variable 'erlang-tags-orig-tag-order) - (symbol-value 'find-tag-tag-order)) - (set (make-local-variable 'erlang-tags-orig-regexp-tag-order) - (symbol-value 'find-tag-regexp-tag-order)) - (set (make-local-variable 'erlang-tags-orig-search-function) - (symbol-value 'find-tag-search-function)) - (set (make-local-variable 'erlang-tags-orig-regexp-search-function) - (symbol-value 'find-tag-regexp-search-function)) - - ;; Install our own functions. - (set (make-local-variable 'find-tag-search-function) - 'erlang-tags-search-forward) - (set (make-local-variable 'find-tag-regexp-search-function) - 'erlang-tags-regexp-search-forward) - (set (make-local-variable 'find-tag-tag-order) - (mapcar #'erlang-make-order-function-aware-of-modules - erlang-tags-orig-tag-order)) - (set (make-local-variable 'find-tag-regexp-tag-order) - (mapcar #'erlang-make-order-function-aware-of-modules - erlang-tags-orig-regexp-tag-order)))) - -(defun erlang-make-order-function-aware-of-modules (f) - `(lambda (tag) - (let (mod) - (when (string-match ":" tag) - (setq mod (substring tag 0 (match-beginning 0))) - (setq tag (substring tag (match-end 0) nil))) - (and (funcall ',f tag) - (or (null mod) - (erlang-tag-at-point-match-module-p mod)))))) - -(defun erlang-tag-at-point-match-module-p (mod) - (string-equal mod (erlang-get-module-from-file-name - (funcall (symbol-function 'file-of-tag))))) - - -(defun erlang-tags-remove-module-check () - "Remove our own tags search functions." - (funcall (symbol-function 'set) - 'tags-table-format-functions - erlang-tags-orig-format-functions) - - ;; Remove our functions from the TAGS files. (Note that - ;; `tags-table-computed-list' need not be the same list as when - ;; the search was started.) - (save-excursion - (let ((buffers erlang-tags-buffer-list)) - (while buffers - (if (buffer-name (car buffers)) - (progn - (set-buffer (car buffers)) - (erlang-tags-remove-local))) - (setq buffers (cdr buffers)))))) -(defun erlang-tags-remove-local () - "Remove our tag search functions from current buffer." - (if (null erlang-tags-buffer-installed-p) - () - (funcall (symbol-function 'set) 'erlang-tags-buffer-installed-p nil) - (funcall (symbol-function 'set) - 'find-tag-tag-order erlang-tags-orig-tag-order) - (funcall (symbol-function 'set) - 'find-tag-regexp-tag-order erlang-tags-orig-regexp-tag-order) - (funcall (symbol-function 'set) - 'find-tag-search-function erlang-tags-orig-search-function) - (funcall (symbol-function 'set) - 'find-tag-regexp-search-function - erlang-tags-orig-regexp-search-function))) - - -(defun erlang-tags-recognize-tags-table () - "Install our functions in all loaded TAGS files. - -This function is added to `tags-table-format-hooks/functions' when searching -for a tag on the form `module:tag'." - (if (null (funcall (symbol-function 'etags-recognize-tags-table))) - nil - (erlang-tags-install-local) - t)) - - -(defun erlang-tags-search-forward (tag &optional bound noerror count) - "Forward search function, aware of Erlang module prefix." - (if (string-match ":" tag) - (setq tag (substring tag (match-end 0) nil))) - ;; Avoid unintended recursion. - (if (eq erlang-tags-orig-search-function 'erlang-tags-search-forward) - (search-forward tag bound noerror count) - (funcall erlang-tags-orig-search-function tag bound noerror count))) - - -(defun erlang-tags-regexp-search-forward (tag &optional bound noerror count) - "Forward regexp search function, aware of Erlang module prefix." - (if (string-match ":" tag) - (setq tag (substring tag (match-end 0) nil))) - (if (eq erlang-tags-orig-regexp-search-function - 'erlang-tags-regexp-search-forward) - (re-search-forward tag bound noerror count) - (funcall erlang-tags-orig-regexp-search-function - tag bound noerror count))) - -;;; Tags completion, Emacs 19 `etags' specific. +;;; Tags completion. ;;; -;;; The basic idea is to create a second completion table `erlang-tags- -;;; completion-table' containing all normal tags plus tags on the form -;;; `module:tag' and `module:'. +;;; The basic idea is to create a completion table containing all normal +;;; tags plus tags on the form `module:tag' and `module:'. (progn (require 'etags) - (if (fboundp 'advice-add) - (advice-add 'etags-tags-completion-table :around - #'erlang-etags-tags-completion-table-advice))) + (advice-add 'etags-tags-completion-table :around + #'erlang-etags-tags-completion-table-advice)) (defun erlang-etags-tags-completion-table-advice (oldfun) (if erlang-replace-etags-tags-completion-table @@ -5131,16 +4653,13 @@ for a tag on the form `module:tag'." (defun erlang-complete-tag () "Perform tags completion on the text around point. -Completes to the set of names listed in the current tags table. - -Should the Erlang tags system be installed this command knows -about Erlang modules." +Completes to the set of names listed in the current tags table, +including module-qualified names." (interactive) (require 'etags) (let ((erlang-replace-etags-tags-completion-table t)) (complete-tag))) - (defun erlang-find-tag-for-completion () (let ((start (save-excursion (skip-chars-backward "[:word:][:digit:]_:'") @@ -5149,59 +4668,9 @@ about Erlang modules." (buffer-substring-no-properties start (point))))) -;; Based on `tags-complete-tag', but this one uses -;; `erlang-tags-completion-table' instead of `tags-completion-table'. -;; -;; This is the entry-point called by system function `completing-read'. -;; -;; Used for minibuffer completion in Emacs 19-24 and completion in -;; erlang buffers in Emacs 19-22. -(defun erlang-tags-complete-tag (string predicate what) - (with-current-buffer (window-buffer (minibuffer-selected-window)) - (save-excursion - ;; If we need to ask for the tag table, allow that. - (let ((enable-recursive-minibuffers t)) - (visit-tags-table-buffer)) - (if (eq what t) - (all-completions string (erlang-tags-completion-table) predicate) - (try-completion string (erlang-tags-completion-table) predicate))))) - - -;; `tags-completion-table' calls itself recursively, make it -;; call our own wedge instead. Note that the recursive call -;; is very rare; it only occurs when a tags-file contains -;; `include'-statements. -(defun erlang-tags-completion-table () - "Build completion table. Tags on the form `tag' or `module:tag'." - (setq erlang-tags-orig-completion-table - (symbol-function 'tags-completion-table)) - (fset 'tags-completion-table - (symbol-function 'erlang-tags-completion-table-1)) - (unwind-protect - (erlang-tags-completion-table-1) - (fset 'tags-completion-table - erlang-tags-orig-completion-table))) - -(defun erlang-tags-completion-table-1 () - (make-local-variable 'erlang-tags-completion-table) - (or erlang-tags-completion-table - (let ((tags-completion-table nil) - (tags-completion-table-function - 'erlang-etags-tags-completion-table)) - (funcall erlang-tags-orig-completion-table) - (setq erlang-tags-completion-table tags-completion-table)))) - - - -;; Emacs 25 expects this function to return a list (and it is ok for -;; it to include duplicates). Older emacsen expects an obarray. + (defun erlang-etags-tags-completion-table () - (if (>= emacs-major-version 25) - (erlang-etags-tags-completion-table-list) - (let ((obarray (make-vector 511 0))) - (dolist (tag (erlang-etags-tags-completion-table-list)) - (intern tag obarray)) - obarray))) + (erlang-etags-tags-completion-table-list)) ;; Based on `etags-tags-completion-table'. The difference is that we ;; add three strings to the list, the tag, module: and module:tag. @@ -5665,18 +5134,19 @@ return XREFS as is." (and file (file-truename file)))) +(declare-function xref-item-location "xref" (item)) +(declare-function xref-location-group "xref" (location)) +(declare-function xref-location-origin "xref" (location)) + (defun erlang-xref-file (xref) - (and (fboundp 'xref-location-group) - (fboundp 'xref-item-location) - (xref-location-group (xref-item-location xref)))) + (let ((location (xref-item-location xref))) + (cond ((fboundp 'xref-location-origin) ; Emacs 30+ + (xref-location-origin location)) + ((fboundp 'xref-location-group) + (xref-location-group location))))) (defun erlang-visit-tags-table-buffer (cont cbuf) - (if (< emacs-major-version 26) - (visit-tags-table-buffer cont) - ;; Remove this with-no-warnings when Emacs 26 is the required - ;; version minimum. - (with-no-warnings - (visit-tags-table-buffer cont cbuf)))) + (visit-tags-table-buffer cont cbuf)) ;;; ;;; Prepare for other methods to run an Erlang slave process. @@ -5780,8 +5250,6 @@ Also see the description of `ielm-prompt-read-only'." (defvar erlang-shell-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\M-\t" 'erlang-complete-tag) - ;; Normally the other way around. (define-key map "\C-a" 'comint-bol) (define-key map "\C-c\C-a" 'beginning-of-line) @@ -5800,11 +5268,12 @@ Also see the description of `ielm-prompt-read-only'." The following special commands are available: \\{erlang-shell-mode-map}" (erlang-mode-variables) + (setq-local erlang-compilation-parsing-end (make-marker)) + (kill-local-variable 'indent-line-function) ;; Needed when compiling directly from the Erlang shell. (setq next-error-last-buffer (current-buffer)) (setq comint-prompt-regexp "^[^>=]*> *") - (make-local-variable 'comint-prompt-read-only) - (setq comint-prompt-read-only erlang-shell-prompt-read-only) + (setq-local comint-prompt-read-only erlang-shell-prompt-read-only) (setq comint-eol-on-send t) (setq comint-input-ignoredups t) (setq comint-scroll-show-maximum-output t) @@ -5815,21 +5284,15 @@ The following special commands are available: 'inferior-erlang-strip-ctrl-m nil t) (setq comint-input-ring-file-name erlang-input-ring-file-name) (comint-read-input-ring t) - (make-local-variable 'kill-buffer-hook) - (add-hook 'kill-buffer-hook 'comint-write-input-ring) + (add-hook 'kill-buffer-hook 'comint-write-input-ring nil t) (compilation-minor-mode 1) - (set (make-local-variable 'minor-mode-overriding-map-alist) + (setq-local minor-mode-overriding-map-alist `((compilation-minor-mode . ,(let ((map (make-sparse-keymap))) - ;; It would be useful to put keymap properties on the - ;; error lines so that we could use RET and mouse-2 - ;; on them directly. - (when (boundp 'compilation-skip-threshold) ; new compile.el - (define-key map [mouse-2] #'erlang-mouse-2-command) - (define-key map "\C-m" #'erlang-RET-command)) - (if (boundp 'compilation-menu-map) - (define-key map [menu-bar compilation] - (cons "Errors" compilation-menu-map))) + (define-key map [mouse-2] #'erlang-mouse-2-command) + (define-key map "\C-m" #'erlang-RET-command) + (define-key map [menu-bar compilation] + (cons "Errors" compilation-menu-map)) map)))) (erlang-tags-init)) @@ -5857,39 +5320,45 @@ Selects Comint or Compilation mode command as appropriate." ;;; Inferior Erlang -- Run an Erlang shell as a subprocess. ;;; -(defvar inferior-erlang-display-buffer-any-frame nil - "When nil, `inferior-erlang-display-buffer' use only selected frame. -When t, all frames are searched. When \='raise, the frame is raised.") - -(defvar inferior-erlang-shell-type 'newshell - "The type of Erlang shell to use. - -When this variable is set to the atom `oldshell', the old shell is used. -When set to `newshell' the new shell is used. Should the variable be -nil, the default shell is used. - -This variable influence the setting of other variables.") - -(defvar inferior-erlang-machine "erl" - "The name of the Erlang shell.") +(defcustom inferior-erlang-display-buffer-any-frame nil + "How to find the inferior Erlang buffer when displaying it. +When nil, use only the selected frame. When t, search all frames. +When `raise', search all frames and raise the frame containing the buffer." + :type '(choice (const :tag "Selected frame only" nil) + (const :tag "Search all frames" t) + (const :tag "Search and raise" raise)) + :group 'erlang) -(defvar inferior-erlang-machine-options '() - "The options used when activating the Erlang shell. +(defcustom inferior-erlang-machine "erl" + "The command to start the Erlang shell." + :type 'string + :group 'erlang) -This must be a list of strings.") +(defcustom inferior-erlang-machine-options '() + "Additional options for the Erlang shell command. +This must be a list of strings." + :type '(repeat string) + :group 'erlang) -(defvar inferior-erlang-process-name "inferior-erlang" - "The name of the inferior Erlang process.") +(defcustom inferior-erlang-process-name "inferior-erlang" + "The name of the inferior Erlang process." + :type 'string + :group 'erlang) -(defvar inferior-erlang-buffer-name erlang-shell-buffer-name - "The name of the inferior Erlang buffer.") +(defcustom inferior-erlang-buffer-name erlang-shell-buffer-name + "The name of the inferior Erlang buffer." + :type 'string + :group 'erlang) -(defvar inferior-erlang-prompt-timeout 60 +(defcustom inferior-erlang-prompt-timeout 60 "Number of seconds before `inferior-erlang-wait-prompt' timeouts. - The time specified is waited after every output made by the inferior Erlang shell. When this variable is t, we assume that we always have -a prompt. When nil, we will wait forever, or until \\[keyboard-quit].") +a prompt. When nil, we will wait forever, or until \\[keyboard-quit]." + :type '(choice integer + (const :tag "Always assume prompt" t) + (const :tag "Wait forever" nil)) + :group 'erlang) (defvar inferior-erlang-process nil "Process of last invoked inferior Erlang, or nil.") @@ -5927,11 +5396,7 @@ editing control characters: (setq cmd "sh" opts (list "-c" command)) (setq cmd inferior-erlang-machine - opts inferior-erlang-machine-options) - (cond ((eq inferior-erlang-shell-type 'oldshell) - (setq opts (cons "-oldshell" opts))) - ((eq inferior-erlang-shell-type 'newshell) - (setq opts (append '("-newshell" "-env" "TERM" "vt100") opts))))) + opts inferior-erlang-machine-options)) ;; Using create-file-buffer and list-buffers-directory in this way ;; makes uniquify give each buffer a unique name based on the @@ -5948,14 +5413,12 @@ editing control characters: (setq inferior-erlang-process (get-buffer-process inferior-erlang-buffer)) - (funcall (symbol-function 'set-process-query-on-exit-flag) - inferior-erlang-process nil) + (set-process-query-on-exit-flag inferior-erlang-process nil) (if erlang-inferior-shell-split-window (switch-to-buffer-other-window inferior-erlang-buffer) (switch-to-buffer inferior-erlang-buffer)) - (if (and (not (eq system-type 'windows-nt)) - (eq inferior-erlang-shell-type 'newshell)) - (setq comint-process-echoes t)) + (unless (eq system-type 'windows-nt) + (setq comint-process-echoes t)) (erlang-shell-mode)) @@ -5986,16 +5449,14 @@ frame will become deselected before the next command." (or (inferior-erlang-running-p) (error "No inferior Erlang process is running")) (let ((win (inferior-erlang-window - inferior-erlang-display-buffer-any-frame)) - (frames-p (fboundp 'selected-frame))) + inferior-erlang-display-buffer-any-frame))) (if (null win) (let ((old-win (selected-window))) (save-excursion (switch-to-buffer-other-window inferior-erlang-buffer) (setq win (selected-window))) (select-window old-win)) - (if (and window-system - frames-p + (if (and (display-graphic-p) (or select (eq inferior-erlang-display-buffer-any-frame 'raise)) (not (eq (selected-frame) (window-frame win)))) @@ -6093,12 +5554,11 @@ Return the position after the newly inserted command." ;; Adjust all windows whose points are incorrect. (if (null comint-process-echoes) (walk-windows - (function - (lambda (window) - (if (and (eq (window-buffer window) inferior-erlang-buffer) - (= (window-point window) insert-point)) - (set-window-point window - (+ insert-point insert-length))))) + (lambda (window) + (if (and (eq (window-buffer window) inferior-erlang-buffer) + (= (window-point window) insert-point)) + (set-window-point window + (+ insert-point insert-length)))) nil t)) (set-buffer old-buffer) (+ insert-point insert-length))) @@ -6107,34 +5567,30 @@ Return the position after the newly inserted command." (defun inferior-erlang-strip-delete (&optional _s) "Remove `^H' (delete) and the characters it was supposed to remove." (interactive) - (if (and (boundp 'comint-last-input-end) - (boundp 'comint-last-output-start)) - (save-excursion - (goto-char - (if (called-interactively-p 'interactive) - (symbol-value 'comint-last-input-end) - (symbol-value 'comint-last-output-start))) - (while (progn (skip-chars-forward "^\C-h") - (not (eq (point) (point-max)))) - (delete-char 1) - (or (bolp) - (delete-char -1)))))) + (save-excursion + (goto-char + (if (called-interactively-p 'interactive) + comint-last-input-end + comint-last-output-start)) + (while (progn (skip-chars-forward "^\C-h") + (not (eq (point) (point-max)))) + (delete-char 1) + (or (bolp) + (delete-char -1))))) ;; Basically `comint-strip-ctrl-m', with a few extra checks. (defun inferior-erlang-strip-ctrl-m (&optional _string) "Strip trailing `^M' characters from the current output group." (interactive) - (if (and (boundp 'comint-last-input-end) - (boundp 'comint-last-output-start)) - (let ((pmark (process-mark (get-buffer-process (current-buffer))))) - (save-excursion - (goto-char - (if (called-interactively-p 'interactive) - (symbol-value 'comint-last-input-end) - (symbol-value 'comint-last-output-start))) - (while (re-search-forward "\r+$" pmark t) - (replace-match "" t t)))))) + (let ((pmark (process-mark (get-buffer-process (current-buffer))))) + (save-excursion + (goto-char + (if (called-interactively-p 'interactive) + comint-last-input-end + comint-last-output-start)) + (while (re-search-forward "\r+$" pmark t) + (replace-match "" t t))))) (defun inferior-erlang-compile (arg) @@ -6164,8 +5620,7 @@ There exists two workarounds for this bug: erlang-compile-extra-opts)) end) (with-current-buffer inferior-erlang-buffer - (when (fboundp 'compilation-forget-errors) - (compilation-forget-errors))) + (compilation-forget-errors)) (setq end (inferior-erlang-send-command (inferior-erlang-compute-compile-command noext opts) nil)) @@ -6339,15 +5794,14 @@ unless the optional NO-DISPLAY is non-nil." (and (fboundp 'tramp-tramp-file-p) (tramp-tramp-file-p (buffer-file-name)))) +(declare-function compilation-forget-errors "compile" ()) +(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault)) +(declare-function tramp-file-name-localname "tramp" (vec)) + (defun erlang-tramp-get-localname () (when (fboundp 'tramp-dissect-file-name) - (let ((tramp-info (tramp-dissect-file-name (buffer-file-name)))) - (if (fboundp 'tramp-file-name-localname) - (tramp-file-name-localname tramp-info) - ;; In old versions of tramp, it was `tramp-file-name-path' - ;; instead of the newer `tramp-file-name-localname' - (when (fboundp 'tramp-file-name-path) - (tramp-file-name-path tramp-info)))))) + (tramp-file-name-localname + (tramp-dissect-file-name (buffer-file-name))))) ;; `next-error' only accepts buffers with major mode `compilation-mode' ;; or with the minor mode `compilation-minor-mode' activated. @@ -6359,8 +5813,7 @@ unless the optional NO-DISPLAY is non-nil." Capable of finding error messages in an inferior Erlang buffer." (interactive "P") (let ((done nil) - (buf (or (and (boundp 'next-error-last-buffer) - next-error-last-buffer) + (buf (or next-error-last-buffer (and (boundp 'compilation-last-buffer) compilation-last-buffer)))) (if (and (bufferp buf) @@ -6397,12 +5850,11 @@ The default is to go to the directory of the current buffer." (match-string 0)))) (defconst erlang-unload-hook - (if (fboundp 'advice-remove) - (list (lambda () - (advice-remove 'Man-notify-when-ready - #'erlang-man-function-name-advice) - (advice-remove 'etags-tags-completion-table - #'erlang-etags-tags-completion-table-advice))))) + (list (lambda () + (advice-remove 'Man-notify-when-ready + #'erlang-man-function-name-advice) + (advice-remove 'etags-tags-completion-table + #'erlang-etags-tags-completion-table-advice)))) ;; The end... diff --git a/elpa/erlang-20250827.800/erldoc.el b/elpa/erlang-20260420.1445/erldoc.el similarity index 85% rename from elpa/erlang-20250827.800/erldoc.el rename to elpa/erlang-20260420.1445/erldoc.el index 2988ae5a..84c83650 100644 --- a/elpa/erlang-20250827.800/erldoc.el +++ b/elpa/erlang-20260420.1445/erldoc.el @@ -24,11 +24,6 @@ ;; Crawl Erlang/OTP HTML documentation and generate lookup tables. ;; -;; This package depends on `cl-lib', `pcase' and -;; `libxml-parse-html-region'. Emacs 24+ compiled with libxml2 should -;; work. On Emacs 24.1 and 24.2 do `M-x package-install RET cl-lib -;; RET' to install `cl-lib'. -;; ;; Please customise `erldoc-man-index' to point to your local OTP ;; documentation. ;; @@ -63,13 +58,11 @@ ;;; Code: (require 'cl-lib) +(require 'dom) (require 'json) (require 'erlang) (eval-when-compile (require 'url-parse)) -(eval-and-compile ;for emacs < 24.3 - (or (fboundp 'user-error) (defalias 'user-error 'error))) - (defgroup erldoc nil "Browse Erlang document." :group 'help) @@ -120,48 +113,31 @@ up the indexing." (url-insert-file-contents url) (libxml-parse-html-region (point-min) (point-max)))) -(defalias 'erldoc-dom-text-node-p #'stringp) - -(defun erldoc-dom-attributes (dom) - (and (not (erldoc-dom-text-node-p dom)) (cadr dom))) - -(defun erldoc-dom-get-attribute (dom attrib-name) - (cdr (assq attrib-name (erldoc-dom-attributes dom)))) - -(defun erldoc-dom-children (dom) - (and (not (erldoc-dom-text-node-p dom)) (cddr dom))) +(defun erldoc-dom-last-text (dom) + "Return the last text child of DOM, or nil." + (let ((text (car (last (dom-children dom))))) + (and (stringp text) text))) -(defun erldoc-dom-get-text (dom) - (let ((text (car (last (erldoc-dom-children dom))))) - (and (erldoc-dom-text-node-p text) text))) - -(defvar erldoc-dom-walk-parent nil) -(defvar erldoc-dom-walk-siblings nil) +(defvar erldoc-dom-walk-parent nil + "Parent node during `erldoc-dom-walk' traversal.") +(defvar erldoc-dom-walk-siblings nil + "Sibling nodes during `erldoc-dom-walk' traversal.") (defun erldoc-dom-walk (dom k) + "Recursively walk DOM, calling K on each node. +During the walk, `erldoc-dom-walk-parent' and +`erldoc-dom-walk-siblings' are dynamically bound." (funcall k dom) (let ((erldoc-dom-walk-parent dom) - (erldoc-dom-walk-siblings (unless (erldoc-dom-text-node-p dom) - (cddr dom)))) + (erldoc-dom-walk-siblings (dom-children dom))) (dolist (child erldoc-dom-walk-siblings) (erldoc-dom-walk child k)))) -(defun erldoc-dom-get-element (dom element-name) - (catch 'return - (erldoc-dom-walk dom (lambda (d) - (when (eq (car-safe d) element-name) - (throw 'return d)))))) - -(defun erldoc-dom-get-element-by-id (dom id) - (catch 'return - (erldoc-dom-walk dom (lambda (d) - (when (equal (erldoc-dom-get-attribute d 'id) id) - (throw 'return d)))))) - (defun erldoc-dom-get-elements-by-id (dom id) + "Return all elements in DOM with the given ID." (let (result) (erldoc-dom-walk dom (lambda (d) - (when (equal (erldoc-dom-get-attribute d 'id) id) + (when (equal (dom-attr d 'id) id) (push d result)))) (nreverse result))) @@ -180,16 +156,16 @@ up the indexing." url)) (defun erldoc-parse-man-index (url) - (let ((table (erldoc-dom-get-element (erldoc-parse-html url) 'table)) + (let ((table (car (dom-by-tag (erldoc-parse-html url) 'table))) (mans)) (erldoc-dom-walk table (lambda (d) (when (eq (car-safe d) 'a) - (let ((href (erldoc-dom-get-attribute d 'href))) + (let ((href (dom-attr d 'href))) (when (and href (not (string-match-p "index\\.html\\'" href))) (with-demoted-errors "erldoc-parse-man-index: %S" - (push (cons (erldoc-dom-get-text d) + (push (cons (erldoc-dom-last-text d) (erldoc-fix-path (erldoc-expand-url href url))) mans))))))) (nreverse mans))) @@ -198,13 +174,13 @@ up the indexing." (let ((dom (erldoc-parse-html (cdr man))) (table (make-hash-table :test #'equal))) (erldoc-dom-walk - (erldoc-dom-get-element-by-id dom "loadscrollpos") + (dom-by-id dom "loadscrollpos") (lambda (d) - (let ((href (erldoc-dom-get-attribute d 'href))) + (let ((href (dom-attr d 'href))) (when (and href (string-match "#" href)) (puthash (substring href (match-end 0)) (list (concat (car man) ":" (erldoc-strip-string - (erldoc-dom-get-text d))) + (erldoc-dom-last-text d))) (erldoc-expand-url href (cdr man))) table))))) (let ((span-content @@ -212,7 +188,7 @@ up the indexing." (let ((texts)) (erldoc-dom-walk span (lambda (d) - (and (erldoc-dom-text-node-p d) + (and (stringp d) (push (erldoc-strip-string d) texts)))) (and texts (mapconcat 'identity (nreverse texts) " "))))) entries) @@ -221,13 +197,13 @@ up the indexing." (lambda (d) ;; Get the full function signature. (when (and (eq (car-safe d) 'a) - (gethash (erldoc-dom-get-attribute d 'name) table)) - (let* ((name (erldoc-dom-get-attribute d 'name)) + (gethash (dom-attr d 'name) table)) + (let* ((name (dom-attr d 'name)) (mfa-url (gethash name table)) (mfa (car mfa-url)) (sig (or (funcall span-content d) (funcall span-content - (or (erldoc-dom-get-element d 'span) + (or (car (dom-by-tag d 'span)) (cadr (memq d erldoc-dom-walk-siblings)))) (progn @@ -240,9 +216,9 @@ up the indexing." ;; Get data types (when (and (eq (car-safe d) 'a) (string-prefix-p "type-" - (or (erldoc-dom-get-attribute d 'name) ""))) + (or (dom-attr d 'name) ""))) (push (list (concat (car man) ":" (funcall span-content d)) - (concat (cdr man) "#" (erldoc-dom-get-attribute d 'name)) + (concat (cdr man) "#" (dom-attr d 'name)) (funcall span-content erldoc-dom-walk-parent)) entries)))) entries))) @@ -279,11 +255,11 @@ up the indexing." (defun erldoc-otp-release () "Get the otp release version (as string) or nil if not found." - (let ((otp (erldoc-dom-get-text - (erldoc-dom-get-element - (erldoc-parse-html - (erldoc-expand-url "index.html" erldoc-man-index)) - 'title)))) + (let ((otp (erldoc-dom-last-text + (car (dom-by-tag + (erldoc-parse-html + (erldoc-expand-url "index.html" erldoc-man-index)) + 'title))))) (and (string-match "[0-9.]+\\'" otp) (match-string 0 otp)))) (defvar erldoc-browse-history nil) @@ -409,7 +385,7 @@ up the indexing." (erldoc-dom-walk (erldoc-parse-html url) (lambda (d) (and (eq (car-safe d) 'table) - (equal (erldoc-dom-get-attribute d 'summary) + (equal (dom-attr d 'summary) "Numerical Index of EEPs") (throw 'return d)))))) (fix-title (lambda (title) @@ -419,9 +395,9 @@ up the indexing." (erldoc-dom-walk table (lambda (d) (when (eq (car-safe d) 'a) - (push (cons (funcall fix-title (erldoc-dom-get-attribute d 'title)) + (push (cons (funcall fix-title (dom-attr d 'title)) (erldoc-expand-url - (erldoc-dom-get-attribute d 'href) + (dom-attr d 'href) url)) result)))) (nreverse result))) @@ -437,7 +413,7 @@ up the indexing." (defvar erldoc-app-manuals '("crypto" "diameter" "erl_docgen" "kernel" "observer" "os_mon" "runtime_tools" "sasl" "snmp" - "ssl" "test_server" + "ssl" ("ssh" . "SSH") ("stdlib" . "STDLIB")) "List of applications that come with a manual.") @@ -445,14 +421,14 @@ up the indexing." (pcase-let ((`(,name . ,url) user-guide)) (unless (member name erldoc-missing-user-guides) (let ((chaps (erldoc-dom-get-elements-by-id - (erldoc-dom-get-element-by-id (erldoc-parse-html url) "leftnav") + (dom-by-id (erldoc-parse-html url) "leftnav") "no"))) (or chaps (warn "erldoc-user-guide-chapters no chapters found for `%s'" (cdr user-guide))) (mapcar (lambda (li) - (cons (concat name "#" (erldoc-dom-get-attribute li 'title)) - (erldoc-expand-url (erldoc-dom-get-attribute - (erldoc-dom-get-element li 'a) 'href) + (cons (concat name "#" (dom-attr li 'title)) + (erldoc-expand-url (dom-attr + (car (dom-by-tag li 'a)) 'href) url))) chaps))))) @@ -463,11 +439,11 @@ up the indexing." (erldoc-parse-html url) (lambda (d) (when (and (eq (car-safe d) 'a) - (not (string-match-p "\\`[0-9.]+\\'" (erldoc-dom-get-text d)))) + (not (string-match-p "\\`[0-9.]+\\'" (erldoc-dom-last-text d)))) (with-demoted-errors "erldoc-user-guides-1: %S" - (let ((name (erldoc-strip-string (erldoc-dom-get-text d))) + (let ((name (erldoc-strip-string (erldoc-dom-last-text d))) (index-page (erldoc-fix-path (erldoc-expand-url - (erldoc-dom-get-attribute d 'href) url)))) + (dom-attr d 'href) url)))) (push (cons name (if (member name erldoc-missing-user-guides) index-page (erldoc-expand-url "users_guide.html" index-page))) -- 2.47.3