From aa3888efb1bcfa0aec3868b788a3d7925aa74ac3 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Mon, 18 Apr 2022 16:32:54 +0200 Subject: [PATCH] update erlang Signed-off-by: Andreas Gerler --- .../erlang-autoloads.el | 37 +++++--- .../erlang-edoc.el | 0 .../erlang-eunit.el | 4 +- .../erlang-flymake.el | 0 .../erlang-pkg.el | 4 +- .../erlang-skels-old.el | 4 +- .../erlang-skels.el | 0 .../erlang-start.el | 4 +- .../erlang-test.el | 2 +- .../erlang.el | 89 ++++++++++++------- .../erldoc.el | 2 +- 11 files changed, 90 insertions(+), 56 deletions(-) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-autoloads.el (83%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-edoc.el (100%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-eunit.el (99%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-flymake.el (100%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-pkg.el (59%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-skels-old.el (99%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-skels.el (100%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-start.el (96%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang-test.el (99%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erlang.el (98%) rename elpa/{erlang-20210315.1640 => erlang-20220215.1844}/erldoc.el (99%) diff --git a/elpa/erlang-20210315.1640/erlang-autoloads.el b/elpa/erlang-20220215.1844/erlang-autoloads.el similarity index 83% rename from elpa/erlang-20210315.1640/erlang-autoloads.el rename to elpa/erlang-20220215.1844/erlang-autoloads.el index 110ee073..99fafb38 100644 --- a/elpa/erlang-20210315.1640/erlang-autoloads.el +++ b/elpa/erlang-20220215.1844/erlang-autoloads.el @@ -1,4 +1,4 @@ -;;; erlang-autoloads.el --- automatically extracted autoloads +;;; erlang-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -115,7 +115,7 @@ editing control characters: \(fn &optional COMMAND)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erlang" '("erlang-" "inferior-erlang-" "run-erlang"))) +(register-definition-prefixes "erlang" '("erlang-" "inferior-erlang-" "run-erlang")) ;;;*** @@ -123,25 +123,34 @@ editing control characters: ;;; Generated autoloads from erlang-edoc.el (autoload 'erlang-edoc-mode "erlang-edoc" "\ -Toggle Erlang-Edoc mode on or off. +Toggle Erlang-EDoc mode on or off. -If called interactively, enable Erlang-Edoc mode if ARG is -positive, and disable it if ARG is zero or negative. If called -from Lisp, also enable the mode if ARG is omitted or nil, and -toggle it if ARG is `toggle'; disable the mode otherwise. +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 it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `erlang-edoc-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. \\{erlang-edoc-mode-map} \(fn &optional ARG)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erlang-edoc" '("erlang-edoc-"))) +(register-definition-prefixes "erlang-edoc" '("erlang-edoc-")) ;;;*** ;;;### (autoloads nil "erlang-eunit" "erlang-eunit.el" (0 0 0 0)) ;;; Generated autoloads from erlang-eunit.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erlang-eunit" '("erlang-e" "filename-join"))) +(register-definition-prefixes "erlang-eunit" '("erlang-e" "filename-join")) ;;;*** @@ -149,14 +158,14 @@ toggle it if ARG is `toggle'; disable the mode otherwise. ;;;;;; 0)) ;;; Generated autoloads from erlang-flymake.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erlang-flymake" '("erlang-flymake-"))) +(register-definition-prefixes "erlang-flymake" '("erlang-flymake-")) ;;;*** ;;;### (autoloads nil "erlang-skels" "erlang-skels.el" (0 0 0 0)) ;;; Generated autoloads from erlang-skels.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erlang-skels" '("erlang-"))) +(register-definition-prefixes "erlang-skels" '("erlang-")) ;;;*** @@ -164,7 +173,7 @@ toggle it if ARG is `toggle'; disable the mode otherwise. ;;;;;; 0 0 0)) ;;; Generated autoloads from erlang-skels-old.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erlang-skels-old" '("erlang-"))) +(register-definition-prefixes "erlang-skels-old" '("erlang-")) ;;;*** @@ -182,7 +191,7 @@ toggle it if ARG is `toggle'; disable the mode otherwise. ;;;### (autoloads nil "erlang-test" "erlang-test.el" (0 0 0 0)) ;;; Generated autoloads from erlang-test.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erlang-test" '("erlang-"))) +(register-definition-prefixes "erlang-test" '("erlang-")) ;;;*** @@ -207,7 +216,7 @@ A function suitable for `eldoc-documentation-function'." nil nil) \(fn TOPIC)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "erldoc" '("erldoc-"))) +(register-definition-prefixes "erldoc" '("erldoc-")) ;;;*** diff --git a/elpa/erlang-20210315.1640/erlang-edoc.el b/elpa/erlang-20220215.1844/erlang-edoc.el similarity index 100% rename from elpa/erlang-20210315.1640/erlang-edoc.el rename to elpa/erlang-20220215.1844/erlang-edoc.el diff --git a/elpa/erlang-20210315.1640/erlang-eunit.el b/elpa/erlang-20220215.1844/erlang-eunit.el similarity index 99% rename from elpa/erlang-20210315.1640/erlang-eunit.el rename to elpa/erlang-20220215.1844/erlang-eunit.el index 62125536..f7c69daa 100644 --- a/elpa/erlang-20210315.1640/erlang-eunit.el +++ b/elpa/erlang-20220215.1844/erlang-eunit.el @@ -1,7 +1,7 @@ ;; ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 2009-2020. All Rights Reserved. +;; Copyright Ericsson AB 2009-2022. 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. @@ -36,7 +36,7 @@ a source file. The first directory in the list will be used, if there is no match.") (defvar erlang-eunit-autosave nil - "*Set to non-nil to automtically save unsaved buffers before running tests. + "*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.") (defvar erlang-eunit-recent-info '((mode . nil) (module . nil) (test . nil) (cover . nil)) diff --git a/elpa/erlang-20210315.1640/erlang-flymake.el b/elpa/erlang-20220215.1844/erlang-flymake.el similarity index 100% rename from elpa/erlang-20210315.1640/erlang-flymake.el rename to elpa/erlang-20220215.1844/erlang-flymake.el diff --git a/elpa/erlang-20210315.1640/erlang-pkg.el b/elpa/erlang-20220215.1844/erlang-pkg.el similarity index 59% rename from elpa/erlang-20210315.1640/erlang-pkg.el rename to elpa/erlang-20220215.1844/erlang-pkg.el index 35180915..27130c42 100644 --- a/elpa/erlang-20210315.1640/erlang-pkg.el +++ b/elpa/erlang-20220215.1844/erlang-pkg.el @@ -1,6 +1,6 @@ -(define-package "erlang" "20210315.1640" "Erlang major mode" +(define-package "erlang" "20220215.1844" "Erlang major mode" '((emacs "24.1")) - :commit "e782c0305e2fcdff0b9ea9c2b365878e602df04a" :authors + :commit "ce4ee6e960ece4193fd3031880f8cfc6b50ee69f" :authors '(("Anders Lindgren")) :maintainer '("Anders Lindgren") diff --git a/elpa/erlang-20210315.1640/erlang-skels-old.el b/elpa/erlang-20220215.1844/erlang-skels-old.el similarity index 99% rename from elpa/erlang-20210315.1640/erlang-skels-old.el rename to elpa/erlang-20220215.1844/erlang-skels-old.el index 4087bc30..7d503c4b 100644 --- a/elpa/erlang-20210315.1640/erlang-skels-old.el +++ b/elpa/erlang-20220215.1844/erlang-skels-old.el @@ -1,7 +1,7 @@ ;; ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 2010-2016. All Rights Reserved. +;; Copyright Ericsson AB 2010-2022. 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. @@ -368,7 +368,7 @@ Please see the function `tempo-define-template'.") "%% supervisor_bridge callbacks" n (erlang-skel-double-separator 2) (erlang-skel-separator 2) - "%% Funcion: init(Args) -> {ok, Pid, State} |" n + "%% Function: init(Args) -> {ok, Pid, State} |" n "%% ignore |" n "%% {error, Reason} " n "%% Description:Creates a supervisor_bridge process, linked to the calling" n diff --git a/elpa/erlang-20210315.1640/erlang-skels.el b/elpa/erlang-20220215.1844/erlang-skels.el similarity index 100% rename from elpa/erlang-20210315.1640/erlang-skels.el rename to elpa/erlang-20220215.1844/erlang-skels.el diff --git a/elpa/erlang-20210315.1640/erlang-start.el b/elpa/erlang-20220215.1844/erlang-start.el similarity index 96% rename from elpa/erlang-20210315.1640/erlang-start.el rename to elpa/erlang-20220215.1844/erlang-start.el index c35f280b..a19f72e2 100644 --- a/elpa/erlang-20210315.1640/erlang-start.el +++ b/elpa/erlang-20220215.1844/erlang-start.el @@ -74,9 +74,9 @@ "Find manual page for NAME, where NAME is module:function." t) (autoload 'erlang-find-tag "erlang" - "Like `find-tag'. Capable of retreiving Erlang modules.") + "Like `find-tag'. Capable of retrieving Erlang modules.") (autoload 'erlang-find-tag-other-window "erlang" - "Like `find-tag-other-window'. Capable of retreiving Erlang modules.") + "Like `find-tag-other-window'. Capable of retrieving Erlang modules.") ;; ;; Declare functions in "erlang-edoc.el". diff --git a/elpa/erlang-20210315.1640/erlang-test.el b/elpa/erlang-20220215.1844/erlang-test.el similarity index 99% rename from elpa/erlang-20210315.1640/erlang-test.el rename to elpa/erlang-20220215.1844/erlang-test.el index 3dab5e55..49d6ea42 100644 --- a/elpa/erlang-20210315.1640/erlang-test.el +++ b/elpa/erlang-20220215.1844/erlang-test.el @@ -8,7 +8,7 @@ ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 2016-2020. All Rights Reserved. +;; Copyright Ericsson AB 2016-2021. 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. diff --git a/elpa/erlang-20210315.1640/erlang.el b/elpa/erlang-20220215.1844/erlang.el similarity index 98% rename from elpa/erlang-20210315.1640/erlang.el rename to elpa/erlang-20220215.1844/erlang.el index 69a5fdae..065e1808 100644 --- a/elpa/erlang-20210315.1640/erlang.el +++ b/elpa/erlang-20220215.1844/erlang.el @@ -9,7 +9,7 @@ ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 1996-2020. All Rights Reserved. +;; Copyright Ericsson AB 1996-2021. 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. @@ -678,6 +678,8 @@ resulting regexp is surrounded by \\_< and \\_>." "of" "receive" "try" + "maybe" + "else" "when") "Erlang reserved keywords")) @@ -1466,8 +1468,8 @@ Other commands: (modify-syntax-entry ?\n ">" table) (modify-syntax-entry ?\" "\"" table) (modify-syntax-entry ?# "." table) - ;; (modify-syntax-entry ?$ "\\" table) ;; Creates problems with indention afterwards - ;; (modify-syntax-entry ?$ "'" table) ;; Creates syntax highlighting and indention problems + ;; (modify-syntax-entry ?$ "\\" table) ;; Creates problems with indentation afterwards + ;; (modify-syntax-entry ?$ "'" table) ;; Creates syntax highlighting and indentation problems (modify-syntax-entry ?$ "/" table) ;; Misses the corner case "string that ends with $" ;; we have to live with that for now..it is the best alternative ;; that can be worked around with "string that ends with \$" @@ -2730,13 +2732,13 @@ Value is list (stack token-start token-type in-what)." ;; Word constituent: check and handle keywords. ((= cs ?w) - (cond ((looking-at "\\(end\\|after\\)[^_a-zA-Z0-9]") + (cond ((looking-at "\\(end\\|after\\|else\\)[^_a-zA-Z0-9]") ;; Must pop top icr layer, `after' will push a new ;; layer next. (progn (while (and stack (eq (car (car stack)) '->)) (erlang-pop stack)) - (if (and stack (memq (car (car stack)) '(icr begin fun try))) + (if (and stack (memq (car (car stack)) '(icr begin fun try maybe))) (erlang-pop stack)))) ((looking-at "catch\\b.*of") t) @@ -2746,7 +2748,7 @@ Value is list (stack token-start token-type in-what)." (progn (while (and stack (eq (car (car stack)) '->)) (erlang-pop stack)) - (if (and stack (memq (car (car stack)) '(icr begin try))) + (if (and stack (memq (car (car stack)) '(icr begin try maybe))) (erlang-pop stack)))) ) (cond ((looking-at "\\(if\\|case\\|receive\\)[^_a-zA-Z0-9]") @@ -2768,7 +2770,7 @@ Value is list (stack token-start token-type in-what)." ((looking-at "\\(fun\\)[^_a-zA-Z0-9]") ;; Push a new layer if we are defining a `fun' - ;; expression, not when we are refering an existing + ;; expression, not when we are referring an existing ;; function. 'fun's defines are only indented one level now. (if (save-excursion (goto-char (match-end 1)) @@ -2783,6 +2785,11 @@ Value is list (stack token-start token-type in-what)." (erlang-push (list 'fun token (current-column)) stack))) ((looking-at "\\(begin\\)[^_a-zA-Z0-9]") (erlang-push (list 'begin token (current-column)) stack)) + ((looking-at "\\(maybe\\)[^_a-zA-Z0-9]") + (erlang-push (list 'begin token (current-column)) stack)) + ((looking-at "\\(else\\)[^_a-zA-Z0-9]") + (erlang-push (list 'icr token (current-column)) stack)) + ;; Normal when case ;;((looking-at "when\\s ") ;;((looking-at "when\\s *\\($\\|%\\)") @@ -2820,7 +2827,7 @@ Value is list (stack token-start token-type in-what)." (forward-char 1)) (t ;; Maybe a character literal, quote the next char to avoid - ;; situations as $" being seen as the begining of a string. + ;; situations as $" being seen as the beginning of a string. ;; Note the quoting something in the middle of a string is harmless. (quote (following-char)) (forward-char 1)))) @@ -2875,7 +2882,7 @@ Value is list (stack token-start token-type in-what)." (erlang-pop stack)) (cond ((eq (car (car stack)) '<<) (erlang-pop stack)) - ((memq (car (car stack)) '(icr begin fun)) + ((memq (car (car stack)) '(icr begin maybe fun)) (error "Missing `end'")) (t (error "Unbalanced parentheses"))) @@ -2947,6 +2954,8 @@ Value is list (stack token-start token-type in-what)." )) ((eq (car (car stack)) 'begin) (error "Missing `end'")) + ((eq (car (car stack)) 'maybe) + (error "Missing `end'")) (t (error "Unbalanced parenthesis")) ) @@ -3048,7 +3057,7 @@ Return nil if inside string, t if in a comment." ((and (eq (car stack-top) '||) (looking-at "\\(]\\|>>\\)[^_a-zA-Z0-9]")) (nth 2 (car (cdr stack)))) ;; Real indentation, where operators create extra indentation etc. - ((memq (car stack-top) '(-> || try begin)) + ((memq (car stack-top) '(-> || try begin maybe)) (if (looking-at "\\(of\\)[^_a-zA-Z0-9]") (nth 2 stack-top) (goto-char (nth 1 stack-top)) @@ -3060,6 +3069,8 @@ Return nil if inside string, t if in a comment." (cond ((null (cdr stack))) ; Top level in function. ((eq (car stack-top) 'begin) (setq skip 5)) + ((eq (car stack-top) 'maybe) + (setq skip 5)) ((eq (car stack-top) 'try) (setq skip 5)) ((eq (car stack-top) '->) @@ -3073,7 +3084,7 @@ Return nil if inside string, t if in a comment." (let ((base (erlang-indent-find-base stack indent-point off skip))) ;; Special cases (goto-char indent-point) - (cond ((looking-at "\\(;\\|end\\|after\\)\\($\\|[^_a-zA-Z0-9]\\)") + (cond ((looking-at "\\(;\\|end\\|after\\|else\\)\\($\\|[^_a-zA-Z0-9]\\)") (if (eq (car stack-top) '->) (erlang-pop stack)) (cond ((and stack (looking-at ";")) @@ -3222,7 +3233,7 @@ Return nil if inside string, t if in a comment." (progn (if (memq (car stack-top) '(-> ||)) (erlang-pop stack)) - ;; Take parent identation + offset, + ;; Take parent indentation + offset, ;; else just erlang-indent-level if no parent (if stack (+ (caddr (car stack)) @@ -3324,8 +3335,8 @@ This assumes that the preceding expression is either simple (defun erlang-at-keyword () "Are we looking at an Erlang keyword which will increase indentation?" - (looking-at (concat "\\(when\\|if\\|fun\\|case\\|begin\\|" - "of\\|receive\\|after\\|catch\\|try\\)\\b"))) + (looking-at (concat "\\(when\\|if\\|fun\\|case\\|begin\\|maybe\\|" + "of\\|receive\\|after\\|catch\\|try\\|else\\)\\b"))) (defun erlang-at-operator () "Are we looking at an Erlang operator?" @@ -5120,8 +5131,8 @@ about Erlang modules." ;; ;; As mentioned this xref implementation is based on the etags xref ;; implementation. But in the cases where arity is considered the -;; etags information structures (class xref-etags-location) will be -;; translated to our own structures which include arity (class +;; etags information structures (struct xref-etags-location) will be +;; translated to our own structures which include arity (struct ;; erlang-xref-location). This translation is started in the function ;; `erlang-refine-xrefs'. @@ -5129,6 +5140,11 @@ about Erlang modules." ;; with xref items with xref-etags-location and some deal with xref ;; items with erlang-xref-location. +;; NOTE: Around Sept 2021, the xrefs package changed all of its defined types +;; (i.e. xref-location, xref-file-location) from EIEIO classes to CL-Lib +;; structures. These are both supported. Older Emacsen with earlier versions of +;; xref will continue to use defclass. Newer Emacsen will use cl-defstruct. + (defun erlang-etags--xref-backend () 'erlang-etags) (defun erlang-soft-require (feature) @@ -5137,6 +5153,7 @@ about Erlang modules." (when (and (erlang-soft-require 'xref) (erlang-soft-require 'cl-generic) + (erlang-soft-require 'cl-lib) (erlang-soft-require 'eieio) (erlang-soft-require 'etags)) ;; The purpose of using eval here is to avoid compilation @@ -5165,10 +5182,20 @@ about Erlang modules." (let ((erlang-replace-etags-tags-completion-table t)) (tags-completion-table))) - (defclass erlang-xref-location (xref-file-location) - ((arity :type fixnum :initarg :arity - :reader erlang-xref-location-arity)) - :documentation "An erlang location is a file location plus arity.") + ;; Xref 1.3.1 bundled with Emacs 28+ switched from using EIEIO classes to + ;; using CL-Lib structs. + (if (find-class 'xref-file-location) + (progn + (defclass erlang-xref-location (xref-file-location) + ((arity :type fixnum :initarg :arity + :reader erlang-xref-location-arity)) + :documentation "An erlang location is a file location plus arity.") + ;; Make a constructor with the same name that a CL structure would have. + (defalias 'make-erlang-xref-location 'erlang-xref-location)) + (cl-defstruct (erlang-xref-location + (:include xref-file-location)) + "An erlang location is a file location plus arity." + (arity 0 :type fixnum))) ;; This method definition only calls the superclass which is ;; the default behaviour if it was not defined. It is only @@ -5331,8 +5358,7 @@ is non-nil then TAG is a regexp." xrefs (when (and xrefs (fboundp 'xref-item-location) - (fboundp 'xref-location-group) - (fboundp 'slot-value)) + (fboundp 'xref-location-group)) (let (files) (cl-loop for xref in xrefs for loc = (xref-item-location xref) @@ -5357,7 +5383,8 @@ is non-nil then TAG is a regexp." t)))) (defun erlang-xrefs-in-file (file kind tag is-regexp) - (when (fboundp 'make-instance) + (when (and (fboundp 'make-erlang-xref-location) + (fboundp 'xref-make)) (with-current-buffer (find-file-noselect file) (save-excursion (goto-char (point-min)) @@ -5369,17 +5396,15 @@ is non-nil then TAG is a regexp." for name = (match-string-no-properties 1) for arity = (save-excursion (erlang-get-arity)) - for loc = (make-instance 'erlang-xref-location - :file file - :line (line-number-at-pos) - :column 0 - :arity arity) + for loc = (make-erlang-xref-location + :file file + :line (line-number-at-pos) + :column 0 + :arity arity) for sum = (erlang-xref-summary kind name arity) when (and arity (not (eq arity last-arity))) - collect (make-instance 'xref-item - :summary sum - :location loc) + collect (xref-make sum loc) do (setq last-arity arity))))))) (defun erlang-xref-summary (kind tag arity) @@ -6054,7 +6079,7 @@ unless the optional NO-DISPLAY is non-nil." erlang-compile-erlang-function module-name (inferior-erlang-format-comma-opts opts)) - (let (;; Hopefully, noone else will ever use these... + (let (;; Hopefully, no one else will ever use these... (tmpvar "Tmp7236") (tmpvar2 "Tmp8742")) (format diff --git a/elpa/erlang-20210315.1640/erldoc.el b/elpa/erlang-20220215.1844/erldoc.el similarity index 99% rename from elpa/erlang-20210315.1640/erldoc.el rename to elpa/erlang-20220215.1844/erldoc.el index 9b7d1801..80b2934c 100644 --- a/elpa/erlang-20210315.1640/erldoc.el +++ b/elpa/erlang-20220215.1844/erldoc.el @@ -2,7 +2,7 @@ ;; %CopyrightBegin% ;; -;; Copyright Ericsson AB 2016-2020. All Rights Reserved. +;; Copyright Ericsson AB 2016-2021. 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. -- 2.47.3