File 1090-Fix-some-removed-stuff-on-emacs-29.patch of Package erlang

From f572e78735a148696cabd1d68b63db16c7300c1d Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson <dgud@erlang.org>
Date: Wed, 25 Sep 2024 12:27:55 +0200
Subject: [PATCH] Fix some removed stuff on emacs-29

Tests complained.

There are more warnings but I don't know how to fix them and some
warnings that can be fixed in the future when we don't support old
emacs versions.
---
 lib/tools/emacs/erlang-flymake.el   |  2 +-
 lib/tools/emacs/erlang-skels-old.el |  4 +-
 lib/tools/emacs/erlang-skels.el     |  6 +--
 lib/tools/emacs/erlang-test.el      |  8 ++--
 lib/tools/emacs/erlang.el           | 59 +++++++++++++++--------------
 5 files changed, 41 insertions(+), 38 deletions(-)

diff --git a/lib/tools/emacs/erlang-flymake.el b/lib/tools/emacs/erlang-flymake.el
index 4e4da51e7a..9a5e7f0ede 100644
--- a/lib/tools/emacs/erlang-flymake.el
+++ b/lib/tools/emacs/erlang-flymake.el
@@ -69,7 +69,7 @@ check on newline and when there are no changes)."
 (defun erlang-flymake-init ()
   (let* ((temp-file
           (cl-letf (((symbol-function 'flymake-get-temp-dir) #'erlang-flymake-temp-dir))
-            (flymake-init-create-temp-buffer-copy
+            (flymake-proc-init-create-temp-buffer-copy
              'flymake-create-temp-with-folder-structure)))
          (code-dir-opts
           (erlang-flymake-flatten
diff --git a/lib/tools/emacs/erlang-skels-old.el b/lib/tools/emacs/erlang-skels-old.el
index 7d503c4bc1..7fdb27c1de 100644
--- a/lib/tools/emacs/erlang-skels-old.el
+++ b/lib/tools/emacs/erlang-skels-old.el
@@ -150,7 +150,7 @@ Please see the function `tempo-define-template'.")
   "*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)
+    (setq erlang-skel-vc \\='(& \"-rcs(\\\"$\Id: $ \\\").\") n)
 
 Please see the function `tempo-define-template'.")
 
@@ -179,7 +179,7 @@ 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)
+  \\='(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n)
 
 Please see the function `tempo-define-template'.")
 
diff --git a/lib/tools/emacs/erlang-skels.el b/lib/tools/emacs/erlang-skels.el
index f61f156f9d..02a0adc188 100644
--- a/lib/tools/emacs/erlang-skels.el
+++ b/lib/tools/emacs/erlang-skels.el
@@ -180,7 +180,7 @@ Please see the function `tempo-define-template'.")
   "*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)
+    (setq erlang-skel-vc \\='(& \"-rcs(\\\"$\Id: $ \\\").\") n)
 
 Please see the function `tempo-define-template'.")
 
@@ -214,7 +214,7 @@ Look in the module `time-stamp' for a battery of functions.")
           (user-full-name)  n))
   "*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)
+  \\='(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n)
 Please see the function `tempo-define-template'.")
 
 (defvar erlang-skel-created-comment
@@ -2026,7 +2026,7 @@ package not be present, this function does nothing."
 
 Example of use, assuming that `erlang-skel-func' is defined:
 
- (defvar foo-skeleton '(\"%%% New function:\"
+ (defvar foo-skeleton \\='(\"%%% New function:\"
                         (erlang-skel-include erlang-skel-func)))
 
 Technically, this function returns the `tempo' attribute`(l ...)' which
diff --git a/lib/tools/emacs/erlang-test.el b/lib/tools/emacs/erlang-test.el
index 49d6ea4286..3c0eb48a23 100644
--- a/lib/tools/emacs/erlang-test.el
+++ b/lib/tools/emacs/erlang-test.el
@@ -171,7 +171,7 @@ concatenated to form an erlang file to test on.")
   (should (string-equal (file-truename expected-file)
                         (file-truename (buffer-file-name))))
   (should (eq expected-line (line-number-at-pos)))
-  (should (= (point-at-bol) (point))))
+  (should (= (line-beginning-position) (point))))
 
 (defun erlang-test-complete-at-point (tags-file)
   (with-temp-buffer
@@ -179,13 +179,13 @@ concatenated to form an erlang file to test on.")
     (setq-local tags-file-name tags-file)
     (insert "\nerlang_test:fun")
     (erlang-complete-tag)
-    (should (looking-back "erlang_test:function" (point-at-bol)))
+    (should (looking-back "erlang_test:function" (line-beginning-position)))
     (insert "\nfun")
     (erlang-complete-tag)
-    (should (looking-back "function" (point-at-bol)))
+    (should (looking-back "function" (line-beginning-position)))
     (insert "\nerlang_")
     (erlang-complete-tag)
-    (should (looking-back "erlang_test:" (point-at-bol)))))
+    (should (looking-back "erlang_test:" (line-beginning-position)))))
 
 
 (ert-deftest erlang-test-compile-options ()
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index fa041a8e55..6b8d8e11a7 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -79,6 +79,7 @@
 (require 'align)
 (require 'comint)
 (require 'tempo)
+(require 'cl-lib)
 
 ;;; `caddr' is builtin since Emacs 26.
 (eval-and-compile
@@ -91,7 +92,7 @@
   "The Erlang programming language."
   :group 'languages)
 
-(defconst erlang-version "2.8.4"
+(defconst erlang-version "2.8.5"
   "The version number of Erlang mode.")
 
 (defcustom erlang-root-dir nil
@@ -108,7 +109,7 @@ Emacs command `M-x erlang-man-download-ask RET' (the download URL
 can be customized with the Emacs variable
 erlang-man-download-url):
 
-    (require 'erlang)
+    (require \='erlang)
     (erlang-man-download)
 
 "
@@ -180,7 +181,7 @@ is an expression which is evaluated every time the menu is displayed.
 Should the expression evaluate to nil the menu item is ghosted.
 
 Example:
-    '((\"Func1\" function-one)
+    \='((\"Func1\" function-one)
       (\"SubItem\"
        ((\"Yellow\" function-yellow)
         (\"Blue\" function-blue)))
@@ -252,15 +253,15 @@ containing all functions defined in the current buffer.
 
 To use the example, copy the following lines to your `~/.emacs' file:
 
-    (add-hook 'erlang-mode-hook 'my-erlang-mode-hook)
+    (add-hook \='erlang-mode-hook \='my-erlang-mode-hook)
 
     (defun my-erlang-mode-hook ()
-      (local-set-key \"\\C-c\\C-c\" 'erlang-compile)
+      (local-set-key \"\\C-c\\C-c\" \='erlang-compile)
       (if window-system
           (progn
             (setq font-lock-maximum-decoration t)
             (font-lock-mode 1)))
-      (if (and window-system (fboundp 'imenu-add-to-menubar))
+      (if (and window-system (fboundp \='imenu-add-to-menubar))
           (imenu-add-to-menubar \"Imenu\")))")
 
 (defvar erlang-load-hook nil
@@ -285,7 +286,7 @@ The following example sets the variable `erlang-root-dir' so that the
 manual pages can be retrieved (note that you must set the value of
 `erlang-root-dir' to match the location of Erlang on your system):
 
-    (add-hook 'erlang-load-hook 'my-erlang-load-hook)
+    (add-hook \='erlang-load-hook \='my-erlang-load-hook)
 
     (defun my-erlang-load-hook ()
        (setq erlang-root-dir \"/usr/local/erlang\"))")
@@ -302,8 +303,10 @@ A useful function is `tempo-template-erlang-normal-header'.
 If the value of this variable is the symbol `ask', the user is
 prompted.  If the value is t the source is silently changed."
   :group 'erlang
-  :type '(choice (const :tag "Check on save" 'ask)
-                 (const :tag "Don't check on save" t)))
+  :type '(choice
+           (const :tag "Prompt" ask)
+           (const :tag "Silently change" t)
+           (const :tag "Don't check on save" nil)))
 
 (defvar erlang-electric-commands
   '(erlang-electric-comma
@@ -366,7 +369,7 @@ is typed.  Each function in the list is called with no arguments,
 and should return one of the following values:
 
   nil             -- no determination made, continue checking
-  'stop           -- do not create prototype for next line
+  \='stop           -- do not create prototype for next line
   (anything else) -- insert prototype, and stop checking
 
 If every function in the list is called with no determination made,
@@ -387,7 +390,7 @@ is typed.  Each function in the list is called with no arguments,
 and should return one of the following values:
 
   nil             -- no determination made, continue checking
-  'stop           -- do not create prototype for next line
+  \='stop           -- do not create prototype for next line
   (anything else) -- insert prototype, and stop checking
 
 If every function in the list is called with no determination made,
@@ -405,7 +408,7 @@ is typed.  Each function in the list is called with no arguments,
 and should return one of the following values:
 
   nil             -- no determination made, continue checking
-  'stop           -- do not create prototype for next line
+  \='stop           -- do not create prototype for next line
   (anything else) -- insert prototype, and stop checking
 
 If every function in the list is called with no determination made,
@@ -426,7 +429,7 @@ is typed.  Each function in the list is called with no arguments,
 and should return one of the following values:
 
   nil             -- no determination made, continue checking
-  'stop           -- do not create prototype for next line
+  \='stop           -- do not create prototype for next line
   (anything else) -- trigger the electric command.
 
 If every function in the list is called with no determination made,
@@ -560,7 +563,7 @@ This is an elisp list of options. Each option can be either:
 - an atom
 - a dotted pair
 - a string
-Example: '(bin_opt_info (i . \"/path1/include\") (i . \"/path2/include\"))")
+Example: \='(bin_opt_info (i . \"/path1/include\") (i . \"/path2/include\"))")
 
 (defvar erlang-compile-command-function-alist
   '((".erl\\'" . inferior-erlang-compute-erl-compile-command)
@@ -1765,9 +1768,9 @@ This could be used when defining your own special font-lock setup, e.g:
       (append erlang-font-lock-keywords-function-header
               erlang-font-lock-keywords-dollar
               (erlang-font-lock-set-face
-               erlang-font-lock-keywords-macros 'my-neon-green-face)
+               erlang-font-lock-keywords-macros \='my-neon-green-face)
               (erlang-font-lock-set-face
-               erlang-font-lock-keywords-lc 'my-deep-red 'my-light-red)
+               erlang-font-lock-keywords-lc \='my-deep-red \='my-light-red)
               erlang-font-lock-keywords-attr))
 
 For a more elaborate example, please see the beginning of the file
@@ -1946,8 +1949,8 @@ menu is left unchanged.
 
 The equality test is performed by `eq'.
 
-Example:  (erlang-menu-add-above 'my-erlang-menu-items
-                                 'erlang-menu-man-items)"
+Example:  (erlang-menu-add-above \='my-erlang-menu-items
+                                 \='erlang-menu-man-items)"
   (erlang-menu-add-below entry above items t))
 
 
@@ -1965,8 +1968,8 @@ The equality test is performed by `eq'.
 Example:
 
 \(setq erlang-menu-items
-      (erlang-menu-add-below 'my-erlang-menu-items
-                             'erlang-menu-base-items
+      (erlang-menu-add-below \='my-erlang-menu-items
+                             \='erlang-menu-base-items
                              erlang-menu-items))"
   (if (memq entry items)
       items                             ; Return the original menu.
@@ -2423,7 +2426,6 @@ the search for the buffer more accurate."
   (let ((buffer (or buf
                     (progn
                       ; find buffer containing man page
-                      (require 'cl-lib)
                       (car (cl-remove-if-not (lambda (buf)
                                                (string-match
                                                 (or module-name "")
@@ -2589,7 +2591,7 @@ package not be present, this function does nothing."
 
 Example of use, assuming that `erlang-skel-func' is defined:
 
- (defvar foo-skeleton '(\"%%% New function:\"
+ (defvar foo-skeleton \='(\"%%% New function:\"
                         (erlang-skel-include erlang-skel-func)))
 
 Technically, this function returns the `tempo' attribute`(l ...)' which
@@ -5765,7 +5767,7 @@ The following special commands are available:
 \\{erlang-shell-mode-map}"
   (erlang-mode-variables)
   ;; Needed when compiling directly from the Erlang shell.
-  (setq compilation-last-buffer (current-buffer))
+  (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)
@@ -5823,7 +5825,7 @@ Selects Comint or Compilation mode command as appropriate."
 
 (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.")
+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.
@@ -5938,7 +5940,7 @@ The window is returned.
 Should `inferior-erlang-display-buffer-any-frame' be nil the buffer is
 displayed in the current frame.  Should it be non-nil, and the buffer
 already is visible in any other frame, no new window will be created.
-Should it be the atom 'raise, the frame containing the window will
+Should it be the atom \='raise, the frame containing the window will
 be raised.
 
 Should the optional argument SELECT be non-nil, the window is
@@ -6136,9 +6138,10 @@ There exists two workarounds for this bug:
     (sit-for 0)
     (inferior-erlang-wait-prompt)
     (with-current-buffer inferior-erlang-buffer
-      (setq compilation-error-list nil)
-      (set-marker compilation-parsing-end end))
-    (setq compilation-last-buffer inferior-erlang-buffer)))
+      (when (and (boundp 'compilation-error-list) (boundp 'compilation-parsing-end))
+        (setq compilation-error-list nil)
+        (set-marker compilation-parsing-end end)))
+    (setq next-error-last-buffer inferior-erlang-buffer)))
 
 (defun inferior-erlang-prepare-for-input (&optional no-display)
   "Create an inferior erlang buffer if needed and ready it for input.
-- 
2.43.0

openSUSE Build Service is sponsored by